diff --git a/share/man/man4/pms.4 b/share/man/man4/pms.4 index 46e614fd0382..24924e47e5c4 100644 --- a/share/man/man4/pms.4 +++ b/share/man/man4/pms.4 @@ -1,4 +1,4 @@ -.\" $NetBSD: pms.4,v 1.32 2018/11/06 09:14:08 blymn Exp $ +.\" $NetBSD: pms.4,v 1.32.2.1 2020/03/30 18:45:16 martin Exp $ .\" .\" Copyright (c) 1993 Christopher G. Demetriou .\" All rights reserved. @@ -32,7 +32,7 @@ .\" .\" <> .\" -.Dd February 4, 2018 +.Dd March 30, 2020 .Dt PMS 4 .Os .Sh NAME @@ -102,13 +102,22 @@ The following variables control behavior of Synaptics touchpads: .Bl -tag -width 8n .It Dv hw.synaptics.up_down_emulation -If the touchpad reports the existence of Up/Down buttons, this value -determines if they should be reported as button 4 and 5 events or if -they should be used to emulate some other event. -When set to 0, report Up/Down events as buttons 4 and 5. -When set to 1, the Up and Down buttons are both mapped to the middle button. -When set to 2 (default), the Up and Down buttons are used for Z-axis -emulation, which more closely resembles how mouse wheels operate. +If the touchpad reports the existence of extra ("Up/Down") buttons, this +value determines what kind of mouse events they should generate. +On certain clickpads, the Up/Down buttons may be physical buttons that +can be used instead of pressing the pad down, or used as additional +buttons. +.Bl -bullet +.It +If set to 0, Up/Down events generate button 4 and 5 clicks. +.It +If set to 1, Up/Down events generate middle button clicks. +.It +If set to 2, the Up and Down buttons are used for Z-axis emulation, +which more closely resembles how mouse wheels operate. +.It +If set to 3 (default), Up/Down events generate left/right clicks. +.El .It Dv hw.synaptics.up_down_motion_delta When the Up/Down buttons are used for Z-axis emulation, this value specifies the emulated delta-Z value per click. @@ -139,9 +148,14 @@ reported pressure drops below this value. More recent touchpads can report the presence of more than one finger on the pad. This value determines how such events are used. +.Bl -bullet +.It If set to 0 (default), two-finger events are ignored. +.It If set to 1, two-finger events generate a right button click. +.It If set to 2, two-finger events generate a middle button click. +.El .It Dv hw.synaptics.scale_x .It Dv hw.synaptics.scale_y .It Dv hw.synaptics.scale_z diff --git a/sys/dev/pckbport/synaptics.c b/sys/dev/pckbport/synaptics.c index decb8dcd0ae9..58ffc2f84bed 100644 --- a/sys/dev/pckbport/synaptics.c +++ b/sys/dev/pckbport/synaptics.c @@ -1,4 +1,4 @@ -/* $NetBSD: synaptics.c,v 1.50 2019/07/05 05:09:24 mlelstv Exp $ */ +/* $NetBSD: synaptics.c,v 1.50.2.1 2020/03/30 18:45:16 martin Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -48,7 +48,7 @@ #include "opt_pms.h" #include -__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50 2019/07/05 05:09:24 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.1 2020/03/30 18:45:16 martin Exp $"); #include #include @@ -98,7 +98,7 @@ static void pms_sysctl_synaptics(struct sysctllog **); static int pms_sysctl_synaptics_verify(SYSCTLFN_ARGS); /* Controlled by sysctl. */ -static int synaptics_up_down_emul = 2; +static int synaptics_up_down_emul = 3; static int synaptics_up_down_motion_delta = 1; static int synaptics_gesture_move = 200; static int synaptics_gesture_length = 20; @@ -852,8 +852,11 @@ pms_sysctl_synaptics_verify(SYSCTLFN_ARGS) return error; /* Sanity check the params. */ - if (node.sysctl_num == synaptics_up_down_emul_nodenum || - node.sysctl_num == synaptics_two_fingers_emul_nodenum) { + if (node.sysctl_num == synaptics_up_down_emul_nodenum) { + if (t < 0 || t > 3) + return (EINVAL); + } else + if (node.sysctl_num == synaptics_two_fingers_emul_nodenum) { if (t < 0 || t > 2) return (EINVAL); } else @@ -1091,13 +1094,29 @@ pms_synaptics_parse(struct pms_softc *psc) /* Old style Middle Button. */ sp.sp_middle = (psc->packet[0] & PMS_LBUTMASK) ^ (psc->packet[3] & PMS_LBUTMASK); - } else if (synaptics_up_down_emul == 1) { + } else if (synaptics_up_down_emul != 1) { + sp.sp_middle = 0; + } + + switch (synaptics_up_down_emul) { + case 1: /* Do middle button emulation using up/down buttons */ sp.sp_middle = sp.sp_up | sp.sp_down; sp.sp_up = sp.sp_down = 0; - } else - sp.sp_middle = 0; - + break; + case 3: + /* Do left/right button emulation using up/down buttons */ + sp.sp_left = sp.sp_up; + sp.sp_right = sp.sp_down; + sp.sp_up = sp.sp_down = 0; + break; + default: + /* + * Don't do any remapping... + * Z-axis emulation is handled in pms_synaptics_process_packet + */ + break; + } } pms_synaptics_process_packet(psc, &sp);