hrev51945 adds 2 changesets to branch 'master'
old head: b08627f310bb2e80bca50176e7a758182384735a
new head: 79cb8f02d9310dae0c347e6730414f7eacb4abd6
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=79cb8f02d931+%5Eb08627f310bb
----------------------------------------------------------------------------
258b7d4a8b25: ps2_synaptics: support Lenovo use of extra buttons
On some Thinkpads, the extra buttons are used for the trackpoint, so
they should be reported as "main" buttons, not extended ones. An
(undocumented) information query was added to the firmware to report
when this is the case, however it is not advertised as supported by the
firmware itself by the usual mechanism.
What we do is (just as the Linux driver) detect that the tocuhpad has a
PS/2 passthrough (likely used to daisy-chain a trackpoint on the same
PS/2 port) and also advertises extra buttons (an unlikely case, it is
already uncommon to even get a middle button these days...) and assume
that the information query is available then.
When the query is available and reports the quirk, the extended buttons
are reported as 0, 1, 2 (left, right, middle), instead of extra buttons
the userland would have no idea what to do with.
Change-Id: Iad5a9e140b6e49c298dcc901f4e331a4a847d7b2
79cb8f02d931: PS/2 synaptics: minimal clickpad support
Handled as a 1-button mouse. We didn't really support this since the old
Macintosh ADB mouses, so let's see if that code aged well!
Change-Id: Ibed2423023e821ae4ce608f0ddbc5ac32bfbd8f7
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
2 files changed, 104 insertions(+), 46 deletions(-)
.../kernel/bus_managers/ps2/ps2_synaptics.cpp | 147 +++++++++++++------
.../kernel/bus_managers/ps2/ps2_synaptics.h | 3 +
############################################################################
Commit: 258b7d4a8b2572c6d0cb83abbda29245fb5f97c4
URL: https://git.haiku-os.org/haiku/commit/?id=258b7d4a8b25
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Thu May 10 17:52:28 2018 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Thu May 17 06:18:19 2018 UTC
ps2_synaptics: support Lenovo use of extra buttons
On some Thinkpads, the extra buttons are used for the trackpoint, so
they should be reported as "main" buttons, not extended ones. An
(undocumented) information query was added to the firmware to report
when this is the case, however it is not advertised as supported by the
firmware itself by the usual mechanism.
What we do is (just as the Linux driver) detect that the tocuhpad has a
PS/2 passthrough (likely used to daisy-chain a trackpoint on the same
PS/2 port) and also advertises extra buttons (an unlikely case, it is
already uncommon to even get a middle button these days...) and assume
that the information query is available then.
When the query is available and reports the quirk, the extended buttons
are reported as 0, 1, 2 (left, right, middle), instead of extra buttons
the userland would have no idea what to do with.
Change-Id: Iad5a9e140b6e49c298dcc901f4e331a4a847d7b2
----------------------------------------------------------------------------
diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp
b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp
index b7fb39dbf4..ccd997f340 100644
--- a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp
+++ b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp
@@ -29,6 +29,21 @@
#define REAL_MAX_PRESSURE 100
#define MAX_PRESSURE 200
+enum {
+ kIdentify = 0x00,
+ kReadModes = 0x01,
+ kReadCapabilities = 0x02,
+ kReadModelId = 0x03,
+ kReadSerialNumberPrefix = 0x06,
+ kReadSerialModelSuffix = 0x07,
+ kReadResolutions = 0x08,
+ kExtendedModelId = 0x09,
+ kContinuedCapabilities = 0x0C,
+ kMaximumCoordinates = 0x0D,
+ kDeluxeLedInfo = 0x0E,
+ kMinimumCoordinates = 0x0F,
+ kTrackpointQuirk = 0x10
+};
static hardware_specs gHardwareSpecs;
@@ -83,6 +98,26 @@ set_touchpad_mode(ps2_dev *dev, uint8 mode)
}
+static status_t
+get_information_query(ps2_dev *dev, uint8 extendedQueries, uint8 query,
+ uint8 val[3])
+{
+ if (query == kTrackpointQuirk) {
+ // Special case: this information query is not reported in the
+ // "extended queries", but is still supported when the touchpad
has
+ // a pass-through port.
+ if (!sTouchpadInfo.capPassThrough)
+ return B_NOT_SUPPORTED;
+ } else if (query > extendedQueries + 8)
+ return B_NOT_SUPPORTED;
+
+ status_t error = send_touchpad_arg(dev, query);
+ if (error != B_OK)
+ return error;
+ return ps2_dev_command(dev, 0xE9, NULL, 0, val, 3);
+}
+
+
static status_t
get_synaptics_movment(synaptics_cookie *cookie, mouse_movement *movement)
{
@@ -128,35 +163,31 @@ get_synaptics_movment(synaptics_cookie *cookie,
mouse_movement *movement)
if (sTouchpadInfo.capMiddleButton ||
sTouchpadInfo.capFourButtons)
event.buttons |= ((event_buffer[0] ^ event_buffer[3]) &
0x01) << 2;
- if (sTouchpadInfo.nExtendedButtons > 0
- && ((event_buffer[0] ^ event_buffer[3]) & 0x02)
!= 0) {
- int nextButton = 2;
- if (sTouchpadInfo.capMiddleButton)
- nextButton = 3;
- if (sTouchpadInfo.capFourButtons)
- nextButton = 4;
-
- // The touchpad supports extended buttons and one of
them is
- // currently being pressed. They replace the lowest
bits of X and Y.
- int button = 0;
- bool pressed;
- while (button < sTouchpadInfo.nExtendedButtons) {
- // Odd buttons are in the X byte
- pressed = event_buffer[4] >> (button / 2) & 0x1;
-
- if (pressed)
- event.buttons |= 1 << (button +
nextButton);
-
- button++;
-
- // Even buttons are in the Y byte
- pressed = event_buffer[5] >> (button / 2) & 0x1;
-
- if (pressed)
- event.buttons |= 1 << (button +
nextButton);
-
- button++;
+ if (sTouchpadInfo.nExtendedButtons > 0)
+ {
+ if (((event_buffer[0] ^ event_buffer[3]) & 0x02) != 0) {
+ // This packet includes extended buttons state.
The state is
+ // only reported once when one of the buttons
is pressed or
+ // released, so we must keep track of the
buttons state.
+
+ // The values replace the lowest bits of the X
and Y coordinates
+ // in the packet, we need to extract them from
there.
+
+ bool pressed;
+ for (int button = 0; button <
sTouchpadInfo.nExtendedButtons;
+ button++) {
+ // Even buttons are in the X byte
+ pressed = event_buffer[4 + button % 2]
+ if (pressed) {button / 2 & 0x1;