After a lot of searching on google I am a bit confused as how to configure everything, also I feel like I am mixing up some of the terminology so just for my senity:
- GadgetFS = old style of USB Gadgets, I should not use this.
- Libcomposite = modern USB Gadget driver
- ConfigFS = filesystem part used to configure LibComposite USB Gadgets
- HID functionality (This I managed to configure more info below)
- Vendor bulk in/out pair (I think this is called FunctionFS?)
I got this part working by doing the following:
Add the following to /boot/config.txt
Run the following command to configure the USB device with a HID function.
Code: Select all
Code: Select all
#!/bin/bash #### ## adapted from http://isticktoit.net/?p=1383 #### SRCPATH=`pwd` HIDDESCRIPTOR=$SRCPATH/Desc1.hid modprobe libcomposite cd /sys/kernel/config/usb_gadget/ mkdir -p test cd test echo 0x1d6b > idVendor # Linux Foundation echo 0x0104 > idProduct # Multifunction Composite Gadget echo 0x0100 > bcdDevice # v1.0.0 echo 0x0200 > bcdUSB # USB2 mkdir -p strings/0x409 echo `cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2` > strings/0x409/serialnumber echo "Youpko" > strings/0x409/manufacturer echo "USB Device" > strings/0x409/product mkdir -p configs/c.1/strings/0x409 echo "Config 1: Test" > configs/c.1/strings/0x409/configuration echo 250 > configs/c.1/MaxPower # Add functions here mkdir -p functions/hid.usb0 echo 1 > functions/hid.usb0/protocol echo 1 > functions/hid.usb0/subclass echo 8 > functions/hid.usb0/report_length cat $HIDDESCRIPTOR > functions/hid.usb0/report_desc ln -s functions/hid.usb0 configs/c.1/ # End functions ls /sys/class/udc > UDC
This part has me stumped as I am used in the PIC32 micro-controller world this is often called a Vendor Interface, no pre-defined stuff from the USB foundation everything is up to the manufacturer, But this term is not used in Linux kernel documentation.
I think the term is FunctionFS and in the kernal documentation there is an configfs-usb-gadget-ffs page but there is no information explained on how to configure this.
I have 2 questions regarding this where can I find more information on the FunctionFS, and is FunctionFS combining with other functions supported things like HID/CDC/MSD.