Skip to content

Instantly share code, notes, and snippets.

@mzyy94
Last active Oct 13, 2020
Embed
What would you like to do?
#!/bin/bash
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
echo BQEVAAkEoQGFMAUBBQkZASkKFQAlAXUBlQpVAGUAgQIFCRkLKQ4VACUBdQGVBIECdQGVAoEDCwEAAQChAAswAAEACzEAAQALMgABAAs1AAEAFQAn//8AAHUQlQSBAsALOQABABUAJQc1AEY7AWUUdQSVAYECBQkZDykSFQAlAXUBlQSBAnUIlTSBAwYA/4UhCQF1CJU/gQOFgQkCdQiVP4EDhQEJA3UIlT+Rg4UQCQR1CJU/kYOFgAkFdQiVP5GDhYIJBnUIlT+Rg8A= | base64 -d > functions/hid.usb0/report_desc
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
#!/bin/bash
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