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