blob: bdb392063f8a40a771495522250c676c20d8d06b [file] [log] [blame]
SamarV-121eb08a772022-04-12 22:01:01 +05301on early-init
2 write /sys/module/musb_hdrc/parameters/kernel_init_done 1
3 #ifdef VENDOR_EDIT
4 #Wanghao@BSP.bootloader.bootflow, 2020/03/28, Add for usb port in meta mode
5 #write /sys/class/udc/musb-hdrc/device/cmode 3
6 #endif
7
8on post-fs
9#ifndef VENDOR_EDIT
10#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
11 #setprop vendor.usb.vid "0x0E8D"
12#else /* VENDOR_EDIT */
13 setprop vendor.usb.vid "0x22d9"
14#endif /* VENDOR_EDIT */
15 mkdir /dev/usb-ffs 0770 shell shell
16 mkdir /dev/usb-ffs/adb 0770 shell shell
17 mkdir /config/usb_gadget/g1 0770 shell shell
18 write /config/usb_gadget/g1/idVendor ${vendor.usb.vid}
19 write /config/usb_gadget/g1/bcdDevice 0x0404
20 write /config/usb_gadget/g1/bcdUSB 0x0200
21 write /config/usb_gadget/g1/os_desc/use 1
22 mkdir /config/usb_gadget/g1/strings/0x409 0770
23 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
24 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
25 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
26 mkdir /config/usb_gadget/g1/functions/accessory.gs2
27 mkdir /config/usb_gadget/g1/functions/audio_source.gs3
28 mkdir /config/usb_gadget/g1/functions/ffs.adb
29 mkdir /config/usb_gadget/g1/functions/mtp.gs0
30 write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP"
31 mkdir /config/usb_gadget/g1/functions/ptp.gs1
32 mkdir /config/usb_gadget/g1/functions/rndis.gs4
33 mkdir /config/usb_gadget/g1/functions/midi.gs5
34 mkdir /config/usb_gadget/g1/functions/acm.gs0
35 mkdir /config/usb_gadget/g1/functions/acm.gs1
36 mkdir /config/usb_gadget/g1/functions/acm.gs2
37 mkdir /config/usb_gadget/g1/functions/acm.gs3
38 mkdir /config/usb_gadget/g1/functions/mass_storage.usb0
39 mkdir /config/usb_gadget/g1/functions/hid.gs0
40 mkdir /config/usb_gadget/g1/functions/via_modem.gs0
41 mkdir /config/usb_gadget/g1/functions/via_ets.gs0
42 mkdir /config/usb_gadget/g1/functions/via_atc.gs0
43 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
44 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
45 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
46 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
47 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
48 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
49 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
50
51on boot
52 setprop sys.usb.configfs 1
53 setprop sys.usb.ffs.aio_compat 1
54 setprop vendor.usb.controller "musb-hdrc"
55 setprop vendor.usb.acm_cnt 0
56 setprop vendor.usb.acm_port0 ""
57 setprop vendor.usb.acm_port1 ""
58 setprop vendor.usb.acm_enable 0
59 write /sys/class/android_usb/android0/f_mtp/cpu_mask 0xF0
60 write /sys/module/usb_f_mtp/parameters/mtp_rx_cont 1
61 chmod 0664 /sys/class/android_usb/android0/iSerial
62 chown root system /sys/class/android_usb/android0/iSerial
63
64 chown radio system /sys/class/usb_rawbulk/data/enable
65 chmod 0660 /sys/class/usb_rawbulk/data/enable
66 chown radio system /sys/class/usb_rawbulk/ets/enable
67 chmod 0660 /sys/class/usb_rawbulk/ets/enable
68 chown radio system /sys/class/usb_rawbulk/atc/enable
69 chmod 0660 /sys/class/usb_rawbulk/atc/enable
70 chown radio system /sys/class/usb_rawbulk/pcv/enable
71 chmod 0660 /sys/class/usb_rawbulk/pcv/enable
72 chown radio system /sys/class/usb_rawbulk/gps/enable
73 chmod 0660 /sys/class/usb_rawbulk/gps/enable
74 chown system radio /dev/ttyGS0
75 chmod 0660 /dev/ttyGS0
76 chown system radio /dev/ttyGS1
77 chmod 0660 /dev/ttyGS1
78 chown system radio /dev/ttyGS2
79 chmod 0660 /dev/ttyGS2
80 chown system radio /dev/ttyGS3
81 chmod 0660 /dev/ttyGS3
82
83 # for UAC MAX dpidle time
84 write /sys/module/xhci_hcd/parameters/dpidle_fs_max 0
85 write /sys/module/xhci_hcd/parameters/dpidle_hs_max 0
86
87 # for usb otg sdcard hot plug detection
88 write /sys/module/block/parameters/events_dfl_poll_msecs 1000
89
90on charger
91 mkdir /config/usb_gadget/g1 0770 shell shell
92 write /config/usb_gadget/g1/idVendor 0x0E8D
93 write /config/usb_gadget/g1/bcdDevice 0x0223
94 write /config/usb_gadget/g1/bcdUSB 0x0200
95 write /config/usb_gadget/g1/os_desc/use 1
96 mkdir /config/usb_gadget/g1/strings/0x409 0770
97 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
98 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
99 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
100 mkdir /config/usb_gadget/g1/functions/hid.gs0
101 mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
102 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
103 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
104 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
105 setprop sys.usb.configfs 1
106 setprop vendor.usb.controller "musb-hdrc"
107 setprop vendor.usb.acm_cnt 0
108 setprop vendor.usb.acm_port0 ""
109 setprop vendor.usb.acm_port1 ""
110 setprop vendor.usb.acm_enable 0
111 setprop sys.usb.config hid
112
113### more command at init.usb.configfs.rc ###
114on property:sys.usb.config=none && property:sys.usb.configfs=1
115 write /config/usb_gadget/g1/idVendor ${vendor.usb.vid}
116 rm /config/usb_gadget/g1/configs/b.1/f4
117 rm /config/usb_gadget/g1/configs/b.1/f5
118 write /sys/class/udc/musb-hdrc/device/saving 0
119
120### HID for KPOC ###
121on property:sys.usb.config=hid && property:sys.usb.configfs=1
122 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "HID"
123 write /config/usb_gadget/g1/idProduct 0x20FF
124 write /config/usb_gadget/g1/functions/hid.gs0/protocol 0
125 write /config/usb_gadget/g1/functions/hid.gs0/subclass 0
126 #write /config/usb_gadget/g1/functions/hid.gs0/report_length 4
127 #write /config/usb_gadget/g1/functions/hid.gs0/report_desc \\x05\\x01\\x09\\x00\\xa1\\x01\\xc0
128 symlink /config/usb_gadget/g1/functions/hid.gs0 /config/usb_gadget/g1/configs/b.1/f1
129 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
130 setprop sys.usb.state ${sys.usb.config}
131
132### main function : adb ###
133### start adbd at init.usb.configfs.rc ###
134on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=0 && \
135property:sys.usb.configfs=1
136#ifndef VENDOR_EDIT
137#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
138 #setprop vendor.usb.pid 0x201C
139#else /* VENDOR_EDIT */
140 setprop vendor.usb.pid 0x2769
141#endif /* VENDOR_EDIT */
142on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=1 && \
143property:sys.usb.configfs=1
144 setprop vendor.usb.pid 0x2006
145 setprop vendor.usb.acm_port1 ""
146on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=2 && \
147property:sys.usb.configfs=1
148#ifndef VENDOR_EDIT
149#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2018/03/14, Modify for OPPO VID&PID */
150 #setprop vendor.usb.pid 0x2029
151#else
152 setprop vendor.usb.pid 0x200E
153#endif
154
155on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && \
156property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
157 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb_acm"
158 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
159 write /sys/class/udc/musb-hdrc/device/saving 1
160 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
161 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
162 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
163 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
164 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
165 setprop sys.usb.state ${sys.usb.config}
166
167on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && \
168property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
169 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
170 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
171 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
172 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
173 setprop sys.usb.state ${sys.usb.config}
174
175### main function : mtp ###
176on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=0 && \
177property:sys.usb.configfs=1
178#ifndef VENDOR_EDIT
179#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
180 #setprop vendor.usb.pid 0x2008
181#else /* VENDOR_EDIT */
182 setprop vendor.usb.pid 0x2764
183#endif /* VENDOR_EDIT */
184on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=1 && \
185property:sys.usb.configfs=1
186 setprop vendor.usb.pid 0x2012
187 setprop vendor.usb.acm_port1 ""
188on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=2 && \
189property:sys.usb.configfs=1
190 setprop vendor.usb.pid 0x202A
191
192on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=1 && \
193property:sys.usb.configfs=1
194 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_acm"
195 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
196 write /config/usb_gadget/g1/os_desc/use 1
197 write /sys/class/udc/musb-hdrc/device/saving 1
198 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
199 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
200 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
201 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
202 setprop sys.usb.state ${sys.usb.config}
203
204on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=0 && \
205property:sys.usb.configfs=1
206 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
207 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
208 write /config/usb_gadget/g1/os_desc/use 1
209 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
210 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
211 setprop sys.usb.state ${sys.usb.config}
212
213### start adbd at init.usb.configfs.rc ###
214on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=0 && \
215property:sys.usb.configfs=1
216#ifndef VENDOR_EDIT
217#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
218 #setprop vendor.usb.pid 0x201D
219#else
220 setprop vendor.usb.pid 0x2765
221#endif
222on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=1 && \
223property:sys.usb.configfs=1
224 setprop vendor.usb.pid 0x200A
225 setprop vendor.usb.acm_port1 ""
226on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=2 && \
227property:sys.usb.configfs=1
228 setprop vendor.usb.pid 0x2026
229
230on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \
231property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
232 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb_acm"
233 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
234 write /config/usb_gadget/g1/os_desc/use 1
235 write /sys/class/udc/musb-hdrc/device/saving 1
236 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
237 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
238 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
239 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
240 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
241 setprop sys.usb.state ${sys.usb.config}
242
243on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \
244property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
245 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb"
246 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
247 write /config/usb_gadget/g1/os_desc/use 1
248 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
249 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
250 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
251 setprop sys.usb.state ${sys.usb.config}
252
253### main function : ptp ###
254on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=0 && \
255property:sys.usb.configfs=1
256 setprop vendor.usb.pid 0x200B
257on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=1 && \
258property:sys.usb.configfs=1
259 setprop vendor.usb.pid 0x2013
260 setprop vendor.usb.acm_port1 ""
261on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=2 && \
262property:sys.usb.configfs=1
263 setprop vendor.usb.pid 0x202B
264
265on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=1 && \
266property:sys.usb.configfs=1
267 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_acm"
268 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
269 write /sys/class/udc/musb-hdrc/device/saving 1
270 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
271 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
272 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
273 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
274 setprop sys.usb.state ${sys.usb.config}
275
276on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=0 && \
277property:sys.usb.configfs=1
278 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp"
279 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
280 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
281 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
282 setprop sys.usb.state ${sys.usb.config}
283
284### start adbd at init.usb.configfs.rc ###
285on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=0 && \
286property:sys.usb.configfs=1
287#ifndef VENDOR_EDIT
288#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
289 #setprop vendor.usb.pid 0x200C
290#else
291 setprop vendor.usb.pid 0x2772
292#endif
293on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=1 && \
294property:sys.usb.configfs=1
295 setprop vendor.usb.pid 0x200D
296 setprop vendor.usb.acm_port1 ""
297on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=2 && \
298property:sys.usb.configfs=1
299 setprop vendor.usb.pid 0x2027
300
301on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \
302property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
303 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb_acm"
304 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
305 write /sys/class/udc/musb-hdrc/device/saving 1
306 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
307 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
308 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
309 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
310 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
311 setprop sys.usb.state ${sys.usb.config}
312
313on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \
314property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
315 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb"
316 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
317 symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
318 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
319 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
320 setprop sys.usb.state ${sys.usb.config}
321
322### main function : rndis ###
323on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=0 && \
324property:sys.usb.configfs=1
325#ifndef VENDOR_EDIT
326#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
327 #setprop vendor.usb.pid 0x2004
328#else
329 setprop vendor.usb.pid 0x276A
330#endif
331on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=1 && \
332property:sys.usb.configfs=1
333 setprop vendor.usb.pid 0x2011
334 setprop vendor.usb.acm_port1 ""
335on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=2 && \
336property:sys.usb.configfs=1
337 setprop vendor.usb.pid 0x202C
338
339on property:sys.usb.config=rndis && property:vendor.usb.acm_enable=1 && \
340property:sys.usb.configfs=1
341 mkdir /config/usb_gadget/g1/functions/rndis.gs4
342 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
343 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
344 write /sys/class/udc/musb-hdrc/device/saving 1
345 symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
346 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
347 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
348 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
349 setprop sys.usb.state ${sys.usb.config}
350
351on property:sys.usb.config=rndis && property:vendor.usb.acm_enable=0 && \
352property:sys.usb.configfs=1
353 mkdir /config/usb_gadget/g1/functions/rndis.gs4
354 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis"
355 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
356 symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
357 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
358 setprop sys.usb.state ${sys.usb.config}
359
360on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=0 && \
361property:sys.usb.configfs=1
362#ifndef VENDOR_EDIT
363#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
364 #setprop vendor.usb.pid 0x2005
365#else
366 setprop vendor.usb.pid 0x2766
367#endif
368on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=1 && \
369property:sys.usb.configfs=1
370 setprop vendor.usb.pid 0x2010
371 setprop vendor.usb.acm_port1 ""
372on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=2 && \
373property:sys.usb.configfs=1
374 setprop vendor.usb.pid 0x2028
375
376on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && \
377property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
378 mkdir /config/usb_gadget/g1/functions/rndis.gs4
379 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm"
380 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
381 write /sys/class/udc/musb-hdrc/device/saving 1
382 symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
383 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
384 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
385 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
386 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
387 setprop sys.usb.state ${sys.usb.config}
388
389on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && \
390property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
391 mkdir /config/usb_gadget/g1/functions/rndis.gs4
392 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
393 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
394 symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
395 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
396 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
397 setprop sys.usb.state ${sys.usb.config}
398
399### main function : midi ###
400on property:sys.usb.config=midi && property:sys.usb.configfs=1
401 write /config/usb_gadget/g1/idProduct 0x2046
402
403on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
404 write /config/usb_gadget/g1/idProduct 0x2048
405
406### main function : accessory ###
407on property:sys.usb.config=accessory && property:sys.usb.configfs=1
408 write /config/usb_gadget/g1/idVendor 0x18d1
409 write /config/usb_gadget/g1/idProduct 0x2d00
410
411on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
412 write /config/usb_gadget/g1/idVendor 0x18d1
413 write /config/usb_gadget/g1/idProduct 0x2d01
414
415### main function : audio_source ###
416on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
417 write /config/usb_gadget/g1/idVendor 0x18d1
418 write /config/usb_gadget/g1/idProduct 0x2d02
419
420on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
421 write /config/usb_gadget/g1/idVendor 0x18d1
422 write /config/usb_gadget/g1/idProduct 0x2d03
423
424### main function : accessory,audio_source ###
425on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
426 write /config/usb_gadget/g1/idVendor 0x18d1
427 write /config/usb_gadget/g1/idProduct 0x2d04
428
429on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
430 write /config/usb_gadget/g1/idVendor 0x18d1
431 write /config/usb_gadget/g1/idProduct 0x2d05
432
433on property:sys.usb.config=via_bypass && property:vendor.usb.acm_cnt=0 && \
434property:sys.usb.configfs=1
435 setprop vendor.usb.pid 0x2031
436on property:sys.usb.config=via_bypass && property:vendor.usb.acm_cnt=1 && \
437property:sys.usb.configfs=1
438 setprop vendor.usb.pid 0x2033
439 setprop vendor.usb.acm_port1 ""
440
441##via_modem,via_ets,via_atc,acm
442on property:sys.usb.config=via_bypass && property:vendor.usb.acm_enable=1 && \
443property:sys.usb.configfs=1
444 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "via_bypass"
445 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
446 write /sys/class/udc/musb-hdrc/device/saving 1
447 symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
448 symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
449 symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
450 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f4
451 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
452 setprop sys.usb.state ${sys.usb.config}
453
454##via_modem,via_ets,via_atc,adb
455on property:sys.usb.config=via_bypass && property:vendor.usb.acm_enable=0 && \
456property:sys.usb.configfs=1
457 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "via_bypass"
458 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
459 write /sys/class/udc/musb-hdrc/device/saving 1
460 symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
461 symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
462 symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
463 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
464 setprop sys.usb.state ${sys.usb.config}
465
466on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=0 && \
467property:sys.usb.configfs=1
468 setprop vendor.usb.pid 0x2032
469on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=1 && \
470property:sys.usb.configfs=1
471 setprop vendor.usb.pid 0x2034
472 setprop vendor.usb.acm_port1 ""
473on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=2 && \
474property:sys.usb.configfs=1
475 setprop vendor.usb.pid 0x2050
476
477on property:sys.usb.config=via_bypass,adb && property:sys.usb.configfs=1
478 start adbd
479
480##via_modem,via_ets,via_atc,adb,acm
481on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
482property:vendor.usb.acm_enable=1 && property:vendor.usb.acm_cnt=1 && \
483property:sys.usb.configfs=1
484 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm"
485 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
486 write /sys/class/udc/musb-hdrc/device/saving 1
487 symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
488 symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
489 symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
490 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4
491 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f5
492 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
493 setprop sys.usb.state ${sys.usb.config}
494
495##via_modem,acm,adb
496on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
497property:vendor.usb.acm_enable=1 && property:vendor.usb.acm_cnt=2 && \
498property:sys.usb.configfs=1
499 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm2"
500 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
501 write /sys/class/udc/musb-hdrc/device/saving 1
502 symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
503 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
504 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
505 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
506 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
507 setprop sys.usb.state ${sys.usb.config}
508
509##via_modem,via_ets,via_atc,adb
510on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
511property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
512 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
513 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
514 write /sys/class/udc/musb-hdrc/device/saving 1
515 symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
516 symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
517 symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
518 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4
519 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
520 setprop sys.usb.state ${sys.usb.config}
521
522### main function : mass_storage ###
523on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=0 && \
524property:sys.usb.configfs=1
525#ifndef VENDOR_EDIT
526#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
527 #setprop vendor.usb.pid 0x2002
528#else /* VENDOR_EDIT */
529 setprop vendor.usb.pid 0x2768
530#endif /* VENDOR_EDIT */
531on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=1 && \
532property:sys.usb.configfs=1
533 setprop vendor.usb.pid 0x200F
534 setprop vendor.usb.acm_port1 ""
535on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=2 && \
536property:sys.usb.configfs=1
537 setprop vendor.usb.pid 0x202D
538
539on property:sys.usb.config=mass_storage && property:vendor.usb.acm_enable=1 && \
540property:sys.usb.configfs=1
541 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
542 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
543 write /sys/class/udc/musb-hdrc/device/saving 1
544 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
545 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
546 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
547 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
548 setprop sys.usb.state ${sys.usb.config}
549
550on property:sys.usb.config=mass_storage && property:vendor.usb.acm_enable=0 && \
551property:sys.usb.configfs=1
552 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums"
553 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
554 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
555 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
556 setprop sys.usb.state ${sys.usb.config}
557
558on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=0 && \
559property:sys.usb.configfs=1
560#ifndef VENDOR_EDIT
561#/* Qiao.Hu@BSP.BaseDrv.CHG.Basic, 2017/12/08, Modify for OPPO VID&PID */
562 #setprop vendor.usb.pid 0x2003
563#else
564 setprop vendor.usb.pid 0x2767
565#endif
566on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=1 && \
567property:sys.usb.configfs=1
568 setprop vendor.usb.pid 0x2006
569 setprop vendor.usb.acm_port1 ""
570on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=2 && \
571property:sys.usb.configfs=1
572 setprop vendor.usb.pid 0x2029
573
574on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1
575 start adbd
576
577on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && \
578property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
579 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb_acm"
580 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
581 write /sys/class/udc/musb-hdrc/device/saving 1
582 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
583 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
584 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
585 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
586 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
587 setprop sys.usb.state ${sys.usb.config}
588
589on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && \
590property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
591 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb"
592 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
593 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
594 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
595 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
596 setprop sys.usb.state ${sys.usb.config}
597
598### main function : bicr ###
599on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=0 && \
600property:sys.usb.configfs=1
601 setprop vendor.usb.pid 0x2002
602on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=1 && \
603property:sys.usb.configfs=1
604 setprop vendor.usb.pid 0x200F
605 setprop vendor.usb.acm_port1 ""
606on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=2 && \
607property:sys.usb.configfs=1
608 setprop vendor.usb.pid 0x202D
609
610on property:sys.usb.config=bicr && property:vendor.usb.acm_enable=1 && \
611property:sys.usb.configfs=1
612 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
613 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
614 write /sys/class/udc/musb-hdrc/device/saving 1
615 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
616 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
617 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
618 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
619 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
620 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
621 setprop sys.usb.state ${sys.usb.config}
622
623on property:sys.usb.config=bicr && property:vendor.usb.acm_enable=0 && \
624property:sys.usb.configfs=1
625 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums"
626 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
627 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
628 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
629 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
630 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
631 setprop sys.usb.state ${sys.usb.config}
632
633on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=0 && \
634property:sys.usb.configfs=1
635 setprop vendor.usb.pid 0x2003
636on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=1 && \
637property:sys.usb.configfs=1
638 setprop vendor.usb.pid 0x2006
639 setprop vendor.usb.acm_port1 ""
640on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=2 && \
641property:sys.usb.configfs=1
642 setprop vendor.usb.pid 0x2029
643
644on property:sys.usb.config=bicr,adb && property:sys.usb.configfs=1
645 start adbd
646
647on property:sys.usb.ffs.ready=1 && property:sys.usb.config=bicr,adb && \
648property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
649 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb_acm"
650 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
651 write /sys/class/udc/musb-hdrc/device/saving 1
652 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
653 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
654 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
655 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
656 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
657 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
658 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
659 setprop sys.usb.state ${sys.usb.config}
660
661on property:sys.usb.ffs.ready=1 && property:sys.usb.config=bicr,adb && \
662property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
663 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb"
664 write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
665 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
666 write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
667 symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
668 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
669 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
670 setprop sys.usb.state ${sys.usb.config}
671
672### ACM APPEND SERIES ###
673on property:persist.vendor.radio.port_index=0 && property:sys.boot_completed=1
674 setprop vendor.usb.acm_idx ""
675 setprop vendor.usb.acm_cnt 0
676 setprop vendor.usb.acm_enable 0
677 setprop sys.usb.config none
678 setprop sys.usb.config ${sys.usb.state}
679
680on property:persist.vendor.radio.port_index=1 && property:sys.boot_completed=1
681 setprop sys.usb.config acm_gs0
682on property:sys.usb.config=mass_storage,adb,acm
683 setprop sys.usb.config acm_gs0
684on property:sys.usb.config=acm_gs0
685 setprop vendor.usb.acm_port0 0
686 setprop vendor.usb.acm_port1 ""
687 setprop vendor.usb.acm_cnt 1
688 setprop vendor.usb.acm_enable 1
689 setprop sys.usb.config none
690 setprop sys.usb.config ${sys.usb.state}
691 setprop vendor.usb.acm_idx "1"
692
693on property:persist.vendor.radio.port_index=2 && property:sys.boot_completed=1
694 setprop sys.usb.config acm_gs1
695on property:sys.usb.config=acm_gs1
696 setprop vendor.usb.acm_port0 1
697 setprop vendor.usb.acm_port1 ""
698 setprop vendor.usb.acm_cnt 1
699 setprop vendor.usb.acm_enable 1
700 setprop sys.usb.config none
701 setprop sys.usb.config ${sys.usb.state}
702 setprop vendor.usb.acm_idx "2"
703
704on property:persist.vendor.radio.port_index=3 && property:sys.boot_completed=1
705 setprop sys.usb.config acm_gs2
706on property:sys.usb.config=acm_third
707 setprop sys.usb.config acm_gs2
708on property:sys.usb.config=acm_gs2
709 setprop vendor.usb.acm_port0 2
710 setprop vendor.usb.acm_port1 ""
711 setprop vendor.usb.acm_cnt 1
712 setprop vendor.usb.acm_enable 1
713 setprop sys.usb.config none
714 setprop sys.usb.config ${sys.usb.state}
715 setprop vendor.usb.acm_idx "3"
716
717on property:persist.vendor.radio.port_index=4 && property:sys.boot_completed=1
718 setprop sys.usb.config acm_gs3
719on property:sys.usb.config=gs3
720 setprop sys.usb.config acm_gs3
721on property:sys.usb.config=mtp,gs3
722 setprop sys.usb.config acm_gs3
723on property:sys.usb.config=acm_gs3
724 setprop vendor.usb.acm_port0 3
725 setprop vendor.usb.acm_port1 ""
726 setprop vendor.usb.acm_cnt 1
727 setprop vendor.usb.acm_enable 1
728 setprop sys.usb.config none
729 setprop sys.usb.config ${sys.usb.state}
730 setprop vendor.usb.acm_idx "4"
731
732on property:sys.usb.config=mtp,gs0gs1
733 setprop sys.usb.config acm_gs0gs1
734on property:sys.usb.config=gs0gs1
735 setprop sys.usb.config acm_gs0gs1
736on property:sys.usb.config=rndis,gs0gs1
737 setprop sys.usb.config acm_gs0gs1
738on property:sys.usb.config=rndis,adb,gs0gs1
739 setprop sys.usb.config acm_gs0gs1
740on property:sys.usb.config=acm_gs0gs1
741 setprop vendor.usb.acm_port0 0
742 setprop vendor.usb.acm_port1 1
743 setprop vendor.usb.acm_cnt 2
744 setprop vendor.usb.acm_enable 1
745 setprop sys.usb.config none
746 setprop sys.usb.config ${sys.usb.state}
747 setprop vendor.usb.acm_idx "1,2"
748
749on property:sys.usb.config=gs3,dual_acm
750 setprop sys.usb.config acm_gs0gs3
751on property:sys.usb.config=mtp,gs3,dual_acm
752 setprop sys.usb.config acm_gs0gs3
753on property:sys.usb.config=mtp,gs0gs3
754 setprop sys.usb.config acm_gs0gs3
755on property:sys.usb.config=gs0gs3
756 setprop sys.usb.config acm_gs0gs3
757on property:sys.usb.config=rndis,gs0gs3
758 setprop sys.usb.config acm_gs0gs3
759on property:sys.usb.config=rndis,adb,gs0gs3
760 setprop sys.usb.config acm_gs0gs3
761on property:sys.usb.config=acm_gs0gs3
762 setprop vendor.usb.acm_port0 0
763 setprop vendor.usb.acm_port1 3
764 setprop vendor.usb.acm_cnt 2
765 setprop vendor.usb.acm_enable 1
766 setprop sys.usb.config none
767 setprop sys.usb.config ${sys.usb.state}
768 setprop vendor.usb.acm_idx "1,4"
769
770on property:sys.usb.config=gs1gs3
771 setprop sys.usb.config acm_gs1gs3
772on property:sys.usb.config=mtp,gs1gs3
773 setprop sys.usb.config acm_gs1gs3
774on property:sys.usb.config=via_bypass,gs1gs3
775 setprop sys.usb.config acm_gs1gs3
776on property:sys.usb.config=rndis,gs1gs3
777 setprop sys.usb.config acm_gs1gs3
778on property:sys.usb.config=acm_gs1gs3
779 setprop vendor.usb.acm_port0 1
780 setprop vendor.usb.acm_port1 3
781 setprop vendor.usb.acm_cnt 2
782 setprop vendor.usb.acm_enable 1
783 setprop sys.usb.config none
784 setprop sys.usb.config ${sys.usb.state}
785 setprop vendor.usb.acm_idx "2,4"
786
787# For ATM (Android Test Mode)
788on property:vendor.usb.clear=1 && property:sys.usb.configfs=1
789 write /config/usb_gadget/g1/UDC "none"
790 write /config/usb_gadget/g1/bDeviceClass 0
791 write /config/usb_gadget/g1/bDeviceSubClass 0
792 write /config/usb_gadget/g1/bDeviceProtocol 0
793 rm /config/usb_gadget/g1/configs/b.1/f1
794 rm /config/usb_gadget/g1/configs/b.1/f2
795 rm /config/usb_gadget/g1/configs/b.1/f3
796 rm /config/usb_gadget/g1/configs/b.1/f4
797 rm /config/usb_gadget/g1/configs/b.1/f5
798 rmdir /config/usb_gadget/g1/functions/rndis.gs4
799 write /sys/class/udc/musb-hdrc/device/saving 0
800 setprop vendor.usb.clear 2
801
802# has permission issue when read from ${sys.usb.ffs.ready}
803on property:sys.usb.ffs.ready=0
804 setprop vendor.usb.ffs.ready 0
805on property:sys.usb.ffs.ready=1
806 setprop vendor.usb.ffs.ready 1
807
808on property:sys.usb.config=atm_gs0 && property:sys.usb.configfs=1
809 stop adbd
810 setprop vendor.usb.ffs.ready 0
811 setprop vendor.usb.clear 1
812
813on property:vendor.usb.ffs.ready=0 && property:sys.usb.config=atm_gs0 && \
814property:vendor.usb.clear=2 && property:sys.usb.configfs=1
815 start adbd
816
817on property:vendor.usb.ffs.ready=1 && property:sys.usb.config=atm_gs0 && \
818property:vendor.usb.clear=2 && property:sys.usb.configfs=1
819 setprop vendor.usb.acm_port0 0
820 setprop vendor.usb.acm_port1 ""
821 setprop vendor.usb.acm_cnt 1
822 setprop vendor.usb.acm_enable 1
823 write /sys/class/udc/musb-hdrc/device/saving 1
824 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "atm_gs0"
825 write /config/usb_gadget/g1/idProduct 0x200A
826 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
827 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
828 symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3
829 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
830 #setprop sys.usb.state ${sys.usb.config}
831 #setprop vendor.usb.pid 0x200A
832 setprop vendor.usb.clear 0
833 setprop vendor.usb.acm_idx "1"
834
835on property:sys.usb.config=atm_gs0gs3 && property:sys.usb.configfs=1
836 stop adbd
837 setprop vendor.usb.ffs.ready 0
838 setprop vendor.usb.clear 1
839
840on property:vendor.usb.ffs.ready=0 && property:sys.usb.config=atm_gs0gs3 && \
841property:vendor.usb.clear=2 && property:sys.usb.configfs=1
842 start adbd
843
844on property:vendor.usb.ffs.ready=1 && property:sys.usb.config=atm_gs0gs3 && \
845property:vendor.usb.clear=2 && property:sys.usb.configfs=1
846 setprop vendor.usb.acm_port0 0
847 setprop vendor.usb.acm_port1 3
848 setprop vendor.usb.acm_cnt 2
849 setprop vendor.usb.acm_enable 1
850 write /sys/class/udc/musb-hdrc/device/saving 1
851#ifndef VENDOR_EDIT
852#Jianchao.Shi@PSW.BSP.CHG.Basic, 2018/11/02, sjc Modify for factory mode
853# write /config/usb_gadget/g1/idProduct 0x2026
854# symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
855# symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
856# symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3
857# symlink /config/usb_gadget/g1/functions/acm.gs3 /config/usb_gadget/g1/configs/b.1/f4
858#else
859 write /config/usb_gadget/g1/idProduct 0x200E
860 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
861 symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f2
862 symlink /config/usb_gadget/g1/functions/acm.gs3 /config/usb_gadget/g1/configs/b.1/f3
863#endif
864 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
865 #setprop sys.usb.state ${sys.usb.config}
866 #setprop vendor.usb.pid 0x2026
867 setprop vendor.usb.clear 0
868 setprop vendor.usb.acm_idx "1,4"
869
870### CHARGING ###
871on property:sys.usb.config=cdp && property:sys.usb.configfs=1
872 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
873 write /config/usb_gadget/g1/idProduct 0x2008
874 write /config/usb_gadget/g1/os_desc/use 1
875 symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
876 write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
877 setprop sys.usb.state ${sys.usb.config}
878 setprop vendor.usb.pid 0x2008
879
880on property:sys.usb.config=charging_yes
881 setprop vendor.usb.state ${sys.usb.state}
882 setprop vendor.usb.charging yes
883 setprop sys.usb.config none
884 setprop sys.usb.config ${vendor.usb.state}
885
886on property:sys.usb.config=charging_no
887 setprop vendor.usb.state ${sys.usb.state}
888 setprop sys.usb.config none
889 setprop sys.usb.config ${vendor.usb.state}
890 setprop vendor.usb.charging no
891
892on property:vendor.usb.charging=yes
893 write /sys/class/udc/musb-hdrc/device/cmode 2
894on property:vendor.usb.charging=no
895 write /sys/class/udc/musb-hdrc/device/cmode 1
896
897on property:vendor.usb.bicr=yes
898 write /sys/class/android_usb/android0/f_mass_storage/bicr 1
899 write /sys/class/android_usb/android0/f_mass_storage/lun/file "/dev/block/loop0"
900on property:vendor.usb.bicr=no
901 write /sys/class/android_usb/android0/f_mass_storage/bicr 0
902 write /sys/class/android_usb/android0/f_mass_storage/lun/file "off"
903
904on property:vendor.usb.port.mode=usb
905 write /sys/class/udc/musb-hdrc/device/portmode 0
906on property:vendor.usb.port.mode=uart
907 write /sys/class/udc/musb-hdrc/device/portmode 1
908
SamarV-121eb08a772022-04-12 22:01:01 +0530909on property:vendor.em.usb.bypass.enable=0
910 write /sys/class/usb_rawbulk/gps/enable 1
911on property:vendor.em.usb.bypass.enable=1
912 write /sys/class/usb_rawbulk/pcv/enable 1
913on property:vendor.em.usb.bypass.enable=2
914 write /sys/class/usb_rawbulk/atc/enable 1
915on property:vendor.em.usb.bypass.enable=3
916 write /sys/class/usb_rawbulk/ets/enable 1
917on property:vendor.em.usb.bypass.enable=4
918 write /sys/class/usb_rawbulk/data/enable 1
919on property:vendor.em.usb.bypass.disable=0
920 write /sys/class/usb_rawbulk/gps/enable 0
921on property:vendor.em.usb.bypass.disable=1
922 write /sys/class/usb_rawbulk/pcv/enable 0
923on property:vendor.em.usb.bypass.disable=2
924 write /sys/class/usb_rawbulk/atc/enable 0
925on property:vendor.em.usb.bypass.disable=3
926 write /sys/class/usb_rawbulk/ets/enable 0
927on property:vendor.em.usb.bypass.disable=4
928 write /sys/class/usb_rawbulk/data/enable 0
929
930### vendor process start ###
931on property:vendor.usb.config=*
932 setprop sys.usb.config ${vendor.usb.config}
933### vendor process end ###
934
935### test command start ###
936on property:vendor.usb.test=*
937 setprop sys.usb.config none
938 setprop sys.usb.config ${vendor.usb.test}
939### test command end ###
940
941on property:vendor.usb.printk=*
942 write /proc/sys/kernel/printk ${vendor.usb.printk}
943
944on property:persist.vendor.usb.printk=*
945 setprop vendor.usb.printk ${persist.vendor.usb.printk}
946
947on property:vendor.usb.speed.mode=u3
948 write /sys/module/musb_hdrc/parameters/speed 1
949 write /sys/class/udc/musb-hdrc/device/cmode 0
950 write /sys/class/udc/musb-hdrc/device/cmode 1
951
952on property:vendor.usb.speed.mode=u2
953 write /sys/module/musb_hdrc/parameters/speed 0
954 write /sys/class/udc/musb-hdrc/device/cmode 0
955 write /sys/class/udc/musb-hdrc/device/cmode 1
956
957on property:persist.vendor.usb.speed.mode=u3
958 write /sys/module/musb_hdrc/parameters/speed 1
959 write /sys/class/udc/musb-hdrc/device/cmode 0
960 write /sys/class/udc/musb-hdrc/device/cmode 1
961
962on property:persist.vendor.usb.speed.mode=u2
963 write /sys/module/musb_hdrc/parameters/speed 0
964 write /sys/class/udc/musb-hdrc/device/cmode 0
965 write /sys/class/udc/musb-hdrc/device/cmode 1
966
967on property:vendor.usb.sib_enable=1
968 write /sys/class/udc/musb-hdrc/device/sib_enable 1
969
970on property:vendor.usb.sib_enable=0
971 write /sys/class/udc/musb-hdrc/device/sib_enable 0
972
973on property:persist.vendor.usb.dbg.lv=*
974 setprop vendor.usb.dbg.lv ${persist.vendor.usb.dbg.lv}
975
976on property:vendor.usb.dbg.lv=*
977 write /sys/module/musb_hdrc/parameters/debug_level ${vendor.usb.dbg.lv}
978
979### PLATFORM VARIANT, cat $rc_file | grep write | sort | grep -vE "android0|usb20_phy" | awk '{print $2}' | uniq ###