changed auto-reset trigger condition to fix auto-reset-and-upload for Windows. now reboots when a port, opened at 1200 bps, is closed.

This commit is contained in:
Zach Eveland 2011-09-06 20:58:00 -04:00
parent 95fd39090e
commit d81084e8e9
1 changed files with 2 additions and 3 deletions

View File

@ -95,14 +95,13 @@ bool WEAK CDC_Setup(Setup& setup)
if (CDC_SET_LINE_CODING == r) if (CDC_SET_LINE_CODING == r)
{ {
USB_RecvControl((void*)&_usbLineInfo,7); USB_RecvControl((void*)&_usbLineInfo,7);
if (1200 == _usbLineInfo.dwDTERate) // auto-reset is triggered when avrdude opens the port at 1200 bps
Reboot();
return true; return true;
} }
if (CDC_SET_CONTROL_LINE_STATE == r) if (CDC_SET_CONTROL_LINE_STATE == r)
{ {
if (0 != _usbLineInfo.lineState && 1200 == _usbLineInfo.dwDTERate) // auto-reset is triggered when the port, already open at 1200 bps, is closed
Reboot();
_usbLineInfo.lineState = setup.wValueL; _usbLineInfo.lineState = setup.wValueL;
return true; return true;
} }