USB devices should report better than generic B_ERROR in order to
help the stack to detect and handle hotplug device removal. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ce97aa1274
commit
6985b0a46f
@ -486,6 +486,9 @@ pegasus_device_read(driver_cookie *cookie, off_t position, void *buffer, size_t
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
if (dev->aue_dying)
|
||||
return B_DEVICE_NOT_FOUND; /* already unplugged */
|
||||
|
||||
blockFlag = dev->nonblocking ? B_TIMEOUT : 0;
|
||||
|
||||
// block until receive is available (if blocking is allowed)
|
||||
@ -552,6 +555,9 @@ pegasus_device_write(driver_cookie *cookie, off_t position, const void *buffer,
|
||||
DPRINTF_ERR("EINVAL\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (dev->aue_dying)
|
||||
return B_DEVICE_NOT_FOUND; /* already unplugged */
|
||||
|
||||
// block until a free tx descriptor is available
|
||||
if ((status = acquire_sem_etc(dev->tx_sem, 1, B_TIMEOUT, ETHER_TRANSMIT_TIMEOUT)) < B_NO_ERROR) {
|
||||
@ -623,7 +629,7 @@ pegasus_device_control(driver_cookie *cookie, uint32 op,
|
||||
DPRINTF_INFO("ioctl(0x%x)\n", (int)op);
|
||||
|
||||
if (device->aue_dying)
|
||||
return B_ERROR; /* already unplugged */
|
||||
return B_DEVICE_NOT_FOUND; /* already unplugged */
|
||||
|
||||
switch (op) {
|
||||
case ETHER_INIT:
|
||||
|
@ -175,7 +175,7 @@ ASIXDevice::Read(uint8 *buffer, size_t *numBytes)
|
||||
if (fRemoved) {
|
||||
TRACE_ALWAYS("Error of receiving %d bytes from removed device.\n",
|
||||
numBytesToRead);
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
TRACE_FLOW("Request %d bytes.\n", numBytesToRead);
|
||||
@ -252,7 +252,7 @@ ASIXDevice::Write(const uint8 *buffer, size_t *numBytes)
|
||||
if (fRemoved) {
|
||||
TRACE_ALWAYS("Error of writing %d bytes to removed device.\n",
|
||||
numBytesToWrite);
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
TRACE_FLOW("Write %d bytes.\n", numBytesToWrite);
|
||||
|
@ -235,7 +235,7 @@ DavicomDevice::Read(uint8 *buffer, size_t *numBytes)
|
||||
if (fRemoved) {
|
||||
TRACE_ALWAYS("Error of receiving %d bytes from removed device.\n",
|
||||
numBytesToRead);
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
TRACE_FLOW("Request %d bytes.\n", numBytesToRead);
|
||||
@ -305,7 +305,7 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes)
|
||||
if (fRemoved) {
|
||||
TRACE_ALWAYS("Error of writing %d bytes to removed device.\n",
|
||||
numBytesToWrite);
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!fHasConnection) {
|
||||
|
@ -178,7 +178,7 @@ ECMDevice::Read(uint8 *buffer, size_t *numBytes)
|
||||
{
|
||||
if (fRemoved) {
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
status_t result = gUSBModule->queue_bulk(fReadEndpoint, buffer, *numBytes,
|
||||
@ -215,7 +215,7 @@ ECMDevice::Write(const uint8 *buffer, size_t *numBytes)
|
||||
{
|
||||
if (fRemoved) {
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
status_t result = gUSBModule->queue_bulk(fWriteEndpoint, (uint8 *)buffer,
|
||||
|
Loading…
Reference in New Issue
Block a user