* Error out on the num events ioctl in case the device was removed, otherwise
the original BeOS input_server will fail to detect the error and never close the device. * Remove the empty kernel_cpp header and use the one from kernel util instead. * Add some missing headers for completeness. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33242 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
Distributed under the terms of the MIT license.
|
Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
#include "DeviceList.h"
|
#include "DeviceList.h"
|
||||||
#include <kernel_cpp.h>
|
#include <util/kernel_cpp.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <USB3.h>
|
#include <USB3.h>
|
||||||
|
#include <util/kernel_cpp.h>
|
||||||
|
|
||||||
#include "DeviceList.h"
|
#include "DeviceList.h"
|
||||||
#include "kernel_cpp.h"
|
|
||||||
|
|
||||||
#define DRIVER_NAME "usb_hid"
|
#define DRIVER_NAME "usb_hid"
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
HIDReport::HIDReport(HIDParser *parser, uint8 type, uint8 id)
|
HIDReport::HIDReport(HIDParser *parser, uint8 type, uint8 id)
|
||||||
@@ -217,6 +218,7 @@ HIDReport::WaitForReport(bigtime_t timeout)
|
|||||||
fConditionVariable.Add(&conditionVariableEntry);
|
fConditionVariable.Add(&conditionVariableEntry);
|
||||||
status_t result = fParser->Device()->MaybeScheduleTransfer();
|
status_t result = fParser->Device()->MaybeScheduleTransfer();
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
|
TRACE_ALWAYS("scheduling transfer failed\n");
|
||||||
conditionVariableEntry.Wait(B_RELATIVE_TIMEOUT, 0);
|
conditionVariableEntry.Wait(B_RELATIVE_TIMEOUT, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <usb/USB_hid.h>
|
#include <usb/USB_hid.h>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "HIDReport.h"
|
#include "HIDReport.h"
|
||||||
#include "HIDReportItem.h"
|
#include "HIDReportItem.h"
|
||||||
|
|
||||||
|
#include <new>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <usb/USB_hid.h>
|
#include <usb/USB_hid.h>
|
||||||
|
|
||||||
@@ -91,7 +92,12 @@ MouseDevice::Control(uint32 op, void *buffer, size_t length)
|
|||||||
return RingBufferRead(buffer, sizeof(mouse_movement));
|
return RingBufferRead(buffer, sizeof(mouse_movement));
|
||||||
|
|
||||||
case MS_NUM_EVENTS:
|
case MS_NUM_EVENTS:
|
||||||
return RingBufferReadable() / sizeof(mouse_movement);
|
{
|
||||||
|
int32 count = RingBufferReadable() / sizeof(mouse_movement);
|
||||||
|
if (count == 0 && fReport->Device()->IsRemoved())
|
||||||
|
return B_DEV_NOT_READY;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
case MS_SET_CLICKSPEED:
|
case MS_SET_CLICKSPEED:
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
@@ -113,7 +119,7 @@ MouseDevice::_ReadReport()
|
|||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
if (fReport->Device()->IsRemoved()) {
|
if (fReport->Device()->IsRemoved()) {
|
||||||
TRACE("device has been removed\n");
|
TRACE("device has been removed\n");
|
||||||
return B_ERROR;
|
return B_DEV_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != B_INTERRUPTED) {
|
if (result != B_INTERRUPTED) {
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
|
||||||
|
#ifndef B_MAX_MOUSE_BUTTONS
|
||||||
|
#define B_MAX_MOUSE_BUTTONS 8
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ProtocolHandler.h"
|
#include "ProtocolHandler.h"
|
||||||
|
|
||||||
class HIDReportItem;
|
class HIDReportItem;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <ring_buffer.h>
|
#include <ring_buffer.h>
|
||||||
|
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user