android_device_tecno_LG8n/rootdir/etc/init/hw/init.mt6789.usb.rc

247 lines
12 KiB
Plaintext
Raw Normal View History

on early-init
write /sys/module/musb_hdrc/parameters/kernel_init_done 1
# write /sys/module/musb_hdrc/parameters/musb_force_on 1
# write /sys/class/udc/musb-hdrc/device/cmode 3
on post-fs
mkdir /dev/usb-ffs 0775 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor 0x0E8D
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/os_desc/use 1
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
#SDD: add multi device name by lijia.chen 2020.08.10 start
write /config/usb_gadget/g1/strings/0x409/product "Android ADB Interface"
#SDD: add multi device name by lijia.chen 2020.08.10 end
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/mtk_rndis.gs4
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/functions/mass_storage.usb0
mkdir /config/usb_gadget/g1/functions/hid.gs0
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
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
on boot
setprop sys.usb.configfs 1
setprop sys.usb.controller "musb-hdrc"
setprop vendor.usb.controller "musb-hdrc"
setprop sys.usb.ffs.aio_compat 0
write /sys/class/android_usb/android0/f_mtp/cpu_mask 0x80
write /sys/module/usb_f_mtp/parameters/mtp_rx_cont 1
chmod 0664 /sys/class/android_usb/android0/iSerial
chown root system /sys/class/android_usb/android0/iSerial
chown radio system /sys/class/usb_rawbulk/data/enable
chmod 0660 /sys/class/usb_rawbulk/data/enable
chown radio system /sys/class/usb_rawbulk/ets/enable
chmod 0660 /sys/class/usb_rawbulk/ets/enable
chown radio system /sys/class/usb_rawbulk/atc/enable
chmod 0660 /sys/class/usb_rawbulk/atc/enable
chown radio system /sys/class/usb_rawbulk/pcv/enable
chmod 0660 /sys/class/usb_rawbulk/pcv/enable
chown radio system /sys/class/usb_rawbulk/gps/enable
chmod 0660 /sys/class/usb_rawbulk/gps/enable
chown system radio /dev/ttyGS0
chmod 0660 /dev/ttyGS0
chown system radio /dev/ttyGS1
chmod 0660 /dev/ttyGS1
chown system radio /dev/ttyGS2
chmod 0660 /dev/ttyGS2
chown system radio /dev/ttyGS3
chmod 0660 /dev/ttyGS3
#SDD: add multi device name by lijia.chen 2020.08.10 start
chmod a+x config/usb_gadget/g1
chmod a+x config/usb_gadget/g1/strings/0x409
chmod 0666 /config/usb_gadget/g1/strings/0x409/product
#SDD: add multi device name by lijia.chen 2020.08.10 end
# for usb otg sdcard hot plug detection
write /sys/module/block/parameters/events_dfl_poll_msecs 1000
on charger
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor 0x0E8D
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/os_desc/use 1
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
#SDD: add multi device name by lijia.chen 2020.08.10 start
#write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
#SDD: add multi device name by lijia.chen 2020.08.10 end
mkdir /config/usb_gadget/g1/functions/hid.gs0
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/configs/b.1/MaxPower 500
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
setprop sys.usb.configfs 1
setprop vendor.usb.controller "musb-hdrc"
setprop sys.usb.config hid
### more command at init.usb.configfs.rc ###
on property:sys.usb.config=none && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x0E8D
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
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
rmdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /sys/devices/platform/soc/mt_usb/saving 0
### HID for KPOC ###
on property:sys.usb.config=hid && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "HID"
write /config/usb_gadget/g1/idProduct 0x20FF
write /config/usb_gadget/g1/functions/hid.gs0/protocol 0
write /config/usb_gadget/g1/functions/hid.gs0/subclass 0
#write /config/usb_gadget/g1/functions/hid.gs0/report_length 4
#write /config/usb_gadget/g1/functions/hid.gs0/report_desc \\x05\\x01\\x09\\x00\\xa1\\x01\\xc0
symlink /config/usb_gadget/g1/functions/hid.gs0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
### main function : adb ###
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
write /config/usb_gadget/g1/idProduct 0x201C
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
### main function : mtp ###
on property:sys.usb.config=mtp && 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
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb"
write /config/usb_gadget/g1/idProduct 0x201D
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/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}
### main function : ptp ###
on property:sys.usb.config=ptp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp"
write /config/usb_gadget/g1/idProduct 0x200B
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb"
write /config/usb_gadget/g1/idProduct 0x200C
symlink /config/usb_gadget/g1/functions/ffs.ptp /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}
### main function : rndis ###
on property:sys.usb.config=rndis && property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis"
write /config/usb_gadget/g1/idProduct 0x2004
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
write /config/usb_gadget/g1/idProduct 0x2005
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /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}
### main function : midi ###
on property:sys.usb.config=midi && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2046
on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2048
### main function : accessory ###
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
### main function : audio_source ###
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
### main function : accessory,audio_source ###
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
### main function : mass_storage ###
on property:sys.usb.config=mass_storage && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums"
write /config/usb_gadget/g1/idProduct 0x2002
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb"
write /config/usb_gadget/g1/idProduct 0x2003
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /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}
on property:vendor.usb.port.mode=usb
write /sys/devices/platform/soc/mt_usb/portmode 0
on property:vendor.usb.port.mode=uart
write /sys/devices/platform/soc/mt_usb/portmode 1
on property:vendor.usb.device.wakeup=*
write ${vendor.usb.device.wakeup} "enabled"
### PLATFORM VARIANT, cat $rc_file | grep write | sort | grep -vE "android0|usb20_phy" | awk '{print $2}' | uniq ###