5 # http://github.com/wismna/raspberry-pi/hackpi
11 cd /sys/kernel/config/usb_gadget/
16 HOST="48:6f:73:74:50:43"
17 RNDIS="42:61:64:55:53:42"
19 ECM="42:61:64:55:53:43"
21 echo 0x04b3 > idVendor
22 echo 0x4010 > idProduct
24 echo 0x0100 > bcdDevice # v1.0.0
25 mkdir -p strings/0x409
26 echo "badc0deddeadbeef" > strings/0x409/serialnumber
27 echo "wismna" > strings/0x409/manufacturer
28 echo "PiZero" > strings/0x409/product
30 if [ ! -z "$RNDIS" ]; then
32 mkdir -p configs/c.1/strings/0x409
33 echo "0x80" > configs/c.1/bmAttributes
34 echo 250 > configs/c.1/MaxPower
35 echo "Config 1: RNDIS network" > configs/c.1/strings/0x409/configuration
37 echo "1" > os_desc/use
38 echo "0xcd" > os_desc/b_vendor_code
39 echo "MSFT100" > os_desc/qw_sign
41 mkdir -p functions/rndis.usb0
42 echo $RNDIS > functions/rndis.usb0/dev_addr
43 echo $HOST > functions/rndis.usb0/host_addr
44 echo "RNDIS" > functions/rndis.usb0/os_desc/interface.rndis/compatible_id
45 echo "5162001" > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id
49 mkdir -p configs/c.2/strings/0x409
50 echo "Config 2: ECM network" > configs/c.2/strings/0x409/configuration
51 echo 250 > configs/c.2/MaxPower
53 mkdir -p functions/ecm.usb0
54 # first byte of address must be even
55 echo $HOST > functions/ecm.usb0/host_addr
56 echo $ECM > functions/ecm.usb0/dev_addr
58 # Create the CDC ACM function
59 mkdir -p functions/acm.gs0
61 # Link everything and bind the USB device
62 if [ ! -z "$RNDIS" ]; then
63 ln -s configs/c.1 os_desc
64 ln -s functions/rndis.usb0 configs/c.1
67 ln -s functions/ecm.usb0 configs/c.2
68 ln -s functions/acm.gs0 configs/c.2
70 ls /sys/class/udc > UDC