Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 1 | on boot |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 2 | mount configfs none /config |
| 3 | mkdir /config/usb_gadget/g1 0770 shell shell |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 4 | mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell |
| 5 | write /config/usb_gadget/g1/bcdUSB 0x0200 |
John Stultz | f80ca2b | 2019-02-01 17:20:07 -0800 | [diff] [blame] | 6 | write /config/usb_gadget/g1/driver_match_existing_only 0 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 7 | write /config/usb_gadget/g1/idVendor 0x18d1 |
| 8 | write /config/usb_gadget/g1/bcdDevice 0x0223 |
Dmitry Shmidt | 128d7e6 | 2016-07-13 14:50:58 -0700 | [diff] [blame] | 9 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 10 | write /config/usb_gadget/g1/strings/0x409/manufacturer "HISILICON" |
| 11 | write /config/usb_gadget/g1/strings/0x409/product "ADB Gadget" |
| 12 | mkdir /config/usb_gadget/g1/functions/accessory.gs2 |
| 13 | mkdir /config/usb_gadget/g1/functions/audio_source.gs3 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 14 | mkdir /config/usb_gadget/g1/functions/midi.gs5 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 15 | mkdir /config/usb_gadget/g1/functions/ffs.adb |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 16 | mkdir /config/usb_gadget/g1/functions/ffs.mtp |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 17 | mkdir /config/usb_gadget/g1/functions/ffs.ptp |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 18 | mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell |
| 19 | mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell |
| 20 | write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 |
| 21 | write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" |
| 22 | write /config/usb_gadget/g1/configs/b.1/MaxPower 500 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 23 | mkdir /dev/usb-ffs 0775 shell shell |
| 24 | mkdir /dev/usb-ffs/adb 0770 shell shell |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 25 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 26 | mkdir /dev/usb-ffs/mtp 0770 mtp mtp |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 27 | mkdir /dev/usb-ffs/ptp 0770 mtp mtp |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 28 | mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 29 | mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 |
Yongqin Liu | 339a268 | 2020-09-11 17:54:01 +0800 | [diff] [blame] | 30 | |
| 31 | setprop sys.usb.controller "f72c0000.usb" |
| 32 | |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 33 | setprop sys.usb.mtp.device_type 3 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 34 | setprop sys.usb.configfs 1 |
Jerry Zhang | 73e8a47 | 2017-08-28 12:40:09 -0700 | [diff] [blame] | 35 | setprop sys.usb.ffs.aio_compat 1 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 36 | symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 37 | |
| 38 | on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| 39 | write /config/usb_gadget/g1/os_desc/use 0 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 40 | |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 41 | on property:sys.usb.config=mtp && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 42 | write /config/usb_gadget/g1/idProduct 0x4ee1 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 43 | write /config/usb_gadget/g1/os_desc/use 1 |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 44 | symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 45 | |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 46 | on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 47 | write /config/usb_gadget/g1/idProduct 0x4ee2 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 48 | write /config/usb_gadget/g1/os_desc/use 1 |
Amit Pundir | 678d29f | 2017-11-06 16:35:32 +0530 | [diff] [blame] | 49 | symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 50 | |
| 51 | on property:sys.usb.config=rndis && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 52 | write /config/usb_gadget/g1/idProduct 0x4ee3 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 53 | |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 54 | on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 55 | write /config/usb_gadget/g1/idProduct 0x4ee4 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 56 | |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 57 | on property:sys.usb.config=ptp && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 58 | write /config/usb_gadget/g1/idProduct 0x4ee5 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 59 | write /config/usb_gadget/g1/os_desc/use 1 |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 60 | symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 61 | |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 62 | on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 63 | write /config/usb_gadget/g1/idProduct 0x4ee6 |
Dmitry Shmidt | ba12172 | 2018-01-05 08:45:33 -0800 | [diff] [blame] | 64 | write /config/usb_gadget/g1/os_desc/use 1 |
Jerry Zhang | fd88441 | 2018-03-01 12:18:17 -0800 | [diff] [blame] | 65 | symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 66 | |
| 67 | on property:sys.usb.config=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 0x4ee7 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 69 | |
| 70 | on property:sys.usb.config=midi && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 71 | write /config/usb_gadget/g1/idProduct 0x4ee8 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 72 | |
| 73 | on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 |
Dmitry Shmidt | a00d7b1 | 2016-01-22 14:00:47 -0800 | [diff] [blame] | 74 | write /config/usb_gadget/g1/idProduct 0x4ee9 |
Dmitry Shmidt | d711433 | 2015-12-10 10:35:59 -0800 | [diff] [blame] | 75 | |
| 76 | on property:sys.usb.config=accessory && property:sys.usb.configfs=1 |
| 77 | write /config/usb_gadget/g1/idProduct 0x2d00 |
| 78 | |
| 79 | on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 |
| 80 | write /config/usb_gadget/g1/idProduct 0x2d01 |
| 81 | |
| 82 | on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 |
| 83 | write /config/usb_gadget/g1/idProduct 0x2d02 |
| 84 | |
| 85 | on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 |
| 86 | write /config/usb_gadget/g1/idProduct 0x2d03 |
| 87 | |
| 88 | on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 |
| 89 | write /config/usb_gadget/g1/idProduct 0x2d04 |
| 90 | |
| 91 | on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 |
| 92 | write /config/usb_gadget/g1/idProduct 0x2d05 |