| # Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. |
| # SPDX-License-Identifier: BSD-3-Clause-Clear |
| |
| on init |
| mount configfs none /config |
| mkdir /config/usb_gadget/g1 0770 |
| mkdir /config/usb_gadget/g1/strings/0x409 0770 |
| write /config/usb_gadget/g1/bcdUSB 0x0200 |
| write /config/usb_gadget/g1/os_desc/use 1 |
| 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.name} |
| mkdir /config/usb_gadget/g1/functions/ffs.adb |
| mkdir /config/usb_gadget/g1/configs/b.1 0770 |
| mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 |
| write /config/usb_gadget/g1/configs/b.1/MaxPower 900 |
| write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 |
| write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" |
| mkdir /dev/usb-ffs 0775 shell system |
| mkdir /dev/usb-ffs/adb 0770 shell system |
| mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=1000,rmode=0770,fmode=0660 |
| 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 |
| write /config/usb_gadget/g1/idVendor 0x18d1 |
| write /config/usb_gadget/g1/idProduct 0x4ee7 |
| symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 |
| start adbd |
| setprop sys.usb.configfs -1 |
| |
| on property:sys.usb.ffs.ready=1 |
| write /config/usb_gadget/g1/UDC ${vendor.usb.controller} |
| setprop sys.usb.state adb |