Merge 42508d5f56a61c2513a4c8ba5fe22ea24946b216 on remote branch
Change-Id: Iaaebe90bd38ea63335fc6b603a2b8073920153a3
diff --git a/etc/Android.bp b/etc/Android.bp
index e90b151..fbb2503 100644
--- a/etc/Android.bp
+++ b/etc/Android.bp
@@ -23,3 +23,10 @@
src: "init.qti.usb.debug.sh",
vendor: true,
}
+
+prebuilt_etc {
+ name: "init.qti.usb.qmaa.rc",
+ src: "init.qti.usb.qmaa.rc",
+ vendor: true,
+ sub_dir: "init",
+}
diff --git a/etc/init.qti.usb.qmaa.rc b/etc/init.qti.usb.qmaa.rc
new file mode 100644
index 0000000..18d4751
--- /dev/null
+++ b/etc/init.qti.usb.qmaa.rc
@@ -0,0 +1,32 @@
+# Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+
+on init
+ mount configfs none /config
+ mkdir /config/usb_gadget/g1 0770
+ mkdir /config/usb_gadget/g1/strings/0x409 0770
+ write /config/usb_gadget/g1/bcdUSB 0x0200
+ write /config/usb_gadget/g1/os_desc/use 1
+ write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
+ write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
+ write /config/usb_gadget/g1/strings/0x409/product ${ro.product.name}
+ mkdir /config/usb_gadget/g1/functions/ffs.adb
+ mkdir /config/usb_gadget/g1/configs/b.1 0770
+ mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770
+ write /config/usb_gadget/g1/configs/b.1/MaxPower 900
+ write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
+ write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
+ mkdir /dev/usb-ffs 0775 shell system
+ mkdir /dev/usb-ffs/adb 0770 shell system
+ mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=1000,rmode=0770,fmode=0660
+ write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
+ symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
+ write /config/usb_gadget/g1/idVendor 0x18d1
+ write /config/usb_gadget/g1/idProduct 0x4ee7
+ symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
+ start adbd
+ setprop sys.usb.configfs -1
+
+on property:sys.usb.ffs.ready=1
+ write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
+ setprop sys.usb.state adb
diff --git a/vendor_product.mk b/vendor_product.mk
index 751e41b..ea98d7a 100644
--- a/vendor_product.mk
+++ b/vendor_product.mk
@@ -1,25 +1,3 @@
-# USB init scripts
-PRODUCT_PACKAGES += init.qcom.usb.rc init.qcom.usb.sh
-
-# additional debugging on userdebug/eng builds
-ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
- PRODUCT_PACKAGES += init.qti.usb.debug.sh
- PRODUCT_PACKAGES += init.qti.usb.debug.rc
-endif
-
-ifneq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),4.9 4.14))
- PRODUCT_PACKAGES += android.hardware.usb@1.2-service-qti
-endif
-
-ifneq ($(filter taro kalama neo parrot anorak,$(TARGET_BOARD_PLATFORM)),)
- PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=1
- PRODUCT_PACKAGES += android.hardware.usb.gadget@1.2-service-qti
- PRODUCT_PACKAGES += usb_compositions.conf
-else
- PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=0
-endif
-
-#
# Default property overrides for various function configurations
# These can be further overridden at runtime in init*.rc files as needed
#
@@ -28,6 +6,7 @@
else
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rndis.func.name=gsi
endif
+
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rmnet.func.name=gsi
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rmnet.inst.name=rmnet
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.dpl.inst.name=dpl
@@ -52,3 +31,27 @@
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_ffs_mtp=0
endif
+ifneq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),4.9 4.14))
+ PRODUCT_PACKAGES += android.hardware.usb@1.2-service-qti
+endif
+
+# USB init scripts
+ifeq ($(USB_USES_QMAA),true)
+ PRODUCT_PACKAGES += init.qti.usb.qmaa.rc
+else
+ PRODUCT_PACKAGES += init.qcom.usb.rc init.qcom.usb.sh
+endif
+
+ifneq ($(filter taro kalama neo parrot anorak,$(TARGET_BOARD_PLATFORM)),)
+ PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=1
+ PRODUCT_PACKAGES += android.hardware.usb.gadget@1.2-service-qti
+ PRODUCT_PACKAGES += usb_compositions.conf
+else
+ PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=0
+endif
+
+# additional debugging on userdebug/eng builds
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+ PRODUCT_PACKAGES += init.qti.usb.debug.sh
+ PRODUCT_PACKAGES += init.qti.usb.debug.rc
+endif