summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2016-04-28 12:17:32 +0530
committerJohn Stultz <john.stultz@linaro.org>2016-05-09 12:21:12 -0700
commit68f52278b69d67650ff20d60e9b6d0e7e5099964 (patch)
tree2bccfaecd7104e1c9897ed0990a8be9c1d65474f
parent597c91b7fd25a3d263922a3bd7f1c03f81279d42 (diff)
downloadflo-68f52278b69d67650ff20d60e9b6d0e7e5099964.tar.gz
flo: enable android configfs gadgets adb, mtp and ptp
Android composite gadget driver is no longer supported on newer > v3.10 kernels. This patch removes the Android composite cadget configurations and switch over to ConfigFS gadget implementations instead. Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--init.flo.usb.rc228
1 files changed, 53 insertions, 175 deletions
diff --git a/init.flo.usb.rc b/init.flo.usb.rc
index 05a0c67..9213d84 100644
--- a/init.flo.usb.rc
+++ b/init.flo.usb.rc
@@ -1,176 +1,54 @@
-# Copyright 2012 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 init
- write /sys/class/android_usb/android0/f_rndis/manufacturer ASUS
- write /sys/class/android_usb/android0/f_rndis/vendorID 18D1
- write /sys/class/android_usb/android0/f_rndis/wceis 1
-
on boot
- write /sys/class/android_usb/android0/iSerial $ro.serialno
- write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
- write /sys/class/android_usb/android0/iProduct $ro.product.model
-
-# MTP
-on property:sys.usb.config=mtp
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE1
- write /sys/class/android_usb/android0/bDeviceClass 0
- write /sys/class/android_usb/android0/bDeviceSubClass 0
- write /sys/class/android_usb/android0/bDeviceProtocol 0
- write /sys/class/android_usb/android0/functions mtp
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE2
- write /sys/class/android_usb/android0/bDeviceClass 0
- write /sys/class/android_usb/android0/bDeviceSubClass 0
- write /sys/class/android_usb/android0/bDeviceProtocol 0
- write /sys/class/android_usb/android0/functions mtp,adb
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# rndis
-on property:sys.usb.config=rndis
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE3
- write /sys/class/android_usb/android0/bDeviceClass 239
- write /sys/class/android_usb/android0/bDeviceSubClass 2
- write /sys/class/android_usb/android0/bDeviceProtocol 1
- write /sys/class/android_usb/android0/functions rndis
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE4
- write /sys/class/android_usb/android0/bDeviceClass 239
- write /sys/class/android_usb/android0/bDeviceSubClass 2
- write /sys/class/android_usb/android0/bDeviceProtocol 1
- write /sys/class/android_usb/android0/functions rndis,adb
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# PTP
-on property:sys.usb.config=ptp
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE5
- write /sys/class/android_usb/android0/bDeviceClass 0
- write /sys/class/android_usb/android0/bDeviceSubClass 0
- write /sys/class/android_usb/android0/bDeviceProtocol 0
- write /sys/class/android_usb/android0/functions ptp
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=ptp,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE6
- write /sys/class/android_usb/android0/bDeviceClass 0
- write /sys/class/android_usb/android0/bDeviceSubClass 0
- write /sys/class/android_usb/android0/bDeviceProtocol 0
- write /sys/class/android_usb/android0/functions ptp,adb
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# USB midi configuration
-on property:sys.usb.config=midi
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# USB midi configuration, with adb
-on property:sys.usb.config=midi,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 18D1
- write /sys/class/android_usb/android0/idProduct 4EE9
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# diag
-on property:sys.usb.config=diag
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 1004
- write /sys/class/android_usb/android0/idProduct 631B
- write /sys/class/android_usb/android0/bDeviceClass 239
- write /sys/class/android_usb/android0/bDeviceSubClass 2
- write /sys/class/android_usb/android0/bDeviceProtocol 1
- write /sys/class/android_usb/android0/f_acm/acm_transports tty
- write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
- write /sys/class/android_usb/android0/functions acm,diag,mtp,adb
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=diag,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 05C6
- write /sys/class/android_usb/android0/idProduct 9025
- write /sys/class/android_usb/android0/f_diag/clients diag
- write /sys/class/android_usb/android0/f_serial/transports smd,tty
- write /sys/class/android_usb/android0/f_rmnet/transports smd,bam
- write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state $sys.usb.config
-
-on property:sys.usb.config=diag,mdm,adb
- stop adbd
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 05C6
- write /sys/class/android_usb/android0/idProduct 9031
- write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
- write /sys/class/android_usb/android0/f_serial/transports hsic,tty
- write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
- write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
- write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
- write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
-
-# Fusion 3 composition with diag_mdm and adb
-on property:sys.usb.config=diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
- write /sys/class/android_usb/android0/enable 0
- write /sys/class/android_usb/android0/idVendor 05C6
- write /sys/class/android_usb/android0/idProduct 9031
- write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm
- write /sys/class/android_usb/android0/f_serial/transports hsic,tty
- write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic
- write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic
- write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic
- write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop sys.usb.state ${sys.usb.config}
+ 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 "0123456789"
+ write /config/usb_gadget/g1/strings/0x409/manufacturer "Asus"
+ write /config/usb_gadget/g1/strings/0x409/product "flo"
+ mkdir /config/usb_gadget/g1/functions/ffs.adb
+ mkdir /config/usb_gadget/g1/functions/mtp.gs0
+ mkdir /config/usb_gadget/g1/functions/ptp.gs1
+ 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/os_desc/b_vendor_code 0x1
+ write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
+ write /config/usb_gadget/g1/configs/b.1/MaxPower 500
+ symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
+ mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
+ setprop sys.usb.configfs 1
+ setprop sys.usb.controller "ci_hdrc.0"
+
+on property:sys.usb.config=none && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/os_desc/use 0
+ setprop sys.usb.ffs.ready 0
+
+on property:init.svc.adbd=stopped
+ setprop sys.usb.ffs.ready 0
+
+on property:sys.usb.config=mtp && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP"
+ write /config/usb_gadget/g1/os_desc/use 1
+ write /config/usb_gadget/g1/idProduct 0x4EE1
+
+on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP"
+ write /config/usb_gadget/g1/os_desc/use 1
+ write /config/usb_gadget/g1/idProduct 0x4EE2
+
+on property:sys.usb.config=ptp && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP"
+ write /config/usb_gadget/g1/os_desc/use 1
+ write /config/usb_gadget/g1/idProduct 0x4EE5
+
+on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id "PTP"
+ write /config/usb_gadget/g1/os_desc/use 1
+ write /config/usb_gadget/g1/idProduct 0x4EE6
+
+on property:sys.usb.config=adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/idProduct 0x4EE7