| # |
| # Copyright 2016 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| on boot |
| mkdir /dev/usb-ffs 0770 shell shell |
| mkdir /dev/usb-ffs/adb 0770 shell shell |
| mount configfs none /config |
| mkdir /config/usb_gadget/g1 0770 shell shell |
| write /config/usb_gadget/g1/idVendor 0x18d1 |
| write /config/usb_gadget/g1/bcdDevice 0x0223 |
| write /config/usb_gadget/g1/bcdUSB 0x0200 |
| mkdir /config/usb_gadget/g1/strings/0x409 0770 |
| write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
| write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} |
| write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} |
| mkdir /config/usb_gadget/g1/functions/ffs.adb |
| mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell |
| mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell |
| write /config/usb_gadget/g1/configs/b.1/MaxPower 500 |
| write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" |
| symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 |
| mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 |
| setprop sys.usb.configfs 1 |
| setprop sys.usb.controller "d4208100.udc" |
| |
| on property:sys.usb.config=none && property:sys.usb.configfs=1 |
| write /config/usb_gadget/g1/UDC "none" |
| stop adbd |
| write /config/usb_gadget/g1/bDeviceClass 0 |
| write /config/usb_gadget/g1/bDeviceSubClass 0 |
| write /config/usb_gadget/g1/bDeviceProtocol 0 |
| setprop sys.usb.state ${sys.usb.config} |
| setprop sys.usb.ffs.ready 0 |
| |
| on property:sys.usb.config=adb && property:sys.usb.configfs=1 |
| start adbd |
| |
| on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1 |
| write /config/usb_gadget/g1/idProduct 0x4ee7 |
| write /config/usb_gadget/g1/UDC ${sys.usb.controller} |
| setprop sys.usb.state ${sys.usb.config} |
| |