Created
March 30, 2017 21:17
-
-
Save arrase/22d8c7c12d404bbff2ac4e04a66a1f7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /sys/kernel/config/usb_gadget/ | |
mkdir -p isticktoit | |
cd isticktoit | |
echo 0x1d6b > idVendor # Linux Foundation | |
echo 0x0104 > idProduct # Multifunction Composite Gadget | |
echo 0x0100 > bcdDevice # v1.0.0 | |
echo 0x0200 > bcdUSB # USB2 | |
mkdir -p strings/0x409 | |
echo "fedcba9876543210" > strings/0x409/serialnumber | |
echo "Tobias Girstmair" > strings/0x409/manufacturer | |
echo "iSticktoit.net USB Device" > strings/0x409/product | |
mkdir -p configs/c.1/strings/0x409 | |
echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration | |
echo 250 > configs/c.1/MaxPower | |
# dd if=/dev/zero of=/home/pi/usbdisk.img bs=1024 count=10000 | |
FILE=/home/pi/usbdisk.img | |
STORAGE=/media/storage | |
mkdir $STORAGE | |
mount -o loop,ro, -t vfat $FILE $STORAGE # FOR IMAGE CREATED WITH DD | |
mkdir -p functions/mass_storage.usb0 | |
echo 1 > functions/mass_storage.usb0/stall | |
echo 0 > functions/mass_storage.usb0/lun.0/cdrom | |
echo 0 > functions/mass_storage.usb0/lun.0/ro | |
echo 0 > functions/mass_storage.usb0/lun.0/nofua | |
echo $FILE > functions/mass_storage.usb0/lun.0/file | |
ln -s functions/mass_storage.usb0 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