Created
December 19, 2021 18:03
-
-
Save phhusson/fa8cfecc73bc26090d61784dfbccfcf6 to your computer and use it in GitHub Desktop.
This file contains 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
mkdir /config | |
mount -t configfs none /config | |
# Init USB gadget | |
g=/config/usb_gadget/g1 | |
mkdir $g | |
echo > $g/UDC | |
rm -Rf $g/configs | |
rm -Rf $g/configs | |
echo 0x18d1 > $g/idVendor | |
echo 0x4ee0 > $g/idProduct | |
mkdir -p $g/strings/0x409 | |
echo "rock-pi-s" > $g/strings/0x409/serialnumber | |
echo rock-pi-s > $g/strings/0x409/manufacturer | |
echo rock-pi-s > $g/strings/0x409/product | |
mkdir $g/configs/c.1/ | |
mkdir $g/configs/c.1/strings/0x409 | |
echo 'conf' > $g/configs/c.1/strings/0x409/configuration | |
echo 0x0409 > $g/bcdDevice | |
mkdir $g/functions/acm.0 | |
mkdir $g/functions/rndis.rndis | |
ln -s $g/functions/acm.0 $g/configs/c.1/f1 | |
ln -s $g/functions/rndis.rndis $g/configs/c.1/f2 | |
echo 0x1 > $g/os_desc/b_vendor_code | |
echo MSFT100 > $g/os_desc/qw_sign | |
echo 1 > $g/os_desc/use | |
ln -s $g/configs/c.1 $g/os_desc/c.1 | |
echo 0x3f > $g/configs/c.1/MaxPower | |
ls /sys/class/udc | head -n 1 | cat > $g/UDC | |
# Now there is a /dev/ttyGS0, you can launch a getty on it | |
# Also there is a `usb0` network interface |
For anything, it's only using standard Linux kernel api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! It's for armbian?