CCing Thinh, as I saw his patches for dwc3/soft_connect, which I'm (ab)using in my workaround. On Fri, 22 Apr 2022 at 15:45, Daniel Martin <consume.noise@xxxxxxxxx> wrote: > I've got: > - a Rock Pi 4 https://wiki.radxa.com/Rockpi4 > - it has a type A port for otg (Ouch!) > - it has an otg switch to set host or device mode (locked at device mode) > - kernel v5.17.3 > - dt overlay to set dr_mode=peripheral > > What I want: > - use the Rock Pi 4 as gadget device > - providing storage, whereof the target can boot from > > What works: > - if the target is up, it'll see the gadget if I enable it (ls > /sys/class/udc > .../UDC) > > What doesn't work: > - if the target is up, just plug in the usb cable (new full-speed > device, device descriptor read/64 error -71, ...) > - boot from the gadget > > So, I was willing to capture trace events for plugging in the usb > cable, but there're none. Though, trace events work in general as I > get them, when I enable the gadget (target is up and write to UDC). regdump doesn't change either, when plugging or unplugging the cable. To hack around the problem I'm doing this atm: -----8<----- #!/usr/bin/env bash set -e UDC_NAME=$(ls /sys/class/udc) UDC_CLS_D="/sys/class/udc/$UDC_NAME" UDC_DBG_D="/sys/kernel/debug/usb/$UDC_NAME" link_prev="" while true; do link_cur=$(< $UDC_DBG_D/link_state) # XXX: link state from debugfs if [ "$link_prev" == "$link_cur" ]; then echo -n "." else echo -en "\n$link_cur" fi if [ "$link_cur" == "SS.Disabled" ]; then echo connect > $UDC_CLS_D/soft_connect elif [ "$link_cur" == "Disconnected" ]; then echo disconnect > $UDC_CLS_D/soft_connect # elif [ "$link_cur" == "U0" ]; then # echo "up and running fi link_prev=$link_cur sleep 1 done ----->8----- Relying on a state from debugfs doesn't look right. Though, I havn't found any other source. > Anything else I could try? Or could this even be a hardware limitation? Thanks, Daniel