History log of /haiku/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp
Revision Date Author Comments
# 49efa33d 17-Jan-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

ps2 synaptics: implement 'extended W' mode.

"Newer" synaptics touchpad support a new mode where they can report more
information to the host. In this mode, there is a different packet
format for tracking extra data from the touchpad, including a wheel
encoder (mousewheel) if available, and multitouch finger tracking.

This mode is documented in the Synaptics touchpad interfacing guide
(Synaptics document 511-000275-01 Rev. B), but was not yet implemented
in our driver.

It should help with detecting multiple fingers, or finger position on
clickpads to determine right or left click.

This change implements the following items from the Synaptics
interfacing guide:

- Cleanup and clarify the code for features detection to properly report
clickpads
- Enable "extended W" mode if supported
- Process extended W values 0 (mouse wheels, reported in the
touchpad_event structure and could be used by input_server for
scrolling), 1 (secondary finger), and 2 (finger count)
- Fix handling of wValue, which is not always a finger width
- Add handling of vValuen which indicates the finger width when wValue
doesn't

Overall, this should provide the movement_maker with a better picture of
what's happening.

Also improve tracing to show received packets and the corresponding
WValue since that's an important value in identifying which type of
packet it is.

Unfortunately I currently don't have a laptop with synaptics touchpad to
test this with.

Change-Id: If334392f4eb2a146955f6c8c897f0ab64d79b8d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4425
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: nephele <nep@packageloss.eu>


# 5e596efe 15-Jul-2022 Augustin Cavalier <waddlesplash@gmail.com>

Refactor touchpad movement generation by migrating MovementMaker to userland.

This considerably overhauls touchpad event generation, simplifying and
cleaning it up considerably:

* Return the touchpad specifications through the MS_IS_TOUCHPAD ioctl.

* There is now a dedicated MS_READ_TOUCHPAD ioctl, as touchpads
can either return touchpad_movement structures or mouse_movement
ones depending on what mode they are operating in.

* Event repeating on timeouts is now handled in MovementMaker and
the input_server control thread, so MS_READ_TOUCHPAD takes
a timeout value. This means we can drop all the EventProducers.

* Use the real floating-point math functions in MovementMaker now
that we are running in userland.

* Drop unused structures, constants, headers, and other things
related to touchpad support.

Change-Id: I28cdb28e4100393a9338a8ebb865573cec13fc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5455
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# a3d84aba 18-Jun-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

ps2: improve tracing

Change-Id: I3991e1974ac4af2ba00d692284bfcf00e5b4cc84
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5386
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 85ab8ef6 05-Sep-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

ps2 synaptics: don't spam the syslog when nothing happens

Some logs are emitted even when nothing at all is happening, constantly
spamming the syslog. Log them only the first time they happen.

Change-Id: I81511a7ce245c2141fa3dcd141b2f3732d9b51ad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4424
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# fdbbdccc 04-Sep-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

ps2: allow more selective tracing

In some cases, we don't need the full tracking of every byte received at
the PS2 level, but higher level traces from specific devices will be
enough.

Change-Id: I31984e6b7784b5d033b457f43f3793f772213f4a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4423
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# cd6365c7 17-May-2018 Jérôme Duval <jerome.duval@gmail.com>

style fixes


# 79cb8f02 13-May-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

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


# 258b7d4a 10-May-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

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


# e003057f 10-May-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

PS/2 Synaptics: add support for extended buttons

It is possible to get up to 8 extra buttons on synaptics touchpads.
On some Thinkpad models, these are used to implement the trackpoint
buttons (reported as buttons 4, 5 and 6). Since the touchpad itself has
no buttons (it is a clickpad), we may at least try to handle these
properly.

Change-Id: I5d4021e36fb3ac86ecf213c5666f9b6ddd3e2bca


# ebdb22de 10-May-2018 Zoltán Mizsei <zmizsei@extrowerk.com>

Fix ps2 debug build on x86_64

