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.
Dependents: STM32F103C8T6_WebUSBDFU STM32F103C8T6_USBDFU STM32F103C8T6_USBDFU dfu_usb_stm32f103
Fork of USBDevice_STM32F103 by
Revision 44:d2638fcd76d9, committed 2015-03-24
- Comitter:
- mbed_official
- Date:
- Tue Mar 24 08:30:19 2015 +0000
- Parent:
- 43:c0605f23f916
- Child:
- 45:0f216c4e75e5
- Commit message:
- Synchronized with git revision e8aa18f061410f623f89d561d047bf0fe7f7bf76
Full URL: https://github.com/mbedmicro/mbed/commit/e8aa18f061410f623f89d561d047bf0fe7f7bf76/
Using "Data Terminal Ready" signal to determine when the host is connected.
Changed in this revision
| USBSerial/USBCDC.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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:
