From 46c313b694fbeead5a7ac652d5f0fc6ff1313784 Mon Sep 17 00:00:00 2001 From: Winter Wang Date: Thu, 24 Mar 2016 17:45:37 +0800 Subject: [PATCH] init: usb: disable usb function switch until adbd is ready In the case of adb enabled, When a usb function switch happens e.g mtp,adb -> ptp,adb, framework will set sys.usb.config from "mtp,adb" to "none" and stop adbd first. At this time, the property "sys.usb.ffs.ready", which is set after the ready of the perious start adbd, is still "1". So , when framework goes on setting the sys.usb.config to "ptp,adb", init.usb.configfs.rc will trigger actions to bind() f_fs without waiting for adbd is actually ready. This will produce some error messages: ------------ configfs-gadget ci_hdrc.0: failed to start g1: -19 init: write_file: Unable to write to '/config/usb_gadget/g1/UDC': No such device ------------ this error msg is caused by configFS start binding f_fs before adbd is ready. Add setting the "sys.usb.ffs.ready" to "0" will help clear this error msg, as the bind process in kernel gadget driver will wait for the set of this property, which is the sign of adbd is ready. Signed-off-by: Winter Wang --- rootdir/init.usb.configfs.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/rootdir/init.usb.configfs.rc b/rootdir/init.usb.configfs.rc index 186384bdd..e19b05824 100644 --- a/rootdir/init.usb.configfs.rc +++ b/rootdir/init.usb.configfs.rc @@ -1,6 +1,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 write /config/usb_gadget/g1/bDeviceClass 0 write /config/usb_gadget/g1/bDeviceSubClass 0 write /config/usb_gadget/g1/bDeviceProtocol 0