From 6bb87160375c4affbec396d2cf2be3d6a0e877f8 Mon Sep 17 00:00:00 2001 From: Demon000 Date: Thu, 16 Jul 2020 02:19:31 +0300 Subject: [PATCH] sm6250-common: rootdir: refactor usb configuration --- rootdir/etc/init.qcom.usb.rc | 179 +++++++++++++++++++++++------------ rootdir/etc/init.target.rc | 2 - 2 files changed, 116 insertions(+), 65 deletions(-) diff --git a/rootdir/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc index 110c451..7161872 100644 --- a/rootdir/etc/init.qcom.usb.rc +++ b/rootdir/etc/init.qcom.usb.rc @@ -26,89 +26,142 @@ # on charger - mkdir /dev/usb-ffs 0770 shell shell - mkdir /dev/usb-ffs/adb 0770 shell shell - mount configfs none /config mkdir /config/usb_gadget/g1 0770 shell shell - 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.model} - mkdir /config/usb_gadget/g1/functions/mass_storage.0 - mkdir /config/usb_gadget/g1/functions/ffs.adb - mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell - write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 - symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 - mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 - write /sys/class/android_usb/android0/f_ffs/aliases adb - setprop sys.usb.config mass_storage + mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell -on boot - write /sys/class/android_usb/android0/iSerial ${ro.serialno} - mount configfs none /config - mkdir /config/usb_gadget/g1 0770 - mkdir /config/usb_gadget/g2 0770 - mkdir /config/usb_gadget/g1/strings/0x409 0770 - mkdir /config/usb_gadget/g2/strings/0x409 0770 write /config/usb_gadget/g1/bcdUSB 0x0200 - write /config/usb_gadget/g2/bcdUSB 0x0200 write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} - write /config/usb_gadget/g2/strings/0x409/serialnumber ${ro.serialno} write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} - write /config/usb_gadget/g2/strings/0x409/manufacturer ${ro.product.manufacturer} write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} - write /config/usb_gadget/g2/strings/0x409/product ${ro.product.model} - mkdir /config/usb_gadget/g1/functions/mass_storage.0 mkdir /config/usb_gadget/g1/functions/mtp.gs0 mkdir /config/usb_gadget/g1/functions/ptp.gs1 mkdir /config/usb_gadget/g1/functions/accessory.gs2 mkdir /config/usb_gadget/g1/functions/audio_source.gs3 mkdir /config/usb_gadget/g1/functions/midi.gs5 mkdir /config/usb_gadget/g1/functions/ffs.adb - mkdir /config/usb_gadget/g1/functions/diag.diag - mkdir /config/usb_gadget/g1/functions/diag.diag_mdm - mkdir /config/usb_gadget/g1/functions/diag.diag_mdm2 - mkdir /config/usb_gadget/g1/functions/cser.dun.0 - mkdir /config/usb_gadget/g1/functions/cser.nmea.1 - mkdir /config/usb_gadget/g1/functions/cser.dun.2 mkdir /config/usb_gadget/g1/functions/gsi.rmnet mkdir /config/usb_gadget/g1/functions/gsi.rndis mkdir /config/usb_gadget/g1/functions/gsi.dpl - mkdir /config/usb_gadget/g1/functions/qdss.qdss - mkdir /config/usb_gadget/g1/functions/qdss.qdss_mdm - mkdir /config/usb_gadget/g1/functions/rndis_bam.rndis - mkdir /config/usb_gadget/g1/functions/rndis.rndis - mkdir /config/usb_gadget/g1/functions/rmnet_bam.rmnet - mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl - mkdir /config/usb_gadget/g1/functions/rmnet_bam.rmnet_bam_dmux - mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl_bam_dmux - mkdir /config/usb_gadget/g1/functions/ncm.0 - mkdir /config/usb_gadget/g1/functions/ccid.ccid - mkdir /config/usb_gadget/g1/functions/uac2.0 - mkdir /config/usb_gadget/g1/functions/uvc.0 - mkdir /config/usb_gadget/g1/configs/b.1 0770 - mkdir /config/usb_gadget/g2/configs/b.1 0770 - mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 - mkdir /config/usb_gadget/g2/configs/b.1/strings/0x409 0770 + + mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + + 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 + + setprop sys.usb.configfs 1 + setprop sys.usb.controller "a600000.dwc3" + setprop sys.mtp.device_type 2 + +on boot + mkdir /config/usb_gadget/g1 0770 shell shell + mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell + + write /config/usb_gadget/g1/bcdUSB 0x0200 + write /config/usb_gadget/g1/os_desc/use 1 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + + 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.model} + mkdir /config/usb_gadget/g1/functions/mtp.gs0 + mkdir /config/usb_gadget/g1/functions/ptp.gs1 + mkdir /config/usb_gadget/g1/functions/accessory.gs2 + mkdir /config/usb_gadget/g1/functions/audio_source.gs3 + mkdir /config/usb_gadget/g1/functions/midi.gs5 + mkdir /config/usb_gadget/g1/functions/ffs.adb + mkdir /config/usb_gadget/g1/functions/gsi.rmnet + mkdir /config/usb_gadget/g1/functions/gsi.rndis + mkdir /config/usb_gadget/g1/functions/gsi.dpl + + mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 - 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 /sys/class/android_usb/android0/f_ffs/aliases adb + + 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 + + setprop sys.usb.configfs 1 + setprop sys.usb.controller "a600000.dwc3" setprop sys.mtp.device_type 2 - setprop vendor.usb.controller ${sys.usb.controller} -on property:persist.vendor.usb.config=* - setprop persist.sys.usb.config ${persist.vendor.usb.config} +on property:sys.usb.config=rndis && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF80 + symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 + setprop sys.usb.state ${sys.usb.config} -on boot && property:ro.boot.usbconfigfs=true - setprop sys.usb.configfs 1 +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF88 + symlink /config/usb_gadget/g1/functions/gsi.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + setprop sys.usb.state ${sys.usb.config} -on property:vendor.usb.configfs=1 && property:sys.usb.configfs=0 - setprop sys.usb.configfs 1 +on property:sys.usb.config=adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x4ee7 + +on property:sys.usb.config=mtp && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xff40 + +on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xff48 + +on property:sys.usb.config=ptp && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xff10 + +on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xff18 + +on property:sys.usb.config=accessory && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d00 + +on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d01 + +on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d02 + +on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d03 + +on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d04 + +on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d05 + +on property:sys.usb.config=midi && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x4ee8 + +on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x4ee9 diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc index 437e2cc..4aee032 100644 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -206,8 +206,6 @@ on charger chmod 0771 /mnt/vendor/persist mkdir /mnt/vendor/persist/subsys 0770 root system start vendor.power_off_alarm - setprop sys.usb.controller a600000.dwc3 - setprop sys.usb.configfs 1 chown system system /sys/class/leds/red/brightness chmod 0666 /sys/class/leds/red/brightness mkdir /data/vendor/charge_logger 0771 system system