Changeset 25459

Show
Ignore:
Timestamp:
05/11/08 15:07:11 (6 days ago)
Author:
mmlr
Message:
* Reset the connection state and speed when the underlaying device is removed.
* Notify the stack of this by releasing the link state change sem (if present).
* Also check for a removed device in the notify callback to prevent accessing
  a device that is going down.

Removing the device under Haiku with an active link will now report the loss of
connection. Still left to implement is to reuse a still existing device if the
same device (based on its MAC) is replugged.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • haiku/trunk/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.cpp

    r25458 r25459  
    373373 
    374374 
     375void 
     376ECMDevice::Removed() 
     377{ 
     378        fRemoved = true; 
     379        fHasConnection = false; 
     380        fDownstreamSpeed = fUpstreamSpeed = 0; 
     381 
     382        if (fLinkStateChangeSem >= B_OK) 
     383                release_sem_etc(fLinkStateChangeSem, 1, B_DO_NOT_RESCHEDULE); 
     384} 
     385 
     386 
    375387status_t 
    376388ECMDevice::_ReadMACAddress() 
     
    433445        uint32 actualLength) 
    434446{ 
    435         if (status == B_CANCELED) 
    436                 return; 
    437  
    438447        ECMDevice *device = (ECMDevice *)cookie; 
     448        if (status == B_CANCELED || device->fRemoved) 
     449                return; 
     450 
    439451        if (status == B_OK && actualLength >= sizeof(cdc_notification)) { 
    440452                bool linkStateChange = false; 
  • haiku/trunk/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.h

    r25458 r25459  
    2626                status_t                        Control(uint32 op, void *buffer, size_t length); 
    2727 
    28                 void                            Removed() { fRemoved = true; }
     28                void                            Removed()
    2929                bool                            IsRemoved() { return fRemoved; }; 
    3030