init.qcom.usb.rc: Move the usb init sequence from post-fs to post-fs-data
USB rules with init.qcom.usb.rc are executed with "on post-fs" and it
is required that all USB modules are loaded by that time. modprobe shell
script loads all vendor modules including USB funcitonality related
modules. There is no guarantee that modprobe has completed loading all
USB modules by USB rules are executed. init.qti.kernel.rc is one which
has "on post-fs" rules which waits for modprobe to succesfully loads
all module with (wait_for_prop vendor.all.modules.ready 1). On some
platform due to this order, USB fails to enumerate USB default composition
as rules are failing to create instance of USB function driver. Fix
this issue by moving USB init sequence from post-fs to post-fs-data.
Change-Id: Iee5a552c9ad876adc6139530c8dcac39ba868a54
diff --git a/etc/init.qcom.usb.rc b/etc/init.qcom.usb.rc
index c4932c1..98cdf67 100644
--- a/etc/init.qcom.usb.rc
+++ b/etc/init.qcom.usb.rc
@@ -26,6 +26,35 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Changes from Qualcomm Innovation Center are provided under the following license:
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of The Linux Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
on charger
mount configfs none /config
mkdir /config/usb_gadget/g1 0770
@@ -44,7 +73,7 @@
wait /sys/class/udc/${sys.usb.controller}
setprop sys.usb.configfs 1
-on post-fs
+on post-fs-data
mount configfs none /config
mkdir /config/usb_gadget/g1 0770
mkdir /config/usb_gadget/g2 0770
@@ -111,7 +140,7 @@
write /config/usb_gadget/g1/strings/0x409/product ${vendor.usb.product_string}
write /config/usb_gadget/g2/strings/0x409/product ${vendor.usb.product_string}
-on post-fs && property:vendor.usb.use_ffs_mtp=1
+on post-fs-data && property:vendor.usb.use_ffs_mtp=1
mkdir /config/usb_gadget/g1/functions/ffs.mtp
mkdir /config/usb_gadget/g1/functions/ffs.ptp
mkdir /dev/usb-ffs/mtp 0770 mtp mtp