Re: usb: dwc2: Detecting cable disconnection in OTG mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dne 11. 12. 21 v 10:55 Pavel Hofman napsal(a):
Hi Minas,

I am trying to find if dwc2 in OTG mode can pass information to gadget functions that the host has been disconnected. I am testing on RPi4. In a datasheet for a different dwc2 implementation https://www.mouser.cn/datasheet/2/196/Infineon-xmc4500_rm_v1.6_2016-UM-v01_06-EN-598157.pdf - chapter "16.8.3 Device Disconnection" I found:


===========
The device session ends when the USB cable is disconnected or if the VBUS is switched off by the host.
The device disconnect flow is as follows:

1. When the USB cable is unplugged or when the VBUS is switched off by the host, the device core triggers GINTSTS.OTGInt [bit 2] interrupt bit
============

I put a printk to core_intr.c:dwc2_handle_otg_intr() which is called only from handling the OTGInt interrupt https://elixir.bootlin.com/linux/v5.1.9/source/drivers/usb/dwc2/core_intr.c#L803 . But this method is not called at all when disconnecting the USB cable on RPi4 in gadget mode.


To add, the method dwc2_hsotg_disconnect is called, but after reconnecting the cable, as part of the gadget reset when handling reset interrupts (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) here https://elixir.bootlin.com/linux/v5.1.9/source/drivers/usb/dwc2/gadget.c#L3653

Thanks a lot,

Pavel.



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux