summaryrefslogtreecommitdiffstats
path: root/src/drivers/usb
diff options
context:
space:
mode:
authorMichael Brown2015-12-07 00:22:37 +0100
committerMichael Brown2015-12-07 14:08:22 +0100
commit15ce7ce355b3cfb5ec8bc2d51528b08f02f4648b (patch)
tree0c8628f693944e02af6db1ea17ef5d5fb5f46427 /src/drivers/usb
parent[efi] Add %.usb target for building EFI-bootable USB (or other) disk images (diff)
downloadipxe-15ce7ce355b3cfb5ec8bc2d51528b08f02f4648b.tar.gz
ipxe-15ce7ce355b3cfb5ec8bc2d51528b08f02f4648b.tar.xz
ipxe-15ce7ce355b3cfb5ec8bc2d51528b08f02f4648b.zip
[usb] Use port->disconnected to check for disconnected devices
The usb_message() and usb_stream() functions currently check for port->speed==USB_SPEED_NONE to determine whether or not a device has been unplugged. This test will give a false negative result if a new device has been plugged in before the hotplug mechanism has finished handling the removal of the old device. Fix by checking instead the port->disconnected flag, which is now cleared only after completing the removal of the old device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/usb')
-rw-r--r--src/drivers/usb/usbhub.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/drivers/usb/usbhub.c b/src/drivers/usb/usbhub.c
index 5cfc4052..a3e7bc00 100644
--- a/src/drivers/usb/usbhub.c
+++ b/src/drivers/usb/usbhub.c
@@ -496,9 +496,10 @@ static void hub_remove ( struct usb_function *func ) {
unsigned int i;
/* If hub has been unplugged, mark all ports as unplugged */
- if ( usb->port->speed == USB_SPEED_NONE ) {
+ if ( usb->port->disconnected ) {
for ( i = 1 ; i <= hub->ports ; i++ ) {
port = usb_port ( hub, i );
+ port->disconnected = 1;
port->speed = USB_SPEED_NONE;
}
}