Change-Id: I579656b6b0619b44aa4a02c87720762cb5dd1415


# 14c42c37 04-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

Synaptics: remove useless delay.

As pointed by Axel and explained in Synaptic docs, the touchpad should
delay the first command itself until it's ready, so an arbitrary delay
should not be needed after reset.

Note: I don't have a touchpad on my machine. Please test this :)


# c2872486 03-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

Reset PS/2 devices before probing as synaptics touchpad.

Patch from dukscry, fixes #8616.


# 4b722b91 27-Jun-2011 Siarzhuk Zharski <zharik@gmx.li>

Proper handling of middle mouse event on capFourButtons and capMiddleButton
capable touchpads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42329 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f4deb44 26-Jun-2011 Siarzhuk Zharski <zharik@gmx.li>

* Implemented PS2_CMD_RESEND command handlig;

* Workaround for touchpad reset timeouts on some HP/Compaq KBCs. Looks like such
KBC marks the mouse reset request (xFF) as correctly sent (by xFA answer) but
does not wait enough time for the answer from touchpad. So complete answer
finally contains xFE xAA x00 bytes. The workaround detects this xFE xAA answer
and issues the RESEND (xFE) request to touchpad. This forces touchpad to resend
the last packet of data (xAA x00) that can be processed normally by the host;

* Fix for handling passthrough_command() call. The parent device was disabled at
start of processing command and was not re-enabled back in case any error return.
This fixes the touchpad "pass-through" feature handling on the same HP/Compaq HW.
This KBC has the "pass-through" capability marked ON but cannot handle it as
currently implemented - there is no answer from corresponding port. The parent
device stay in disabled state after this;

* Fix ps2_dev_publish() for handling passthrough devices (parent_dev != NULL)
This workaround postpone the publishing such device until the parent device
finishes it's opening and set the PS2_ENABLED_FALG. It prevent from mixing
the Synaptics multi-command sequences from synaptics_open() and ps2_dev_publish()
routines and failing both initializations;

Fixes #2867 #3594 #4315



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b35c5d3 06-Apr-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

- Generate helper events for ALPS touchpads. This is needed for tap drag and edge motion. This emulates the synaptics touchpad somehow. For example, we need more events to decide if a tap is a
simple click or becomes a tap drag. ALPS does not send these events.
- Enable ALPS.
- Force const edge motion speed. Synaptics sends events with a certain frequency ALPS don't. Even worse ALPS stops sending events durring a edge motion when you don't move your finger. Current
speed is 200 pixel/s. In theory synaptics has different event frequency modes which would result in a different edge motion speed in the previous approach. Please check if synaptics works/speed is correct. Will try to get a synaptics laptop for testing...
- fix class variable names.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a16bab72 06-Apr-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Initialize the synaptics cookie again. Not sure but maybe this fixes a crash on startup (if there is an interrupt before the ring buffer is created...).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41189 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c152c70b 30-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

- ALPS and synaptics are sharing the same code to generate mouse events now. The movement generation is calibrated on the synaptics touchpad, though.
ALPS movements are fine now, hope the synaptics is still working. Please test! There are still some leftovers form switching from a c struct to a c++
class will fix that later.
- Support ALPS devices with passthrough.
- ALPS is still disabled because tap and edge motion is not working yet. The
problem is that synaptics generates more helper events which makes this a lot
easier to implement. My plan is to emulate this events to imitate the synatics touchpad.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41140 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e637ccf5 28-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Reapply the ps2 cpp patch. Thanks Axel.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79bdca06 28-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Revert r41129 to get history back.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41133 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 278a2b8a 27-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Making the ps2 busmanager c++.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41129 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14c42c37834c22ec722b28bb5462d494dac9b23c 04-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

Synaptics: remove useless delay.

As pointed by Axel and explained in Synaptic docs, the touchpad should
delay the first command itself until it's ready, so an arbitrary delay
should not be needed after reset.

Note: I don't have a touchpad on my machine. Please test this :)


