Skip to content

Commit

Permalink
wsp: Allow the trackpad to be used after a partially unreleased click.
Browse files Browse the repository at this point in the history
This provides functionality for a click which is partially unreleased
and then allows the user to continue moving the mousepad as if were not
invoked as a full click

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
Reviewed by: imp, wulf
Pull Request: freebsd#1365
  • Loading branch information
MegaManSec authored and bsdimp committed Sep 6, 2024
1 parent 8b62e51 commit 28f2b2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions share/man/man4/wsp.4
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ Pointer sensitivity can be controlled using the sysctl tunable
Tap to left-click can be controlled using the sysctl tunable
.Nm hw.usb.wsp.enable_single_tap_clicks ,
set to 0 to disable single tap clicks or 1 to enable them (default).
Movement on the trackpad following a partially-released click can be
controlled using the sysctl tunable
.Nm hw.usb.wsp.enable_single_tap_movement ,
set to 0 to disable the movement on the trackpad until a full release
or 1 to allow the continued movement (default).
Z-Axis sensitivity can be controlled using the sysctl tunable
.Nm hw.usb.wsp.z_factor .
Z-Axis inversion can be controlled using the sysctl tunable
Expand Down
10 changes: 8 additions & 2 deletions sys/dev/usb/input/wsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static struct wsp_tuning {
int pressure_tap_threshold;
int scr_hor_threshold;
int enable_single_tap_clicks;
int enable_single_tap_movement;
}
wsp_tuning =
{
Expand All @@ -110,6 +111,7 @@ static struct wsp_tuning {
.pressure_tap_threshold = 120,
.scr_hor_threshold = 20,
.enable_single_tap_clicks = 1,
.enable_single_tap_movement = 1,
};

static void
Expand All @@ -123,6 +125,7 @@ wsp_runing_rangecheck(struct wsp_tuning *ptun)
WSP_CLAMP(ptun->pressure_tap_threshold, 1, 255);
WSP_CLAMP(ptun->scr_hor_threshold, 1, 255);
WSP_CLAMP(ptun->enable_single_tap_clicks, 0, 1);
WSP_CLAMP(ptun->enable_single_tap_movement, 0, 1);
}

SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scale_factor, CTLFLAG_RWTUN,
Expand All @@ -141,6 +144,9 @@ SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scr_hor_threshold, CTLFLAG_RWTUN,
&wsp_tuning.scr_hor_threshold, 0, "horizontal scrolling threshold");
SYSCTL_INT(_hw_usb_wsp, OID_AUTO, enable_single_tap_clicks, CTLFLAG_RWTUN,
&wsp_tuning.enable_single_tap_clicks, 0, "enable single tap clicks");
SYSCTL_INT(_hw_usb_wsp, OID_AUTO, enable_single_tap_movement, CTLFLAG_RWTUN,
&wsp_tuning.enable_single_tap_movement, 0, "enable single tap movement");


/*
* Some tables, structures, definitions and constant values for the
Expand Down Expand Up @@ -1149,8 +1155,8 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error)
dx = sc->pos_x[0] - sc->pre_pos_x;
dy = sc->pos_y[0] - sc->pre_pos_y;

/* Ignore movement during button is releasing */
if (sc->ibtn != 0 && sc->sc_status.button == 0)
/* Optionally ignore movement during button is releasing */
if (tun.enable_single_tap_movement != 1 && sc->ibtn != 0 && sc->sc_status.button == 0)
dx = dy = 0;

/* Ignore movement if ntouch changed */
Expand Down

0 comments on commit 28f2b2f

Please sign in to comment.