From fb256b696b0e05f3e8043b818e3a5edf2fd59d80 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Fri, 14 Apr 2017 18:48:24 -0700 Subject: [PATCH] Add ffs.mtp.ready triggers to mtp configs. This allows devices to use functionfs for mtp and ptp instead of the ordinary functions. The property is set regardless of which function is enabled so mtp and ptp functions will continue to work. Bug: 33220530 Test: use mtp with ffs and non ffs devices Change-Id: I4527e153bd10ef1e262e487482ae455835d1c698 --- rootdir/init.usb.configfs.rc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rootdir/init.usb.configfs.rc b/rootdir/init.usb.configfs.rc index 32f019820..a64b50694 100644 --- a/rootdir/init.usb.configfs.rc +++ b/rootdir/init.usb.configfs.rc @@ -2,6 +2,7 @@ on property:sys.usb.config=none && property:sys.usb.configfs=1 write /config/usb_gadget/g1/UDC "none" stop adbd setprop sys.usb.ffs.ready 0 + setprop sys.usb.ffs.mtp.ready 0 write /config/usb_gadget/g1/bDeviceClass 0 write /config/usb_gadget/g1/bDeviceSubClass 0 write /config/usb_gadget/g1/bDeviceProtocol 0 @@ -20,7 +21,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.u write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} -on property:sys.usb.config=mtp && property:sys.usb.configfs=1 +on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1 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} @@ -29,14 +30,15 @@ on property:sys.usb.config=mtp && property:sys.usb.configfs=1 on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 start adbd -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 +on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && \ +property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 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} setprop sys.usb.state ${sys.usb.config} -on property:sys.usb.config=ptp && property:sys.usb.configfs=1 +on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1 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} @@ -45,7 +47,8 @@ on property:sys.usb.config=ptp && property:sys.usb.configfs=1 on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 start adbd -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 +on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.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" 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