blob: 5d6986b3f69b3157eab6ddb019159a89cc888d64 [file] [log] [blame]
Dmitry Shmidtd7114332015-12-10 10:35:59 -08001on boot
Dmitry Shmidtd7114332015-12-10 10:35:59 -08002 mount configfs none /config
3 mkdir /config/usb_gadget/g1 0770 shell shell
Dmitry Shmidtba121722018-01-05 08:45:33 -08004 mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
5 write /config/usb_gadget/g1/bcdUSB 0x0200
Dmitry Shmidtd7114332015-12-10 10:35:59 -08006 write /config/usb_gadget/g1/idVendor 0x18d1
7 write /config/usb_gadget/g1/bcdDevice 0x0223
Dmitry Shmidt128d7e62016-07-13 14:50:58 -07008 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
Dmitry Shmidtd7114332015-12-10 10:35:59 -08009 write /config/usb_gadget/g1/strings/0x409/manufacturer "HISILICON"
10 write /config/usb_gadget/g1/strings/0x409/product "ADB Gadget"
11 mkdir /config/usb_gadget/g1/functions/accessory.gs2
12 mkdir /config/usb_gadget/g1/functions/audio_source.gs3
Dmitry Shmidtba121722018-01-05 08:45:33 -080013 mkdir /config/usb_gadget/g1/functions/midi.gs5
Dmitry Shmidtd7114332015-12-10 10:35:59 -080014 mkdir /config/usb_gadget/g1/functions/ffs.adb
Amit Pundir678d29f2017-11-06 16:35:32 +053015 mkdir /config/usb_gadget/g1/functions/ffs.mtp
Dmitry Shmidtd7114332015-12-10 10:35:59 -080016 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
17 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
18 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
19 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
20 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
Dmitry Shmidtba121722018-01-05 08:45:33 -080021 mkdir /dev/usb-ffs 0775 shell shell
22 mkdir /dev/usb-ffs/adb 0770 shell shell
Dmitry Shmidtd7114332015-12-10 10:35:59 -080023 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
Amit Pundir678d29f2017-11-06 16:35:32 +053024 mkdir /dev/usb-ffs/mtp 0770 mtp mtp
25 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
26 setprop sys.usb.mtp.device_type 3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080027 setprop sys.usb.configfs 1
Jerry Zhang73e8a472017-08-28 12:40:09 -070028 setprop sys.usb.ffs.aio_compat 1
Dmitry Shmidtba121722018-01-05 08:45:33 -080029 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080030
31on property:sys.usb.config=none && property:sys.usb.configfs=1
32 write /config/usb_gadget/g1/os_desc/use 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -080033
Amit Pundir678d29f2017-11-06 16:35:32 +053034on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080035 write /config/usb_gadget/g1/idProduct 0x4ee1
Dmitry Shmidtba121722018-01-05 08:45:33 -080036 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053037 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080038
Amit Pundir678d29f2017-11-06 16:35:32 +053039on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080040 write /config/usb_gadget/g1/idProduct 0x4ee2
Dmitry Shmidtba121722018-01-05 08:45:33 -080041 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053042 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080043
44on property:sys.usb.config=rndis && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080045 write /config/usb_gadget/g1/idProduct 0x4ee3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080046
Dmitry Shmidtba121722018-01-05 08:45:33 -080047on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080048 write /config/usb_gadget/g1/idProduct 0x4ee4
Dmitry Shmidtd7114332015-12-10 10:35:59 -080049
Amit Pundir678d29f2017-11-06 16:35:32 +053050on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080051 write /config/usb_gadget/g1/idProduct 0x4ee5
Dmitry Shmidtba121722018-01-05 08:45:33 -080052 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053053 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080054
Amit Pundir678d29f2017-11-06 16:35:32 +053055on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080056 write /config/usb_gadget/g1/idProduct 0x4ee6
Dmitry Shmidtba121722018-01-05 08:45:33 -080057 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053058 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080059
60on property:sys.usb.config=adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080061 write /config/usb_gadget/g1/idProduct 0x4ee7
Dmitry Shmidtd7114332015-12-10 10:35:59 -080062
63on property:sys.usb.config=midi && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080064 write /config/usb_gadget/g1/idProduct 0x4ee8
Dmitry Shmidtd7114332015-12-10 10:35:59 -080065
66on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080067 write /config/usb_gadget/g1/idProduct 0x4ee9
Dmitry Shmidtd7114332015-12-10 10:35:59 -080068
69on property:sys.usb.config=accessory && property:sys.usb.configfs=1
70 write /config/usb_gadget/g1/idProduct 0x2d00
71
72on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
73 write /config/usb_gadget/g1/idProduct 0x2d01
74
75on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
76 write /config/usb_gadget/g1/idProduct 0x2d02
77
78on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
79 write /config/usb_gadget/g1/idProduct 0x2d03
80
81on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
82 write /config/usb_gadget/g1/idProduct 0x2d04
83
84on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
85 write /config/usb_gadget/g1/idProduct 0x2d05