1# Copyright 2014 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15on init
16    write /sys/class/android_usb/android0/f_rndis/wceis 1
17
18on boot
19    write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
20    write /sys/class/android_usb/android0/iProduct ${ro.product.model}
21    write /sys/class/android_usb/android0/f_mass_storage/vendor ${ro.product.manufacturer}
22    write /sys/class/android_usb/android0/f_mass_storage/product ${ro.product.model}
23    write /sys/class/android_usb/android0/iSerial ${ro.serialno}
24    write /sys/module/dwc3_msm/parameters/prop_chg_detect 1
25    mkdir /dev/bus 0755 root root
26    mkdir /dev/bus/usb 0755 root root
27    chown system system /sys/class/android_usb/android0/secure
28    chmod 0660 /sys/class/android_usb/android0/secure
29
30on fs
31    mkdir /dev/usb-ffs 0770 shell shell
32    mkdir /dev/usb-ffs/adb 0770 shell shell
33    mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
34    write /sys/class/android_usb/android0/f_ffs/aliases adb
35
36# USB compositions
37on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb
38    start tcmd
39    write /sys/class/android_usb/android0/enable 0
40    write /sys/class/android_usb/android0/idVendor 05C6
41    write /sys/class/android_usb/android0/idProduct 9025
42    write /sys/class/android_usb/android0/f_diag/clients diag
43    write /sys/class/android_usb/android0/f_serial/transports smd,tty
44    write /sys/class/android_usb/android0/f_rmnet/transports smd,bam
45    write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage
46    write /sys/class/android_usb/android0/enable 1
47    start adbd
48    setprop sys.usb.state ${sys.usb.config}
49
50on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_bam,mass_storage
51    write /sys/class/android_usb/android0/enable 0
52    write /sys/class/android_usb/android0/idVendor 05C6
53    write /sys/class/android_usb/android0/idProduct 9026
54    write /sys/class/android_usb/android0/f_diag/clients diag
55    write /sys/class/android_usb/android0/f_serial/transports smd,tty
56    write /sys/class/android_usb/android0/f_rmnet/transports smd,bam
57    write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage
58    write /sys/class/android_usb/android0/enable 1
59    setprop sys.usb.state ${sys.usb.config}
60
61on property:sys.usb.config=rndis
62    write /sys/class/android_usb/android0/enable 0
63    write /sys/class/android_usb/android0/idVendor 18D1
64    write /sys/class/android_usb/android0/idProduct 4EE3
65    write /sys/class/android_usb/android0/functions rndis
66    write /sys/class/android_usb/android0/enable 1
67    setprop sys.usb.state ${sys.usb.config}
68
69on property:sys.usb.config=rndis,adb
70    write /sys/class/android_usb/android0/enable 0
71    write /sys/class/android_usb/android0/idVendor 18D1
72    write /sys/class/android_usb/android0/idProduct 4EE4
73    write /sys/class/android_usb/android0/functions rndis,adb
74    write /sys/class/android_usb/android0/enable 1
75    start adbd
76    setprop sys.usb.state ${sys.usb.config}
77
78on property:sys.usb.config=mtp
79    write /sys/class/android_usb/android0/enable 0
80    write /sys/class/android_usb/android0/bDeviceClass 0
81    write /sys/class/android_usb/android0/bDeviceSubClass 0
82    write /sys/class/android_usb/android0/bDeviceProtocol 0
83    write /sys/class/android_usb/android0/idVendor 18D1
84    write /sys/class/android_usb/android0/idProduct 4EE1
85    write /sys/class/android_usb/android0/functions mtp
86    write /sys/class/android_usb/android0/enable 1
87    setprop sys.usb.state ${sys.usb.config}
88
89on property:sys.usb.config=mtp,adb
90    write /sys/class/android_usb/android0/enable 0
91    write /sys/class/android_usb/android0/bDeviceClass 0
92    write /sys/class/android_usb/android0/bDeviceSubClass 0
93    write /sys/class/android_usb/android0/bDeviceProtocol 0
94    write /sys/class/android_usb/android0/idVendor 18D1
95    write /sys/class/android_usb/android0/idProduct 4EE2
96    write /sys/class/android_usb/android0/functions mtp,adb
97    write /sys/class/android_usb/android0/enable 1
98    start adbd
99    setprop sys.usb.state ${sys.usb.config}
100
101on property:sys.usb.config=diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,usbnet,adb
102    start tcmd
103    write /sys/class/android_usb/android0/enable 0
104    write /sys/class/android_usb/android0/idProduct 2ea1
105    write /sys/class/android_usb/android0/idVendor 22b8
106    write /sys/class/diag/diag/logging_mode usb
107    write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
108    write /sys/class/android_usb/android0/f_serial/transports hsic,tty
109    write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
110    write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
111    write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
112    write /sys/class/android_usb/android0/functions diag,serial,rmnet,usbnet,adb
113    write /sys/class/android_usb/android0/enable 1
114    start adbd
115    setprop sys.usb.state ${sys.usb.config}
116
117on property:sys.usb.config=diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,usbnet
118    start tcmd
119    write /sys/class/android_usb/android0/enable 0
120    write /sys/class/android_usb/android0/idProduct ${ro.usb.bpt}
121    write /sys/class/android_usb/android0/idVendor 22b8
122    write /sys/class/diag/diag/logging_mode usb
123    write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
124    write /sys/class/android_usb/android0/f_serial/transports hsic,tty
125    write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
126    write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
127    write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
128    write /sys/class/android_usb/android0/functions diag,serial,rmnet,usbnet
129    write /sys/class/android_usb/android0/enable 1
130    setprop sys.usb.state ${sys.usb.config}
131
132on property:sys.usb.config=rndis,diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,usbnet,adb
133    start tcmd
134    write /sys/class/android_usb/android0/enable 0
135    write /sys/class/android_usb/android0/idProduct 2ea3
136    write /sys/class/android_usb/android0/idVendor 22b8
137    write /sys/class/diag/diag/logging_mode usb
138    write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
139    write /sys/class/android_usb/android0/f_serial/transports hsic,tty
140    write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
141    write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
142    write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
143    write /sys/class/android_usb/android0/functions rndis,diag,serial,rmnet,usbnet,adb
144    write /sys/class/android_usb/android0/enable 1
145    start adbd
146    setprop sys.usb.state ${sys.usb.config}
147
148on property:sys.usb.config=rndis,diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,usbnet
149    stop adbd
150    start tcmd
151    write /sys/class/android_usb/android0/enable 0
152    write /sys/class/android_usb/android0/idProduct ${ro.usb.bpteth}
153    write /sys/class/android_usb/android0/idVendor 22b8
154    write /sys/class/diag/diag/logging_mode usb
155    write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
156    write /sys/class/android_usb/android0/f_serial/transports hsic,tty
157    write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
158    write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
159    write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
160    write /sys/class/android_usb/android0/functions rndis,diag,serial,rmnet,usbnet
161    write /sys/class/android_usb/android0/enable 1
162    setprop sys.usb.state ${sys.usb.config}
163
164on property:sys.usb.config=usbnet,adb
165    start tcmd
166    write /sys/class/android_usb/android0/enable 0
167    write /sys/class/android_usb/android0/idProduct 2e2d
168    write /sys/class/android_usb/android0/idVendor 22b8
169    write /sys/class/diag/diag/logging_mode internal
170    write /sys/class/android_usb/android0/functions usbnet,adb
171    write /sys/class/android_usb/android0/enable 1
172    start adbd
173    setprop sys.usb.state ${sys.usb.config}
174
175on property:sys.usb.config=usbnet
176    stop adbd
177    start tcmd
178    write /sys/class/android_usb/android0/enable 0
179    write /sys/class/android_usb/android0/idProduct 2e2c
180    write /sys/class/android_usb/android0/idVendor 22b8
181    write /sys/class/diag/diag/logging_mode internal
182    write /sys/class/android_usb/android0/functions usbnet
183    write /sys/class/android_usb/android0/enable 1
184    setprop sys.usb.state ${sys.usb.config}
185
186on property:sys.usb.config=diag,usbnet
187    start tcmd
188    write /sys/class/android_usb/android0/enable 0
189    write /sys/class/android_usb/android0/idProduct 2e34
190    write /sys/class/android_usb/android0/idVendor 22b8
191    write /sys/class/diag/diag/logging_mode usb
192    write /sys/class/android_usb/android0/f_diag/clients diag
193    write /sys/class/android_usb/android0/functions diag,usbnet
194    write /sys/class/android_usb/android0/enable 1
195    setprop sys.usb.state ${sys.usb.config}
196
197on property:sys.usb.config=diag,usbnet,adb
198    start tcmd
199    write /sys/class/android_usb/android0/enable 0
200    write /sys/class/android_usb/android0/idProduct 2e35
201    write /sys/class/android_usb/android0/idVendor 22b8
202    write /sys/class/diag/diag/logging_mode usb
203    write /sys/class/android_usb/android0/f_diag/clients diag
204    write /sys/class/android_usb/android0/functions diag,usbnet,adb
205    write /sys/class/android_usb/android0/enable 1
206    start adbd
207    setprop sys.usb.state ${sys.usb.config}
208
209on property:sys.usb.config=ptp
210    write /sys/class/android_usb/android0/enable 0
211    write /sys/class/android_usb/android0/bDeviceClass 0
212    write /sys/class/android_usb/android0/bDeviceSubClass 0
213    write /sys/class/android_usb/android0/bDeviceProtocol 0
214    write /sys/class/android_usb/android0/idVendor 18D1
215    write /sys/class/android_usb/android0/idProduct 4EE5
216    write /sys/class/android_usb/android0/functions ptp
217    write /sys/class/android_usb/android0/enable 1
218    setprop sys.usb.state ${sys.usb.config}
219
220on property:sys.usb.config=ptp,adb
221    start tcmd
222    write /sys/class/android_usb/android0/enable 0
223    write /sys/class/android_usb/android0/bDeviceClass 0
224    write /sys/class/android_usb/android0/bDeviceSubClass 0
225    write /sys/class/android_usb/android0/bDeviceProtocol 0
226    write /sys/class/android_usb/android0/idVendor 18D1
227    write /sys/class/android_usb/android0/idProduct 4EE6
228    write /sys/class/android_usb/android0/functions ptp,adb
229    write /sys/class/android_usb/android0/enable 1
230    start adbd
231    setprop sys.usb.state ${sys.usb.config}
232
233# USB midi configuration
234on property:sys.usb.config=midi
235    write /sys/class/android_usb/android0/enable 0
236    write /sys/class/android_usb/android0/idVendor 18D1
237    write /sys/class/android_usb/android0/idProduct 4EE8
238    write /sys/class/android_usb/android0/functions ${sys.usb.config}
239    write /sys/class/android_usb/android0/enable 1
240    start adbd
241    setprop sys.usb.state ${sys.usb.config}
242
243# USB midi configuration, with adb
244on property:sys.usb.config=midi,adb
245    write /sys/class/android_usb/android0/enable 0
246    write /sys/class/android_usb/android0/idVendor 18D1
247    write /sys/class/android_usb/android0/idProduct 4EE9
248    write /sys/class/android_usb/android0/functions ${sys.usb.config}
249    write /sys/class/android_usb/android0/enable 1
250    start adbd
251    setprop sys.usb.state ${sys.usb.config}
252
253# QDSS - Qualcomm Debug Subsystem
254on property:sys.usb.config=diag,qdss,adb
255    write /sys/class/android_usb/android0/enable 0
256    write /sys/class/android_usb/android0/idVendor 05C6
257    write /sys/class/android_usb/android0/idProduct 9060
258    write /sys/class/android_usb/android0/f_diag/clients diag
259    write /sys/class/android_usb/android0/functions diag,qdss,adb
260    write /sys/class/android_usb/android0/enable 1
261    start adbd
262    setprop sys.usb.state ${sys.usb.config}
263