1on boot 2 mount configfs none /config 3 mkdir /config/usb_gadget/g1 0770 shell shell 4 mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell 5 write /config/usb_gadget/g1/bcdUSB 0x0200 6 write /config/usb_gadget/g1/idVendor 0x18d1 7 write /config/usb_gadget/g1/bcdDevice 0x0223 8 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} 9 write /config/usb_gadget/g1/strings/0x409/manufacturer "QUALCOMM" 10 write /config/usb_gadget/g1/strings/0x409/product "Android Gadget" 11 mkdir /config/usb_gadget/g1/functions/accessory.gs2 12 mkdir /config/usb_gadget/g1/functions/audio_source.gs3 13 mkdir /config/usb_gadget/g1/functions/midi.gs5 14 mkdir /config/usb_gadget/g1/functions/ffs.adb 15 mkdir /config/usb_gadget/g1/functions/ffs.mtp 16 mkdir /config/usb_gadget/g1/functions/ffs.ptp 17 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell 18 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell 19 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 20 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" 21 write /config/usb_gadget/g1/configs/b.1/MaxPower 500 22 mkdir /dev/usb-ffs 0775 shell shell 23 mkdir /dev/usb-ffs/adb 0770 shell shell 24 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 25 mkdir /dev/usb-ffs/mtp 0770 mtp mtp 26 mkdir /dev/usb-ffs/ptp 0770 mtp mtp 27 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 28 mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 29 setprop sys.usb.controller "a600000.dwc3" 30 31 setprop sys.usb.mtp.device_type 3 32 setprop sys.usb.configfs 1 33 setprop sys.usb.ffs.aio_compat 1 34 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 35 36on property:sys.usb.config=none && property:sys.usb.configfs=1 37 write /config/usb_gadget/g1/os_desc/use 0 38 39on property:sys.usb.config=mtp && property:sys.usb.configfs=1 40 write /config/usb_gadget/g1/idProduct 0x4ee1 41 write /config/usb_gadget/g1/os_desc/use 1 42 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 43 44on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 45 write /config/usb_gadget/g1/idProduct 0x4ee2 46 write /config/usb_gadget/g1/os_desc/use 1 47 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 48 49on property:sys.usb.config=rndis && property:sys.usb.configfs=1 50 write /config/usb_gadget/g1/idProduct 0x4ee3 51 52on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 53 write /config/usb_gadget/g1/idProduct 0x4ee4 54 55on property:sys.usb.config=ptp && property:sys.usb.configfs=1 56 write /config/usb_gadget/g1/idProduct 0x4ee5 57 write /config/usb_gadget/g1/os_desc/use 1 58 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 59 60on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 61 write /config/usb_gadget/g1/idProduct 0x4ee6 62 write /config/usb_gadget/g1/os_desc/use 1 63 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 64 65on property:sys.usb.config=adb && property:sys.usb.configfs=1 66 write /config/usb_gadget/g1/idProduct 0x4ee7 67 68on property:sys.usb.config=midi && property:sys.usb.configfs=1 69 write /config/usb_gadget/g1/idProduct 0x4ee8 70 71on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 72 write /config/usb_gadget/g1/idProduct 0x4ee9 73 74on property:sys.usb.config=accessory && property:sys.usb.configfs=1 75 write /config/usb_gadget/g1/idProduct 0x2d00 76 77on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 78 write /config/usb_gadget/g1/idProduct 0x2d01 79 80on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 81 write /config/usb_gadget/g1/idProduct 0x2d02 82 83on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 84 write /config/usb_gadget/g1/idProduct 0x2d03 85 86on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 87 write /config/usb_gadget/g1/idProduct 0x2d04 88 89on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 90 write /config/usb_gadget/g1/idProduct 0x2d05 91