* Deactivate the device when both the transfers and the clear feature fail

* Some restructuring and cleanup

This keeps the input_server from polling a removed device continuously.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23388 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-01-11 11:37:18 +00:00
parent cb6cd9af6f
commit cc2bf27596

View File

@ -613,12 +613,19 @@ handle_interrupt_transfer(hid_device_info* device)
/* cancelled: device is unplugged */
return status;
}
#if 1
status = usb->clear_feature(device->ept->handle, USB_FEATURE_ENDPOINT_HALT);
if (status != B_OK)
if (status != B_OK) {
DPRINTF_ERR((MY_ID "clear_feature() error %d\n", (int)status));
#endif
} else {
// probably the device was removed and we just didn't get the
// removed notification yet.
device->active = false;
return status;
}
return device->bus_status;
}
/* got a report */
#if 0
uint32 i;
@ -636,9 +643,8 @@ handle_interrupt_transfer(hid_device_info* device)
memcpy(device->last_buffer, device->buffer, device->total_report_size);
} else
interpret_mouse_buffer(device);
}
return status;
return B_OK;
}
@ -910,8 +916,7 @@ hid_device_write(driver_cookie *cookie, off_t position,
static status_t
hid_device_control(driver_cookie *cookie, uint32 op,
void *arg, size_t len)
hid_device_control(driver_cookie *cookie, uint32 op, void *arg, size_t length)
{
status_t err = B_ERROR;
hid_device_info *device;
@ -967,7 +972,7 @@ hid_device_control(driver_cookie *cookie, uint32 op,
case KB_SET_LEDS:
set_leds(device, (uint8 *)arg);
break;
return B_OK;
}
} else {
switch (op) {
@ -1006,11 +1011,12 @@ hid_device_control(driver_cookie *cookie, uint32 op,
default:
/* not implemented */
break;
return B_ERROR;
}
}
return err;
/* shouldn't get here */
return B_ERROR;
}
@ -1112,6 +1118,7 @@ uninit_driver(void)
free_device_names();
}
/*!
device names are generated dynamically
*/
@ -1153,4 +1160,3 @@ find_device(const char *name)
return &hooks;
}