Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 1 | on 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 |
Dmitry Shmidt | 128d7e6 | 2016-07-13 14:50:58 -0700 | [diff] [blame] | 10 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 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 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 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 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 27 | |
| 28 | on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| 29 | write /config/usb_gadget/g1/os_desc/use 0 |
| 30 | setprop sys.usb.ffs.ready 0 |
| 31 | |
| 32 | on property:init.svc.adbd=stopped |
| 33 | setprop sys.usb.ffs.ready 0 |
| 34 | |
| 35 | on property:sys.usb.config=mtp && property:sys.usb.configfs=1 |
| 36 | write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP" |
| 37 | write /config/usb_gadget/g1/os_desc/use 1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 38 | write /config/usb_gadget/g1/idProduct 0x4ee1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 39 | |
| 40 | on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 |
| 41 | write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP" |
| 42 | write /config/usb_gadget/g1/os_desc/use 1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 43 | write /config/usb_gadget/g1/idProduct 0x4ee2 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 44 | |
| 45 | on property:sys.usb.config=rndis && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 46 | write /config/usb_gadget/g1/idProduct 0x4ee3 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 47 | |
| 48 | on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 49 | write /config/usb_gadget/g1/idProduct 0x4ee4 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 50 | |
| 51 | on property:sys.usb.config=ptp && property:sys.usb.configfs=1 |
| 52 | write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP" |
| 53 | write /config/usb_gadget/g1/os_desc/use 1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 54 | write /config/usb_gadget/g1/idProduct 0x4ee5 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 55 | |
| 56 | on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 |
| 57 | write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP" |
| 58 | write /config/usb_gadget/g1/os_desc/use 1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 59 | write /config/usb_gadget/g1/idProduct 0x4ee6 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 60 | |
| 61 | on property:sys.usb.config=adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 62 | write /config/usb_gadget/g1/idProduct 0x4ee7 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 63 | |
| 64 | on property:sys.usb.config=midi && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 65 | write /config/usb_gadget/g1/idProduct 0x4ee8 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 66 | |
| 67 | on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 68 | write /config/usb_gadget/g1/idProduct 0x4ee9 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 69 | |
| 70 | on property:sys.usb.config=accessory && property:sys.usb.configfs=1 |
| 71 | write /config/usb_gadget/g1/idProduct 0x2d00 |
| 72 | |
| 73 | on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 |
| 74 | write /config/usb_gadget/g1/idProduct 0x2d01 |
| 75 | |
| 76 | on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 |
| 77 | write /config/usb_gadget/g1/idProduct 0x2d02 |
| 78 | |
| 79 | on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 |
| 80 | write /config/usb_gadget/g1/idProduct 0x2d03 |
| 81 | |
| 82 | on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 |
| 83 | write /config/usb_gadget/g1/idProduct 0x2d04 |
| 84 | |
| 85 | on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 |
| 86 | write /config/usb_gadget/g1/idProduct 0x2d05 |