1 # Copyright 2015 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 15 on init 16 write /sys/class/android_usb/android0/f_rndis/manufacturer Huawei 17 write /sys/class/android_usb/android0/f_rndis/vendorID 18D1 18 write /sys/class/android_usb/android0/f_rndis/wceis 1 19 20 on boot 21 write /sys/class/android_usb/android0/iSerial ${ro.serialno} 22 write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer} 23 write /sys/class/android_usb/android0/iProduct ${ro.product.model} 24 25 on post-fs 26 mkdir /dev/usb-ffs 0770 shell shell 27 mkdir /dev/usb-ffs/adb 0770 shell shell 28 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 29 write /sys/class/android_usb/android0/f_ffs/aliases adb 30 31 on charger 32 setprop persist.sys.usb.config charging 33 34 # MTP 35 on property:sys.usb.config=mtp 36 stop adbd 37 write /sys/class/android_usb/android0/enable 0 38 write /sys/class/android_usb/android0/idVendor 18D1 39 write /sys/class/android_usb/android0/idProduct 4EE1 40 write /sys/class/android_usb/android0/bDeviceClass 0 41 write /sys/class/android_usb/android0/bDeviceSubClass 0 42 write /sys/class/android_usb/android0/bDeviceProtocol 0 43 write /sys/class/android_usb/android0/functions mtp 44 write /sys/class/android_usb/android0/enable 1 45 setprop sys.usb.state ${sys.usb.config} 46 47 on property:sys.usb.config=mtp,adb 48 write /sys/class/android_usb/android0/enable 0 49 write /sys/class/android_usb/android0/idVendor 18D1 50 write /sys/class/android_usb/android0/idProduct 4EE2 51 write /sys/class/android_usb/android0/bDeviceClass 0 52 write /sys/class/android_usb/android0/bDeviceSubClass 0 53 write /sys/class/android_usb/android0/bDeviceProtocol 0 54 write /sys/class/android_usb/android0/functions mtp,adb 55 write /sys/class/android_usb/android0/enable 1 56 start adbd 57 setprop sys.usb.state ${sys.usb.config} 58 59 # rndis 60 on property:sys.usb.config=rndis 61 stop adbd 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/bDeviceClass 239 66 write /sys/class/android_usb/android0/bDeviceSubClass 2 67 write /sys/class/android_usb/android0/bDeviceProtocol 1 68 write /sys/class/android_usb/android0/functions rndis 69 write /sys/class/android_usb/android0/enable 1 70 setprop sys.usb.state ${sys.usb.config} 71 72 on property:sys.usb.config=rndis,adb 73 write /sys/class/android_usb/android0/enable 0 74 write /sys/class/android_usb/android0/idVendor 18D1 75 write /sys/class/android_usb/android0/idProduct 4EE4 76 write /sys/class/android_usb/android0/bDeviceClass 239 77 write /sys/class/android_usb/android0/bDeviceSubClass 2 78 write /sys/class/android_usb/android0/bDeviceProtocol 1 79 write /sys/class/android_usb/android0/functions rndis,adb 80 write /sys/class/android_usb/android0/enable 1 81 start adbd 82 setprop sys.usb.state ${sys.usb.config} 83 84 # PTP 85 on property:sys.usb.config=ptp 86 stop adbd 87 write /sys/class/android_usb/android0/enable 0 88 write /sys/class/android_usb/android0/idVendor 18D1 89 write /sys/class/android_usb/android0/idProduct 4EE5 90 write /sys/class/android_usb/android0/bDeviceClass 0 91 write /sys/class/android_usb/android0/bDeviceSubClass 0 92 write /sys/class/android_usb/android0/bDeviceProtocol 0 93 write /sys/class/android_usb/android0/functions ptp 94 write /sys/class/android_usb/android0/enable 1 95 setprop sys.usb.state ${sys.usb.config} 96 97 on property:sys.usb.config=ptp,adb 98 write /sys/class/android_usb/android0/enable 0 99 write /sys/class/android_usb/android0/idVendor 18D1 100 write /sys/class/android_usb/android0/idProduct 4EE6 101 write /sys/class/android_usb/android0/bDeviceClass 0 102 write /sys/class/android_usb/android0/bDeviceSubClass 0 103 write /sys/class/android_usb/android0/bDeviceProtocol 0 104 write /sys/class/android_usb/android0/functions ptp,adb 105 write /sys/class/android_usb/android0/enable 1 106 start adbd 107 setprop sys.usb.state ${sys.usb.config} 108 109 # diag 110 on property:sys.usb.config=diag 111 stop adbd 112 write /sys/class/android_usb/android0/enable 0 113 write /sys/class/android_usb/android0/idVendor 05c6 114 write /sys/class/android_usb/android0/idProduct 9060 115 write /sys/class/android_usb/android0/f_diag/clients diag 116 write /sys/class/android_usb/android0/functions diag,mtp,adb 117 write /sys/class/android_usb/android0/enable 1 118 start adbd 119 setprop sys.usb.state ${sys.usb.config} 120 121 # USB midi configuration 122 on property:sys.usb.config=midi 123 write /sys/class/android_usb/android0/enable 0 124 write /sys/class/android_usb/android0/idVendor 18d1 125 write /sys/class/android_usb/android0/idProduct 4ee8 126 write /sys/class/android_usb/android0/functions ${sys.usb.config} 127 write /sys/class/android_usb/android0/enable 1 128 start adbd 129 setprop sys.usb.state ${sys.usb.config} 130 131 # USB midi configuration, with adb 132 on property:sys.usb.config=midi,adb 133 write /sys/class/android_usb/android0/enable 0 134 write /sys/class/android_usb/android0/idVendor 18d1 135 write /sys/class/android_usb/android0/idProduct 4ee9 136 write /sys/class/android_usb/android0/functions ${sys.usb.config} 137 write /sys/class/android_usb/android0/enable 1 138 start adbd 139 setprop sys.usb.state ${sys.usb.config} 140 141 # USB charging configuration 142 on property:sys.usb.config=charging 143 stop adbd 144 write /sys/class/android_usb/android0/enable 0 145 write /sys/class/android_usb/android0/idVendor 18d1 146 write /sys/class/android_usb/android0/idProduct 4eea 147 write /sys/class/android_usb/android0/functions charging 148 write /sys/class/android_usb/android0/enable 1 149 setprop sys.usb.state ${sys.usb.config} 150 151 # QDSS - Qualcomm Debug Subsystem 152 on property:sys.usb.config=diag,qdss,adb 153 write /sys/class/android_usb/android0/enable 0 154 write /sys/class/android_usb/android0/idVendor 05C6 155 write /sys/class/android_usb/android0/idProduct 9060 156 write /sys/class/android_usb/android0/f_diag/clients diag 157 write /sys/class/android_usb/android0/functions diag,qdss,adb 158 write /sys/class/android_usb/android0/enable 1 159 start adbd 160 setprop sys.usb.state ${sys.usb.config} 161 162 # USB factory configuration 163 on property:sys.usb.config=manufacture,adb 164 stop adbd 165 write /sys/class/android_usb/android0/enable 0 166 write /sys/class/android_usb/android0/idVendor 12d1 167 write /sys/class/android_usb/android0/idProduct 1035 168 write /sys/class/android_usb/android0/f_diag/clients diag 169 write /sys/class/android_usb/android0/f_serial/transports smd,smd 170 write /sys/class/android_usb/android0/functions serial,mass_storage,adb,diag 171 write /sys/class/android_usb/android0/enable 1 172 start adbd 173 setprop sys.usb.state ${sys.usb.config} 174 175 # RmNet using USB BAM to IPA BAM 176 on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_ipa,mass_storage,adb 177 stop adbd 178 write /sys/class/android_usb/android0/enable 0 179 write /sys/class/android_usb/android0/idVendor 05C6 180 write /sys/class/android_usb/android0/idProduct 9025 181 write /sys/class/android_usb/android0/f_diag/clients diag 182 write /sys/class/android_usb/android0/f_serial/transports smd,tty 183 write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa 184 write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage 185 write /sys/class/android_usb/android0/enable 1 186 start adbd 187 setprop sys.usb.state ${sys.usb.config} 188 189 on property:sys.usb.config=diag,serial_smd,rmnet_ipa,adb 190 stop adbd 191 write /sys/class/android_usb/android0/enable 0 192 write /sys/class/android_usb/android0/idVendor 05C6 193 write /sys/class/android_usb/android0/idProduct 9091 194 write /sys/class/android_usb/android0/f_diag/clients diag 195 write /sys/class/android_usb/android0/f_serial/transports smd 196 write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa 197 write /sys/class/android_usb/android0/functions diag,serial,rmnet,adb 198 write /sys/class/android_usb/android0/enable 1 199 start adbd 200 setprop sys.usb.state ${sys.usb.config} 201 202 # rndis with serial 203 on property:sys.usb.config=rndis,serial 204 stop adbd 205 write /sys/class/android_usb/android0/enable 0 206 write /sys/class/android_usb/android0/idVendor 12d1 207 write /sys/class/android_usb/android0/idProduct 105d 208 write /sys/class/android_usb/android0/f_diag/clients diag 209 write /sys/class/android_usb/android0/f_serial/transports smd 210 write /sys/class/android_usb/android0/functions rndis,serial,diag 211 write /sys/class/android_usb/android0/enable 1 212 setprop sys.usb.state ${sys.usb.config} 213 214 # rndis with serial and adb 215 on property:sys.usb.config=rndis,serial,adb 216 stop adbd 217 write /sys/class/android_usb/android0/enable 0 218 write /sys/class/android_usb/android0/idVendor 12d1 219 write /sys/class/android_usb/android0/idProduct 105d 220 write /sys/class/android_usb/android0/f_diag/clients diag 221 write /sys/class/android_usb/android0/f_serial/transports smd 222 write /sys/class/android_usb/android0/functions rndis,serial,diag,adb 223 write /sys/class/android_usb/android0/enable 1 224 start adbd 225 setprop sys.usb.state ${sys.usb.config} 226 227