sdm845-common: recovery: Wait for USB UDC to be created

After setting the DWC3 controller into peripheral mode, there is
still a race in which the on property:sys.usb.config=adb or fastboot
action may proceed to write the UDC to the ConfigFS gadget but the
UDC is still in the middle of being created. This results in failure
to bind the gadget.

Although adbd contains a built-in retry mechanism that results in
sys.usb.ffs.ready getting set to 1 again which causes the action to
be retried, fastbootd does not implement such a retry, so there is
only one shot to successfully bind the UDC to ConfigFS. To help
the chance of success, add another wait for up to a second for the
/sys/class/udc/<controller> path to be created to ensure it is
present before the sys.usb.config=fastboot action executes.

Change-Id: Iec9d56c39ca6f10ca4298b9050ba744cd0c08ef9
This commit is contained in:
Jack Pham 2021-06-17 22:37:39 -07:00 committed by Bruno Martins
parent 9892b43ad4
commit 0a738934d0

View File

@ -33,6 +33,7 @@ on property:ro.boot.usbcontroller=*
setprop sys.usb.controller ${ro.boot.usbcontroller}
wait /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode
write /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode peripheral
wait /sys/class/udc/${ro.boot.usbcontroller} 1
on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}