|  | @@ -485,7 +485,7 @@ int usb_message ( struct usb_endpoint *ep, unsigned int request,
 | 
		
	
		
			
			| 485 | 485 |  	assert ( iob_headroom ( iobuf ) >= sizeof ( *packet ) );
 | 
		
	
		
			
			| 486 | 486 |  
 | 
		
	
		
			
			| 487 | 487 |  	/* Fail immediately if device has been unplugged */
 | 
		
	
		
			
			| 488 |  | -	if ( port->speed == USB_SPEED_NONE )
 | 
		
	
		
			
			|  | 488 | +	if ( port->disconnected )
 | 
		
	
		
			
			| 489 | 489 |  		return -ENODEV;
 | 
		
	
		
			
			| 490 | 490 |  
 | 
		
	
		
			
			| 491 | 491 |  	/* Reset endpoint if required */
 | 
		
	
	
		
			
			|  | @@ -534,7 +534,7 @@ int usb_stream ( struct usb_endpoint *ep, struct io_buffer *iobuf,
 | 
		
	
		
			
			| 534 | 534 |  	int rc;
 | 
		
	
		
			
			| 535 | 535 |  
 | 
		
	
		
			
			| 536 | 536 |  	/* Fail immediately if device has been unplugged */
 | 
		
	
		
			
			| 537 |  | -	if ( port->speed == USB_SPEED_NONE )
 | 
		
	
		
			
			|  | 537 | +	if ( port->disconnected )
 | 
		
	
		
			
			| 538 | 538 |  		return -ENODEV;
 | 
		
	
		
			
			| 539 | 539 |  
 | 
		
	
		
			
			| 540 | 540 |  	/* Reset endpoint if required */
 | 
		
	
	
		
			
			|  | @@ -1717,23 +1717,24 @@ static int usb_hotplugged ( struct usb_port *port ) {
 | 
		
	
		
			
			| 1717 | 1717 |  	if ( ( rc = hub->driver->speed ( hub, port ) ) != 0 ) {
 | 
		
	
		
			
			| 1718 | 1718 |  		DBGC ( hub, "USB hub %s port %d could not get speed: %s\n",
 | 
		
	
		
			
			| 1719 | 1719 |  		       hub->name, port->address, strerror ( rc ) );
 | 
		
	
		
			
			| 1720 |  | -		goto err_speed;
 | 
		
	
		
			
			|  | 1720 | +		/* Treat as a disconnection */
 | 
		
	
		
			
			|  | 1721 | +		port->disconnected = 1;
 | 
		
	
		
			
			|  | 1722 | +		port->speed = USB_SPEED_NONE;
 | 
		
	
		
			
			| 1721 | 1723 |  	}
 | 
		
	
		
			
			| 1722 | 1724 |  
 | 
		
	
		
			
			| 1723 | 1725 |  	/* Detach device, if applicable */
 | 
		
	
		
			
			| 1724 | 1726 |  	if ( port->attached && ( port->disconnected || ! port->speed ) )
 | 
		
	
		
			
			| 1725 | 1727 |  		usb_detached ( port );
 | 
		
	
		
			
			| 1726 | 1728 |  
 | 
		
	
		
			
			|  | 1729 | +	/* Clear any recorded disconnections */
 | 
		
	
		
			
			|  | 1730 | +	port->disconnected = 0;
 | 
		
	
		
			
			|  | 1731 | +
 | 
		
	
		
			
			| 1727 | 1732 |  	/* Attach device, if applicable */
 | 
		
	
		
			
			| 1728 | 1733 |  	if ( port->speed && ( ! port->attached ) &&
 | 
		
	
		
			
			| 1729 | 1734 |  	     ( ( rc = usb_attached ( port ) ) != 0 ) )
 | 
		
	
		
			
			| 1730 |  | -		goto err_attached;
 | 
		
	
		
			
			|  | 1735 | +		return rc;
 | 
		
	
		
			
			| 1731 | 1736 |  
 | 
		
	
		
			
			| 1732 |  | - err_attached:
 | 
		
	
		
			
			| 1733 |  | - err_speed:
 | 
		
	
		
			
			| 1734 |  | -	/* Clear any recorded disconnections */
 | 
		
	
		
			
			| 1735 |  | -	port->disconnected = 0;
 | 
		
	
		
			
			| 1736 |  | -	return rc;
 | 
		
	
		
			
			|  | 1737 | +	return 0;
 | 
		
	
		
			
			| 1737 | 1738 |  }
 | 
		
	
		
			
			| 1738 | 1739 |  
 | 
		
	
		
			
			| 1739 | 1740 |  /******************************************************************************
 |