]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[usb] Handle port status changes received after failing to find a driver
authorMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2015 00:46:22 +0000 (00:46 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2015 00:57:15 +0000 (00:57 +0000)
commit6fe8f80418c71b4d05b7de362db9f142690d1a57
treeb5ca7b9246439cf44c0ff27fb55317008b6e5c67
parentf3725a86e00cf5a4281997670c8779f83c38eeba
[usb] Handle port status changes received after failing to find a driver

Commit a60f2dd ("[usb] Try multiple USB device configurations")
changed the behaviour of register_usb() such that if no drivers are
found then the device will be closed and the memory used will be
freed.

If a port status change subsequently occurs while the device is still
physically attached, then usb_hotplug() will see this as a new device
having been attached, since there is no device recorded as being
currently attached to the port.  This can lead to spurious hotplug
events (or even endless loops of hotplug events, if the process of
opening and closing the device happens to generate a port status
change).

Fix by using a separate flag to indicate that a device is physically
attached (even if we have no corresponding struct usb_device).

Reported-by: Dan Ellis <Dan.Ellis@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/bus/usb.c
src/include/ipxe/usb.h