blob: 79d4d58c011ee5da9708cd7f934df3e4dcfefda8 [file] [log] [blame]
Amit Pundir4e375822019-04-18 16:46:10 +05301on boot
2 mount configfs none /config
3 mkdir /config/usb_gadget/g1 0770 shell shell
4 mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
5 write /config/usb_gadget/g1/bcdUSB 0x0200
6 write /config/usb_gadget/g1/idVendor 0x18d1
7 write /config/usb_gadget/g1/bcdDevice 0x0223
8 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
9 write /config/usb_gadget/g1/strings/0x409/manufacturer "QUALCOMM"
10 write /config/usb_gadget/g1/strings/0x409/product "Android Gadget"
11 mkdir /config/usb_gadget/g1/functions/accessory.gs2
12 mkdir /config/usb_gadget/g1/functions/audio_source.gs3
13 mkdir /config/usb_gadget/g1/functions/midi.gs5
14 mkdir /config/usb_gadget/g1/functions/ffs.adb
15 mkdir /config/usb_gadget/g1/functions/ffs.mtp
16 mkdir /config/usb_gadget/g1/functions/ffs.ptp
17 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
22 mkdir /dev/usb-ffs 0775 shell shell
23 mkdir /dev/usb-ffs/adb 0770 shell shell
24 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
25 mkdir /dev/usb-ffs/mtp 0770 mtp mtp
26 mkdir /dev/usb-ffs/ptp 0770 mtp mtp
27 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
28 mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
John Stultz50b8dae2020-06-24 20:29:07 +000029
Amit Pundir4e375822019-04-18 16:46:10 +053030 setprop sys.usb.mtp.device_type 3
31 setprop sys.usb.configfs 1
32 setprop sys.usb.ffs.aio_compat 1
33 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
34
Amit Pundir242bcef2021-07-22 22:55:10 +053035on property:vendor.usb.controller=*
36 setprop sys.usb.controller ${vendor.usb.controller}
37
Amit Pundir4e375822019-04-18 16:46:10 +053038on property:sys.usb.config=none && property:sys.usb.configfs=1
39 write /config/usb_gadget/g1/os_desc/use 0
40
41on property:sys.usb.config=mtp && property:sys.usb.configfs=1
42 write /config/usb_gadget/g1/idProduct 0x4ee1
43 write /config/usb_gadget/g1/os_desc/use 1
44 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
45
46on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
47 write /config/usb_gadget/g1/idProduct 0x4ee2
48 write /config/usb_gadget/g1/os_desc/use 1
49 symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
50
51on property:sys.usb.config=rndis && property:sys.usb.configfs=1
52 write /config/usb_gadget/g1/idProduct 0x4ee3
53
54on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
55 write /config/usb_gadget/g1/idProduct 0x4ee4
56
57on property:sys.usb.config=ptp && property:sys.usb.configfs=1
58 write /config/usb_gadget/g1/idProduct 0x4ee5
59 write /config/usb_gadget/g1/os_desc/use 1
60 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
61
62on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
63 write /config/usb_gadget/g1/idProduct 0x4ee6
64 write /config/usb_gadget/g1/os_desc/use 1
65 symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
66
67on property:sys.usb.config=adb && property:sys.usb.configfs=1
68 write /config/usb_gadget/g1/idProduct 0x4ee7
69
70on property:sys.usb.config=midi && property:sys.usb.configfs=1
71 write /config/usb_gadget/g1/idProduct 0x4ee8
72
73on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
74 write /config/usb_gadget/g1/idProduct 0x4ee9
75
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
Amit Pundir242bcef2021-07-22 22:55:10 +053093
94on post-fs
95 start set_udc
96
97service set_udc /vendor/bin/set_udc.sh
98 class core
99 user root
100 group system
101 disabled
102 oneshot