diff --git a/services/etc/init.usb.cfg b/services/etc/init.usb.cfg index 5cf0ddb6b..dd282c005 100755 --- a/services/etc/init.usb.cfg +++ b/services/etc/init.usb.cfg @@ -1,109 +1,9 @@ { "jobs" : [{ - "name" : "post-fs-data", - "cmds" : [ - "chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file", - "chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file", - "chown system system /sys/class/android_usb/android0/f_rndis/ethaddr", - "chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr", - "mkdir /data/misc/adb 02750 system shell", - "mkdir /data/adb 0700 root root" - ] - }, { "name" : "boot", "cmds" : [ "setparam sys.usb.configfs 0" ] - }, { - "name" : "param:sys.usb.config=none && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=none && sys.usb.configfs=0", - "cmds" : [ - "stop adbd", - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/bDeviceClass 0", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=adb && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 4EE7", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "start adbd", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=accessory && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d00", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d01", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "start adbd", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=audio_source && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d02", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d03", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "start adbd", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d04", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=0", - "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0", - "cmds" : [ - "write /sys/class/android_usb/android0/enable 0", - "write /sys/class/android_usb/android0/idVendor 18d1", - "write /sys/class/android_usb/android0/idProduct 2d05", - "write /sys/class/android_usb/android0/functions ${sys.usb.config}", - "write /sys/class/android_usb/android0/enable 1", - "start adbd", - "setparam sys.usb.state ${sys.usb.config}" - ] }, { "name" : "boot && param:persist.sys.usb.config=*", "condition" : "boot && persist.sys.usb.config=*", @@ -111,54 +11,24 @@ "setparam sys.usb.config ${persist.sys.usb.config}" ] }, { - "name" : "param:sys.usb.typec.mode=dfp", - "condition" : "sys.usb.typec.mode=dfp", + "name" : "param:sys.usb.config=none && param:sys.usb.configfs=0", + "condition" : "sys.usb.config=none && sys.usb.configfs=0", "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", - "setparam sys.usb.typec.state ${sys.usb.typec.mode}" + "stop hdcd" ] }, { - "name" : "param:sys.usb.typec.mode=ufp", - "condition" : "sys.usb.typec.mode=ufp", + "name" : "param:sys.usb.config=hdc && param:sys.usb.configfs=0", + "condition" : "sys.usb.config=hdc && sys.usb.configfs=0", "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", - "setparam sys.usb.typec.state ${sys.usb.typec.mode}" - ] - }, { - "name" : "param:sys.usb.typec.data_role=device", - "condition" : "sys.usb.typec.data_role=device", - "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", - "setparam sys.usb.typec.state ${sys.usb.typec.data_role}" - ] - }, { - "name" : "param:sys.usb.typec.data_role=host", - "condition" : "sys.usb.typec.data_role=host", - "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", - "setparam sys.usb.typec.state ${sys.usb.typec.data_role}" - ] - }, { - "name" : "param:sys.usb.typec.power_role=source", - "condition" : "sys.usb.typec.power_role=source", - "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", - "setparam sys.usb.typec.state ${sys.usb.typec.power_role}" - ] - }, { - "name" : "param:sys.usb.typec.power_role=sink", - "condition" : "sys.usb.typec.power_role=sink", - "cmds" : [ - "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", - "setparam sys.usb.typec.state ${sys.usb.typec.power_role}" + "start hdcd" ] } ], "services" : [{ - "name" : "adbd", + "name" : "hdcd", "path" : ["/system/bin/hdcd"], "socket" : [ - "adbd seqpacket 660 system system false" + "hdcd seqpacket 660 system system false" ], "disabled" : 1 } diff --git a/services/etc/init.usb.configfs.cfg b/services/etc/init.usb.configfs.cfg index b80b4302c..989fa74d1 100755 --- a/services/etc/init.usb.configfs.cfg +++ b/services/etc/init.usb.configfs.cfg @@ -4,214 +4,32 @@ "condition" : "sys.usb.config=none && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/UDC none", - "stop adbd", + "stop hdcd", "setparam sys.usb.ffs.ready 0", "write /config/usb_gadget/g1/bDeviceClass 0", "write /config/usb_gadget/g1/bDeviceSubClass 0", "write /config/usb_gadget/g1/bDeviceProtocol 0", "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", - "rmdir /config/usb_gadget/g1/functions/rndis.gs4", "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "param:init.svc.adbd=stopped", - "condition" : "init.svc.adbd=stopped", + "name" : "param:init.svc.hdcd=stopped", + "condition" : "init.svc.hdcd=stopped", "cmds" : [ "setparam sys.usb.ffs.ready 0" ] }, { - "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=adb && sys.usb.configfs=1", + "name" : "param:sys.usb.config=hdc && param:sys.usb.configfs=1", + "condition" : "sys.usb.config=hdc && sys.usb.configfs=1", "cmds" : [ - "start adbd" + "start hdcd" ] }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=hdc && param:sys.usb.configfs=1", + "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=hdc && sys.usb.configfs=1", "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration adb", - "symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=mtp && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=mtp && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration mtp", - "symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration mtp_adb", - "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 ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=ptp && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=ptp && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration ptp", - "symlink /config/usb_gadget/g1/functions/ptp.gs1 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration ptp_adb", - "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 ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=accessory && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration accessory", - "symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration accessory_adb", - "symlink /config/usb_gadget/g1/functions/accessory.gs2 /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 ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=audio_source && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration audiosource", - "symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration audiosource_adb", - "symlink /config/usb_gadget/g1/functions/audio_source.gs3 /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 ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration accessory_audiosource", - "symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", - "symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration accessory_audiosource_adb", - "symlink /config/usb_gadget/g1/functions/accessory.gs2 /config/usb_gadget/g1/configs/b.1/f1", - "symlink /config/usb_gadget/g1/functions/audio_source.gs3 /config/usb_gadget/g1/configs/b.1/f2", - "symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=midi && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=midi && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration midi", - "symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=midi,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=midi,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1", - "cmds" : [ - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration midi_adb", - "symlink /config/usb_gadget/g1/functions/midi.gs5 /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 ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=rndis && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=rndis && sys.usb.configfs=1", - "cmds" : [ - "mkdir /config/usb_gadget/g1/functions/rndis.gs4", - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration rndis", - "symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1", - "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", - "setparam sys.usb.state ${sys.usb.config}" - ] - }, { - "name" : "param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1", - "cmds" : [ - "start adbd" - ] - }, { - "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1", - "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1", - "cmds" : [ - "mkdir /config/usb_gadget/g1/functions/rndis.gs4", - "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration rndis_adb", - "symlink /config/usb_gadget/g1/functions/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/configs/b.1/strings/0x409/configuration hdc", + "symlink /config/usb_gadget/g1/functions/ffs.hdc /config/usb_gadget/g1/configs/b.1/f1", "write /config/usb_gadget/g1/UDC ${sys.usb.controller}", "setparam sys.usb.state ${sys.usb.config}" ]