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

Commit 4222a9f7 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: f_gsi: Send zero length packet for MBIM/GPS on cable connect



Qmuxd bridge daemon is opening /dev/gps before USB enumerated with
USB composition having GPS interface as part of it. This daemon
performs EP_LOOKUP ioctl and encounters failure. It keeps retrying
for some iterations, and later goes into sleep and doesn't perform
any IOs. This results into no GPS related IOs between daemon and
host side QMUXD driver. Hence this change sends zero length packet
for MBIM (as QBI also faces same issue) and GPS interface when
USB cable is connected and those interfaces are part of USB
composition. Both QBI and Qmuxd bridge daemon are now wait for zero
length packet as indication for change in USB cable status, and
queries using GSI_MBIM_GPS_USB_STATUS IOCTL (newly added). Based on
this IOCTL related response, both daemons performs read/write with
created control devices.

Change-Id: Ib47443fe0e473ab4e27facb3f2927b8c13966158
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 409af4b4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2018, Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2019, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1436,6 +1436,7 @@ static long gsi_ctrl_dev_ioctl(struct file *fp, unsigned int cmd,
		atomic_set(&c_port->ctrl_online, 1);
		break;
	case QTI_CTRL_GET_LINE_STATE:
	case GSI_MBIM_GPS_USB_STATUS:
		val = atomic_read(&gsi->connected);
		if (gsi->prot_id == USB_PROT_RMNET_IPA ||
				gsi->prot_id == USB_PROT_RMNET_ETHER)
@@ -2485,7 +2486,9 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf,

	/* send 0 len pkt to qti to notify state change */
	if (gsi->prot_id == USB_PROT_DIAG_IPA ||
				gsi->prot_id == USB_PROT_DPL_ETHER)
				gsi->prot_id == USB_PROT_DPL_ETHER ||
				gsi->prot_id == USB_PROT_GPS_CTRL ||
				gsi->prot_id == USB_PROT_MBIM_IPA)
		gsi_ctrl_send_cpkt_tomodem(gsi, NULL, 0);

	return 0;
@@ -2521,7 +2524,7 @@ static void gsi_disable(struct usb_function *f)
	}

	gsi_ctrl_clear_cpkt_queues(gsi, false);
	/* send 0 len pkt to qti/qbi to notify state change */
	/* send 0 len pkt to qti/qbi/gps to notify state change */
	gsi_ctrl_send_cpkt_tomodem(gsi, NULL, 0);
	gsi->c_port.notify_req_queued = false;
	/* Disable Data Path  - only if it was initialized already (alt=1) */