mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 09:32:33 +03:00
[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>
This commit is contained in:
@@ -702,7 +702,13 @@ struct usb_port {
|
||||
unsigned int protocol;
|
||||
/** Port speed */
|
||||
unsigned int speed;
|
||||
/** Currently attached device (if any) */
|
||||
/** Port has an attached device */
|
||||
int attached;
|
||||
/** Currently attached device (if in use)
|
||||
*
|
||||
* Note that this field will be NULL if the attached device
|
||||
* has been freed (e.g. because there were no drivers found).
|
||||
*/
|
||||
struct usb_device *usb;
|
||||
/** List of changed ports */
|
||||
struct list_head list;
|
||||
|
||||
Reference in New Issue
Block a user