Skip to content

Commit fd28578

Browse files
committed
Merge branch 'master' of https://github.com/mbedmicro/mbed
2 parents 562f280 + ea01d61 commit fd28578

31 files changed

+361
-26
lines changed

libraries/USBDevice/USBSerial/USBCDC.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ static uint8_t cdc_line_coding[7]= {0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08};
2727
#define CDC_GET_LINE_CODING 0x21
2828
#define CDC_SET_CONTROL_LINE_STATE 0x22
2929

30+
// Control Line State bits
31+
#define CLS_DTR (1 << 0)
32+
#define CLS_RTS (1 << 1)
33+
3034
#define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK
3135

3236
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 @@ bool USBCDC::USBCallback_request(void) {
5458
transfer->remaining = 7;
5559
transfer->notify = true;
5660
success = true;
57-
terminal_connected = true;
5861
break;
5962
case CDC_SET_CONTROL_LINE_STATE:
60-
terminal_connected = false;
63+
if (transfer->setup.wValue & CLS_DTR) {
64+
terminal_connected = true;
65+
} else {
66+
terminal_connected = false;
67+
}
6168
success = true;
6269
break;
6370
default:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)