From 3a7622205013d59be6409d52e9924f39c39792a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Fri, 29 Jan 2016 00:26:12 +0100 Subject: [PATCH] send buffered data when connected to USB CDC ACM serial port --- lib/usb_cdcacm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/usb_cdcacm.c b/lib/usb_cdcacm.c index 9f3d01e..3afae5c 100644 --- a/lib/usb_cdcacm.c +++ b/lib/usb_cdcacm.c @@ -206,10 +206,11 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data * switch (req->bRequest) { case USB_CDC_REQ_SET_CONTROL_LINE_STATE: { - /* bool dtr = (req->wValue & (1 << 0)) ? true : false; bool rts = (req->wValue & (1 << 1)) ? true : false; - */ + if (dtr || rts) { // host opened serial port + usbd_ep_write_packet(usb_device, 0x82, NULL, 0); // start transmitting + } /* this Linux cdc_acm driver requires this to be implemented * even though it's optional in the CDC spec, and we don't * advertise it in the ACM functional descriptor.