diff options
author | philip <philip@FreeBSD.org> | 2004-08-08 00:57:07 +0000 |
---|---|---|
committer | philip <philip@FreeBSD.org> | 2004-08-08 00:57:07 +0000 |
commit | 6870f3b6f42c83cf36a0538193df1ff54d0b09f5 (patch) | |
tree | d977781c0592d5a0e12a1ac517daf5df8fa2221e /sys/isa | |
parent | aaf6af918f5acef907fd249b655dd0707de269d9 (diff) | |
download | FreeBSD-src-6870f3b6f42c83cf36a0538193df1ff54d0b09f5.zip FreeBSD-src-6870f3b6f42c83cf36a0538193df1ff54d0b09f5.tar.gz |
Update support for Synaptics Touchpads (Volume II)
o Handle the 'up/down' buttons some touchpads have as
a z-axis (scrollwheel) as recommended by the specs
o Report the buttons as button4 and button5 instead
of button2 and button4, button2 can be emulated by
pressing button1 and button3 simultaneously. This
allows one to use the two extra buttons for other
purposes if one so desires.
Tested by: many subscribers to -current
Approved by: njl
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/psm.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/sys/isa/psm.c b/sys/isa/psm.c index d811777..37faa1b 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -2502,16 +2502,19 @@ psmsoftintr(void *arg) ((pb->ipacket[0] & 0x04) >> 1) | ((pb->ipacket[3] & 0x04) >> 2); + /* Button presses */ ms.button = 0; if (pb->ipacket[0] & 0x01) ms.button |= MOUSE_BUTTON1DOWN; if (pb->ipacket[0] & 0x02) ms.button |= MOUSE_BUTTON3DOWN; - if ((pb->ipacket[3] & 0x01) && (pb->ipacket[0] & 0x01) == 0) - ms.button |= MOUSE_BUTTON2DOWN; - if ((pb->ipacket[3] & 0x02) && (pb->ipacket[0] & 0x02) == 0) - ms.button |= MOUSE_BUTTON4DOWN; + if (sc->synhw.capExtended && sc->synhw.capFourButtons) { + if ((pb->ipacket[3] & 0x01) && (pb->ipacket[0] & 0x01) == 0) + ms.button |= MOUSE_BUTTON4DOWN; + if ((pb->ipacket[3] & 0x02) && (pb->ipacket[0] & 0x02) == 0) + ms.button |= MOUSE_BUTTON5DOWN; + } /* There is a finger on the pad. */ if ((w >= 4 && w <= 7) && (z >= 16 && z < 200)) { @@ -2537,7 +2540,15 @@ psmsoftintr(void *arg) } else { sc->flags &= ~PSM_FLAGS_FINGERDOWN; } - z = 0; + + /* Use the extra buttons as a scrollwheel */ + if (ms.button & MOUSE_BUTTON4DOWN) + z = -1; + else if (ms.button & MOUSE_BUTTON5DOWN) + z = 1; + else + z = 0; + break; case MOUSE_MODEL_GENERIC: @@ -3140,6 +3151,16 @@ enable_synaptics(struct psm_softc *sc) /* Reset the sampling rate */ set_mouse_sampling_rate(kbdc, 20); + /* + * Report the correct number of buttons + * + * XXX: I'm not sure this is used anywhere. + */ + if (sc->synhw.capExtended && sc->synhw.capFourButtons) + sc->hw.buttons = 4; + else + sc->hw.buttons = 3; + return (TRUE); } |