1on property:sys.usb.config=none && property:sys.usb.configfs=1
2    write /config/usb_gadget/g1/UDC "none"
3    stop adbd
4    setprop sys.usb.ffs.ready 0
5    write /config/usb_gadget/g1/bDeviceClass 0
6    write /config/usb_gadget/g1/bDeviceSubClass 0
7    write /config/usb_gadget/g1/bDeviceProtocol 0
8    rm /config/usb_gadget/g1/configs/b.1/f1
9    rm /config/usb_gadget/g1/configs/b.1/f2
10    rm /config/usb_gadget/g1/configs/b.1/f3
11    rmdir /config/usb_gadget/g1/functions/rndis.gs4
12    setprop sys.usb.state ${sys.usb.config}
13
14on property:init.svc.adbd=stopped
15    setprop sys.usb.ffs.ready 0
16
17on property:sys.usb.config=adb && property:sys.usb.configfs=1
18    start adbd
19
20on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
21    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
22    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
23    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
24    setprop sys.usb.state ${sys.usb.config}
25
26on property:sys.usb.config=mtp && property:sys.usb.configfs=1
27    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
28    symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
29    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
30    setprop sys.usb.state ${sys.usb.config}
31
32on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
33    start adbd
34
35on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
36    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb"
37    symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
38    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
39    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
40    setprop sys.usb.state ${sys.usb.config}
41
42on property:sys.usb.config=ptp && property:sys.usb.configfs=1
43    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp"
44    symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
45    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
46    setprop sys.usb.state ${sys.usb.config}
47
48on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
49    start adbd
50
51on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
52    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb"
53    symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1
54    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
55    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
56    setprop sys.usb.state ${sys.usb.config}
57
58on property:sys.usb.config=accessory && property:sys.usb.configfs=1
59    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory"
60    symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1
61    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
62    setprop sys.usb.state ${sys.usb.config}
63
64on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
65    start adbd
66
67on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
68    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_adb"
69    symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1
70    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
71    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
72    setprop sys.usb.state ${sys.usb.config}
73
74on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
75    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "audiosource"
76    symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1
77    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
78    setprop sys.usb.state ${sys.usb.config}
79
80on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
81    start adbd
82
83on property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
84    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "audiosource_adb"
85    symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1
86    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
87    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
88    setprop sys.usb.state ${sys.usb.config}
89
90on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
91    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_audiosource"
92    symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1
93    symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2
94    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
95    setprop sys.usb.state ${sys.usb.config}
96
97on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
98    start adbd
99
100on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
101    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "accessory_audiosource_adb"
102    symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1
103    symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2
104    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3
105    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
106    setprop sys.usb.state ${sys.usb.config}
107
108on property:sys.usb.config=midi && property:sys.usb.configfs=1
109    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi"
110    symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
111    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
112    setprop sys.usb.state ${sys.usb.config}
113
114on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
115    start adbd
116
117on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
118    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi_adb"
119    symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
120    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
121    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
122    setprop sys.usb.state ${sys.usb.config}
123
124on property:sys.usb.config=rndis && property:sys.usb.configfs=1
125    mkdir /config/usb_gadget/g1/functions/rndis.gs4
126    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis"
127    symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
128    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
129    setprop sys.usb.state ${sys.usb.config}
130
131on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
132    start adbd
133
134on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
135    mkdir /config/usb_gadget/g1/functions/rndis.gs4
136    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
137    symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
138    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
139    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
140    setprop sys.usb.state ${sys.usb.config}
141