android_device_oneplus_dre/rootdir/etc/init.recovery.qcom.rc
Jack Pham 1cdeaf4f5e sm8350-common: init.recovery.qcom.rc: Force USB to peripheral mode
On some newer platforms USB relies on PMIC to notify it of
cable connection status, but the PMIC driver has relocated
to ADSP FW. Since ADSP is not expected to be loaded in
recovery or fastbootd mode, USB may not get notified and
hence won't start up. Force the USB to start in peripheral
mode since the whole purpose of recovery/fastbootd is to
interact with a USB connection anyhow.

Currently the command assumes that there is a sysfs "mode"
param located at /sys/class/udc/${ro.boot.usbcontroller}/device/..
which is true for dwc3-msm based driver on most QC SoCs.

Change-Id: I5f7a01defdf987dbf4bd48f77bc70344c212a623
2021-06-01 23:23:38 +01:00

11 lines
327 B
Text

import /init.recovery.target.rc
on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
on init
setprop sys.usb.configfs 1
on property:ro.boot.usbcontroller=*
write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral