f_fs: Return correct USB endpoint descriptor to user space daemon

Some of user space daemon like ADB queries endpoint descriptor using
ioctl to know wMaxPacketSize value. Based on wMaxPacketSize value it
queues additional buffer to read zero length packet if expected read
buffer size is multiple of wMaxPacketSize. Currently driver is missing
handling for super speed plus case which results into sending full
speed related USB endpoint descriptor (i.e. wMaxPacketSize 64 bytes).
Hence when adbd is expecting 64 bytes packet from host, it queues one
more additional buffer. This results into mismatch of ADB command and
response when multiple ADB commands are used and causing different ADB
related stability issues. Fix this issue adding super speed plus check
with FUNCTIONFS_ENDPOINT_DESC ioctl command.

Change-Id: I9416295c07c2d98f9d32df43d7e506f975da15a2
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This commit is contained in:
Mayank Rana 2019-08-12 14:35:32 -07:00 • committed by Jack Pham
commit 4abb83b709

View file

@ -1457,6 +1457,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
struct usb_endpoint_descriptor desc1, *desc;
switch (epfile->ffs->gadget->speed) {
case USB_SPEED_SUPER_PLUS:
case USB_SPEED_SUPER:
desc_idx = 2;
break;