1#
2# Copyright (C) 2016 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17on early-boot
18    mount configfs none /config
19    mkdir /config/usb_gadget/g1 0770
20    mkdir /config/usb_gadget/g1/strings/0x409 0770
21    write /config/usb_gadget/g1/bcdUSB 0x0200
22    write /config/usb_gadget/g1/idVendor 0x18d1
23    write /config/usb_gadget/g1/bcdDevice 0x0440
24    write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
25    write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
26    write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
27    mkdir /config/usb_gadget/g1/functions/mass_storage.0
28    mkdir /config/usb_gadget/g1/functions/accessory.gs2
29    mkdir /config/usb_gadget/g1/functions/audio_source.gs3
30    mkdir /config/usb_gadget/g1/functions/midi.gs5
31    mkdir /config/usb_gadget/g1/functions/ffs.adb
32    mkdir /config/usb_gadget/g1/functions/ffs.mtp
33    mkdir /config/usb_gadget/g1/functions/ffs.ptp
34    mkdir /config/usb_gadget/g1/functions/diag.diag
35    mkdir /config/usb_gadget/g1/functions/cser.dun.0
36    mkdir /config/usb_gadget/g1/functions/cser.nmea.1
37    mkdir /config/usb_gadget/g1/functions/gsi.rmnet
38    mkdir /config/usb_gadget/g1/functions/gsi.rndis
39    mkdir /config/usb_gadget/g1/functions/qdss.qdss
40    mkdir /config/usb_gadget/g1/configs/b.1 0770
41    mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770
42    write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
43    write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
44    mkdir /dev/usb-ffs 0775 shell shell
45    mkdir /dev/usb-ffs/adb 0770 shell shell
46    mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
47    mkdir /dev/usb-ffs/mtp 0770 mtp mtp
48    mkdir /dev/usb-ffs/ptp 0770 mtp mtp
49    mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
50    mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
51    setprop sys.usb.mtp.device_type 3
52    setprop sys.usb.controller "a800000.dwc3"
53    write /sys/module/libcomposite/parameters/disable_l1_for_hs "y"
54    symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
55    write /config/usb_gadget/g1/functions/gsi.rndis/rndis_wceis 1
56
57on boot
58    setprop sys.usb.configfs 2
59