Configuring USB gadget descriptors from userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everybody,

I'm working on a USB gadget driver for a device that needs to report a bunch 
of class-specific descriptors.

Those class descriptors do not depend on kernelspace code in the device 
driver. They merely expose capabilities of the device that are implemented in 
userspace. I thus would like to provide the USB gadget driver with those 
descriptors from a userspace application.

I got this working for a single-function device by disconnecting from the bus 
in the bind() handler (usb_gadget_disconnect). The driver then waits until an 
application feeds it with descriptors through a sysfs file, and connects to 
the bus.

I'm now porting the driver to the composite framework, and things get more 
complex. The composite framework expect the bind() handler to configure the 
descriptors. I thus need to have them available before the bind() handler is 
called, which means I need them before registering the composite driver with 
usb_composite_register().

The composite driver registers itself in its module initialization function. 
As no device structure is available at that point I can't create a sysfs or 
configfs file, nor can I use the firmware request API. procfs might be a 
solution, but it doesn't feel very clean for some reason.

As this is my first USB gadget driver I could have got the architecture wrong. 
I'd appreciate any advice you could give me. Has someone worked on a driver 
with similar requirements before ? Are there guidelines I should follow ?

Best regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux