Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
synapticstouchpad [2018/12/15 14:10] – First cut proof read and improvements KubilayKocaksynapticstouchpad [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.+===== Introduction =====
  
-You might want to see [[https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/x.html#idp59961704|Chapter 11. The X Window System and Virtual Consoles]] for more information on touchpads.+The Synaptics Touchpad is a pointing device found on many laptops and supported since %%FreeBSD%% 8.
  
-This device is supported since %%FreeBSD%% 8 and by default, is recognized as a standard 3-buttons mouse. Additional features can be enabled with the ''%%hw.psm.synaptics_support%%'' sysctl tunable.+By default, it is recognized and configured as a 3-buttons mouse. Additional features can be enabled with the ''%%hw.psm.synaptics_support%%'' sysctl tunable. 
 + 
 +Also check out [[https://docs.freebsd.org/en/books/faq/#x-and-synaptic|FreeBSD FAQ: My laptop has a Synaptics Touchpad. Can I use it in X?]]
  
 ===== Features ===== ===== Features =====
Line 14: Line 16:
   * 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%%.   * 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 =====+===== Setup =====
  
 To enable psm(4) Synaptics support, add the following line to ''%%/boot/loader.conf%%'' To enable psm(4) Synaptics support, add the following line to ''%%/boot/loader.conf%%''
Line 46: Line 48:
 </code> </code>
  
-===== sysctl documentation =====+===== Touchpad Configuration =====
  
 ==== Palm Detection ==== ==== Palm Detection ====
Line 57: Line 59:
 </code> </code>
  
-If the pressure is less than ''%%min_pressure%%'' of above ''%%max_pressure%%'', the packet is ignored but the current action isn't terminated. The pressure is comprised between 0 and 255. Here are some meaningful values, as stated by Synaptics specifications:+If the pressure is less than ''%%min_pressure%%'' or above ''%%max_pressure%%'', the packet is ignored but the current action isn't terminated. The pressure is comprised between 0 and 255. Here are some meaningful values, as stated by Synaptics specifications:
   * 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 109: 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 borders generate a lot of noise in the reported coordinates. There are two sets of sysctl that control this area:+The smoothing is based on a weighted average: 
 + 
 +<code cpp> 
 +average = (weight_current * delta + weight_previous * average) / (weight_current + weight_preivous) 
 +</code> 
 + 
 +where : 
 +  * ''%%average%%'' is the previous average, which is kept between each packet. 
 +  * ''%%delta%%'' is the relative movement. 
 +  * ''%%weight_current%%'' and ''%%weight_previous%%'' are configurable weights. 
 + 
 +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 (''%%weight_previous%%'' greater then ''%%weight_current%%'') or a sharp but imprecise movement at slow speed (''%%weight_previous%%'' smaller or equal to ''%%weight_current%%''). 
 + 
 +The idea is then to change ''%%weight_previous%%'' based on the last packets: 
 +  * If the movement is slow, we keep ''%%weight_previous%%'' at its original value. 
 +  * If the movement is fast, ''%%weight_previous%%'' decreases and may reach 0 for the fastest movements. 
 + 
 +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" is really the length squared. */ 
 +len = (dx * dx) + (dy * dy); 
 + 
 +/* "sysctl_weight_len_squared" is the length squared at which the 
 + * "weight_previous" will start to decrease. */ 
 +weight_previous = sysctl_weight_len_squared * weight_previous / len; 
 +weight_previous = imin(weight_previous, sysctl_weight_previous); 
 +</code> 
 + 
 +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't reproduce well what the finger is doing. 
 + 
 +==== Touchpad Borders (Margins) ==== 
 + 
 +Touchpad edges (borders) can generate a lot of noise in reported coordinates. There are two sets of sysctl tunables that control this area:
  
 <code> <code>
Line 166: Line 206:
  
 An area must be dedicated to virtual scrolling for now. This area is defined by ''%%vscroll_hor_area%%'' (positive for an area at the bottom, negative for an area at the top) for horizontal scrolling and ''%%vscroll_ver_area%%'' (positive for an area on the left, negative for an area on the right) for vertical scrolling. ''%%vscroll_min_delta%%'' is the minimum delta between points to consider a scrolling action. This is to prevent unwanted scrolling when tapping for instance. ''%%vscroll_div_min%%'' and ''%%vscroll_div_max%%'' are the divisors used instead of ''%%div_min%%'' and ''%%div_max%%'' respectively. An area must be dedicated to virtual scrolling for now. This area is defined by ''%%vscroll_hor_area%%'' (positive for an area at the bottom, negative for an area at the top) for horizontal scrolling and ''%%vscroll_ver_area%%'' (positive for an area on the left, negative for an area on the right) for vertical scrolling. ''%%vscroll_min_delta%%'' is the minimum delta between points to consider a scrolling action. This is to prevent unwanted scrolling when tapping for instance. ''%%vscroll_div_min%%'' and ''%%vscroll_div_max%%'' are the divisors used instead of ''%%div_min%%'' and ''%%div_max%%'' respectively.
- 
-===== How it works ===== 
- 
-==== Movement smoothing and tap-hold support ==== 
- 
-The smoothing is based on a weighted average: 
- 
-<code cpp> 
-average = (weight_current * delta + weight_previous * average) / (weight_current + weight_preivous) 
-</code> 
- 
-where : 
-  * ''%%average%%'' is the previous average, which is kept between each packet. 
-  * ''%%delta%%'' is the relative movement. 
-  * ''%%weight_current%%'' and ''%%weight_previous%%'' are configurable weights. 
- 
-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 (''%%weight_previous%%'' greater then ''%%weight_current%%'') or a sharp but imprecise movement at slow speed (''%%weight_previous%%'' smaller or equal to ''%%weight_current%%''). 
- 
-The idea is then to change ''%%weight_previous%%'' based on the last packets: 
-  * If the movement is slow, we keep ''%%weight_previous%%'' at its original value. 
-  * If the movement is fast, ''%%weight_previous%%'' decreases and may reach 0 for the fastest movements. 
- 
-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" is really the length squared. */ 
-len = (dx * dx) + (dy * dy); 
- 
-/* "sysctl_weight_len_squared" is the length squared at which the 
- * "weight_previous" will start to decrease. */ 
-weight_previous = sysctl_weight_len_squared * weight_previous / len; 
-weight_previous = imin(weight_previous, sysctl_weight_previous); 
-</code> 
- 
-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't reproduce well what the finger is doing. 
  
 ===== Toggling Synaptics Touchpad with devd ===== ===== Toggling Synaptics Touchpad with devd =====
  
-Although there is some palm detection support for [[SynapticsTouchpad|synaptics touchpads]], it is sometimes desirable disable the touchpad if a USB mouse is plugged in.+Although touchpads can support palm detection, it is sometimes desirable to disable them if a USB mouse is plugged in.
  
-These instructions assume use of a USB wired mouse or a wireless mouse using a transceiver. For a mouse that connects via Bluetooth, you will need to identify your mouse ''%%device-name%%''.+These instructions assume a USB wired or wireless mouse. For a mouse that connects via Bluetooth, you will also need to identify your mouse ''%%device-name%%''.
  
-==== Installation ====+==== Setup ====
  
 We will be triggering a script from devd in order to toggle synaptics. We will be triggering a script from devd in order to toggle synaptics.
Line 281: Line 281:
  
 Credit for scripted synpatics toggle via devd goes to SamuelGogarty. Credit for scripted synpatics toggle via devd goes to SamuelGogarty.
 +
 +===== Other Resources =====
 +
 +  * [[https://www.freshports.org/sysutils/iichid/|FreeBSD Port: sysutils/iichid -- Generic FreeBSD HID layer for I2C and USB devices]]
  
 ---- ----
  
 {{tag>HowTo}} {{tag>HowTo}}
 +{{tag>Laptop}}
  
  • synapticstouchpad.1544883000.txt.gz
  • Last modified: 2018/12/15 14:10
  • by KubilayKocak