Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0ace218 authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

usb: gadget: Send BRK signal to host on flow disable ioctl



Currently in u_data_bridge 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: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 4f818aad
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011, 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011, 2013-2018, The Linux Foundation. All rights reserved.
 * Linux Foundation chooses to take subject only to the GPLv2 license terms,
 * and distributes only under these terms.
 *
@@ -636,6 +636,9 @@ static int gbridge_port_tiocmget(struct gbridge_port *port)

	if (gser->serial_state & TIOCM_DSR)
		result |= TIOCM_DSR;

	if (gser->serial_state & TIOCM_CTS)
		result |= TIOCM_CTS;
fail:
	spin_unlock_irqrestore(&port->port_lock, flags);
	return result;
@@ -689,6 +692,18 @@ static int gbridge_port_tiocmset(struct gbridge_port *port,
		gser->serial_state |= TIOCM_DSR;
	if (clear & TIOCM_DSR)
		gser->serial_state &= ~TIOCM_DSR;
	if (set & TIOCM_CTS) {
		if (gser->send_break) {
			gser->serial_state |= TIOCM_CTS;
			status = gser->send_break(gser, 0);
		}
	}
	if (clear & TIOCM_CTS) {
		if (gser->send_break) {
			gser->serial_state &= ~TIOCM_CTS;
			status = gser->send_break(gser, 1);
		}
	}
fail:
	spin_unlock_irqrestore(&port->port_lock, flags);
	return status;
+3 −1
Original line number Diff line number Diff line
@@ -470,7 +470,7 @@ static unsigned int convert_uart_sigs_to_acm(unsigned uart_sig)
	unsigned int acm_sig = 0;

	/* should this needs to be in calling functions ??? */
	uart_sig &= (TIOCM_RI | TIOCM_CD | TIOCM_DSR);
	uart_sig &= (TIOCM_RI | TIOCM_CD | TIOCM_DSR | TIOCM_CTS);

	if (uart_sig & TIOCM_RI)
		acm_sig |= SMD_ACM_CTRL_RI;
@@ -478,6 +478,8 @@ static unsigned int convert_uart_sigs_to_acm(unsigned uart_sig)
		acm_sig |= SMD_ACM_CTRL_DCD;
	if (uart_sig & TIOCM_DSR)
		acm_sig |= SMD_ACM_CTRL_DSR;
	if (uart_sig & TIOCM_CTS)
		acm_sig |= SMD_ACM_CTRL_BRK;

	return acm_sig;
}