cc'ing Eddy for general Android expertise and Laurent as the owner of UVC gadget driver. On Wed, Oct 19, 2022 at 3:13 PM Avichal Rakesh <arakesh@xxxxxxxxxx> wrote: > > Hey all, > > Disclaimer: I am very new to the kernel space so apologies for any > newb mistakes. > > I am working on trying to enable the UVC gadget driver on an Android > Device. The device already supports configfs and has a few gadget > functions already working. ADB (f_fs) and USB Tethering (f_ncm) are > the ones I tested with. > > I added CONFIG_USB_CONFIGFS_F_UVC=y to the kernel's config, was able > to create a uvc function following the example in > https://docs.kernel.org/usb/gadget-testing.html#uvc-function. > > After symlinking the uvc function to configfs, when the gadget is > pulled up I see that all functions including UVC are bound to the > composite gadget without any errors. However, while the UVC function > is linked, no other function can communicate over their endpoints. The > host is able to enumerate all the functions, but is unable to read > from or write to non-uvc endpoints. Removing the UVC function from > configfs and pulling up the gadget again restores all other functions. > > Testing the UVC gadget shows that the UVC driver is functioning > properly and a linux host is able to communicate with the UVC gadget > over V4L2 as expected. > > AFAICT, there are no kernel logs showing errors in reading/writing to > endpoints even after enabling debug logs. Some rudimentary debugging > shows that the endpoints of other functions stop responding if the UVC > gadget writes its usb descriptors to its usb_function in > uvc_function_bind. I stub out all functionality from the uvc gadget > (except alloc and free), the other functions work properly. But if I > unstub uvc_function_bind to go as far as writing the descriptor in > fs_descriptors (f_uvc.c, uvc_function_bind line#713), the other > functions stop working. > > Is this a known issue, or am I missing something obvious? Any help > would be appreciated! > > Misc info: > - Kernel Version: 5.10.107 > - USB controller: DWC3 (unfortunately, I don't have devices with any > other controllers available) > - Changes made: None. The gadget drivers show this behavior without > any changes. I tried to copy over changes from ToT > https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_uvc.c > which fixed some crashes, but this behavior sticks. > > Thank you! > > - Avi -- - Avi.