I'm working on a project in which a RPi Zero (raspibian buster) controls an android phone by sending commands via adb. Everything works correctly if I connect the device once the RPi Zero has done the bootup.
pi@raspberrypi:~ $ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M
pi@raspberrypi:~ $ adb devices
List of devices attached
a7ad4ee device
But if the phone is plugged in when you turn on the raspi, it is not detected.
pi@raspberrypi:~ $ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
pi@raspberrypi:~ $ adb devices
List of devices attached
If I unplug it and plugit back works
[ 1488.695002] usb 1-1: new high-speed USB device number 2 using dwc2
[ 1488.946794] usb 1-1: New USB device found, idVendor=2717, idProduct=4ee7, bcdDevice= 4.04
[ 1488.946836] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1488.946859] usb 1-1: Product: SDM660-MTP _SN:251F05EA
[ 1488.946879] usb 1-1: Manufacturer: Xiaomi
[ 1488.946897] usb 1-1: SerialNumber: a7ad4ee
I'm afraid it has to do with the USB OTG the raspizero because it does not happen with a RPi3
I've trying to find a way to "emulate" a plug/unplug event with no luck.
Can you think of any way to solve this problem?