Loading

Paste #poaoua5n9

  1. #!/bin/sh
  2.  
  3. #Set up configfs as we are not using droid-boot
  4.  
  5. USB_FUNCTIONS=rndis
  6. GADGET_DIR=/sys/kernel/config/usb_gadget
  7.  
  8. G_USB_ISERIAL=$GADGET_DIR/g1/strings/0x409/serialnumber
  9.  
  10. mkdir $GADGET_DIR/g1
  11. write $GADGET_DIR/g1/idVendor                   "0x18D1"
  12. write $GADGET_DIR/g1/idProduct                  "0xD001"
  13. mkdir $GADGET_DIR/g1/strings/0x409
  14. write $GADGET_DIR/g1/strings/0x409/serialnumber "$1"
  15. write $GADGET_DIR/g1/strings/0x409/manufacturer "Mer Boat Loader"
  16. write $GADGET_DIR/g1/strings/0x409/product      "$CUSTOMPRODUCT"
  17.  
  18. if echo $USB_FUNCTIONS | grep -q "rndis"; then
  19.     mkdir $GADGET_DIR/g1/functions/rndis.usb0
  20.     mkdir $GADGET_DIR/g1/functions/rndis_bam.rndis
  21. fi
  22. echo $USB_FUNCTIONS | grep -q "mass_storage" && mkdir $GADGET_DIR/g1/functions/storage.0
  23.  
  24. mkdir $GADGET_DIR/g1/configs/c.1
  25. mkdir $GADGET_DIR/g1/configs/c.1/strings/0x409
  26. write $GADGET_DIR/g1/configs/c.1/strings/0x409/configuration "$USB_FUNCTIONS"
  27.  
  28. if echo $USB_FUNCTIONS | grep -q "rndis"; then
  29.     ln -s $GADGET_DIR/g1/functions/rndis.usb0 $GADGET_DIR/g1/configs/c.1
  30.     ln -s $GADGET_DIR/g1/functions/rndis_bam.rndis $GADGET_DIR/g1/configs/c.1
  31. fi
  32. echo $USB_FUNCTIONS | grep -q "mass_storage" && ln -s $GADGET_DIR/g1/functions/storage.0 $GADGET_DIR/g1/configs/c.1
  33.  
  34. echo "$(ls /sys/class/udc)" > $GADGET_DIR/g1/UDC