USB device stack - Added support for the logo/windows key to USB keyboard.

Dependents:   randomSearch

Fork of USBDevice by mbed official

Files at this revision

API Documentation at this revision

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: