A script to configure libcomposite USB Ethernet Gadget that will be recognised by Windows based on https://github.com/RoganDawes/P4wnP1/blob/62b5c40d9461e4b80998c54830625d6c855833f0/boot/init_usb.sh
#!/bin/bash | |
cd /sys/kernel/config/usb_gadget/ | |
mkdir -p pi4 | |
cd pi4 | |
echo 0x1d6b > idVendor # Linux Foundation | |
echo 0x0100 > idProduct # change to get Windows to rescan while testing | |
echo 0x0100 > bcdDevice # v1.0.0 | |
echo 0x0200 > bcdUSB # USB2 | |
echo 0xEF > bDeviceClass | |
echo 0x02 > bDeviceSubClass | |
echo 0x01 > bDeviceProtocol | |
mkdir -p strings/0x409 | |
echo "fedcba9876543212" > strings/0x409/serialnumber | |
echo "Ben Hardill" > strings/0x409/manufacturer | |
echo "PI4 USB Device" > strings/0x409/product | |
mkdir -p configs/c.1/strings/0x409 | |
echo "Config 1: RNDIS network" > configs/c.1/strings/0x409/configuration | |
echo 250 > configs/c.1/MaxPower | |
echo 0x80 > configs/c.1/bmAttributes | |
# Add functions here | |
# see gadget configurations below | |
# End functions | |
HOST="00:dc:c8:f7:75:14" | |
SELF="00:dd:dc:eb:6d:a1" | |
mkdir -p functions/rndis.usb0 | |
echo $HOST > functions/rndis.usb0/host_addr | |
echo $SELF > functions/rndis.usb0/dev_addr | |
mkdir -p os_desc | |
echo 1 > os_desc/use | |
echo 0xbc > os_desc/b_vendor_code | |
echo MSTF100 > os_desc/qw_sign | |
mkdir -p functions/rndis.usb0/os_desc/interface.rndis | |
echo RNDIS > functions/rndis.usb0/os_desc/interface.rndis/compatible_id | |
echo 5162001 > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id | |
ln -s functions/rndis.usb0 configs/c.1/ | |
UCD_DRIVER=$(ls /sys/class/udc | cut -f1 | head -n 1) | |
echo $UCD_DRIVER > UDC | |
sleep 0.2 | |
udevadm settle -t 5 || : | |
#ifup usb0 | |
sleep 2 | |
service dnsmasq restart |
This comment has been minimized.
This comment has been minimized.
Yeah, this doesn't seem to work on OSx either. |
This comment has been minimized.
This comment has been minimized.
any breakthrough yet? |
This comment has been minimized.
This comment has been minimized.
seems that https://gist.github.com/ianfinch/08288379b3575f360b64dee62a9f453f found the solution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
While this matches the P4wnP1 script it doesn't work on my Windows 10 machine, but it's the starting point. It works with Linux and I'll test it on a Mac later.