From ef172e02c1bb8265691dddf190315358482ef037 Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Wed, 14 Feb 2024 11:38:15 +0100 Subject: [PATCH] mt6765-common: rootdir: Checkout usb init scripts to 11 --- rootdir/etc/init.mt6765.usb.rc | 88 +++++++++++++++------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/rootdir/etc/init.mt6765.usb.rc b/rootdir/etc/init.mt6765.usb.rc index f002fbc..41db120 100644 --- a/rootdir/etc/init.mt6765.usb.rc +++ b/rootdir/etc/init.mt6765.usb.rc @@ -3,7 +3,7 @@ on early-init on post-fs setprop vendor.usb.vid "0x0E8D" - mkdir /dev/usb-ffs 0775 shell shell + mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mkdir /config/usb_gadget/g1 0770 shell shell write /config/usb_gadget/g1/idVendor ${vendor.usb.vid} @@ -17,9 +17,9 @@ on post-fs mkdir /config/usb_gadget/g1/functions/accessory.gs2 mkdir /config/usb_gadget/g1/functions/audio_source.gs3 mkdir /config/usb_gadget/g1/functions/ffs.adb - mkdir /config/usb_gadget/g1/functions/ffs.mtp - write /config/usb_gadget/g1/functions/ffs.mtp/os_desc/interface.MTP/compatible_id "MTP" - mkdir /config/usb_gadget/g1/functions/ffs.ptp + mkdir /config/usb_gadget/g1/functions/mtp.gs0 + write /config/usb_gadget/g1/functions/mtp.gs0/os_desc/interface.MTP/compatible_id "MTP" + mkdir /config/usb_gadget/g1/functions/ptp.gs1 mkdir /config/usb_gadget/g1/functions/rndis.gs4 mkdir /config/usb_gadget/g1/functions/midi.gs5 mkdir /config/usb_gadget/g1/functions/acm.gs0 @@ -37,11 +37,7 @@ on post-fs write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" write /config/usb_gadget/g1/configs/b.1/MaxPower 500 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 - mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1 - mkdir /dev/usb-ffs/mtp 0770 mtp mtp - mkdir /dev/usb-ffs/ptp 0770 mtp mtp - 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 + mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 on boot setprop sys.usb.configfs 1 @@ -160,23 +156,23 @@ property:sys.usb.configfs=1 setprop vendor.usb.pid 0x202A on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=1 && \ -property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1 +property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_acm" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /config/usb_gadget/g1/os_desc/use 1 write /sys/devices/platform/mt_usb/saving 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=0 && \ -property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1 +property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -193,12 +189,12 @@ property:sys.usb.configfs=1 setprop vendor.usb.pid 0x2026 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \ -property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1 +property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb_acm" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /config/usb_gadget/g1/os_desc/use 1 write /sys/devices/platform/mt_usb/saving 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4 @@ -206,11 +202,11 @@ property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vend setprop sys.usb.state ${sys.usb.config} on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \ -property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1 +property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -228,21 +224,21 @@ property:sys.usb.configfs=1 setprop vendor.usb.pid 0x202B on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=1 && \ -property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1 +property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_acm" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /sys/devices/platform/mt_usb/saving 1 - symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=0 && \ -property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1 +property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} - symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -259,11 +255,11 @@ property:sys.usb.configfs=1 setprop vendor.usb.pid 0x2027 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \ -property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1 +property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb_acm" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} write /sys/devices/platform/mt_usb/saving 1 - symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4 @@ -271,10 +267,10 @@ property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vend setprop sys.usb.state ${sys.usb.config} on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \ -property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1 +property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb" write /config/usb_gadget/g1/idProduct ${vendor.usb.pid} - symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -686,8 +682,6 @@ on property:sys.usb.config=acm_gs0gs1 setprop sys.usb.config ${sys.usb.state} setprop vendor.usb.acm_idx "1,2" -on property:persist.vendor.radio.port_index=1,4 && property:sys.boot_completed=1 - setprop sys.usb.config acm_gs0gs3 on property:sys.usb.config=gs3,dual_acm setprop sys.usb.config acm_gs0gs3 on property:sys.usb.config=mtp,gs3,dual_acm @@ -727,7 +721,7 @@ on property:sys.usb.config=acm_gs1gs3 setprop vendor.usb.acm_idx "2,4" # For ATM (Android Test Mode) -on property:vendor.usb.clear=1 && property:sys.usb.configfs=1 && property:sys.usb.ffs.ready=0 +on property:vendor.usb.clear=1 && property:sys.usb.configfs=1 write /config/usb_gadget/g1/UDC "none" write /config/usb_gadget/g1/bDeviceClass 0 write /config/usb_gadget/g1/bDeviceSubClass 0 @@ -765,7 +759,7 @@ property:vendor.usb.clear=2 && property:sys.usb.configfs=1 write /sys/class/udc/musb-hdrc/device/saving 1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "atm_gs0" write /config/usb_gadget/g1/idProduct 0x200A - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} @@ -791,7 +785,7 @@ property:vendor.usb.clear=2 && property:sys.usb.configfs=1 setprop vendor.usb.acm_enable 1 write /sys/class/udc/musb-hdrc/device/saving 1 write /config/usb_gadget/g1/idProduct 0x2026 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3 symlink /config/usb_gadget/g1/functions/acm.gs3 /config/usb_gadget/g1/configs/b.1/f4 @@ -806,7 +800,7 @@ on property:sys.usb.config=cdp && property:sys.usb.configfs=1 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp" write /config/usb_gadget/g1/idProduct 0x2008 write /config/usb_gadget/g1/os_desc/use 1 - symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 write /config/usb_gadget/g1/UDC ${vendor.usb.controller} setprop sys.usb.state ${sys.usb.config} setprop vendor.usb.pid 0x2008 @@ -824,7 +818,7 @@ on property:sys.usb.config=charging_no setprop vendor.usb.charging no on property:vendor.usb.charging=yes - write /sys/class/udc/musb-hdrc/device/cmode 0 + write /sys/class/udc/musb-hdrc/device/cmode 2 on property:vendor.usb.charging=no write /sys/class/udc/musb-hdrc/device/cmode 1 @@ -840,14 +834,18 @@ on property:vendor.usb.port.mode=usb on property:vendor.usb.port.mode=uart write /sys/devices/platform/mt_usb/portmode 1 -on property:vendor.em.usb.set=term_sel - write /proc/mtk_usb/usb-phy0/u2_phy/term_sel ${vendor.em.usb.value} -on property:vendor.em.usb.set=vrt_sel - write /proc/mtk_usb/usb-phy0/u2_phy/vrt_sel ${vendor.em.usb.value} -on property:vendor.em.usb.set=phy_rev6 - write /proc/mtk_usb/usb-phy0/u2_phy/phy_rev6 ${vendor.em.usb.value} -on property:vendor.em.usb.set=discth - write /proc/mtk_usb/usb-phy0/u2_phy/discth ${vendor.em.usb.value} +on property:vendor.em.usb.set=USB_DRIVING_CAPABILITY + write /sys/kernel/debug/usb20_phy/USB_DRIVING_CAPABILITY ${mediatek.em.usb.value} +on property:vendor.em.usb.set=RG_USB20_TERM_VREF_SEL + write /sys/kernel/debug/usb20_phy/RG_USB20_TERM_VREF_SEL ${mediatek.em.usb.value} +on property:vendor.em.usb.set=RG_USB20_HSTX_SRCTRL + write /sys/kernel/debug/usb20_phy/RG_USB20_HSTX_SRCTRL ${mediatek.em.usb.value} +on property:vendor.em.usb.set=RG_USB20_VRT_VREF_SEL + write /sys/kernel/debug/usb20_phy/RG_USB20_VRT_VREF_SEL ${mediatek.em.usb.value} +on property:vendor.em.usb.set=RG_USB20_INTR_EN + write /sys/kernel/debug/usb20_phy/RG_USB20_INTR_EN ${mediatek.em.usb.value} +on property:vendor.em.usb.set=RG_USB20_PHY_REV6 + write /sys/kernel/debug/usb20_phy/RG_USB20_PHY_REV6 ${mediatek.em.usb.value} on property:vendor.em.usb.bypass.enable=0 write /sys/class/usb_rawbulk/gps/enable 1 @@ -887,14 +885,4 @@ on property:vendor.usb.printk=* on property:persist.vendor.usb.printk=* setprop vendor.usb.printk ${persist.vendor.usb.printk} -on property:vendor.usb.testmode=0 - write /proc/mtk_usb/testmode "0" -on property:vendor.usb.testmode=1 - write /proc/mtk_usb/testmode "test SE0 NAK" -on property:vendor.usb.testmode=2 - write /proc/mtk_usb/testmode "test J" -on property:vendor.usb.testmode=3 - write /proc/mtk_usb/testmode "test K" -on property:vendor.usb.testmode=4 - write /proc/mtk_usb/testmode "test packet" ### PLATFORM VARIANT, cat $rc_file | grep write | sort | grep -vE "android0|usb20_phy" | awk '{print $2}' | uniq ### -- GitLab