# c2872486ecdbb9e151eef60bdfca0382ba57acda 03-Dec-2014 Adrien Destugues <pulkomandy@gmail.com>

Reset PS/2 devices before probing as synaptics touchpad.

Patch from dukscry, fixes #8616.


# 4b722b91dbef7f8d005bfaec6174faa7cfcaecb4 27-Jun-2011 Siarzhuk Zharski <zharik@gmx.li>

Proper handling of middle mouse event on capFourButtons and capMiddleButton
capable touchpads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42329 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f4deb4400434bb3c210a7b0333eddd4800290bf 26-Jun-2011 Siarzhuk Zharski <zharik@gmx.li>

* Implemented PS2_CMD_RESEND command handlig;

* Workaround for touchpad reset timeouts on some HP/Compaq KBCs. Looks like such
KBC marks the mouse reset request (xFF) as correctly sent (by xFA answer) but
does not wait enough time for the answer from touchpad. So complete answer
finally contains xFE xAA x00 bytes. The workaround detects this xFE xAA answer
and issues the RESEND (xFE) request to touchpad. This forces touchpad to resend
the last packet of data (xAA x00) that can be processed normally by the host;

* Fix for handling passthrough_command() call. The parent device was disabled at
start of processing command and was not re-enabled back in case any error return.
This fixes the touchpad "pass-through" feature handling on the same HP/Compaq HW.
This KBC has the "pass-through" capability marked ON but cannot handle it as
currently implemented - there is no answer from corresponding port. The parent
device stay in disabled state after this;

* Fix ps2_dev_publish() for handling passthrough devices (parent_dev != NULL)
This workaround postpone the publishing such device until the parent device
finishes it's opening and set the PS2_ENABLED_FALG. It prevent from mixing
the Synaptics multi-command sequences from synaptics_open() and ps2_dev_publish()
routines and failing both initializations;

Fixes #2867 #3594 #4315



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b35c5d38ddff53d71b9f6b0644704b87c5ad9bb 06-Apr-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

- Generate helper events for ALPS touchpads. This is needed for tap drag and edge motion. This emulates the synaptics touchpad somehow. For example, we need more events to decide if a tap is a
simple click or becomes a tap drag. ALPS does not send these events.
- Enable ALPS.
- Force const edge motion speed. Synaptics sends events with a certain frequency ALPS don't. Even worse ALPS stops sending events durring a edge motion when you don't move your finger. Current
speed is 200 pixel/s. In theory synaptics has different event frequency modes which would result in a different edge motion speed in the previous approach. Please check if synaptics works/speed is correct. Will try to get a synaptics laptop for testing...
- fix class variable names.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a16bab72a73194534d048c254684d34327ae1791 06-Apr-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Initialize the synaptics cookie again. Not sure but maybe this fixes a crash on startup (if there is an interrupt before the ring buffer is created...).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41189 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c152c70b467536ee3e54c43674f70e1f849c4532 30-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

- ALPS and synaptics are sharing the same code to generate mouse events now. The movement generation is calibrated on the synaptics touchpad, though.
ALPS movements are fine now, hope the synaptics is still working. Please test! There are still some leftovers form switching from a c struct to a c++
class will fix that later.
- Support ALPS devices with passthrough.
- ALPS is still disabled because tap and edge motion is not working yet. The
problem is that synaptics generates more helper events which makes this a lot
easier to implement. My plan is to emulate this events to imitate the synatics touchpad.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41140 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e637ccf5c1c22c87fa0cb695a2d62d6ee1d92308 28-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Reapply the ps2 cpp patch. Thanks Axel.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79bdca06506e69ebd8d9a1eecc5a246b21286472 28-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Revert r41129 to get history back.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41133 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 278a2b8aaa75b3252ca8de1eef36ca6afc836ac1 27-Mar-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Making the ps2 busmanager c++.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41129 a95241bf-73f2-0310-859d-f6bbb57e9c96