1on init
2    write /sys/class/android_usb/android0/f_rndis/vendorID 18D1
3    write /sys/class/android_usb/android0/f_rndis/wceis 1
4
5on boot
6    write /sys/class/android_usb/android0/iSerial ${ro.serialno}
7    write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
8    write /sys/class/android_usb/android0/iProduct ${ro.product.model}
9
10    write /sys/class/android_usb/f_mass_storage/lun/nofua 1
11
12    write /sys/class/android_usb/android0/f_rndis_qc/rndis_transports BAM2BAM_IPA
13    write /sys/module/g_android/parameters/mtp_tx_req_len 131072
14    write /sys/module/g_android/parameters/mtp_rx_req_len 131072
15    setprop sys.usb.ffs.max_write 524288
16    setprop sys.usb.ffs.max_read 524288
17    setprop sys.usb.mtp.device_type 3
18    setprop sys.usb.rps_mask 0
19
20on post-fs
21    write /sys/class/android_usb/android0/f_ffs/aliases adb,mtp
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    mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
27
28on property:sys.usb.config=mtp
29    stop adbd
30    write /sys/class/android_usb/android0/enable 0
31    write /sys/class/android_usb/android0/idVendor 18D1
32    write /sys/class/android_usb/android0/idProduct 4EE1
33    write /sys/class/android_usb/android0/bDeviceClass 0
34    write /sys/class/android_usb/android0/bDeviceSubClass 0
35    write /sys/class/android_usb/android0/bDeviceProtocol 0
36    write /sys/class/android_usb/android0/functions ${sys.usb.config}
37    write /sys/class/android_usb/android0/enable 1
38    setprop sys.usb.state ${sys.usb.config}
39
40on property:sys.usb.config=mtp,adb
41    write /sys/class/android_usb/android0/enable 0
42    write /sys/class/android_usb/android0/idVendor 18D1
43    write /sys/class/android_usb/android0/idProduct 4EE2
44    write /sys/class/android_usb/android0/bDeviceClass 0
45    write /sys/class/android_usb/android0/bDeviceSubClass 0
46    write /sys/class/android_usb/android0/bDeviceProtocol 0
47    write /sys/class/android_usb/android0/functions ${sys.usb.config}
48    write /sys/class/android_usb/android0/enable 1
49    start adbd
50    setprop sys.usb.state ${sys.usb.config}
51
52on property:sys.usb.config=rndis
53    stop adbd
54    write /sys/class/android_usb/android0/enable 0
55    write /sys/class/android_usb/android0/idVendor 18D1
56    write /sys/class/android_usb/android0/idProduct 4EE3
57    write /sys/class/android_usb/android0/bDeviceClass 239
58    write /sys/class/android_usb/android0/bDeviceSubClass 2
59    write /sys/class/android_usb/android0/bDeviceProtocol 1
60    write /sys/class/android_usb/android0/functions ${sys.usb.config}
61    write /sys/class/android_usb/android0/enable 1
62    setprop sys.usb.state ${sys.usb.config}
63
64on property:sys.usb.config=rndis,adb
65    write /sys/class/android_usb/android0/enable 0
66    write /sys/class/android_usb/android0/idVendor 18D1
67    write /sys/class/android_usb/android0/idProduct 4EE4
68    write /sys/class/android_usb/android0/bDeviceClass 239
69    write /sys/class/android_usb/android0/bDeviceSubClass 2
70    write /sys/class/android_usb/android0/bDeviceProtocol 1
71    write /sys/class/android_usb/android0/functions ${sys.usb.config}
72    write /sys/class/android_usb/android0/enable 1
73    start adbd
74    setprop sys.usb.state ${sys.usb.config}
75
76on property:sys.usb.config=ptp
77    stop adbd
78    write /sys/class/android_usb/android0/enable 0
79    write /sys/class/android_usb/android0/idVendor 18D1
80    write /sys/class/android_usb/android0/idProduct 4EE5
81    write /sys/class/android_usb/android0/bDeviceClass 0
82    write /sys/class/android_usb/android0/bDeviceSubClass 0
83    write /sys/class/android_usb/android0/bDeviceProtocol 0
84    write /sys/class/android_usb/android0/functions mtp
85    write /sys/class/android_usb/android0/enable 1
86    setprop sys.usb.state ${sys.usb.config}
87
88on property:sys.usb.config=ptp,adb
89    write /sys/class/android_usb/android0/enable 0
90    write /sys/class/android_usb/android0/idVendor 18D1
91    write /sys/class/android_usb/android0/idProduct 4EE6
92    write /sys/class/android_usb/android0/bDeviceClass 0
93    write /sys/class/android_usb/android0/bDeviceSubClass 0
94    write /sys/class/android_usb/android0/bDeviceProtocol 0
95    write /sys/class/android_usb/android0/functions mtp,adb
96    write /sys/class/android_usb/android0/enable 1
97    start adbd
98    setprop sys.usb.state ${sys.usb.config}
99
100on property:sys.usb.config=midi
101    stop adbd
102    write /sys/class/android_usb/android0/enable 0
103    write /sys/class/android_usb/android0/idVendor 18D1
104    write /sys/class/android_usb/android0/idProduct 4EE8
105    write /sys/class/android_usb/android0/bDeviceClass 0
106    write /sys/class/android_usb/android0/bDeviceSubClass 0
107    write /sys/class/android_usb/android0/bDeviceProtocol 0
108    write /sys/class/android_usb/android0/functions ${sys.usb.config}
109    write /sys/class/android_usb/android0/enable 1
110    setprop sys.usb.state ${sys.usb.config}
111
112on property:sys.usb.config=midi,adb
113    write /sys/class/android_usb/android0/enable 0
114    write /sys/class/android_usb/android0/idVendor 18D1
115    write /sys/class/android_usb/android0/idProduct 4EE9
116    write /sys/class/android_usb/android0/bDeviceClass 0
117    write /sys/class/android_usb/android0/bDeviceSubClass 0
118    write /sys/class/android_usb/android0/bDeviceProtocol 0
119    write /sys/class/android_usb/android0/functions ${sys.usb.config}
120    write /sys/class/android_usb/android0/enable 1
121    start adbd
122    setprop sys.usb.state ${sys.usb.config}
123