Skip to content

Instantly share code, notes, and snippets.

Last active October 13, 2020 11:35
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
cd /sys/kernel/config/usb_gadget/
mkdir -p procon
cd procon
echo 0x057e > idVendor
echo 0x2009 > idProduct
echo 0x0200 > bcdDevice
echo 0x0200 > bcdUSB
echo 0x00 > bDeviceClass
echo 0x00 > bDeviceSubClass
echo 0x00 > bDeviceProtocol
mkdir -p strings/0x409
echo "000000000001" > strings/0x409/serialnumber
echo "Nintendo Co., Ltd." > strings/0x409/manufacturer
echo "Pro Controller" > strings/0x409/product
mkdir -p configs/c.1/strings/0x409
echo "" > configs/c.1/strings/0x409/configuration
echo 500 > configs/c.1/MaxPower
echo 0xa0 > configs/c.1/bmAttributes
mkdir -p functions/hid.usb0
echo 0 > functions/hid.usb0/protocol
echo 0 > functions/hid.usb0/subclass
echo 64 > functions/hid.usb0/report_length
mkdir -p functions/uac1.0
ln -s functions/hid.usb0 configs/c.1/
ln -s functions/uac1.0 configs/c.1/
udevadm settle -t 5 || :
ls /sys/class/udc > UDC
cd /sys/kernel/config/usb_gadget/
mkdir -p audio
cd audio
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x1d6b > idVendor # Linux Foundation
mkdir strings/0x409
echo "000000000" > strings/0x409/serialnumber
echo "Linux Foundation" > strings/0x409/manufacturer
echo "Multifunction Composite Gadget" > strings/0x409/product
mkdir -p configs/c.1/strings/0x409
echo "Audio Gadget" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower
mkdir -p functions/uac1.0
ln -s functions/uac1.0 configs/c.1/
ls /sys/class/udc > UDC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment