[haiku-commits] r35305 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 27 Jan 2010 00:27:57 +0100 (CET)

Author: mmlr
Date: 2010-01-27 00:27:56 +0100 (Wed, 27 Jan 2010)
New Revision: 35305
Changeset: http://dev.haiku-os.org/changeset/35305/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp
   haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp
   haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp
   haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h
   haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp
Log:
Make the HID parser usable standalone in userland.


Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp      
2010-01-26 21:30:50 UTC (rev 35304)
+++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.cpp      
2010-01-26 23:27:56 UTC (rev 35305)
@@ -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"
 

Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp  
2010-01-26 21:30:50 UTC (rev 35304)
+++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp  
2010-01-26 23:27:56 UTC (rev 35305)
@@ -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"

Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp  
2010-01-26 21:30:50 UTC (rev 35304)
+++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.cpp  
2010-01-26 23:27:56 UTC (rev 35305)
@@ -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 @@
                fCurrentReport(NULL),
                fBusyCount(0)
 {
+#ifndef USERLAND_HID
        fConditionVariable.Init(this, "hid report");
+#endif
 }
 
 
@@ -155,10 +162,13 @@
                fReportStatus = B_ERROR;
        }
 
+#ifndef USERLAND_HID
        fConditionVariable.NotifyAll();
+#endif
 }
 
 
+#ifndef USERLAND_HID
 status_t
 HIDReport::SendReport()
 {
@@ -184,6 +194,7 @@
        free(report);
        return result;
 }
+#endif // !USERLAND_HID
 
 
 HIDReportItem *
@@ -208,6 +219,7 @@
 }
 
 
+#ifndef USERLAND_HID
 status_t
 HIDReport::WaitForReport(bigtime_t timeout)
 {
@@ -241,6 +253,7 @@
 {
        atomic_add(&fBusyCount, -1);
 }
+#endif // !USERLAND_HID
 
 
 void

Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h    
2010-01-26 21:30:50 UTC (rev 35304)
+++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReport.h    
2010-01-26 23:27:56 UTC (rev 35305)
@@ -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 @@
                                                                        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 @@
                status_t                                fReportStatus;
                uint8 *                                 fCurrentReport;
                int32                                   fBusyCount;
+
+#ifndef USERLAND_HID
                ConditionVariable               fConditionVariable;
+#endif
 };
 
 #endif // HID_REPORT_H

Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp      
2010-01-26 21:30:50 UTC (rev 35304)
+++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/HIDReportItem.cpp      
2010-01-26 23:27:56 UTC (rev 35305)
@@ -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"


Other related posts:

  • » [haiku-commits] r35305 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid - mmlr