On Fri, Sep 20, 2019 at 02:15:38PM +0200, Greg KH wrote: > On Fri, Sep 20, 2019 at 03:17:26PM +0200, David Heinzelmann wrote: > > Hi, > > > > sorry for the wrong patch format. > > No problem, that's normal. But please do not top-post on linux mailing > lists. > > > I am trying to detect a change. At the moment I think the change could be ignored if a > > port connection-change occurs and the port status has again the 'PORT_CONNECTION' bit set. > > > > I have a fx3 device which does a re-enumeration after a firmware download. This is working > > as expected and I am seeing a 'remove event' and a 'add event' monitoring via udevadm. But > > if I connect multiple devices at the same time via an usb hub I am sometimes not receiving > > a 'remove event' and 'add event' for a single device. > > Sounds like a broken hub :) > I tried different hubs but I forgot to mention that it is also possible to trigger the issue without a hub if I reboot the devices via software at the same time. > > I think the problem could be that when a device disconnects and the port connection-change > > occurs and before the 'PORT_CONNECTION' bit is checked the device could already be > > reconnected and the 'PORT_CONNECTION' bit is set. Therefore I think it is not correct to > > resuscitate the exisiting device. > > Does your patch actually fix the issue? When a fx3 device downloads > firmware and re-enumerates, it should come back as a totally different > device, which will fail this check, right? So I don't see how this > fixes the issues with your devices. > With the patch I do not have the issue anymore. After re-enumerate the device comes back with the same VID/PID but with a different device descriptor. Therefore the check will fail and hub_port_connect is called which initiates a device disconnect and connect. Without this 'reconnect' lsusb still shows me the old device descriptor and I am not able to communicate with the device. > Unless all of the devices reset themselves at the same time and the hub > doesn't like that and can't notice that it happened? > > If you use a different hub, does that work properly? > There is no difference if an other hub is used. It also happens without a hub when the devices are rebooted via software. My thoughts on this is that when the device re-enumerates and the device descriptor has changed a device disconnect and connect should be initiated instead of doing nothing? If I understand it correctly the resuscitation is used for handling port enable-changes occured by EMI. But when the device is doing a re-enumeration there should be no resuscitation. David