* 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25459 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -372,6 +372,18 @@ ECMDevice::Control(uint32 op, void *buffer, size_t length)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ECMDevice::Removed()
|
||||
{
|
||||
fRemoved = true;
|
||||
fHasConnection = false;
|
||||
fDownstreamSpeed = fUpstreamSpeed = 0;
|
||||
|
||||
if (fLinkStateChangeSem >= B_OK)
|
||||
release_sem_etc(fLinkStateChangeSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ECMDevice::_ReadMACAddress()
|
||||
{
|
||||
@@ -432,10 +444,10 @@ void
|
||||
ECMDevice::_NotifyCallback(void *cookie, int32 status, void *data,
|
||||
uint32 actualLength)
|
||||
{
|
||||
if (status == B_CANCELED)
|
||||
ECMDevice *device = (ECMDevice *)cookie;
|
||||
if (status == B_CANCELED || device->fRemoved)
|
||||
return;
|
||||
|
||||
ECMDevice *device = (ECMDevice *)cookie;
|
||||
if (status == B_OK && actualLength >= sizeof(cdc_notification)) {
|
||||
bool linkStateChange = false;
|
||||
cdc_notification *notification
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
status_t Write(const uint8 *buffer, size_t *numBytes);
|
||||
status_t Control(uint32 op, void *buffer, size_t length);
|
||||
|
||||
void Removed() { fRemoved = true; };
|
||||
void Removed();
|
||||
bool IsRemoved() { return fRemoved; };
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user