[haiku-commits] haiku: hrev53826 - src/add-ons/kernel/drivers/input/usb_hid headers/os/drivers/usb

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 5 Feb 2020 19:10:19 -0500 (EST)

hrev53826 adds 1 changeset to branch 'master'
old head: 8a0fd7e14e19eb09f30e1cb15ba4caa14f424195
new head: a206dcc221e781aa6c03631de1fc4da9b146a880
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=a206dcc221e7+%5E8a0fd7e14e19

----------------------------------------------------------------------------

a206dcc221e7: usb hid: implement horizontal scrollwheel
  
  - Fix USB_hid_page_consumer.h: some values are skipped in the spec so
    our defines were off
  - Handle the horizontal wheel on my mouse which is declared as a
    CON_AC_PAN, but otherwise works just like the vertical wheel
  - Input server and interface kit already handle the events properly
    (they were available for serial mice already).
  
  Change-Id: Ie0080ebb27e9478bcfe9f9dc5fd2a936ae05a848
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2201
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53826
Commit:      a206dcc221e781aa6c03631de1fc4da9b146a880
URL:         https://git.haiku-os.org/haiku/commit/?id=a206dcc221e7
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Feb  5 09:11:16 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Feb  6 00:10:10 2020 UTC

----------------------------------------------------------------------------

3 files changed, 14 insertions(+), 5 deletions(-)
headers/os/drivers/usb/USB_hid_page_consumer.h       |  2 +-
.../drivers/input/usb_hid/MouseProtocolHandler.cpp   | 16 ++++++++++++----
.../drivers/input/usb_hid/MouseProtocolHandler.h     |  1 +

----------------------------------------------------------------------------

diff --git a/headers/os/drivers/usb/USB_hid_page_consumer.h 
b/headers/os/drivers/usb/USB_hid_page_consumer.h
index c0766bb2c8..9bf9c44d55 100644
--- a/headers/os/drivers/usb/USB_hid_page_consumer.h
+++ b/headers/os/drivers/usb/USB_hid_page_consumer.h
@@ -263,7 +263,7 @@ enum {
        B_HID_UID_CON_AC_SAVE,
        B_HID_UID_CON_AC_PRINT,
        B_HID_UID_CON_AC_PROPERTIES,
-       B_HID_UID_CON_AC_UNDO,
+       B_HID_UID_CON_AC_UNDO = 0x21A,
        B_HID_UID_CON_AC_COPY,
        B_HID_UID_CON_AC_CUT,
        B_HID_UID_CON_AC_PASTE,
diff --git a/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.cpp 
b/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.cpp
index 2c87564da7..5b8aab26dd 100644
--- a/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.cpp
+++ b/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.cpp
@@ -32,6 +32,7 @@ MouseProtocolHandler::MouseProtocolHandler(HIDReport &report,
        fXAxis(xAxis),
        fYAxis(yAxis),
        fWheel(NULL),
+       fHorizontalPan(NULL),
 
        fLastButtons(0),
        fClickCount(0),
@@ -54,8 +55,11 @@ MouseProtocolHandler::MouseProtocolHandler(HIDReport &report,
 
        fWheel = report.FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
                B_HID_UID_GD_WHEEL);
+       fHorizontalPan = report.FindItem(B_HID_USAGE_PAGE_CONSUMER,
+               B_HID_UID_CON_AC_PAN);
 
-       TRACE("mouse device with %lu buttons and %swheel\n", buttonCount,
+       TRACE("mouse device with %lu buttons %sand %swheel\n", buttonCount,
+               fHorizontalPan == NULL ? "" : ", horizontal pan ",
                fWheel == NULL ? "no " : "");
        TRACE("report id: %u\n", report.ID());
 }
@@ -204,9 +208,12 @@ MouseProtocolHandler::_ReadReport(void *buffer, uint32 
*cookie)
        if (fYAxis.Extract() == B_OK && fYAxis.Valid())
                axisRelativeData[1] = fYAxis.Data();
 
-       uint32 wheelData = 0;
+       uint32 wheelData[2] = {0};
        if (fWheel != NULL && fWheel->Extract() == B_OK && fWheel->Valid())
-               wheelData = fWheel->Data();
+               wheelData[0] = fWheel->Data();
+       if (fHorizontalPan != NULL && fHorizontalPan->Extract() == B_OK
+                       && fHorizontalPan->Valid())
+               wheelData[1] = fHorizontalPan->Data();
 
        uint32 buttons = 0;
        for (uint32 i = 0; i < B_MAX_MOUSE_BUTTONS; i++) {
@@ -245,7 +252,8 @@ MouseProtocolHandler::_ReadReport(void *buffer, uint32 
*cookie)
        info->ydelta = -axisRelativeData[1];
        info->clicks = clicks;
        info->timestamp = timestamp;
-       info->wheel_ydelta = -wheelData;
+       info->wheel_ydelta = -wheelData[0];
+       info->wheel_xdelta = wheelData[1];
 
        return B_OK;
 }
diff --git a/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.h 
b/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.h
index 81ab7a7cb0..301fe77480 100644
--- a/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.h
+++ b/src/add-ons/kernel/drivers/input/usb_hid/MouseProtocolHandler.h
@@ -41,6 +41,7 @@ private:
                        HIDReportItem &         fXAxis;
                        HIDReportItem &         fYAxis;
                        HIDReportItem *         fWheel;
+                       HIDReportItem *         fHorizontalPan;
                        HIDReportItem *         fButtons[B_MAX_MOUSE_BUTTONS];
 
                        uint32                          fLastButtons;


Other related posts:

  • » [haiku-commits] haiku: hrev53826 - src/add-ons/kernel/drivers/input/usb_hid headers/os/drivers/usb - waddlesplash