diff --git a/share/man/man4/wsp.4 b/share/man/man4/wsp.4 --- a/share/man/man4/wsp.4 +++ b/share/man/man4/wsp.4 @@ -66,6 +66,11 @@ 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). +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 +.Nm hw.usb.wsp.z_invert , +set to 0 to disable (default) or 1 to enable inversion. .Sh FILES .Nm creates a blocking pseudo-device file, diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -85,6 +85,7 @@ static struct wsp_tuning { int scale_factor; int z_factor; + int z_invert; int pressure_touch_threshold; int pressure_untouch_threshold; int pressure_tap_threshold; @@ -95,6 +96,7 @@ { .scale_factor = 12, .z_factor = 5, + .z_invert = 0, .pressure_touch_threshold = 50, .pressure_untouch_threshold = 10, .pressure_tap_threshold = 120, @@ -107,6 +109,7 @@ { WSP_CLAMP(ptun->scale_factor, 1, 63); WSP_CLAMP(ptun->z_factor, 1, 63); + WSP_CLAMP(ptun->z_invert, 0, 1); WSP_CLAMP(ptun->pressure_touch_threshold, 1, 255); WSP_CLAMP(ptun->pressure_untouch_threshold, 1, 255); WSP_CLAMP(ptun->pressure_tap_threshold, 1, 255); @@ -118,6 +121,8 @@ &wsp_tuning.scale_factor, 0, "movement scale factor"); SYSCTL_INT(_hw_usb_wsp, OID_AUTO, z_factor, CTLFLAG_RWTUN, &wsp_tuning.z_factor, 0, "Z-axis scale factor"); +SYSCTL_INT(_hw_usb_wsp, OID_AUTO, z_invert, CTLFLAG_RWTUN, + &wsp_tuning.z_invert, 0, "enable Z-axis inversion"); SYSCTL_INT(_hw_usb_wsp, OID_AUTO, pressure_touch_threshold, CTLFLAG_RWTUN, &wsp_tuning.pressure_touch_threshold, 0, "touch pressure threshold"); SYSCTL_INT(_hw_usb_wsp, OID_AUTO, pressure_untouch_threshold, CTLFLAG_RWTUN, @@ -1124,7 +1129,7 @@ dx = dy = 0; if (sc->dz_count == 0) - dz = sc->dz_sum / tun.z_factor; + dz = (sc->dz_sum / tun.z_factor) * (tun.z_invert ? -1 : 1); if (sc->scr_mode == WSP_SCR_HOR || abs(sc->pos_x[0] - sc->pos_x[1]) > MAX_DISTANCE || abs(sc->pos_y[0] - sc->pos_y[1]) > MAX_DISTANCE)