Make the HID parser usable standalone in userland.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35305 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
64a9bd15c8
commit
fd97180e27
@ -3,7 +3,12 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
#include "Driver.h"
|
||||
#else
|
||||
#include "UserlandHID.h"
|
||||
#endif
|
||||
|
||||
#include "HIDCollection.h"
|
||||
#include "HIDReportItem.h"
|
||||
|
||||
|
@ -3,7 +3,12 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
#include "Driver.h"
|
||||
#else
|
||||
#include "UserlandHID.h"
|
||||
#endif
|
||||
|
||||
#include "HIDCollection.h"
|
||||
#include "HIDParser.h"
|
||||
#include "HIDReport.h"
|
||||
|
@ -3,7 +3,12 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
#include "Driver.h"
|
||||
#else
|
||||
#include "UserlandHID.h"
|
||||
#endif
|
||||
|
||||
#include "HIDCollection.h"
|
||||
#include "HIDDevice.h"
|
||||
#include "HIDReport.h"
|
||||
@ -26,7 +31,9 @@ HIDReport::HIDReport(HIDParser *parser, uint8 type, uint8 id)
|
||||
fCurrentReport(NULL),
|
||||
fBusyCount(0)
|
||||
{
|
||||
#ifndef USERLAND_HID
|
||||
fConditionVariable.Init(this, "hid report");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -155,10 +162,13 @@ HIDReport::SetReport(status_t status, uint8 *report, size_t length)
|
||||
fReportStatus = B_ERROR;
|
||||
}
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
fConditionVariable.NotifyAll();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
status_t
|
||||
HIDReport::SendReport()
|
||||
{
|
||||
@ -184,6 +194,7 @@ HIDReport::SendReport()
|
||||
free(report);
|
||||
return result;
|
||||
}
|
||||
#endif // !USERLAND_HID
|
||||
|
||||
|
||||
HIDReportItem *
|
||||
@ -208,6 +219,7 @@ HIDReport::FindItem(uint16 usagePage, uint16 usageID)
|
||||
}
|
||||
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
status_t
|
||||
HIDReport::WaitForReport(bigtime_t timeout)
|
||||
{
|
||||
@ -241,6 +253,7 @@ HIDReport::DoneProcessing()
|
||||
{
|
||||
atomic_add(&fBusyCount, -1);
|
||||
}
|
||||
#endif // !USERLAND_HID
|
||||
|
||||
|
||||
void
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
#include "HIDParser.h"
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
#include <condition_variable.h>
|
||||
#endif
|
||||
|
||||
#define HID_REPORT_TYPE_INPUT 0x01
|
||||
#define HID_REPORT_TYPE_OUTPUT 0x02
|
||||
@ -39,14 +41,18 @@ public:
|
||||
size_t length);
|
||||
uint8 * CurrentReport() { return fCurrentReport; };
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
status_t SendReport();
|
||||
#endif
|
||||
|
||||
uint32 CountItems() { return fItemsUsed; };
|
||||
HIDReportItem * ItemAt(uint32 index);
|
||||
HIDReportItem * FindItem(uint16 usagePage, uint16 usageID);
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
status_t WaitForReport(bigtime_t timeout);
|
||||
void DoneProcessing();
|
||||
#endif
|
||||
|
||||
void PrintToStream();
|
||||
|
||||
@ -66,7 +72,10 @@ private:
|
||||
status_t fReportStatus;
|
||||
uint8 * fCurrentReport;
|
||||
int32 fBusyCount;
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
ConditionVariable fConditionVariable;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // HID_REPORT_H
|
||||
|
@ -3,7 +3,11 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef USERLAND_HID
|
||||
#include "Driver.h"
|
||||
#else
|
||||
#include "UserlandHID.h"
|
||||
#endif
|
||||
|
||||
#include "HIDReportItem.h"
|
||||
#include "HIDReport.h"
|
||||
|
Loading…
Reference in New Issue
Block a user