• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2017 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 boot
18    mkdir /config/usb_gadget/g1 0770 shell shell
19    mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
20    write /config/usb_gadget/g1/bcdUSB 0x0200
21    write /config/usb_gadget/g1/idVendor 0x18d1
22    write /config/usb_gadget/g1/bcdDevice 0x0440
23    write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
24    write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
25    write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
26    mkdir /config/usb_gadget/g1/functions/mass_storage.0
27    mkdir /config/usb_gadget/g1/functions/accessory.gs2
28    mkdir /config/usb_gadget/g1/functions/audio_source.gs3
29    mkdir /config/usb_gadget/g1/functions/midi.gs5
30    mkdir /config/usb_gadget/g1/functions/ffs.adb
31    mkdir /config/usb_gadget/g1/functions/ffs.mtp
32    mkdir /config/usb_gadget/g1/functions/ffs.ptp
33    mkdir /config/usb_gadget/g1/functions/diag.diag
34    mkdir /config/usb_gadget/g1/functions/cser.dun.0
35    mkdir /config/usb_gadget/g1/functions/cser.nmea.1
36    mkdir /config/usb_gadget/g1/functions/gsi.rmnet
37    mkdir /config/usb_gadget/g1/functions/gsi.rndis
38    mkdir /config/usb_gadget/g1/functions/qdss.qdss
39    mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
40    mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
41    write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
42    mkdir /dev/usb-ffs 0775 shell shell
43    mkdir /dev/usb-ffs/adb 0770 shell shell
44    mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
45    mkdir /dev/usb-ffs/mtp 0770 mtp mtp
46    mkdir /dev/usb-ffs/ptp 0770 mtp mtp
47    mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
48    mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
49    setprop sys.usb.mtp.device_type 3
50    setprop sys.usb.configfs 1
51    setprop sys.usb.controller "dummy_udc.0"
52    write /sys/module/libcomposite/parameters/disable_l1_for_hs "y"
53
54on property:sys.usb.config=mtp && property:sys.usb.configfs=1
55    write /config/usb_gadget/g1/idProduct 0x4ee1
56    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
57
58on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
59    write /config/usb_gadget/g1/idProduct 0x4ee2
60    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
61
62on property:sys.usb.config=rndis && property:sys.usb.configfs=1
63    write /config/usb_gadget/g1/idProduct 0x4ee3
64    symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1
65
66on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
67    write /config/usb_gadget/g1/idProduct 0x4ee4
68    symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1
69
70on property:sys.usb.config=ptp && property:sys.usb.configfs=1
71    write /config/usb_gadget/g1/idProduct 0x4ee5
72    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
73
74on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
75    write /config/usb_gadget/g1/idProduct 0x4ee6
76    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
77
78on property:sys.usb.config=adb && property:sys.usb.configfs=1
79    write /config/usb_gadget/g1/idProduct 0x4ee7
80
81on property:sys.usb.config=midi && property:sys.usb.configfs=1
82    write /config/usb_gadget/g1/idProduct 0x4ee8
83
84on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
85    write /config/usb_gadget/g1/idProduct 0x4ee9
86
87on property:sys.usb.config=accessory && property:sys.usb.configfs=1
88    write /config/usb_gadget/g1/idProduct 0x2d00
89
90on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
91    write /config/usb_gadget/g1/idProduct 0x2d01
92
93on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
94    write /config/usb_gadget/g1/idProduct 0x2d02
95
96on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
97    write /config/usb_gadget/g1/idProduct 0x2d03
98
99on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
100    write /config/usb_gadget/g1/idProduct 0x2d04
101
102on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
103    write /config/usb_gadget/g1/idProduct 0x2d05
104