#!/bin/bash # Create gadget directory cd /sys/kernel/config/usb_gadget/ mkdir -p usbarmory cd usbarmory # Gadget information (device descriptor) echo 0x1d6b > idVendor # Assigned by USB.com (Linux Foundation) echo 0x0104 > idProduct # Product descriptor (manufacturer) echo 0x0100 > bcdDevice # Device release number (manufacturer) echo 0x0200 > bcdUSB # USB release (USB2) # Gadget product information (English) mkdir -p strings/0x409 echo "fedcba9876543210" > strings/0x409/serialnumber echo "Inverse Path" > strings/0x409/manufacturer echo "USB Armory" > strings/0x409/product # Device function instance (name.instance) mkdir -p functions/hid.usb0 echo 1 > functions/hid.usb0/protocol echo 1 > functions/hid.usb0/subclass echo 8 > functions/hid.usb0/report_length echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.usb0/report_desc # Device configuration instance (name.number)(English) mkdir -p configs/c.1/strings/0x409 echo 250 > configs/c.1/MaxPower echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration # Bind function instance to configuration instance ln -s functions/hid.usb0 configs/c.1/ # Attach the device to the USB device controller ls /sys/class/udc > UDC exit 0