blob: b49baa1b9513f51d35ca20d36a5f0d6440342cf0 [file] [log] [blame]
Dmitry Shmidtd7114332015-12-10 10:35:59 -08001on 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 "0123456789"
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/rndis.gs4
19 write /config/usb_gadget/g1/functions/rndis.gs4/wceis 1
20 mkdir /config/usb_gadget/g1/functions/midi.gs5
21 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
22 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
23 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
24 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
25 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
26 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
27 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
28 setprop sys.usb.configfs 1
29 setprop sys.usb.controller "f72c0000.usb"
30
31on property:sys.usb.config=none && property:sys.usb.configfs=1
32 write /config/usb_gadget/g1/os_desc/use 0
33 setprop sys.usb.ffs.ready 0
34
35on property:init.svc.adbd=stopped
36 setprop sys.usb.ffs.ready 0
37
38on property:sys.usb.config=mtp && property:sys.usb.configfs=1
39 write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP"
40 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080041 write /config/usb_gadget/g1/idProduct 0x4ee1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080042
43on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
44 write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP"
45 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080046 write /config/usb_gadget/g1/idProduct 0x4ee2
Dmitry Shmidtd7114332015-12-10 10:35:59 -080047
48on property:sys.usb.config=rndis && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080049 write /config/usb_gadget/g1/idProduct 0x4ee3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080050
51on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080052 write /config/usb_gadget/g1/idProduct 0x4ee4
Dmitry Shmidtd7114332015-12-10 10:35:59 -080053
54on property:sys.usb.config=ptp && property:sys.usb.configfs=1
55 write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP"
56 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080057 write /config/usb_gadget/g1/idProduct 0x4ee5
Dmitry Shmidtd7114332015-12-10 10:35:59 -080058
59on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
60 write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP"
61 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080062 write /config/usb_gadget/g1/idProduct 0x4ee6
Dmitry Shmidtd7114332015-12-10 10:35:59 -080063
64on property:sys.usb.config=adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080065 write /config/usb_gadget/g1/idProduct 0x4ee7
Dmitry Shmidtd7114332015-12-10 10:35:59 -080066
67on property:sys.usb.config=midi && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080068 write /config/usb_gadget/g1/idProduct 0x4ee8
Dmitry Shmidtd7114332015-12-10 10:35:59 -080069
70on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080071 write /config/usb_gadget/g1/idProduct 0x4ee9
Dmitry Shmidtd7114332015-12-10 10:35:59 -080072
73on property:sys.usb.config=accessory && property:sys.usb.configfs=1
74 write /config/usb_gadget/g1/idProduct 0x2d00
75
76on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
77 write /config/usb_gadget/g1/idProduct 0x2d01
78
79on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
80 write /config/usb_gadget/g1/idProduct 0x2d02
81
82on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
83 write /config/usb_gadget/g1/idProduct 0x2d03
84
85on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
86 write /config/usb_gadget/g1/idProduct 0x2d04
87
88on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
89 write /config/usb_gadget/g1/idProduct 0x2d05