USB device stack
Dependents: MATSU-bed_blinky MATSU-bed_detection
Fork of USBDevice by
Diff: USBSerial/USBCDC.cpp
- Revision:
- 44:d2638fcd76d9
- Parent:
- 25:7c72828865f3
--- a/USBSerial/USBCDC.cpp Thu Mar 12 14:32:09 2015 +0000 +++ b/USBSerial/USBCDC.cpp Tue Mar 24 08:30:19 2015 +0000 @@ -27,6 +27,10 @@ #define CDC_GET_LINE_CODING 0x21 #define CDC_SET_CONTROL_LINE_STATE 0x22 +// Control Line State bits +#define CLS_DTR (1 << 0) +#define CLS_RTS (1 << 1) + #define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking): USBDevice(vendor_id, product_id, product_release) { @@ -54,10 +58,13 @@ transfer->remaining = 7; transfer->notify = true; success = true; - terminal_connected = true; break; case CDC_SET_CONTROL_LINE_STATE: - terminal_connected = false; + if (transfer->setup.wValue & CLS_DTR) { + terminal_connected = true; + } else { + terminal_connected = false; + } success = true; break; default: