blob: 1152529978177b97d5a248463d227482ad174dde [file] [log] [blame]
Dmitry Shmidtd7114332015-12-10 10:35:59 -08001on boot
Amit Pundir678d29f2017-11-06 16:35:32 +05302 mkdir /dev/usb-ffs 0775 shell shell
Dmitry Shmidtd7114332015-12-10 10:35:59 -08003 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 Shmidt128d7e62016-07-13 14:50:58 -070010 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
Dmitry Shmidtd7114332015-12-10 10:35:59 -080011 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
Amit Pundir678d29f2017-11-06 16:35:32 +053016 mkdir /config/usb_gadget/g1/functions/ffs.mtp
Dmitry Shmidtd7114332015-12-10 10:35:59 -080017 mkdir /config/usb_gadget/g1/functions/midi.gs5
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 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 Shmidtd7114332015-12-10 10:35:59 -080029
30on property:sys.usb.config=none && property:sys.usb.configfs=1
31 write /config/usb_gadget/g1/os_desc/use 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -080032
Amit Pundir678d29f2017-11-06 16:35:32 +053033on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080034 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080035 write /config/usb_gadget/g1/idProduct 0x4ee1
Amit Pundir678d29f2017-11-06 16:35:32 +053036 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080037
Amit Pundir678d29f2017-11-06 16:35:32 +053038on 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 Shmidtd7114332015-12-10 10:35:59 -080039 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080040 write /config/usb_gadget/g1/idProduct 0x4ee2
Amit Pundir678d29f2017-11-06 16:35:32 +053041 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080042
43on property:sys.usb.config=rndis && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080044 write /config/usb_gadget/g1/idProduct 0x4ee3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080045
46on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080047 write /config/usb_gadget/g1/idProduct 0x4ee4
Dmitry Shmidtd7114332015-12-10 10:35:59 -080048
Amit Pundir678d29f2017-11-06 16:35:32 +053049on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080050 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080051 write /config/usb_gadget/g1/idProduct 0x4ee5
Amit Pundir678d29f2017-11-06 16:35:32 +053052 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080053
Amit Pundir678d29f2017-11-06 16:35:32 +053054on 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 Shmidtd7114332015-12-10 10:35:59 -080055 write /config/usb_gadget/g1/os_desc/use 1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080056 write /config/usb_gadget/g1/idProduct 0x4ee6
Amit Pundir678d29f2017-11-06 16:35:32 +053057 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080058
59on property:sys.usb.config=adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080060 write /config/usb_gadget/g1/idProduct 0x4ee7
Dmitry Shmidtd7114332015-12-10 10:35:59 -080061
62on property:sys.usb.config=midi && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080063 write /config/usb_gadget/g1/idProduct 0x4ee8
Dmitry Shmidtd7114332015-12-10 10:35:59 -080064
65on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080066 write /config/usb_gadget/g1/idProduct 0x4ee9
Dmitry Shmidtd7114332015-12-10 10:35:59 -080067
68on property:sys.usb.config=accessory && property:sys.usb.configfs=1
69 write /config/usb_gadget/g1/idProduct 0x2d00
70
71on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
72 write /config/usb_gadget/g1/idProduct 0x2d01
73
74on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
75 write /config/usb_gadget/g1/idProduct 0x2d02
76
77on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
78 write /config/usb_gadget/g1/idProduct 0x2d03
79
80on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
81 write /config/usb_gadget/g1/idProduct 0x2d04
82
83on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
84 write /config/usb_gadget/g1/idProduct 0x2d05