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:
@@ -3,7 +3,12 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
#else
|
||||||
|
#include "UserlandHID.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HIDCollection.h"
|
#include "HIDCollection.h"
|
||||||
#include "HIDReportItem.h"
|
#include "HIDReportItem.h"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
#else
|
||||||
|
#include "UserlandHID.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HIDCollection.h"
|
#include "HIDCollection.h"
|
||||||
#include "HIDParser.h"
|
#include "HIDParser.h"
|
||||||
#include "HIDReport.h"
|
#include "HIDReport.h"
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
#else
|
||||||
|
#include "UserlandHID.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HIDCollection.h"
|
#include "HIDCollection.h"
|
||||||
#include "HIDDevice.h"
|
#include "HIDDevice.h"
|
||||||
#include "HIDReport.h"
|
#include "HIDReport.h"
|
||||||
@@ -26,7 +31,9 @@ HIDReport::HIDReport(HIDParser *parser, uint8 type, uint8 id)
|
|||||||
fCurrentReport(NULL),
|
fCurrentReport(NULL),
|
||||||
fBusyCount(0)
|
fBusyCount(0)
|
||||||
{
|
{
|
||||||
|
#ifndef USERLAND_HID
|
||||||
fConditionVariable.Init(this, "hid report");
|
fConditionVariable.Init(this, "hid report");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,10 +162,13 @@ HIDReport::SetReport(status_t status, uint8 *report, size_t length)
|
|||||||
fReportStatus = B_ERROR;
|
fReportStatus = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
fConditionVariable.NotifyAll();
|
fConditionVariable.NotifyAll();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
status_t
|
status_t
|
||||||
HIDReport::SendReport()
|
HIDReport::SendReport()
|
||||||
{
|
{
|
||||||
@@ -184,6 +194,7 @@ HIDReport::SendReport()
|
|||||||
free(report);
|
free(report);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif // !USERLAND_HID
|
||||||
|
|
||||||
|
|
||||||
HIDReportItem *
|
HIDReportItem *
|
||||||
@@ -208,6 +219,7 @@ HIDReport::FindItem(uint16 usagePage, uint16 usageID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
status_t
|
status_t
|
||||||
HIDReport::WaitForReport(bigtime_t timeout)
|
HIDReport::WaitForReport(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
@@ -241,6 +253,7 @@ HIDReport::DoneProcessing()
|
|||||||
{
|
{
|
||||||
atomic_add(&fBusyCount, -1);
|
atomic_add(&fBusyCount, -1);
|
||||||
}
|
}
|
||||||
|
#endif // !USERLAND_HID
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
#include "HIDParser.h"
|
#include "HIDParser.h"
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
#include <condition_variable.h>
|
#include <condition_variable.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define HID_REPORT_TYPE_INPUT 0x01
|
#define HID_REPORT_TYPE_INPUT 0x01
|
||||||
#define HID_REPORT_TYPE_OUTPUT 0x02
|
#define HID_REPORT_TYPE_OUTPUT 0x02
|
||||||
@@ -39,14 +41,18 @@ public:
|
|||||||
size_t length);
|
size_t length);
|
||||||
uint8 * CurrentReport() { return fCurrentReport; };
|
uint8 * CurrentReport() { return fCurrentReport; };
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
status_t SendReport();
|
status_t SendReport();
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32 CountItems() { return fItemsUsed; };
|
uint32 CountItems() { return fItemsUsed; };
|
||||||
HIDReportItem * ItemAt(uint32 index);
|
HIDReportItem * ItemAt(uint32 index);
|
||||||
HIDReportItem * FindItem(uint16 usagePage, uint16 usageID);
|
HIDReportItem * FindItem(uint16 usagePage, uint16 usageID);
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
status_t WaitForReport(bigtime_t timeout);
|
status_t WaitForReport(bigtime_t timeout);
|
||||||
void DoneProcessing();
|
void DoneProcessing();
|
||||||
|
#endif
|
||||||
|
|
||||||
void PrintToStream();
|
void PrintToStream();
|
||||||
|
|
||||||
@@ -66,7 +72,10 @@ private:
|
|||||||
status_t fReportStatus;
|
status_t fReportStatus;
|
||||||
uint8 * fCurrentReport;
|
uint8 * fCurrentReport;
|
||||||
int32 fBusyCount;
|
int32 fBusyCount;
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
ConditionVariable fConditionVariable;
|
ConditionVariable fConditionVariable;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HID_REPORT_H
|
#endif // HID_REPORT_H
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef USERLAND_HID
|
||||||
#include "Driver.h"
|
#include "Driver.h"
|
||||||
|
#else
|
||||||
|
#include "UserlandHID.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HIDReportItem.h"
|
#include "HIDReportItem.h"
|
||||||
#include "HIDReport.h"
|
#include "HIDReport.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user