summaryrefslogtreecommitdiff
path: root/rootdir/bin/init.qcom.usb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rootdir/bin/init.qcom.usb.sh')
-rw-r--r--[-rwxr-xr-x]rootdir/bin/init.qcom.usb.sh131
1 files changed, 55 insertions, 76 deletions
diff --git a/rootdir/bin/init.qcom.usb.sh b/rootdir/bin/init.qcom.usb.sh
index 4a18c40..28e8324 100755..100644
--- a/rootdir/bin/init.qcom.usb.sh
+++ b/rootdir/bin/init.qcom.usb.sh
@@ -29,43 +29,20 @@
#
# Set platform variables
-if [ -f /sys/devices/soc0/hw_platform ]; then
- soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
-else
- soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
-fi
-
-if [ -f /sys/devices/soc0/machine ]; then
- soc_machine=`cat /sys/devices/soc0/machine` 2> /dev/null
-else
- soc_machine=`cat /sys/devices/system/soc/soc0/machine` 2> /dev/null
-fi
+soc_hwplatform=`cat /sys/devices/soc0/hw_platform 2> /dev/null`
+soc_machine=`cat /sys/devices/soc0/machine 2> /dev/null`
+soc_machine=${soc_machine:0:2}
+soc_id=`cat /sys/devices/soc0/soc_id 2> /dev/null`
#
-# Check ESOC for external MDM
+# Check ESOC for external modem
#
-# Note: currently only a single MDM is supported
+# Note: currently only a single MDM/SDX is supported
#
-if [ -d /sys/bus/esoc/devices ]; then
-for f in /sys/bus/esoc/devices/*; do
- if [ -d $f ]; then
- if [ `grep -e "^MDM" -e "^SDX" $f/esoc_name` ]; then
- esoc_link=`cat $f/esoc_link`
- break
- fi
- fi
-done
-fi
+esoc_name=`cat /sys/bus/esoc/devices/esoc0/esoc_name 2> /dev/null`
target=`getprop ro.board.platform`
-# soc_ids for 8937
-if [ -f /sys/devices/soc0/soc_id ]; then
- soc_id=`cat /sys/devices/soc0/soc_id`
-else
- soc_id=`cat /sys/devices/system/soc/soc0/id`
-fi
-
if [ -f /sys/class/android_usb/f_mass_storage/lun/nofua ]; then
echo 1 > /sys/class/android_usb/f_mass_storage/lun/nofua
fi
@@ -74,13 +51,11 @@ fi
# Override USB default composition
#
# If USB persist config not set, set default configuration
-miui_release=`getprop ro.fota.oem`
-miui_debuggable=`getprop ro.debuggable`
if [ "$(getprop persist.vendor.usb.config)" == "" -a \
"$(getprop init.svc.vendor.usb-gadget-hal-1-0)" != "running" ]; then
- if [ "$esoc_link" != "" ]; then
+ if [ "$esoc_name" != "" ]; then
setprop persist.vendor.usb.config diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb
- else
+ else
case "$(getprop ro.baseband)" in
"apq")
setprop persist.vendor.usb.config diag,adb
@@ -91,16 +66,12 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a \
setprop persist.vendor.usb.config diag,adb
;;
*)
- soc_machine=${soc_machine:0:3}
case "$soc_machine" in
- "SDA")
+ "SA")
setprop persist.vendor.usb.config diag,adb
;;
*)
case "$target" in
- "msm8996")
- setprop persist.vendor.usb.config diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,adb
- ;;
"msm8909")
setprop persist.vendor.usb.config diag,serial_smd,rmnet_qti_bam,adb
;;
@@ -110,7 +81,6 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a \
else
case "$soc_id" in
"313" | "320")
- echo BAM2BAM_IPA > /sys/class/android_usb/android0/f_rndis_qc/rndis_transports
setprop persist.vendor.usb.config diag,serial_smd,rmnet_ipa,adb
;;
*)
@@ -126,34 +96,20 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a \
setprop persist.vendor.usb.config diag,serial_smd,rmnet_ipa,adb
fi
;;
- "msm8998" | "sdm660" | "sdm636"| "apq8098_latv")
- case "$miui_release" in
- "")
- case "$miui_debuggable" in
- "1")
- setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb
- ;;
- *)
- setprop persist.vendor.usb.config diag,serial_cdev,rmnet
- ;;
- esac
- ;;
- *)
- case "$miui_debuggable" in
- "1")
- setprop persist.vendor.usb.config adb
- ;;
- *)
- setprop persist.vendor.usb.config none
- ;;
- esac
- ;;
- esac
- ;;
+ "msm8996")
+ if [ -d /config/usb_gadget ]; then
+ setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb
+ else
+ setprop persist.vendor.usb.config diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,adb
+ fi
+ ;;
+ "msm8998" | "sdm660" | "apq8098_latv")
+ setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb
+ ;;
"sdm845" | "sdm710")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb
;;
- "msmnile" | "talos")
+ "msmnile" | "sm6150" | "trinket")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb
;;
*)
@@ -169,6 +125,20 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a \
fi
fi
+# Start peripheral mode on primary USB controllers for Automotive platforms
+case "$soc_machine" in
+ "SA")
+ if [ -f /sys/bus/platform/devices/a600000.ssusb/mode ]; then
+ default_mode=`cat /sys/bus/platform/devices/a600000.ssusb/mode`
+ case "$default_mode" in
+ "none")
+ echo peripheral > /sys/bus/platform/devices/a600000.ssusb/mode
+ ;;
+ esac
+ fi
+ ;;
+esac
+
# set rndis transport to BAM2BAM_IPA for 8920 and 8940
if [ "$target" == "msm8937" ]; then
if [ ! -d /config/usb_gadget ]; then
@@ -179,19 +149,28 @@ if [ "$target" == "msm8937" ]; then
*)
;;
esac
+ else
+ case "$soc_id" in
+ "313" | "320")
+ setprop vendor.usb.rndis.func.name "rndis_bam"
+ setprop vendor.usb.rmnet.func.name "rmnet_bam"
+ setprop vendor.usb.rmnet.inst.name "rmnet"
+ setprop vendor.usb.dpl.inst.name "dpl"
+ ;;
+ *)
+ ;;
+ esac
fi
fi
-# set device mode notification to USB driver for SA8150 Auto ADP
-product=`getprop ro.build.product`
-
-case "$product" in
- "msmnile_au")
- echo peripheral > /sys/bus/platform/devices/a600000.ssusb/mode
- ;;
- *)
- ;;
-esac
+if [ "$target" == "msm8996" ]; then
+ if [ -d /config/usb_gadget ]; then
+ setprop vendor.usb.rndis.func.name "rndis_bam"
+ setprop vendor.usb.rmnet.func.name "rmnet_bam"
+ setprop vendor.usb.rmnet.inst.name "rmnet"
+ setprop vendor.usb.dpl.inst.name "dpl"
+ fi
+fi
# check configfs is mounted or not
if [ -d /config/usb_gadget ]; then
@@ -203,7 +182,7 @@ if [ -d /config/usb_gadget ]; then
echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product
# ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy
- serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber` 2> /dev/null
+ serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber 2> /dev/null`
if [ "$serialnumber" == "" ]; then
serialno=1234567
echo $serialno > /config/usb_gadget/g1/strings/0x409/serialnumber