Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBDevice_STM32F103 by
Diff: USBSerial/USBCDC.cpp
- Revision:
- 44:d2638fcd76d9
- Parent:
- 25:7c72828865f3
- Child:
- 65:48fe9050cb4a
--- 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: