diff --git a/soc/fs1130/init.fs1130.rc b/soc/fs1130/init.fs1130.rc index ff93d28247d086b6cb963c3123bc4693554e826b..beacd9f3fa15d52ee10f98d7befd3ef54c33d03f 100644 --- a/soc/fs1130/init.fs1130.rc +++ b/soc/fs1130/init.fs1130.rc @@ -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} diff --git a/soc/fs1130/init.usb.fs1130.rc b/soc/fs1130/init.usb.fs1130.rc new file mode 100644 index 0000000000000000000000000000000000000000..00375dadc01777fbc9d33231014a02c94a2ce9e8 --- /dev/null +++ b/soc/fs1130/init.usb.fs1130.rc @@ -0,0 +1,42 @@ +# +# 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 diff --git a/soc/fs1130/sepolicy/file.te b/soc/fs1130/sepolicy/file.te new file mode 100644 index 0000000000000000000000000000000000000000..485b6663602d2cce484d6e031ea17fcc92443794 --- /dev/null +++ b/soc/fs1130/sepolicy/file.te @@ -0,0 +1,2 @@ +# Configfs /config +type configfs, fs_type; diff --git a/soc/fs1130/sepolicy/genfs_contexts b/soc/fs1130/sepolicy/genfs_contexts new file mode 100644 index 0000000000000000000000000000000000000000..50c7cd7ba15b929f823e8859dbfe490ab4285927 --- /dev/null +++ b/soc/fs1130/sepolicy/genfs_contexts @@ -0,0 +1 @@ +genfscon configfs / u:object_r:configfs:s0 diff --git a/soc/fs1130/sepolicy/init.te b/soc/fs1130/sepolicy/init.te new file mode 100644 index 0000000000000000000000000000000000000000..d7a2e61f835989b854c9a28bc36fcfd8f4ea003c --- /dev/null +++ b/soc/fs1130/sepolicy/init.te @@ -0,0 +1,3 @@ +#============= init ============== +allow init configfs:dir create_dir_perms; +allow init configfs:{ file lnk_file } create_file_perms; diff --git a/soc/fs1130/soc.kconf b/soc/fs1130/soc.kconf index 006e6f63860c4c4a7beba3b9bae88913c87e88cb..f18270909893f349d5e78d8d4d8cb6f4403f1363 100644 --- a/soc/fs1130/soc.kconf +++ b/soc/fs1130/soc.kconf @@ -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 diff --git a/soc/fs1130/soc.mk b/soc/fs1130/soc.mk index b248dbddb217c86e646f3b60348301ea448df0a5..687bb31c85934c6be38cb3fa227e316d5b9556b0 100644 --- a/soc/fs1130/soc.mk +++ b/soc/fs1130/soc.mk @@ -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 \