Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| synapticstouchpad [2009/07/30 08:55] – Fix: use moused_enable="YES" instead of enable_moused="YES" JeanSébastienPédron | synapticstouchpad [2022/08/18 05:58] (current) – Indent command/file/code lines for readability KubilayKocak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Synaptics Touchpad | + | ===== Synaptics Touchpad ===== |
| - | The Synaptics Touchpad is a pointing device, found on many laptops for instance. First, we discuss the problems with the current driver. Then we talk about a replacement driver to improve the quality and extend features. | + | ===== Introduction ===== |
| - | ===== Current driver in RELENG_7 ===== | + | The Synaptics Touchpad is a pointing device found on many laptops and supported since %%FreeBSD%% 8. |
| - | Support for this device | + | By default, it is recognized |
| - | The current implementation provides the following features: | + | Also check out [[https:// |
| - | * movement smoothing | + | |
| - | * tap detection with one finger | + | |
| - | * palm detection | + | |
| - | * support for extra buttons | + | |
| - | * support for guest devices | + | |
| - | However it lacks several useful features: | + | ===== Features ===== |
| - | * precision with slow movements | + | |
| - | * tap detection with two or three fingers | + | |
| - | * tap-hold (to simulate a button kept pressed) | + | |
| - | * virtual scrolling (to simulate a wheel) | + | |
| - | * movement continuation (to continue a movement when the finger reaches a border) | + | |
| - | An [[http:// | + | * Improved movement smoothing. It's comparable to the Microsoft Windows driver from Synaptics, except when the finger reaches touchpad borders where the movement becomes chaotic. |
| + | * Tap detection with one (left click), two (right click), or three (middle click) finger tap support. | ||
| + | * Tap-hold detection with one, two, or three fingers. | ||
| + | * Virtual scrolling. For now, an area must be dedicated to virtual scrolling; typically, one on the right (vertical scrolling) | ||
| - | ===== New driver | + | ===== Setup ===== |
| - | The development of the new driver will go through two phases: | + | To enable |
| - | - Bring the **quality** of the movement smoothing and tap-hold support on par with what is done internaly by the touchpad, when '' | + | |
| - | - Add **more features** such as virtual scrolling. | + | |
| - | + | ||
| - | ==== Patch ==== | + | |
| - | + | ||
| - | The latest patch was committed to 8-CURRENT as revision r183888 on 10/14/2008. If you're using CVS or CVSup, check that src/ | + | |
| - | + | ||
| - | To be able **to use horizontal scrolling** with this new driver under X.Org (through sysmouse), you'll need a [[http:// | + | |
| - | + | ||
| - | To apply it: | + | |
| - | + | ||
| - | < | + | |
| - | # cd / | + | |
| - | # make patch | + | |
| - | # cd work | + | |
| - | # patch -p1 < xf86-input-mouse-sysmouse-horizontal-scrolling.patch | + | |
| - | # cd .. | + | |
| - | # make | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Current features ==== | + | |
| - | + | ||
| - | * better movement smoothing. It's comparable to the Microsoft Windows driver from Synaptics, | + | |
| - | * tap detection with one (left click), two (right click) or three (middle click) fingers. | + | |
| - | * tap-hold detection with one, two or three fingers. | + | |
| - | * virtual scrolling. For now, an area must be dedicated to virtual scrolling; typically, one on the right (vertical scrolling) and one at the bottom (horizontal scrolling). Also, a patch must be applied to xf86-input-mouse to handle horizontal scrolling from sysmouse. Later, virtual scrolling with two fingers will be re-added, as found on Apple MacBook. | + | |
| - | + | ||
| - | ==== How to use it ==== | + | |
| - | + | ||
| - | You must add the following line in '' | + | |
| < | < | ||
| Line 61: | Line 24: | ||
| </ | </ | ||
| - | You'll need moused(8) | + | Enable |
| < | < | ||
| Line 67: | Line 30: | ||
| </ | </ | ||
| - | To use it with X.Org, | + | To use it within |
| < | < | ||
| Line 79: | Line 42: | ||
| </ | </ | ||
| - | Horizontal scrolling is disabled by default. To enable it, you need to set a sysctl (in your '' | + | Horizontal scrolling is disabled by default. To enable it, add the following |
| < | < | ||
| Line 85: | Line 48: | ||
| </ | </ | ||
| - | ==== sysctl documentation | + | ===== Touchpad Configuration ===== |
| - | === Palm detection | + | ==== Palm Detection ==== |
| - | == Finger | + | === Finger |
| < | < | ||
| Line 96: | Line 59: | ||
| </ | </ | ||
| - | If the pressure is less than '' | + | If the pressure is less than '' |
| * z = 0: no finger contact | * z = 0: no finger contact | ||
| * z = 10: finger hovering near the pad | * z = 10: finger hovering near the pad | ||
| Line 105: | Line 68: | ||
| * z = 255: maximum reportable Z | * z = 255: maximum reportable Z | ||
| - | == Finger | + | === Finger |
| < | < | ||
| Line 116: | Line 79: | ||
| * w = 15: maximum reportable width (capPalmDetect needed | * w = 15: maximum reportable width (capPalmDetect needed | ||
| - | === Movement | + | ==== Movement |
| - | To smooth the movement, we use a weighted average then a division where both the weight and the divisor vary, depending on the movement speed. See "How it works" | + | For movement |
| < | < | ||
| Line 148: | Line 111: | ||
| This multiplicator is used during averages and divisions to increase the precision. | This multiplicator is used during averages and divisions to increase the precision. | ||
| - | === Touchpad borders | + | === How Movement Smoothing Works === |
| - | The touchpad | + | The smoothing is based on a weighted average: |
| + | |||
| + | <code cpp> | ||
| + | average = (weight_current * delta + weight_previous * average) / (weight_current + weight_preivous) | ||
| + | </ | ||
| + | |||
| + | where : | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | This average is calculated for each axis (x & y) separately. | ||
| + | |||
| + | The problem with a simple weighted average as above is that the user has to choose between a smooth but laggy movement ('' | ||
| + | |||
| + | The idea is then to change '' | ||
| + | * If the movement is slow, we keep '' | ||
| + | * If the movement is fast, '' | ||
| + | |||
| + | Internaly, the driver keeps the last 10 packets. Here is the simplified algorithm: | ||
| + | |||
| + | <code cpp> | ||
| + | dx = abs(new_x - older_x) + 1; /* +1: to avoid a division by zero below. */ | ||
| + | dy = abs(new_y - older_y) + 1; | ||
| + | |||
| + | /* " | ||
| + | len = (dx * dx) + (dy * dy); | ||
| + | |||
| + | /* " | ||
| + | * " | ||
| + | weight_previous = sysctl_weight_len_squared * weight_previous / len; | ||
| + | weight_previous = imin(weight_previous, | ||
| + | </ | ||
| + | |||
| + | The driver will do almost the same with the divisor to calculate the acceleration. The rest of the division is also kept between each packet; otherwise, with slow movements, the pointer doesn' | ||
| + | |||
| + | ==== Touchpad Borders (Margins) ==== | ||
| + | |||
| + | Touchpad edges (borders) can generate a lot of noise in reported coordinates. There are two sets of sysctl | ||
| < | < | ||
| Line 168: | Line 169: | ||
| </ | </ | ||
| - | '' | + | '' |
| - | === Points | + | ==== Points |
| < | < | ||
| Line 179: | Line 180: | ||
| '' | '' | ||
| - | === Tap and tap-hold === | + | ==== Tap and Tap-hold ==== |
| < | < | ||
| Line 194: | Line 195: | ||
| '' | '' | ||
| - | === Virtual | + | ==== Virtual |
| < | < | ||
| Line 206: | Line 207: | ||
| An area must be dedicated to virtual scrolling for now. This area is defined by '' | An area must be dedicated to virtual scrolling for now. This area is defined by '' | ||
| - | ==== How it works ==== | + | ===== Toggling Synaptics Touchpad with devd ===== |
| - | === Movement smoothing and tap-hold | + | Although touchpads can support |
| - | The smoothing is based on a weighted average: | + | These instructions assume |
| - | < | + | ==== Setup ==== |
| - | average = (weight_current * delta + weight_previous * average) / (weight_current + weight_preivous) | + | |
| + | We will be triggering a script from devd in order to toggle synaptics. | ||
| + | |||
| + | Create a new script in / | ||
| + | |||
| + | In this script, paste the following: | ||
| + | |||
| + | < | ||
| + | #!/bin/sh | ||
| + | |||
| + | trackpad_disable(){ | ||
| + | | ||
| + | } | ||
| + | |||
| + | trackpad_enable(){ | ||
| + | / | ||
| + | / | ||
| + | } | ||
| + | |||
| + | synaptics_$1 | ||
| </ | </ | ||
| - | where : | + | Then you will want to make the script executable. |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | This average is calculated for each axis (x & y) separately. | + | < |
| + | chmod +x synaptics-hotplug | ||
| + | </ | ||
| - | The problem with a simple weighted average as above is that the user has to choose between a smooth but laggy movement ('' | + | Next you will want to open / |
| - | The idea is then to change '' | + | < |
| - | * If the movement is slow, we keep '' | + | nomatch 32 { |
| - | * If the movement is fast, '' | + | match " |
| + | match " | ||
| + | match " | ||
| + | match " | ||
| + | match " | ||
| + | action " | ||
| + | }; | ||
| + | </ | ||
| - | Internaly, the driver keeps the last 10 packets. Here is the simplified algorithm: | + | That last line in the block, ' |
| - | < | + | < |
| - | dx = abs(new_x | + | action " |
| - | dy = abs(new_y | + | </ |
| - | /* "len" | + | Now everytime we plug in our USB mouse, it will run our script with the "disable" |
| - | len = (dx * dx) + (dy * dy); | + | |
| - | /* " | + | Next open /etc/ |
| - | * "weight_previous" | + | |
| - | weight_previous = sysctl_weight_len_squared * weight_previous | + | < |
| - | weight_previous = imin(weight_previous, | + | detach 100 { |
| + | device-name | ||
| + | | ||
| + | }; | ||
| </ | </ | ||
| - | The driver will do almost | + | With this done, the only thing you'll need to do is restart devd |
| + | |||
| + | < | ||
| + | service devd restart | ||
| + | </ | ||
| + | |||
| + | Once devd is restarted, the synaptics trackpad should turn off and on depending whether your USB mouse is plugged in. | ||
| + | |||
| + | Credit for scripted synpatics toggle via devd goes to SamuelGogarty. | ||
| + | |||
| + | ===== Other Resources ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | {{tag> | ||
| + | {{tag> | ||