blob: f198a8b5b527a11bf6ecff67113d19ae5e281777 [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
Jerry Zhangfd884412018-03-01 12:18:17 -080016 mkdir /config/usb_gadget/g1/functions/ffs.ptp
Dmitry Shmidtd7114332015-12-10 10:35:59 -080017 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
18 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
19 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
20 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
21 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
Dmitry Shmidtba121722018-01-05 08:45:33 -080022 mkdir /dev/usb-ffs 0775 shell shell
23 mkdir /dev/usb-ffs/adb 0770 shell shell
Dmitry Shmidtd7114332015-12-10 10:35:59 -080024 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
Amit Pundir678d29f2017-11-06 16:35:32 +053025 mkdir /dev/usb-ffs/mtp 0770 mtp mtp
Jerry Zhangfd884412018-03-01 12:18:17 -080026 mkdir /dev/usb-ffs/ptp 0770 mtp mtp
Amit Pundir678d29f2017-11-06 16:35:32 +053027 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
Jerry Zhangfd884412018-03-01 12:18:17 -080028 mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
Amit Pundir678d29f2017-11-06 16:35:32 +053029 setprop sys.usb.mtp.device_type 3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080030 setprop sys.usb.configfs 1
Jerry Zhang73e8a472017-08-28 12:40:09 -070031 setprop sys.usb.ffs.aio_compat 1
Dmitry Shmidtba121722018-01-05 08:45:33 -080032 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080033
34on property:sys.usb.config=none && property:sys.usb.configfs=1
35 write /config/usb_gadget/g1/os_desc/use 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -080036
Jerry Zhangfd884412018-03-01 12:18:17 -080037on property:sys.usb.config=mtp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080038 write /config/usb_gadget/g1/idProduct 0x4ee1
Dmitry Shmidtba121722018-01-05 08:45:33 -080039 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053040 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080041
Jerry Zhangfd884412018-03-01 12:18:17 -080042on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080043 write /config/usb_gadget/g1/idProduct 0x4ee2
Dmitry Shmidtba121722018-01-05 08:45:33 -080044 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053045 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080046
47on property:sys.usb.config=rndis && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080048 write /config/usb_gadget/g1/idProduct 0x4ee3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080049
Dmitry Shmidtba121722018-01-05 08:45:33 -080050on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080051 write /config/usb_gadget/g1/idProduct 0x4ee4
Dmitry Shmidtd7114332015-12-10 10:35:59 -080052
Jerry Zhangfd884412018-03-01 12:18:17 -080053on property:sys.usb.config=ptp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080054 write /config/usb_gadget/g1/idProduct 0x4ee5
Dmitry Shmidtba121722018-01-05 08:45:33 -080055 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080056 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080057
Jerry Zhangfd884412018-03-01 12:18:17 -080058on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080059 write /config/usb_gadget/g1/idProduct 0x4ee6
Dmitry Shmidtba121722018-01-05 08:45:33 -080060 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080061 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080062
63on property:sys.usb.config=adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080064 write /config/usb_gadget/g1/idProduct 0x4ee7
Dmitry Shmidtd7114332015-12-10 10:35:59 -080065
66on property:sys.usb.config=midi && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080067 write /config/usb_gadget/g1/idProduct 0x4ee8
Dmitry Shmidtd7114332015-12-10 10:35:59 -080068
69on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080070 write /config/usb_gadget/g1/idProduct 0x4ee9
Dmitry Shmidtd7114332015-12-10 10:35:59 -080071
72on property:sys.usb.config=accessory && property:sys.usb.configfs=1
73 write /config/usb_gadget/g1/idProduct 0x2d00
74
75on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
76 write /config/usb_gadget/g1/idProduct 0x2d01
77
78on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
79 write /config/usb_gadget/g1/idProduct 0x2d02
80
81on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
82 write /config/usb_gadget/g1/idProduct 0x2d03
83
84on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
85 write /config/usb_gadget/g1/idProduct 0x2d04
86
87on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
88 write /config/usb_gadget/g1/idProduct 0x2d05