I'm using the following to set up and emulate a usb device:
modprobe libcomposite
cd /sys/kernel/config/usb_gadget/
mkdir -p g1
cd g1
echo 0x1430 > idVendor # Linux Foundation
echo 0x0150 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0x00 > bDeviceClass
echo 0x00 > bDeviceSubClass
echo 0x00 > bDeviceProtocol
mkdir -p strings/0x409
echo cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2 > strings/0x409/serialnumber
echo "Some Co" > strings/0x409/manufacturer
echo "Some product" > strings/0x409/product
mkdir -p configs/c.1/strings/0x409
echo "HID configuration" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower
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 '\x06\x00\xff\x09\x01\xa1\x01\x19\x01\x29\x40\x15\x00\x26\xff\x00\x75\x08\x95\x20\x81\x00\x19\x01\x29\xff\x91\x00\xc0' > functions/hid.usb0/report_desc
ln -s functions/hid.usb0 configs/c.1/
ls /sys/class/udc > UDC
I don't get any errors when configuring the device, my windows machine see's the correct vendor and product id, but it doesn't create the in and out files for communication.
Might anyone know what I'm missing?
My end goal is to replicate the functionality of this script:
https://raw.githubusercontent.com/tresni/PoweredPortals/master/facedancer-portal.py
with out the need for facedancer. from what i understand of the script is that it mocks an hid device and reports back it's status when requested.