* Check for the removed case before doing any transfers.
* Cancel possibly active transfers when removed. * Do not interpret the transfer buffer in case of an error or removal. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25658 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -275,6 +275,7 @@ void
|
|||||||
HIDDevice::Removed()
|
HIDDevice::Removed()
|
||||||
{
|
{
|
||||||
fRemoved = true;
|
fRemoved = true;
|
||||||
|
gUSBModule->cancel_queued_transfers(fInterruptPipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -297,6 +298,8 @@ HIDDevice::_ScheduleTransfer()
|
|||||||
{
|
{
|
||||||
if (fTransferUnprocessed)
|
if (fTransferUnprocessed)
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
|
if (fRemoved)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
status_t result = gUSBModule->queue_interrupt(fInterruptPipe,
|
status_t result = gUSBModule->queue_interrupt(fInterruptPipe,
|
||||||
fTransferBuffer, fTotalReportSize, _TransferCallback, this);
|
fTransferBuffer, fTotalReportSize, _TransferCallback, this);
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ KeyboardDevice::_WriteKey(uint32 key, bool down)
|
|||||||
status_t
|
status_t
|
||||||
KeyboardDevice::_SetLEDs(uint8 *data)
|
KeyboardDevice::_SetLEDs(uint8 *data)
|
||||||
{
|
{
|
||||||
|
if (IsRemoved())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
uint8 leds = 0;
|
uint8 leds = 0;
|
||||||
if (data[0] == 1)
|
if (data[0] == 1)
|
||||||
leds |= (1 << 0);
|
leds |= (1 << 0);
|
||||||
@@ -126,6 +129,17 @@ KeyboardDevice::_SetLEDs(uint8 *data)
|
|||||||
status_t
|
status_t
|
||||||
KeyboardDevice::_InterpretBuffer()
|
KeyboardDevice::_InterpretBuffer()
|
||||||
{
|
{
|
||||||
|
if (fTransferStatus != B_OK) {
|
||||||
|
if (IsRemoved())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
if (gUSBModule->clear_feature(fInterruptPipe,
|
||||||
|
USB_FEATURE_ENDPOINT_HALT) != B_OK)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32 sModifierTable[] = {
|
static uint32 sModifierTable[] = {
|
||||||
KEY_ControlL,
|
KEY_ControlL,
|
||||||
KEY_ShiftL,
|
KEY_ShiftL,
|
||||||
|
|||||||
@@ -78,6 +78,17 @@ MouseDevice::Control(uint32 op, void *buffer, size_t length)
|
|||||||
status_t
|
status_t
|
||||||
MouseDevice::_InterpretBuffer()
|
MouseDevice::_InterpretBuffer()
|
||||||
{
|
{
|
||||||
|
if (fTransferStatus != B_OK) {
|
||||||
|
if (IsRemoved())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
if (gUSBModule->clear_feature(fInterruptPipe,
|
||||||
|
USB_FEATURE_ENDPOINT_HALT) != B_OK)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
mouse_movement info;
|
mouse_movement info;
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
for (size_t i = 0; i < fInstructionCount; i++) {
|
for (size_t i = 0; i < fInstructionCount; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user