From 4abb83b709e8b5fe0edc85e1dc64d23ecd51f426 Mon Sep 17 00:00:00 2001 From: Mayank Rana Date: Mon, 12 Aug 2019 14:35:32 -0700 Subject: [PATCH] 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 --- drivers/usb/gadget/function/f_fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 57bd80efeee0..1c745d6da3a1 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -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;