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