0
votes

I have developed a kernel driver for a USB device. Such a device has some pins that can provide functionality both as CDC ACM serial port or as input buttons. So to implement that I had to use two different USB configuration descriptors.

The driver works as expected, but I have to hardcode the chosen setup before compiling and loading the firmware to the micro-controller. I am searching a mechanism to change that device configuration from userspace.

I read about a SET_CONFIGURATION message on USB documentation, but coudn't find any Linux tool to send such kind of standard USB messages from userspace to the USB bus.

Does some of you (with more experience on this topic) know some userspace Linux tool to send a SET_CONFIGURATION message to a device connected to the USB bus?

Thanks in advance! :)

2
Re-edited the question to include the background. Thanks for the information.criptobadia

2 Answers

1
votes

The function libusb_set_configuration() in LibUSB could do that in theory, but there is no need.

One can simply put both HID (for the button) and CDC (serial port) into one configuration using an "Interface association descriptor" (IAD).

0
votes

This github repo resolves my issue:

https://github.com/avtolstoy/usbtool