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
This commit is contained in:
parent
4079d722ac
commit
7589cb5cae
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133296
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user