blob: bf9e0a465f9a4e554d8340bb5fbe2cc79359fff6 [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
Yongqin Liu339a2682020-09-11 17:54:01 +080030
31 setprop sys.usb.controller "ff100000.dwc3"
32
Amit Pundir678d29f2017-11-06 16:35:32 +053033 setprop sys.usb.mtp.device_type 3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080034 setprop sys.usb.configfs 1
Jerry Zhang73e8a472017-08-28 12:40:09 -070035 setprop sys.usb.ffs.aio_compat 1
Dmitry Shmidtba121722018-01-05 08:45:33 -080036 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080037
38on property:sys.usb.config=none && property:sys.usb.configfs=1
39 write /config/usb_gadget/g1/os_desc/use 0
Dmitry Shmidtd7114332015-12-10 10:35:59 -080040
Jerry Zhangfd884412018-03-01 12:18:17 -080041on property:sys.usb.config=mtp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080042 write /config/usb_gadget/g1/idProduct 0x4ee1
Dmitry Shmidtba121722018-01-05 08:45:33 -080043 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053044 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080045
Jerry Zhangfd884412018-03-01 12:18:17 -080046on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080047 write /config/usb_gadget/g1/idProduct 0x4ee2
Dmitry Shmidtba121722018-01-05 08:45:33 -080048 write /config/usb_gadget/g1/os_desc/use 1
Amit Pundir678d29f2017-11-06 16:35:32 +053049 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080050
51on property:sys.usb.config=rndis && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080052 write /config/usb_gadget/g1/idProduct 0x4ee3
Dmitry Shmidtd7114332015-12-10 10:35:59 -080053
Dmitry Shmidtba121722018-01-05 08:45:33 -080054on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080055 write /config/usb_gadget/g1/idProduct 0x4ee4
Dmitry Shmidtd7114332015-12-10 10:35:59 -080056
Jerry Zhangfd884412018-03-01 12:18:17 -080057on property:sys.usb.config=ptp && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080058 write /config/usb_gadget/g1/idProduct 0x4ee5
Dmitry Shmidtba121722018-01-05 08:45:33 -080059 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080060 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080061
Jerry Zhangfd884412018-03-01 12:18:17 -080062on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080063 write /config/usb_gadget/g1/idProduct 0x4ee6
Dmitry Shmidtba121722018-01-05 08:45:33 -080064 write /config/usb_gadget/g1/os_desc/use 1
Jerry Zhangfd884412018-03-01 12:18:17 -080065 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
Dmitry Shmidtd7114332015-12-10 10:35:59 -080066
67on property:sys.usb.config=adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080068 write /config/usb_gadget/g1/idProduct 0x4ee7
Dmitry Shmidtd7114332015-12-10 10:35:59 -080069
70on property:sys.usb.config=midi && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080071 write /config/usb_gadget/g1/idProduct 0x4ee8
Dmitry Shmidtd7114332015-12-10 10:35:59 -080072
73on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
Dmitry Shmidta00d7b12016-01-22 14:00:47 -080074 write /config/usb_gadget/g1/idProduct 0x4ee9
Dmitry Shmidtd7114332015-12-10 10:35:59 -080075
76on property:sys.usb.config=accessory && property:sys.usb.configfs=1
77 write /config/usb_gadget/g1/idProduct 0x2d00
78
79on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
80 write /config/usb_gadget/g1/idProduct 0x2d01
81
82on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
83 write /config/usb_gadget/g1/idProduct 0x2d02
84
85on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
86 write /config/usb_gadget/g1/idProduct 0x2d03
87
88on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
89 write /config/usb_gadget/g1/idProduct 0x2d04
90
91on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
92 write /config/usb_gadget/g1/idProduct 0x2d05