Skip to main content
Visitor II
March 11, 2022
Solved

USB ethernet gadget stops working after replugging cable

  • March 11, 2022
  • 11 replies
  • 6190 views

Not sure if this is the best forum for this question but I am using the USB OTG port in device mode as ethernet gadget. It works fine if plugged in from boot, or first plug in anytime after.

But if unplugged and plugged in again it will not come back without a board reboot:

[ 46.766872] dwc2 49000000.usb-otg: new device is high-speed
[ 46.771014] dwc2 49000000.usb-otg: dwc2_hsotg_enqueue_setup: failed queue (-11)

Error -11 is something like "resource temporarily unavailable". Ever seen this before?

    This topic has been closed for replies.
    Best answer by BillR

    I decided it was time to take the dive into the kernel and then confirmed there is no disconnect interrupt in device mode, only suspend due to no activity on D lines.  

    0693W00000Lvm1AQAR.pngThis isn't a problem on the DK2 I believe because its using the STMUSB1600 which gives disconnected indication. Since we only needed device mode and that chip was not available, we thought it wouldn't be a problem to leave out.

    So, in

    drivers/usb/dwc2/core_intr.c

    we have the following:

    /*
     * Change to L2 (suspend) state before releasing
     * spinlock
     */
    hsotg->lx_state = DWC2_L2;
     
    /* Call gadget suspend callback */
    call_gadget(hsotg, suspend);

    Change to:

    dwc2_hsotg_disconnect(hsotg); 

    I am going to test this next week.

    Bill

    11 replies

    BillRAuthor
    Visitor II
    April 7, 2022

    Kevin - OK, now I understand. I am not that familiar with kernel driver development and how to signal the daemon directly, but if I have some time I may look into that approach.

    Thanks! Bill