* Add handling for B_INTERRUPTED so USB keyboards can work again
* Beginnings of devfs interaction to properly publish/unpublish under Haiku git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23412 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,6 +4,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
|
|||||||
|
|
||||||
SubDirSysHdrs $(HAIKU_TOP) headers os drivers ;
|
SubDirSysHdrs $(HAIKU_TOP) headers os drivers ;
|
||||||
UsePrivateHeaders [ FDirName kernel util ] input ;
|
UsePrivateHeaders [ FDirName kernel util ] input ;
|
||||||
|
UsePrivateHeaders kernel ;
|
||||||
|
|
||||||
local buffer_impl = ;
|
local buffer_impl = ;
|
||||||
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
#include <fs/devfs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_BUTTONS 16
|
#define MAX_BUTTONS 16
|
||||||
|
|
||||||
@@ -878,6 +881,9 @@ hid_device_removed(void *cookie)
|
|||||||
device->active = false;
|
device->active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
devfs_unpublish_device(device->name, true);
|
||||||
|
#endif
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -971,6 +977,8 @@ hid_device_control(driver_cookie *cookie, uint32 op, void *arg, size_t length)
|
|||||||
err = handle_interrupt_transfer(device);
|
err = handle_interrupt_transfer(device);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
} else if (err == B_INTERRUPTED) {
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -985,22 +993,32 @@ hid_device_control(driver_cookie *cookie, uint32 op, void *arg, size_t length)
|
|||||||
case KB_SET_LEDS:
|
case KB_SET_LEDS:
|
||||||
set_leds(device, (uint8 *)arg);
|
set_leds(device, (uint8 *)arg);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* not implemented */
|
||||||
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case MS_READ:
|
case MS_READ:
|
||||||
while (ring_buffer_readable(device->rbuf) == 0) {
|
while (ring_buffer_readable(device->rbuf) == 0) {
|
||||||
err = schedule_interrupt_transfer(device);
|
if (!device->transfer_scheduled) {
|
||||||
if (err != B_OK)
|
err = schedule_interrupt_transfer(device);
|
||||||
return err;
|
if (err != B_OK)
|
||||||
// NOTE: this thread is now blocking until
|
return err;
|
||||||
// the semaphore will be released from the
|
device->transfer_scheduled = true;
|
||||||
// call_back function
|
// NOTE: this thread is now blocking until
|
||||||
|
// the semaphore will be released from the
|
||||||
|
// call_back function
|
||||||
|
}
|
||||||
|
|
||||||
err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL);
|
err = acquire_sem_etc(device->sem_cb, 1, B_CAN_INTERRUPT, 0LL);
|
||||||
if (err != B_OK)
|
if (err == B_INTERRUPTED)
|
||||||
|
continue;
|
||||||
|
else if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
device->transfer_scheduled = false;
|
||||||
err = handle_interrupt_transfer(device);
|
err = handle_interrupt_transfer(device);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user