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 LGE 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 chown root system /sys/class/dual_role_usb/otg_default/mode 26 chmod 664 /sys/class/dual_role_usb/otg_default/mode 27 28 on post-fs 29 mkdir /dev/usb-ffs 0775 shell shell 30 mkdir /dev/usb-ffs/adb 0770 shell shell 31 mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 32 mkdir /dev/usb-ffs/mtp 0770 mtp mtp 33 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 34 write /sys/module/g_android/parameters/mtp_rx_req_len 131072 35 write /sys/module/g_android/parameters/mtp_tx_reqs 32 36 setprop sys.usb.ffs.max_write 262144 37 setprop sys.usb.ffs.max_read 262144 38 setprop sys.usb.mtp.device_type 3 39 write /sys/class/android_usb/android0/f_ffs/aliases adb,mtp 40 41 on post-fs-data 42 write /sys/module/rndis_ipa/parameters/min_cpu_freq 1036800 43 write /sys/class/android_usb/android0/f_rndis_qc/rndis_transports BAM2BAM_IPA 44 45 # MTP 46 on property:sys.usb.config=mtp 47 stop adbd 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 4EE1 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 55 write /sys/class/android_usb/android0/enable 1 56 setprop sys.usb.state ${sys.usb.config} 57 58 on property:sys.usb.config=mtp,adb 59 write /sys/class/android_usb/android0/enable 0 60 write /sys/class/android_usb/android0/idVendor 18D1 61 write /sys/class/android_usb/android0/idProduct 4EE2 62 write /sys/class/android_usb/android0/bDeviceClass 0 63 write /sys/class/android_usb/android0/bDeviceSubClass 0 64 write /sys/class/android_usb/android0/bDeviceProtocol 0 65 write /sys/class/android_usb/android0/functions mtp,adb 66 write /sys/class/android_usb/android0/enable 1 67 start adbd 68 setprop sys.usb.state ${sys.usb.config} 69 70 # rndis 71 on property:sys.usb.config=rndis 72 stop adbd 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 4EE3 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 80 write /sys/class/android_usb/android0/enable 1 81 setprop sys.usb.state ${sys.usb.config} 82 83 on property:sys.usb.config=rndis,adb 84 write /sys/class/android_usb/android0/enable 0 85 write /sys/class/android_usb/android0/idVendor 18D1 86 write /sys/class/android_usb/android0/idProduct 4EE4 87 write /sys/class/android_usb/android0/bDeviceClass 239 88 write /sys/class/android_usb/android0/bDeviceSubClass 2 89 write /sys/class/android_usb/android0/bDeviceProtocol 1 90 write /sys/class/android_usb/android0/functions rndis,adb 91 write /sys/class/android_usb/android0/enable 1 92 start adbd 93 setprop sys.usb.state ${sys.usb.config} 94 95 # PTP 96 on property:sys.usb.config=ptp 97 stop adbd 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 4EE5 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 mtp 105 write /sys/class/android_usb/android0/enable 1 106 setprop sys.usb.state ${sys.usb.config} 107 108 on property:sys.usb.config=ptp,adb 109 write /sys/class/android_usb/android0/enable 0 110 write /sys/class/android_usb/android0/idVendor 18D1 111 write /sys/class/android_usb/android0/idProduct 4EE6 112 write /sys/class/android_usb/android0/bDeviceClass 0 113 write /sys/class/android_usb/android0/bDeviceSubClass 0 114 write /sys/class/android_usb/android0/bDeviceProtocol 0 115 write /sys/class/android_usb/android0/functions mtp,adb 116 write /sys/class/android_usb/android0/enable 1 117 start adbd 118 setprop sys.usb.state ${sys.usb.config} 119 120 # diag 121 on property:sys.usb.config=diag 122 stop adbd 123 write /sys/class/android_usb/android0/enable 0 124 write /sys/class/android_usb/android0/idVendor 05C6 125 write /sys/class/android_usb/android0/idProduct 903D 126 write /sys/class/android_usb/android0/bDeviceClass 0 127 write /sys/class/android_usb/android0/bDeviceSubClass 0 128 write /sys/class/android_usb/android0/bDeviceProtocol 0 129 write /sys/class/android_usb/android0/f_diag/clients diag 130 write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty 131 write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa 132 write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet 133 write /sys/class/android_usb/android0/enable 1 134 start adbd 135 setprop sys.usb.state ${sys.usb.config} 136 137 on property:sys.usb.config=diag,adb 138 stop adbd 139 write /sys/class/android_usb/android0/enable 0 140 write /sys/class/android_usb/android0/idVendor 05C6 141 write /sys/class/android_usb/android0/idProduct 903D 142 write /sys/class/android_usb/android0/bDeviceClass 0 143 write /sys/class/android_usb/android0/bDeviceSubClass 0 144 write /sys/class/android_usb/android0/bDeviceProtocol 0 145 write /sys/class/android_usb/android0/f_diag/clients diag 146 write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty 147 write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa 148 write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet 149 write /sys/class/android_usb/android0/enable 1 150 start adbd 151 setprop sys.usb.state ${sys.usb.config} 152 153 # USB midi configuration 154 on property:sys.usb.config=midi 155 stop adbd 156 write /sys/class/android_usb/android0/enable 0 157 write /sys/class/android_usb/android0/idVendor 18D1 158 write /sys/class/android_usb/android0/idProduct 4EE8 159 write /sys/class/android_usb/android0/functions ${sys.usb.config} 160 write /sys/class/android_usb/android0/enable 1 161 setprop sys.usb.state ${sys.usb.config} 162 163 # USB midi configuration, with adb 164 on property:sys.usb.config=midi,adb 165 write /sys/class/android_usb/android0/enable 0 166 write /sys/class/android_usb/android0/idVendor 18D1 167 write /sys/class/android_usb/android0/idProduct 4EE9 168 write /sys/class/android_usb/android0/functions ${sys.usb.config} 169 write /sys/class/android_usb/android0/enable 1 170 start adbd 171 setprop sys.usb.state ${sys.usb.config} 172