#!/bin/bash modprobe libcomposite cd /sys/kernel/config/usb_gadget/ mkdir -p g1 && cd g1 # Standard USB descriptors echo 0x1d6b > idVendor echo 0x0104 > idProduct echo 0x0100 > bcdDevice echo 0x0200 > bcdUSB mkdir -p strings/0x409 echo "TALIA003512M" > strings/0x409/serialnumber echo "Debian" > strings/0x409/manufacturer echo "EmulatedDrive" > strings/0x409/product mkdir -p configs/c.1/strings/0x409 echo "Storage and Serial" > configs/c.1/strings/0x409/configuration echo 500 > configs/c.1/MaxPower mkdir -p functions/mass_storage.usb0 echo 1 > functions/mass_storage.usb0/stall echo 1 > functions/mass_storage.usb0/lun.0/removable # CRITICAL: Forces target PC to treat it as Read-Only echo 1 > functions/mass_storage.usb0/lun.0/ro echo /usb_share.img > functions/mass_storage.usb0/lun.0/file ln -sf functions/mass_storage.usb0 configs/c.1/ # Serial connection mkdir -p functions/acm.usb0 ln -sf functions/acm.usb0 configs/c.1/ # Bind to the physical controller to make it appear on the reading PC echo $(ls /sys/class/udc/) > UDC