usb: gadget: Send BRK signal to host on flow disable ioctl
Currently in f_cdev driver, we are not handling the TIOCM_CTS
signal generared by SIO_IOCTL_INBOUND_FLOW IOCTL. Hence we
are not able to send BRK signal to the host and it keeps
sending data leading to data loss.
Fix this by handling TIOCM_CTS in the driver.
Change-Id: If8e4774e3e0772cb7189f3400d7e53e258b7d5a3
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
diff --git a/drivers/usb/gadget/function/f_cdev.c b/drivers/usb/gadget/function/f_cdev.c
index 95423ed..afa62e8 100644
--- a/drivers/usb/gadget/function/f_cdev.c
+++ b/drivers/usb/gadget/function/f_cdev.c
@@ -1353,6 +1353,9 @@
if (cser->serial_state & TIOCM_DSR)
result |= TIOCM_DSR;
+
+ if (cser->serial_state & TIOCM_CTS)
+ result |= TIOCM_CTS;
return result;
}
@@ -1399,6 +1402,18 @@
if (clear & TIOCM_DSR)
cser->serial_state &= ~TIOCM_DSR;
+ if (set & TIOCM_CTS) {
+ if (cser->send_break) {
+ cser->serial_state |= TIOCM_CTS;
+ status = cser->send_break(cser, 0);
+ }
+ }
+ if (clear & TIOCM_CTS) {
+ if (cser->send_break) {
+ cser->serial_state &= ~TIOCM_CTS;
+ status = cser->send_break(cser, 1);
+ }
+ }
return status;
}