blob: 16054ba0be9d3dd2c7aac81ef972406a5754d6c3 [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
John Stultzf80ca2b2019-02-01 17:20:07 -08006 write /config/usb_gadget/g1/driver_match_existing_only 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -08007 write /config/usb_gadget/g1/idVendor 0x18d1
8 write /config/usb_gadget/g1/bcdDevice 0x0223
Dmitry Shmidt128d7e62016-07-13 14:50:58 -07009 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
Dmitry Shmidtd7114332015-12-10 10:35:59 -080010 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 Shmidtba121722018-01-05 08:45:33 -080014 mkdir /config/usb_gadget/g1/functions/midi.gs5
Dmitry Shmidtd7114332015-12-10 10:35:59 -080015 mkdir /config/usb_gadget/g1/functions/ffs.adb
Amit Pundir678d29f2017-11-06 16:35:32 +053016 mkdir /config/usb_gadget/g1/functions/ffs.mtp
Jerry Zhangfd884412018-03-01 12:18:17 -080017 mkdir /config/usb_gadget/g1/functions/ffs.ptp
Dmitry Shmidtd7114332015-12-10 10:35:59 -080018 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 Shmidtba121722018-01-05 08:45:33 -080023 mkdir /dev/usb-ffs 0775 shell shell
24 mkdir /dev/usb-ffs/adb 0770 shell shell
Dmitry Shmidtd7114332015-12-10 10:35:59 -080025 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
Amit Pundir678d29f2017-11-06 16:35:32 +053026 mkdir /dev/usb-ffs/mtp 0770 mtp mtp
Jerry Zhangfd884412018-03-01 12:18:17 -080027 mkdir /dev/usb-ffs/ptp 0770 mtp mtp
Amit Pundir678d29f2017-11-06 16:35:32 +053028 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 -080029 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 +053030 setprop sys.usb.mtp.device_type 3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080031 setprop sys.usb.configfs 1
Jerry Zhang73e8a472017-08-28 12:40:09 -070032 setprop sys.usb.ffs.aio_compat 1
Dmitry Shmidtba121722018-01-05 08:45:33 -080033 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080034
35on property:sys.usb.config=none && property:sys.usb.configfs=1
36 write /config/usb_gadget/g1/os_desc/use 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -080037
Jerry Zhangfd884412018-03-01 12:18:17 -080038on property:sys.usb.config=mtp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080039 write /config/usb_gadget/g1/idProduct 0x4ee1
Dmitry Shmidtba121722018-01-05 08:45:33 -080040 write /config/usb_gadget/g1/os_desc/use 1
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
Jerry Zhangfd884412018-03-01 12:18:17 -080043on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080044 write /config/usb_gadget/g1/idProduct 0x4ee2
Dmitry Shmidtba121722018-01-05 08:45:33 -080045 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053046 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
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
Dmitry Shmidtba121722018-01-05 08:45:33 -080051on property:sys.usb.ffs.ready=1 && 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
Jerry Zhangfd884412018-03-01 12:18:17 -080054on property:sys.usb.config=ptp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080055 write /config/usb_gadget/g1/idProduct 0x4ee5
Dmitry Shmidtba121722018-01-05 08:45:33 -080056 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080057 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080058
Jerry Zhangfd884412018-03-01 12:18:17 -080059on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080060 write /config/usb_gadget/g1/idProduct 0x4ee6
Dmitry Shmidtba121722018-01-05 08:45:33 -080061 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080062 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
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