Skip to content
Snippets Groups Projects
Commit 65d3e31d authored by Chris Dearman's avatar Chris Dearman
Browse files

Switch to configfs_usb

Replaces legacy g_ffs driver

Bug: 27477999
Change-Id: If649292b71c6a11ed3b8cf20f613737aebd65a34
parent e0b7d5af
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@
# limitations under the License.
#
import init.usb.${ro.hardware}.rc
on init
# Android creates by-name disk links with the disk controller
# in the generated path, so that the names pulled out of the GPT
......@@ -23,8 +25,3 @@ on init
on fs
mount_all /fstab.${ro.hardware}
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
write /sys/class/android_usb/android0/f_ffs/aliases adb
write /sys/class/android_usb/android0/iSerial ${ro.hardware}${ro.serialno}
#
# 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 0x149a
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.hardware}${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
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
setprop sys.usb.configfs 1
setprop sys.usb.controller "18120000.usb"
on property:sys.usb.config=none && property:sys.usb.configfs=1
setprop sys.usb.ffs.ready 0
on property:init.svc.adbd=stopped
setprop sys.usb.ffs.ready 0
on property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x0006
# Configfs /config
type configfs, fs_type;
genfscon configfs / u:object_r:configfs:s0
#============= init ==============
allow init configfs:dir create_dir_perms;
allow init configfs:{ file lnk_file } create_file_perms;
......@@ -57,8 +57,14 @@ CONFIG_CFG80211_INTERNAL_REGDB=y
# [ 89.274810] [<80c270f8>] nl80211_new_station+0x3b4/0x494
# CONFIG_MAC80211_DEBUGFS is not set
# Use generic functionsfs for adb gadget
CONFIG_USB_FUNCTIONFS=y
# CONFIG_USB_FUNCTIONFS_ETH is not set
# CONFIG_USB_FUNCTIONFS_RNDIS is not set
CONFIG_USB_FUNCTIONFS_GENERIC=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_MTP=y
CONFIG_USB_CONFIGFS_F_PTP=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_UEVENT=y
......@@ -29,10 +29,6 @@ TARGET_NO_KERNEL := false
BOARD_KERNEL_CMDLINE := console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x18101500,115200 androidboot.console=ttyS1 androidboot.hardware=fs1130 security=selinux androidboot.selinux=enforcing
# Should be in bootloader DTB... firmware/android/
BOARD_KERNEL_CMDLINE += androidboot.serialno=4567
BOARD_KERNEL_CMDLINE += g_ffs.idVendor=0x18d1 g_ffs.idProduct=0xc141 g_ffs.iSerialNumber=4567
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 131072
......@@ -40,6 +36,8 @@ BOARD_FLASH_BLOCK_SIZE := 131072
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.fs1130.rc:root/init.fs1130.rc \
system/core/rootdir/init.usb.rc:root/init.usb.rc \
system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
$(LOCAL_PATH)/init.usb.fs1130.rc:root/init.usb.fs1130.rc \
system/core/rootdir/ueventd.rc:root/ueventd.rc \
$(LOCAL_PATH)/ueventd.fs1130.rc:root/ueventd.fs1130.rc \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment