Developing a Linux ConfigFS Gadget -> How to set all information on the device site correctly?

  • Thread starter Thread starter sele-sdst
  • Start date Start date
S

sele-sdst

Guest
Hello all,

We are developing a Linux based device. To be able to communicate a USB connection can be established. This USB connection shall emulate a serial connection.

On the device site the configuration is made with configfs. But I'm not sure if I have set all necessary information correct.
What I've done so far is the below configuration on the device itself:


mount -t configfs none /sys/kernel/config
cd /sys/kernel/config
modprobe libcomposite
cd usb_gadget/
mkdir serial_gadget && cd serial_gadget/

echo 0x0200 > bcdUSB
echo 0x0100 > bcdDevice
echo 0x1d6b > idVendor
echo 0x0104 > idProduct
echo 0x02 > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol

mkdir -p strings/0x409
echo "0000000000000014" > strings/0x409/serialnumber
echo "My Company" > strings/0x409/manufacturer
echo "My Device" > strings/0x409/product

mkdir -p configs/c.1
mkdir -p configs/c.1/strings/0x409
echo "CDC ACM" > configs/c.1/strings/0x409/configuration

echo "1" > os_desc/use
echo "0xbc" > os_desc/b_vendor_code
echo "MSFT100" > os_desc/qw_sign

mkdir -p functions/acm.GS0
ln -s functions/acm.GS0 configs/c.1
ln -s configs/c.1 os_desc/

ls /sys/class/udc/ > UDC

I have found an inf file on kernel.org (https://www.kernel.org/doc/Documentation/usb/linux-cdc-acm.inf) which can be used for Windows 7.
On Windows 10 the driver should automatically be loaded. But this doesn't work on all PC's. Sometimes it works and after restart of either the device or the PC the driver/device is not recognized correctly. Sometimes I see the error message that the device is sending wrong OS descriptor values.

That's why I have several questions about this:
1) Where do I find a full description about the MS OS Descriptors? Especially about the "b_vendor_code"?
2) Do I need this MS OS Device Descriptors? I've already read, that this is not always necessary. At least the values of bDeviceClass, bDeviceSubClass and bDeviceProtocol have to match the above values to use the device with Windows 10 and to automatically load the usbser driver.
3) Is there somewhere an example when I want to create a composite device (Mass Storage, RNDIS & CDC ACM)?

Thank you for your time and support.

Best regards

Fernando

Continue reading...
 
Back
Top