gta4xl-common: Switch to usb gadget HAL
* usb init script based on gs101
Change-Id: Ia9a801a38928348348e9d6b2853080a00983ccb0
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
index e70f099..4cbc55a 100644
--- a/BoardConfigCommon.mk
+++ b/BoardConfigCommon.mk
@@ -177,6 +177,9 @@
BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
+## USB
+$(call soong_config_set,samsungUsbGadgetVars,gadget_name,13200000.dwc3)
+
## Verified Boot
BOARD_AVB_ENABLE := true
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 0
diff --git a/common.mk b/common.mk
index 8244401..fa2ef4c 100644
--- a/common.mk
+++ b/common.mk
@@ -291,7 +291,8 @@
# USB
PRODUCT_PACKAGES += \
- android.hardware.usb-service.samsung
+ android.hardware.usb-service.samsung \
+ android.hardware.usb.gadget-service.samsung
# WiFi
PRODUCT_PACKAGES += \
diff --git a/configs/init/init.exynos9611.usb.rc b/configs/init/init.exynos9611.usb.rc
index 00361bc..9d2ac02 100644
--- a/configs/init/init.exynos9611.usb.rc
+++ b/configs/init/init.exynos9611.usb.rc
@@ -1,538 +1,152 @@
-on init
- mount configfs none /config
+on early-boot
mkdir /config/usb_gadget/g1
mkdir /config/usb_gadget/g1/strings/0x409
mkdir /config/usb_gadget/g1/configs/b.1
- mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409
- mkdir /config/usb_gadget/g1/functions/mtp.0
- mkdir /config/usb_gadget/g1/functions/ptp.0
- mkdir /config/usb_gadget/g1/functions/acm.0
- mkdir /config/usb_gadget/g1/functions/uts.0
- mkdir /config/usb_gadget/g1/functions/dm.0
- mkdir /config/usb_gadget/g1/functions/rndis.0
- mkdir /config/usb_gadget/g1/functions/conn_gadget.0
- mkdir /config/usb_gadget/g1/functions/midi.0
- mkdir /config/usb_gadget/g1/functions/accessory.0
- mkdir /config/usb_gadget/g1/functions/audio_source.0
- mkdir /config/usb_gadget/g1/functions/ncm.0
- mkdir /config/usb_gadget/g1/functions/mass_storage.0
- mkdir /config/usb_gadget/g1/functions/ffs.adb 0770 shell shell
- 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
- restorecon_recursive /dev/usb-ffs/adb
-
-on charger && property:ro.debuggable=1
+ write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
- write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.vendor.manufacturer}
- write /config/usb_gadget/g1/strings/0x409/product ${ro.product.vendor.model}
- write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Conf 1"
- symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
- setprop sys.usb.configfs 2
- setprop sys.usb.config adb
+ write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
+ write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
+ write /config/usb_gadget/g1/configs/b.1/MaxPower 0x384
+ write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
+ write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
+
+ # ffs function
+ mkdir /config/usb_gadget/g1/functions/ffs.adb 0770 shell shell
+ mkdir /config/usb_gadget/g1/functions/ffs.mtp
+ mkdir /config/usb_gadget/g1/functions/ffs.ptp
+ mkdir /dev/usb-ffs 0775 shell shell
+ mkdir /dev/usb-ffs/adb 0770 shell shell
+ mkdir /dev/usb-ffs/mtp 0770 mtp mtp
+ mkdir /dev/usb-ffs/ptp 0770 mtp mtp
+ mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
+ mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
+ mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
+ setprop sys.usb.mtp.device_type 3
+ setprop sys.usb.mtp.batchcancel true
+ symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
+
+ # mtp function
+ mkdir /config/usb_gadget/g1/functions/mtp.gs0
+
+ # ptp function
+ mkdir /config/usb_gadget/g1/functions/ptp.gs1
+
+ # accessory function
+ mkdir /config/usb_gadget/g1/functions/accessory.gs2
+
+ # audio_source function
+ mkdir /config/usb_gadget/g1/functions/audio_source.gs3
+
+ # rndis function
+ mkdir /config/usb_gadget/g1/functions/rndis.gs4
+ # Modify class/subclass/protocol for rndis.gs4
+ # Remote NDIS: Class: Wireless Controller (0xe0), Subclass: 0x1, Protocol: 0x3
+ write /config/usb_gadget/g1/functions/rndis.gs4/class e0
+ write /config/usb_gadget/g1/functions/rndis.gs4/subclass 01
+ write /config/usb_gadget/g1/functions/rndis.gs4/protocol 03
+ write /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.ncm/compatible_id RNDIS
+ write /config/usb_gadget/g1/functions/rndis.gs4/ifname rndis%d
+ setprop vendor.usb.rndis.config rndis.gs4
+
+ # midi function
+ mkdir /config/usb_gadget/g1/functions/midi.gs5
+
+ # acm function
+ mkdir /config/usb_gadget/g1/functions/acm.gs6
+
+ # dm function
+ mkdir /config/usb_gadget/g1/functions/dm.gs7
+
+ # uts function
+ mkdir /config/usb_gadget/g1/functions/uts.gs8
+
+ # ncm function
+ mkdir /config/usb_gadget/g1/functions/ncm.gs9
+ write /config/usb_gadget/g1/functions/ncm.gs9/os_desc/interface.ncm/compatible_id WINNCM
+ write /config/usb_gadget/g1/functions/ncm.gs9/ifname ncm%d
+
+ # chown file/folder permission
+ chown system system /config/usb_gadget/
+ chown system system /config/usb_gadget/g1
+ chown system system /config/usb_gadget/g1/UDC
+ chown system system /config/usb_gadget/g1/bDeviceClass
+ chown system system /config/usb_gadget/g1/bDeviceProtocol
+ chown system system /config/usb_gadget/g1/bDeviceSubClass
+ chown system system /config/usb_gadget/g1/bMaxPacketSize0
+ chown system system /config/usb_gadget/g1/bcdDevice
+ chown system system /config/usb_gadget/g1/bcdUSB
+ chown system system /config/usb_gadget/g1/configs
+ chown system system /config/usb_gadget/g1/configs/b.1
+ chown system system /config/usb_gadget/g1/configs/b.1/MaxPower
+ chown system system /config/usb_gadget/g1/configs/b.1/bmAttributes
+ chown system system /config/usb_gadget/g1/configs/b.1/strings
+ chown system system /config/usb_gadget/g1/functions
+ chown system system /config/usb_gadget/g1/functions/accessory.gs2
+ chown system system /config/usb_gadget/g1/functions/acm.gs6
+ chown system system /config/usb_gadget/g1/functions/acm.gs6/port_num
+ chown system system /config/usb_gadget/g1/functions/audio_source.gs3
+ chown system system /config/usb_gadget/g1/functions/dm.gs7
+ chown system system /config/usb_gadget/g1/functions/ffs.adb
+ chown system system /config/usb_gadget/g1/functions/ffs.mtp
+ chown system system /config/usb_gadget/g1/functions/ffs.ptp
+ chown system system /config/usb_gadget/g1/functions/midi.gs5
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/buflen
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/id
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/in_ports
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/index
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/out_ports
+ chown system system /config/usb_gadget/g1/functions/midi.gs5/qlen
+ chown system system /config/usb_gadget/g1/functions/mtp.gs0
+ chown system system /config/usb_gadget/g1/functions/mtp.gs0/os_desc
+ chown system system /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP
+ chown system system /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id
+ chown system system /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/sub_compatible_id
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/dev_addr
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/host_addr
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/ifname
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/os_desc
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/os_desc/interface.ncm
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/os_desc/interface.ncm/compatible_id
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/os_desc/interface.ncm/sub_compatible_id
+ chown system system /config/usb_gadget/g1/functions/ncm.gs9/qmult
+ chown system system /config/usb_gadget/g1/functions/ptp.gs1
+ chown system system /config/usb_gadget/g1/functions/ptp.gs1/os_desc
+ chown system system /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP
+ chown system system /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/compatible_id
+ chown system system /config/usb_gadget/g1/functions/ptp.gs1/os_desc/interface.MTP/sub_compatible_id
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/class
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/dev_addr
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/host_addr
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/ifname
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/compatible_id
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/sub_compatible_id
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/protocol
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/qmult
+ chown system system /config/usb_gadget/g1/functions/rndis.gs4/subclass
+ chown system system /config/usb_gadget/g1/idProduct
+ chown system system /config/usb_gadget/g1/idVendor
+ chown system system /config/usb_gadget/g1/max_speed
+ chown system system /config/usb_gadget/g1/os_desc
+ chown system system /config/usb_gadget/g1/os_desc/b.1
+ chown system system /config/usb_gadget/g1/os_desc/b_vendor_code
+ chown system system /config/usb_gadget/g1/os_desc/qw_sign
+ chown system system /config/usb_gadget/g1/os_desc/use
+ chown system system /config/usb_gadget/g1/strings
+ chown system system /config/usb_gadget/g1/strings/0x409
+ chown system system /config/usb_gadget/g1/strings/0x409/manufacturer
+ chown system system /config/usb_gadget/g1/strings/0x409/product
+ chown system system /config/usb_gadget/g1/strings/0x409/serialnumber
+ setprop vendor.usb.functions.ready 1
on boot
- write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
- write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.vendor.manufacturer}
- write /config/usb_gadget/g1/strings/0x409/product ${ro.product.vendor.model}
- write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Conf 1"
- write /config/usb_gadget/g1/configs/b.1/MaxPower 0x1f4
- symlink /config/usb_gadget/g1/functions/mtp.0 /config/usb_gadget/g1/configs/b.1/mtp.0
- symlink /config/usb_gadget/g1/functions/ptp.0 /config/usb_gadget/g1/configs/b.1/ptp.0
- symlink /config/usb_gadget/g1/functions/acm.0 /config/usb_gadget/g1/configs/b.1/acm.0
- symlink /config/usb_gadget/g1/functions/uts.0 /config/usb_gadget/g1/configs/b.1/uts.0
- symlink /config/usb_gadget/g1/functions/rndis.0 /config/usb_gadget/g1/configs/b.1/rndis.0
- symlink /config/usb_gadget/g1/functions/dm.0 /config/usb_gadget/g1/configs/b.1/dm.0
- symlink /config/usb_gadget/g1/functions/conn_gadget.0 /config/usb_gadget/g1/configs/b.1/conn_gadget.0
- symlink /config/usb_gadget/g1/functions/midi.0 /config/usb_gadget/g1/configs/b.1/midi.0
- symlink /config/usb_gadget/g1/functions/accessory.0 /config/usb_gadget/g1/configs/b.1/accessory.0
- symlink /config/usb_gadget/g1/functions/audio_source.0 /config/usb_gadget/g1/configs/b.1/audio_source.0
- symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/ncm.0
- symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/mass_storage.0
- symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
- chown system system /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
- chmod 0660 /config/usb_gadget/g1/functions/mass_storage.0/lun.0/file
- chown system system /dev/dun
- chown system system /dev/dun2
- setprop sys.usb.ffs.aio_compat 1
+ write /config/usb_gadget/g1/bcdDevice 0x0414
+ # Use USB Gadget HAL
setprop sys.usb.configfs 2
-# Used to disable USB when switching states
-on property:sys.usb.config=none
- write /sys/class/android_usb/android0/enable 0
- stop adbd
- setprop sys.usb.ffs.ready 0
- stop ss_conn_daemon2_service
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/bDeviceSubClass 0
- write /config/usb_gadget/g1/bDeviceProtocol 0
- setprop sys.usb.state ${sys.usb.config}
-
-# adb only USB configuration For VTS Test
-# This is the fallback configuration if the
-# USB manager fails to set a standard configuration
-on property:sys.usb.config=adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685D
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,acm
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,acm,adb
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,acm,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,acm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-#[For Smart MTP CHN
-on property:sys.usb.config=mtp,categories
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,acm
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,categories,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,categories,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,acm,adb
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,categories,acm,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,categories,acm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,acm,adb
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-#]
-
-on property:sys.usb.config=rndis
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6863
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6864
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=ptp
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6865
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=ptp,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x6865
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,dm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6862
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,acm,dm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6862
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,acm,dm,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,acm,dm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x6862
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,acm,dm,uts
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x6862
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=rndis,acm,dm,uts,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,acm,dm,uts,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x6862
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=acm,dm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685D
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=acm,dm,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=acm,dm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685D
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=acm,dm,uts
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685D
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=acm,dm,uts,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=acm,dm,uts,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685D
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=dm,acm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685D
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=dm,acm,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=dm,acm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685D
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=dm,acm,uts
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685D
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=dm,acm,uts,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=dm,acm,uts,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685D
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=sec_charging
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=sec_charging,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=sec_charging,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,adb
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685B
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,adb
- start adbd
-
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685E
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mass_storage,acm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x685E
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
- on property:sys.usb.config=mtp,conn_gadget
- start ss_conn_daemon2_service
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,conn_gadget,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,conn_gadget,adb
- start ss_conn_daemon2_service
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-#For Smart MTP CHN start
-on property:sys.usb.config=mtp,categories,conn_gadget
- start ss_conn_daemon2_service
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,conn_gadget
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=mtp,categories,conn_gadget,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,categories,conn_gadget,adb
- start ss_conn_daemon2_service
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idVendor 0x04E8
- write /config/usb_gadget/g1/idProduct 0x6860
- write /sys/class/android_usb/android0/functions mtp,conn_gadget,adb
- write /config/usb_gadget/g1/bDeviceClass 0
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-#For Smart MTP CHN end
-
-# USB accessory configuration
-on property:sys.usb.config=accessory
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d00
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-# USB accessory configuration, with adb
-on property:sys.usb.config=accessory,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d01
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-# audio accessory configuration
-on property:sys.usb.config=audio_source
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d02
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-# audio accessory configuration, with adb
-on property:sys.usb.config=audio_source,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d03
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-# USB and audio accessory configuration
-on property:sys.usb.config=accessory,audio_source
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d04
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-# USB and audio accessory configuration, with adb
-on property:sys.usb.config=accessory,audio_source,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x2d05
- write /config/usb_gadget/g1/idVendor 0x18d1
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=midi
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x686C
- write /config/usb_gadget/g1/idVendor 0x04e8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=midi,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x686C
- write /config/usb_gadget/g1/idVendor 0x04e8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
- on property:sys.usb.config=ncm
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685d
- write /config/usb_gadget/g1/idVendor 0x04e8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/bDeviceClass 2
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
-
-on property:sys.usb.config=ncm,adb
- start adbd
-on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ncm,adb
- write /sys/class/android_usb/android0/enable 0
- write /config/usb_gadget/g1/idProduct 0x685d
- write /config/usb_gadget/g1/idVendor 0x04e8
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
- write /config/usb_gadget/g1/bDeviceClass 2
- write /config/usb_gadget/g1/UDC "13200000.dwc3"
- write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/idProduct 0x4EE7
+ write /config/usb_gadget/g1/idVendor 0x18D1
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index 8783494..4a16964 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -12,6 +12,7 @@
genfscon sysfs /devices/platform/11500000.mali/dma_buf_gpu_mem u:object_r:sysfs_gpu:s0
genfscon sysfs /devices/platform/11500000.mali/total_gpu_mem u:object_r:sysfs_gpu:s0
genfscon sysfs /devices/platform/11500000.mali/kprcs u:object_r:sysfs_gpu:s0
+genfscon sysfs /devices/platform/13200000.usb/13200000.dwc3/udc/13200000.dwc3/current_speed u:object_r:sysfs_usb:s0
genfscon sysfs /devices/platform/13900000.spi/spi_master/spi6/spi6.0/input/input0/enabled u:object_r:sysfs_touchscreen_writable:s0
genfscon sysfs /devices/platform/13900000.spi/spi_master/spi6/spi6.0/input/input1/enabled u:object_r:sysfs_touchscreen_writable:s0
genfscon sysfs /devices/platform/13840000.i2c/i2c-1/1-0049/sm5713-fuelgauge/power_supply/sm5713-fuelgauge/type u:object_r:sysfs_battery:s0