Merge tag 'LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/usb into lineage-21.0
"LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0"
* tag 'LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/usb:
Add minimal USB init RC for QMAA
USB GADGET HAL: Update HAL to version 1.2
init.qcom.usb.sh: Configure RNDIS to be identified by Windows
init.qti.debug.sh: Add support to enable NCM functionality
USB: HAL: Add AUDIO_ACCESSORY as one of the supported modes
init.qti.usb.debug: Remove unwanted events from usb instance
USB: HAL: handling readFile failure on device path
USB: Solving path traversal issue in USB HAL AppendNodeMapper
init.qcom.usb: Set default composition to 90DB for Ravelin
init.qcom.usb.sh: do not set vendor.usb.rndis.func.name on Anorak
init.qti.usb.debug: Enable readl/writel ftraces of dwc3
UsbGadgetHal: Add null check in getCurrentUsbFunctions()
USB: Use SW path for QDSS over USB
USB: Enable USB Gadget HAL for Anorak
init.qti.debug.sh: Add support to enable ftraces for xhci on usb
init.qcom.usb.sh: Set default composition to 9060 for Anorak
init.qti.usb.debug: Enable RPM ftrace with dwc3 msm device
init.qcom.usb.sh: Set default composition to 9060 for Neo
init.qcom.usb.rc: Add support for diag_cnss comp for non IPA targets
USBGadgetHAL: Add diag,diag_cnss,adb to supported composition list
USB: Enable USBGadget HAL for Parrot
init.qcom.usb: Set default composition to 90DB for parrot
USB: Use SW path for QDSS over USB
USB: Enable USBGadget HAL for Neo
USB: Use USB QDSS data over SW path on Neo
init.qcom.usb.sh: Pass blank MSM serial number for virtual Android
USB: Use USB QDSS data over SW path on parrot
init.qcom.usb.rc: Add uvc declarations under a trigger in rc
init.qti.usb.debug.sh: Enable DWC3 core runtime resume/suspend ftrace
USBGadgetHAL: Read supported compositions from file
USB HAL: Bind UDC to ConfigFS when re-added
USB: Set sys.usb.mtp.batchcancel for targets using mtp over ffs
USB: Enable USBGadget HAL for kalama
Revert "USB: Enable USBGadget HAL for Taro"
Conflicts:
etc/init.qcom.usb.rc
etc/init.qcom.usb.sh
etc/init.qti.usb.debug.sh
etc/init.qti.usb.qmaa.rc
hal/Usb.cpp
hal/usb_compositions.conf
vendor_product.mk
Change-Id: I72263ede3b2f5eb5b8526a2a1a591af13b7667b8
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..1f46454
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/usb
diff --git a/etc/init.qcom.usb.rc b/etc/init.qcom.usb.rc
index 8ce0b5e..f22df65 100644
--- a/etc/init.qcom.usb.rc
+++ b/etc/init.qcom.usb.rc
@@ -45,9 +45,11 @@
exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qcom.usb.sh
write /config/usb_gadget/g1/strings/0x409/product ${vendor.usb.product_string}
setprop sys.usb.config mass_storage
+ setprop sys.usb.controller ${vendor.usb.controller}
+ wait /sys/class/udc/${sys.usb.controller}
setprop sys.usb.configfs 1
-on post-fs
+on post-fs-data
mount configfs none /config
mkdir /config/usb_gadget/g1 0770
mkdir /config/usb_gadget/g2 0770
@@ -114,7 +116,7 @@
write /config/usb_gadget/g1/strings/0x409/product ${vendor.usb.product_string}
write /config/usb_gadget/g2/strings/0x409/product ${vendor.usb.product_string}
-on post-fs && property:vendor.usb.use_ffs_mtp=1
+on post-fs-data && property:vendor.usb.use_ffs_mtp=1
mkdir /config/usb_gadget/g1/functions/ffs.mtp
mkdir /config/usb_gadget/g1/functions/ffs.ptp
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
@@ -1806,45 +1808,124 @@
on property:vendor.usb.uvc.function.init=1
write /config/usb_gadget/g1/functions/uvc.0/streaming_maxpacket 3072
- write /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst 1
+ write /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst 10
mkdir /config/usb_gadget/g1/functions/uvc.0/control/header/h
symlink /config/usb_gadget/g1/functions/uvc.0/control/header/h /config/usb_gadget/g1/functions/uvc.0/control/class/fs/h
symlink /config/usb_gadget/g1/functions/uvc.0/control/header/h /config/usb_gadget/g1/functions/uvc.0/control/class/ss/h
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/360p
- write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/360p/dwFrameInterval "666666\n1000000\n5000000\n"
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/360p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/360p/dwDefaultFrameInterval 333333
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p
write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/wWidth 1280
write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/wHeight 720
write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwMinBitRate 29491200
write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwMaxBitRate 29491200
write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwMaxVideoFrameBufferSize 1843200
- write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwDefaultFrameInterval 5000000
- write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwFrameInterval "5000000\n"
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/720p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/wWidth 1920
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/wHeight 1080
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/dwMinBitRate 66355200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/dwMaxBitRate 995328000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/dwMaxVideoFrameBufferSize 4147200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u/1080p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u1
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u1/360p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u1/360p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u1/360p/dwDefaultFrameInterval 333333
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/wWidth 640
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/wHeight 360
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/dwMinBitRate 18432000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/dwMaxBitRate 55296000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/dwMaxVideoFrameBufferSize 460800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/360p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/wWidth 1280
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/wHeight 720
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/dwMinBitRate 29491200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/dwMaxBitRate 29491200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/dwMaxVideoFrameBufferSize 1843200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/720p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/wWidth 1920
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/wHeight 1080
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/dwMinBitRate 66355200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/dwMaxBitRate 995328000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/dwMaxVideoFrameBufferSize 4147200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/1080p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p
- write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwFrameInterval "666666\n1000000\n5000000\n"
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/wWidth 640
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/wHeight 360
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwMinBitRate 18432000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwMaxBitRate 55296000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwMaxVideoFrameBufferSize 460800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/360p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wWidth 1280
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wHeight 720
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMinBitRate 29491200
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMaxBitRate 29491200
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize 1843200
- write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwDefaultFrameInterval 5000000
- write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwFrameInterval "5000000\n"
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wWidth 1920
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wHeight 1080
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMinBitRate 66355200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMaxBitRate 995328000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMaxVideoFrameBufferSize 4147200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/wWidth 2560
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/wHeight 1440
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/dwMinBitRate 117964800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/dwMaxBitRate 1769472000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/dwMaxVideoFrameBufferSize 7372800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1440p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/wWidth 3840
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/wHeight 2160
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/dwMinBitRate 265420800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/dwMaxBitRate 3981312000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/dwMaxVideoFrameBufferSize 16588800
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/2160p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bmaControls 0x04
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1/bmaControls 0x04
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h
- mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/960p
- write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/960p/wWidth 1920
- write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/960p/wHeight 960
- write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/960p/bLevelIDC 40
- write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/960p/dwFrameInterval "333667\n"
- mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1920p
- write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1920p/dwFrameInterval "333667\n"
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/wWidth 1920
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/wHeight 1080
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/bLevelIDC 40
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/dwMinBitRate 66355200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/dwMaxBitRate 995328000
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/dwMaxVideoFrameBufferSize 4147200
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/dwDefaultFrameInterval 333333
+ write /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h/1080p/dwFrameInterval 333333\n666666\n1000000\n5000000\n
mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/header/h
+ mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/header/h1
+ symlink /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u1 /config/usb_gadget/g1/functions/uvc.0/streaming/header/h1/u1
+ symlink /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m1 /config/usb_gadget/g1/functions/uvc.0/streaming/header/h1/h1
symlink /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed/u /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/u
symlink /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/m
- symlink /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h /config/usb_gadget/g1/functions/uvc.0/streaming/header/h
- symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/fs/h
- symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/hs/h
+ symlink /config/usb_gadget/g1/functions/uvc.0/streaming/h264/h /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/h
+ symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h1 /config/usb_gadget/g1/functions/uvc.0/streaming/class/fs/h1
+ symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h1 /config/usb_gadget/g1/functions/uvc.0/streaming/class/hs/h1
symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/ss/h
+
+on property:vendor.usb.uac2.function.init=1
+ chown system system config/usb_gadget/g1/functions/uac2.0/c_status
+ chown system system config/usb_gadget/g1/functions/uac2.0/p_status
+ write config/usb_gadget/g1/functions/uac2.0/c_sync adaptive
diff --git a/etc/init.qcom.usb.sh b/etc/init.qcom.usb.sh
index 94a5673..6488772 100644
--- a/etc/init.qcom.usb.sh
+++ b/etc/init.qcom.usb.sh
@@ -106,10 +106,13 @@
"msm8998" | "sdm660" | "apq8098_latv")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb
;;
+ "monaco")
+ setprop persist.vendor.usb.config diag,qdss,rmnet,adb
+ ;;
"sdm845" | "sdm710")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb
;;
- "msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina" | "holi" | "taro" | "parrot" | "ravelin")
+ "msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina" | "holi" | "taro" | "parrot" | "ravelin" | "kalama" | "crow")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb
;;
*)
@@ -147,15 +150,21 @@
# check configfs is mounted or not
if [ -d /config/usb_gadget ]; then
- # Chip-serial is used for unique MSM identification in Product string
- msm_serial=`cat /sys/devices/soc0/serial_number`;
- # If MSM serial number is not available, then keep it blank instead of 0x00000000
- if [ "$msm_serial" != "" ]; then
- msm_serial_hex=`printf %08X $msm_serial`
+ machine_type=`cat /sys/devices/soc0/machine`
+
+ # Chip ID & serial are used for unique MSM identification in Product String
+ # If not present, then omit them instead of using 0x00000000
+ msm_chipid=`cat /sys/devices/soc0/nproduct_id`;
+ if [ "$msm_chipid" != "" ]; then
+ msm_chipid_hex=`printf _CID:%04X $msm_chipid`
fi
- machine_type=`cat /sys/devices/soc0/machine`
- setprop vendor.usb.product_string "$machine_type-$soc_hwplatform _SN:$msm_serial_hex"
+ msm_serial=`cat /sys/devices/soc0/serial_number`;
+ if [ "$msm_serial" != "" ]; then
+ msm_serial_hex=`printf _SN:%08X $msm_serial`
+ fi
+
+ setprop vendor.usb.product_string "$machine_type-$soc_hwplatform$msm_chipid_hex$msm_serial_hex"
# ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy
serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber 2> /dev/null`
@@ -189,6 +198,10 @@
setprop vendor.usb.uvc.function.init 1
fi
+if [ -d /config/usb_gadget/g1/functions/uac2.0 ]; then
+ setprop vendor.usb.uac2.function.init 1
+fi
+
# enable ncm
case "$target" in
"neo" | "anorak")
diff --git a/etc/init.qti.usb.debug.sh b/etc/init.qti.usb.debug.sh
index a2866c4..c341490 100644
--- a/etc/init.qti.usb.debug.sh
+++ b/etc/init.qti.usb.debug.sh
@@ -27,8 +27,41 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
-# SPDX-License-Identifier: BSD-3-Clause-Clear
+#
+# Changes from Qualcomm Innovation Center are provided under the following license:
+#
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted (subject to the limitations in the
+# disclaimer below) provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+# GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+# HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
prop_enabled=`getprop persist.vendor.usb.enable_ftrace 0`
@@ -41,42 +74,60 @@
tracefs=/sys/kernel/tracing
if [ -d $tracefs ]; then
- mkdir $tracefs/instances/usb
+ cd $tracefs
+
+ # global kprobe events
+ echo 'p:usb_gadget/p_config_usb_cfg_link_0 config_usb_cfg_link cfg=+0(+0($arg1)):string func=+0(+0($arg2)):string' >> kprobe_events
+ echo 'r:usb_gadget/r_config_usb_cfg_link_0 config_usb_cfg_link ret=$retval:s32' >> kprobe_events
+ echo 'p:usb_gadget/p_config_usb_cfg_unlink_0 config_usb_cfg_unlink cfg=+0(+0($arg1)):string func=+0(+0($arg2)):string' >> kprobe_events
+ echo 'p:usb_gadget/p_gadget_dev_desc_UDC_store_0 gadget_dev_desc_UDC_store udc=+0($arg2):string' >> kprobe_events
+ echo 'r:usb_gadget/r_gadget_dev_desc_UDC_store_0 gadget_dev_desc_UDC_store ret=$retval:s32' >> kprobe_events
+ echo 'p:usb_gadget/p_unregister_gadget_item_0 unregister_gadget_item gadget=+0(+0($arg1)):string' >> kprobe_events
+
+ # usb instances
+ mkdir instances/usb
+ cd instances/usb
# dwc3
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_complete_trb/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_ctrl_req/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_ep_dequeue/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_ep_queue/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_gadget_ep_cmd/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_gadget_ep_disable/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_gadget_ep_enable/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_gadget_giveback/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_prepare_trb/enable
- echo 1 > $tracefs/instances/usb/events/dwc3/dwc3_event/enable
+ echo 1 > events/dwc3/dwc3_complete_trb/enable
+ echo 1 > events/dwc3/dwc3_ctrl_req/enable
+ echo 1 > events/dwc3/dwc3_ep_dequeue/enable
+ echo 1 > events/dwc3/dwc3_ep_queue/enable
+ echo 1 > events/dwc3/dwc3_gadget_ep_cmd/enable
+ echo 1 > events/dwc3/dwc3_gadget_ep_disable/enable
+ echo 1 > events/dwc3/dwc3_gadget_ep_enable/enable
+ echo 1 > events/dwc3/dwc3_gadget_giveback/enable
+ echo 1 > events/dwc3/dwc3_prepare_trb/enable
+ echo 1 > events/dwc3/dwc3_event/enable
+ echo 1 > events/dwc3/dwc3_alloc_request/enable
+ echo 1 > events/dwc3/dwc3_free_request/enable
+ echo 1 > events/dwc3/dwc3_gadget_generic_cmd/enable
# ucsi
- echo 1 > $tracefs/instances/usb/events/ucsi/ucsi_connector_change/enable
- echo 1 > $tracefs/instances/usb/events/ucsi/ucsi_reset_ppm/enable
- echo 1 > $tracefs/instances/usb/events/ucsi/ucsi_run_command/enable
+ echo 1 > events/ucsi/ucsi_connector_change/enable
+ echo 1 > events/ucsi/ucsi_reset_ppm/enable
+ echo 1 > events/ucsi/ucsi_run_command/enable
- #USB gadget
- echo 1 > $tracefs/instances/usb/events/gadget/usb_gadget_disconnect/enable
- echo 1 > $tracefs/instances/usb/events/gadget/usb_gadget_connect/enable
- echo 1 > $tracefs/instances/usb/events/gadget/usb_gadget_vbus_draw/enable
+ # USB gadget
+ echo 1 > events/gadget/usb_gadget_disconnect/enable
+ echo 1 > events/gadget/usb_gadget_connect/enable
+ echo 1 > events/gadget/usb_gadget_vbus_draw/enable
+
+ # usb instance kprobe events
+ echo 1 > events/usb_gadget/enable
#DWC3 core runtime
- echo 'name~"a600000.*"' > $tracefs/instances/usb/events/rpm/filter
- echo 1 > $tracefs/instances/usb/events/rpm/rpm_resume/enable
- echo 1 > $tracefs/instances/usb/events/rpm/rpm_suspend/enable
- echo 1 > $tracefs/instances/usb/events/rpm/rpm_return_int/enable
+ echo 'name~"a600000.*"' > events/rpm/filter
+ echo 1 > events/rpm/rpm_resume/enable
+ echo 1 > events/rpm/rpm_suspend/enable
+ echo 1 > events/rpm/rpm_return_int/enable
#xhci
mkdir $tracefs/instances/usb_xhci
echo 1 > $tracefs/instances/usb_xhci/events/xhci-hcd/enable
echo 1 > $tracefs/instances/usb_xhci/tracing_on
- echo 1 > $tracefs/instances/usb/tracing_on
+ echo 1 > tracing_on
#dwc3_readl_writel
mkdir $tracefs/instances/dwc3_rw_traces
diff --git a/etc/init.qti.usb.qmaa.rc b/etc/init.qti.usb.qmaa.rc
index 18d4751..c56dee4 100644
--- a/etc/init.qti.usb.qmaa.rc
+++ b/etc/init.qti.usb.qmaa.rc
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause-Clear
on init
diff --git a/hal/Android.bp b/hal/Android.bp
index 4cccf13..854319f 100644
--- a/hal/Android.bp
+++ b/hal/Android.bp
@@ -38,7 +38,7 @@
shared_libs: [
"android.hardware.usb.gadget@1.0",
"android.hardware.usb.gadget@1.1",
- "android.hardware.usb.gadget@1.2",
+ "android.hardware.usb.gadget@1.2",
],
static_libs: [
"libusbconfigfs-2"
diff --git a/hal/Usb.cpp b/hal/Usb.cpp
index 06b60b1..418f43c 100644
--- a/hal/Usb.cpp
+++ b/hal/Usb.cpp
@@ -15,6 +15,10 @@
* 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.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "android.hardware.usb@1.2-service-qti"
@@ -54,6 +58,8 @@
// Set by the signal handler to destroy the thread
volatile bool destroyThread;
+// USB bus reset recovery active
+int usbResetRecov;
static void checkUsbWakeupSupport(struct Usb *usb);
static void checkUsbInHostMode(struct Usb *usb);
@@ -730,12 +736,16 @@
static void uevent_event(uint32_t /*epevents*/, struct data *payload) {
char msg[UEVENT_MSG_LEN + 2];
- int n;
+ int n, ret;
std::string gadgetName = GetProperty(USB_CONTROLLER_PROP, "");
static std::regex add_regex("add@(/devices/platform/soc/.*dwc3/xhci-hcd\\.\\d\\.auto/"
"usb\\d/\\d-\\d(?:/[\\d\\.-]+)*)");
+ static std::regex remove_regex("remove@((/devices/platform/soc/.*dwc3/xhci-hcd\\.\\d\\.auto/"
+ "usb\\d)/\\d-\\d(?:/[\\d\\.-]+)*)");
static std::regex bind_regex("bind@(/devices/platform/soc/.*dwc3/xhci-hcd\\.\\d\\.auto/"
"usb\\d/\\d-\\d(?:/[\\d\\.-]+)*)/([^/]*:[^/]*)");
+ static std::regex bus_reset_regex("change@(/devices/platform/soc/.*dwc3/xhci-hcd\\.\\d\\.auto/"
+ "usb\\d/\\d-\\d(?:/[\\d\\.-]+)*)/([^/]*:[^/]*)");
static std::regex udc_regex("(add|remove)@/devices/platform/soc/.*/" + gadgetName +
"/udc/" + gadgetName);
@@ -764,6 +774,31 @@
std::csub_match intfpath = match[2];
checkUsbInterfaceAutoSuspend("/sys" + devpath.str(), intfpath.str());
}
+ } else if (std::regex_match(msg, match, bus_reset_regex)) {
+ std::csub_match devpath = match[1];
+ std::csub_match intfpath = match[2];
+
+ ALOGI("Handling USB bus reset recovery");
+
+ // Limit the recovery to when an audio device is connected directly to
+ // the roothub. A path reference is needed so other non-audio class
+ // related devices don't trigger the disconnectMon. (unbind uevent occurs
+ // after sysfs files are cleaned, can't check bInterfaceClass)
+ usbResetRecov = 1;
+ ret = writeFile("/sys" + devpath.str() + "/../authorized", "0");
+ if (ret < 0)
+ ALOGI("unable to deauthorize device");
+ } else if (std::regex_match(msg, match, remove_regex)) {
+ std::csub_match devpath = match[1];
+ std::csub_match parentpath = match[2];
+
+ ALOGI("Disconnect received");
+ if (usbResetRecov) {
+ usbResetRecov = 0;
+ //Allow interfaces to disconnect
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ writeFile("/sys" + parentpath.str() + "/authorized", "1");
+ }
} else if (std::regex_match(msg, match, udc_regex)) {
if (!strncmp(msg, "add", 3)) {
// Allow ADBD to resume its FFS monitor thread
diff --git a/hal/UsbGadget.cpp b/hal/UsbGadget.cpp
index f3ddfba..d2c2e67 100644
--- a/hal/UsbGadget.cpp
+++ b/hal/UsbGadget.cpp
@@ -101,6 +101,30 @@
}
}
+static std::map<std::string, std::tuple<std::string, std::string, std::string> >
+supported_compositions;
+
+static void createCompositionsMap(std:: string fileName) {
+ std::ifstream compositions(fileName);
+ std::string line;
+
+ while (std::getline(compositions, line)) {
+ std::string prop;
+ std::tuple<std::string, std::string, std::string> vpa;
+ // Ignore comments in the file
+ auto pos = line.find('#');
+ if (pos != std::string::npos)
+ line.erase(pos);
+
+ std::stringstream words(line);
+
+ words >> prop >> std::get<0>(vpa) >> std::get<1>(vpa) >> std::get<2>(vpa);
+ // If we get vpa[1], we have the three minimum values needed. Or else we skip
+ if (!std::get<1>(vpa).empty())
+ supported_compositions.insert_or_assign(prop, vpa);
+ }
+}
+
UsbGadget::UsbGadget(const char* const gadget)
: mCurrentUsbFunctionsApplied(false),
mMonitorFfs(gadget) {
@@ -280,7 +304,7 @@
V1_0::Status ret = Status::SUCCESS;
switch (functions) {
case static_cast<uint64_t>(GadgetFunction::ADB):
- ret = setVidPid("0x18d1", "0x4ee7");
+ ret = setVidPid("0x18d1", "0x4e11");
break;
case static_cast<uint64_t>(GadgetFunction::MTP):
ret = setVidPid("0x18d1", "0x4ee1");
diff --git a/vendor_product.mk b/vendor_product.mk
index ea98d7a..674cf8b 100644
--- a/vendor_product.mk
+++ b/vendor_product.mk
@@ -1,3 +1,4 @@
+#
# Default property overrides for various function configurations
# These can be further overridden at runtime in init*.rc files as needed
#
@@ -11,8 +12,19 @@
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rmnet.inst.name=rmnet
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.dpl.inst.name=dpl
+ifneq ($(filter bengal monaco trinket,$(TARGET_BOARD_PLATFORM)),)
+ PRODUCT_PROPERTY_OVERRIDES += vendor.usb.controller=4e00000.dwc3
+ ifneq ($(filter bengal,$(TARGET_BOARD_PLATFORM)),)
+ PRODUCT_SYSTEM_PROPERTIES += ro.boot.usb.dwc3_msm=4e00000.ssusb
+ else
+ PRODUCT_SYSTEM_PROPERTIES += ro.boot.usb.dwc3_msm=4e00000.hsusb
+ endif
+else
+ PRODUCT_PROPERTY_OVERRIDES += vendor.usb.controller=a600000.dwc3
+endif
+
# QDSS uses SW path on these targets
-ifneq ($(filter lahaina taro parrot neo anorak ravelin,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter lahaina taro parrot neo anorak ravelin bengal kalama monaco kona crow trinket,$(TARGET_BOARD_PLATFORM)),)
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.qdss.inst.name=qdss_sw
else
PRODUCT_PROPERTY_OVERRIDES += vendor.usb.qdss.inst.name=qdss
@@ -35,19 +47,29 @@
PRODUCT_PACKAGES += android.hardware.usb@1.2-service-qti
endif
+USB_USES_QMAA = $(TARGET_USES_QMAA)
+ifeq ($(TARGET_USES_QMAA_OVERRIDE_USB),true)
+ USB_USES_QMAA = false
+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
+ #
+ # USB Gadget HAL is enabled on newer targets and takes the place
+ # of the init-based configfs rules for setting USB compositions
+ #
+ ifneq ($(filter taro kalama neo parrot anorak bengal monaco kona crow trinket,$(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
+
endif
# additional debugging on userdebug/eng builds