1 Elantech Touchpad Driver
2 ========================
4 Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
6 Extra information for hardware version 1 found and
7 provided by Steve Havelka
9 Version 2 (EeePC) hardware support based on patches
10 received from Woody at Xandros and forwarded to me
11 by user StewieGriffin at the eeeuser.com forum
17 3. Differentiating hardware versions
20 4.2 Native relative mode 4 byte packet format
21 4.3 Native absolute mode 4 byte packet format
24 5.2 Native absolute mode 6 byte packet format
25 5.2.1 Parity checking and packet re-synchronization
26 5.2.2 One/Three finger touch
27 5.2.3 Two finger touch
30 6.2 Native absolute mode 6 byte packet format
31 6.2.1 One/Three finger touch
32 6.2.2 Two finger touch
35 7.2 Native absolute mode 6 byte packet format
39 8. Trackpoint (for Hardware version 3 and 4)
41 8.2 Native relative mode 6 byte packet format
49 Currently the Linux Elantech touchpad driver is aware of four different
50 hardware versions unimaginatively called version 1,version 2, version 3
51 and version 4. Version 1 is found in "older" laptops and uses 4 bytes per
52 packet. Version 2 seems to be introduced with the EeePC and uses 6 bytes
53 per packet, and provides additional features such as position of two fingers,
54 and width of the touch. Hardware version 3 uses 6 bytes per packet (and
55 for 2 fingers the concatenation of two 6 bytes packets) and allows tracking
56 of up to 3 fingers. Hardware version 4 uses 6 bytes per packet, and can
57 combine a status packet with multiple head or motion packets. Hardware version
58 4 allows tracking up to 5 fingers.
60 Some Hardware version 3 and version 4 also have a trackpoint which uses a
61 separate packet format. It is also 6 bytes per packet.
63 The driver tries to support both hardware versions and should be compatible
64 with the Xorg Synaptics touchpad driver and its graphical configuration
67 Note that a mouse button is also associated with either the touchpad or the
68 trackpoint when a trackpoint is available. Disabling the Touchpad in xorg
69 (TouchPadOff=0) will also disable the buttons associated with the touchpad.
71 Additionally the operation of the touchpad can be altered by adjusting the
72 contents of some of its internal registers. These registers are represented
73 by the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio?
74 that can be read from and written to.
76 Currently only the registers for hardware version 1 are somewhat understood.
77 Hardware version 2 seems to use some of the same registers but it is not
78 known whether the bits in the registers represent the same thing or might
79 have changed their meaning.
81 On top of that, some register settings have effect only when the touchpad is
82 in relative mode and not in absolute mode. As the Linux Elantech touchpad
83 driver always puts the hardware into absolute mode not all information
84 mentioned below can be used immediately. But because there is no freely
85 available Elantech documentation the information is provided here anyway for
92 Currently the Linux Elantech touchpad driver provides three extra knobs under
93 /sys/bus/serio/drivers/psmouse/serio? for the user.
97 Turn different levels of debugging ON or OFF.
99 By echoing "0" to this file all debugging will be turned OFF.
101 Currently a value of "1" will turn on some basic debugging and a value of
102 "2" will turn on packet debugging. For hardware version 1 the default is
103 OFF. For version 2 the default is "1".
105 Turning packet debugging on will make the driver dump every packet
106 received to the syslog before processing it. Be warned that this can
107 generate quite a lot of data!
111 Turns parity checking ON or OFF.
113 By echoing "0" to this file parity checking will be turned OFF. Any
114 non-zero value will turn it ON. For hardware version 1 the default is ON.
115 For version 2 the default it is OFF.
117 Hardware version 1 provides basic data integrity verification by
118 calculating a parity bit for the last 3 bytes of each packet. The driver
119 can check these bits and reject any packet that appears corrupted. Using
120 this knob you can bypass that check.
122 Hardware version 2 does not provide the same parity bits. Only some basic
123 data consistency checking can be done. For now checking is disabled by
124 default. Currently even turning it on will do nothing.
128 Sets crc_enabled to 0/1. The name "crc_enabled" is the official name of
129 this integrity check, even though it is not an actual cyclic redundancy
132 Depending on the state of crc_enabled, certain basic data integrity
133 verification is done by the driver on hardware version 3 and 4. The
134 driver will reject any packet that appears corrupted. Using this knob,
135 The state of crc_enabled can be altered with this knob.
137 Reading the crc_enabled value will show the active value. Echoing
138 "0" or "1" to this file will set the state to "0" or "1".
140 Differentiating hardware versions
141 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143 To detect the hardware version, read the version number as param[0].param[1].param[2]::
145 4 bytes version: (after the arrow is the name given in the Dell-provided driver)
149 In the wild, there appear to be more versions, such as 00.01.64, 01.00.21,
150 02.00.00, 02.00.04, 02.00.06::
157 04.01.XX => Scroll_EF051
160 In the wild, there appear to be more versions, such as 04.03.01, 04.04.11. There
161 appears to be almost no difference, except for EF113, which does not report
162 pressure/width and has different data consistency checks.
164 Probably all the versions with param[0] <= 01 can be considered as
165 4 bytes/firmware 1. The versions < 02.08.00, with the exception of 02.00.30, as
166 4 bytes/firmware 2. Everything >= 02.08.00 can be considered as 6 bytes.
175 By echoing a hexadecimal value to a register it contents can be altered.
179 echo -n 0x16 > reg_10
186 E: 1 = enable smart edges unconditionally
187 S: 1 = enable smart edges only when dragging
188 A: 1 = absolute mode (needs 4 byte packets, see reg_11)
189 L: 1 = enable drag lock (see reg_22)
190 D: 1 = disable dynamic resolution
191 T: 1 = disable tapping
192 C: 1 = enable corner tap
193 B: 1 = swap left and right button
200 P: 1 = enable parity checking for relative mode
201 F: 1 = enable native 4 byte packet mode
202 V: 1 = enable vertical scroll area
203 H: 1 = enable horizontal scroll area
211 scroll area width (small: 0x40 ... wide: 0xff)
215 drag lock time out (short: 0x14 ... long: 0xfe;
216 0xff = tap again to release)
228 smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)
232 smart edge activation area width?
235 Native relative mode 4 byte packet format
236 -----------------------------------------
243 L, R, M = 1 when Left, Right, Middle mouse button pressed
244 some models have M as byte 3 odd parity bit
245 when parity checking is enabled (reg_11, P = 1):
246 p1..p2 = byte 1 and 2 odd parity bit
247 c = 1 when corner tap detected
252 dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
254 dx7..dx0 = x movement; positive = right, negative = left
255 byte 1 = 0xf0 when corner tap detected
260 dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
262 dy7..dy0 = y movement; positive = up, negative = down
266 parity checking enabled (reg_11, P = 1):
269 w h n1 n0 ds3 ds2 ds1 ds0
272 ds3..ds0 = scroll wheel amount and direction
273 positive = down or left
274 negative = up or right
275 when corner tap detected:
276 ds0 = 1 when top right corner tapped
277 ds1 = 1 when bottom right corner tapped
278 ds2 = 1 when bottom left corner tapped
279 ds3 = 1 when top left corner tapped
280 n1..n0 = number of fingers on touchpad
281 only models with firmware 2.x report this, models with
282 firmware 1.x seem to map one, two and three finger taps
283 directly to L, M and R mouse buttons
284 h = 1 when horizontal scroll action
285 w = 1 when wide finger touch?
287 otherwise (reg_11, P = 0):
290 ds7 ds6 ds5 ds4 ds3 ds2 ds1 ds0
292 ds7..ds0 = vertical scroll amount and direction
297 Native absolute mode 4 byte packet format
298 -----------------------------------------
300 EF013 and EF019 have a special behaviour (due to a bug in the firmware?), and
301 when 1 finger is touching, the first 2 position reports must be discarded.
302 This counting is reset whenever a different number of fingers is reported.
306 firmware version 1.x:
311 L, R = 1 when Left, Right mouse button pressed
312 p1..p3 = byte 1..3 odd parity bit
313 D, U = 1 when rocker switch pressed Up, Down
315 firmware version 2.x:
320 L, R = 1 when Left, Right mouse button pressed
321 p1..p3 = byte 1..3 odd parity bit
322 n1..n0 = number of fingers on touchpad
326 firmware version 1.x:
329 f 0 th tw x9 x8 y9 y8
331 tw = 1 when two finger touch
332 th = 1 when three finger touch
333 f = 1 when finger touch
335 firmware version 2.x:
343 x7 x6 x5 x4 x3 x2 x1 x0
345 x9..x0 = absolute x value (horizontal)
350 y7 y6 y5 y4 y3 y2 y1 y0
352 y9..y0 = absolute y value (vertical)
362 By echoing a hexadecimal value to a register it contents can be altered.
366 echo -n 0x56 > reg_10
373 D: 1 = enable drag and drop
380 S: 1 = enable vertical scroll
388 drag and drop release time out (short: 0x70 ... long 0x7e;
389 0x7f = never i.e. tap again to release)
392 Native absolute mode 6 byte packet format
393 -----------------------------------------
395 Parity checking and packet re-synchronization
396 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
398 There is no parity checking, however some consistency checks can be performed.
400 For instance for EF113::
408 if( (((SA1 & 0x3C) != 0x3C) && ((SA1 & 0xC0) != 0x80)) || // check Byte 1
409 (((SA1 & 0x0C) != 0x0C) && ((SA1 & 0xC0) == 0x80)) || // check Byte 1 (one finger pressed)
410 (((SA1 & 0xC0) != 0x80) && (( A1 & 0xF0) != 0x00)) || // check Byte 2
411 (((SB1 & 0x3E) != 0x38) && ((SA1 & 0xC0) != 0x80)) || // check Byte 4
412 (((SB1 & 0x0E) != 0x08) && ((SA1 & 0xC0) == 0x80)) || // check Byte 4 (one finger pressed)
413 (((SA1 & 0xC0) != 0x80) && (( C1 & 0xF0) != 0x00)) ) // check Byte 5
416 For all the other ones, there are just a few constant bits::
418 if( ((packet[0] & 0x0C) != 0x04) ||
419 ((packet[3] & 0x0f) != 0x02) )
423 In case an error is detected, all the packets are shifted by one (and packet[0] is discarded).
425 One/Three finger touch
426 ^^^^^^^^^^^^^^^^^^^^^^
433 L, R = 1 when Left, Right mouse button pressed
434 n1..n0 = number of fingers on touchpad
439 p7 p6 p5 p4 x11 x10 x9 x8
444 x7 x6 x5 x4 x3 x2 x1 x0
446 x11..x0 = absolute x value (horizontal)
453 n4 = set if more than 3 fingers (only in 3 fingers mode)
454 vf = a kind of flag ? (only on EF123, 0 when finger is over one
455 of the buttons, 1 otherwise)
456 w3..w0 = width of the finger touch (not EF113)
457 b2 (on EF113 only, 0 otherwise), b2.R.L indicates one button pressed:
461 3 = Middle (Left and Right)
470 p3 p1 p2 p0 y11 y10 y9 y8
472 p7..p0 = pressure (not EF113)
477 y7 y6 y5 y4 y3 y2 y1 y0
479 y11..y0 = absolute y value (vertical)
485 Note that the two pairs of coordinates are not exactly the coordinates of the
486 two fingers, but only the pair of the lower-left and upper-right coordinates.
487 So the actual fingers might be situated on the other diagonal of the square
488 defined by these two points.
493 n1 n0 ay8 ax8 . . R L
495 L, R = 1 when Left, Right mouse button pressed
496 n1..n0 = number of fingers on touchpad
501 ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
503 ax8..ax0 = lower-left finger absolute x value
508 ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0
510 ay8..ay0 = lower-left finger absolute y value
520 bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
522 bx8..bx0 = upper-right finger absolute x value
527 by7 by8 by5 by4 by3 by2 by1 by0
529 by8..by0 = upper-right finger absolute y value
542 A: 1 = enable absolute tracking
543 T: 1 = enable two finger mode auto correct
544 F: 1 = disable ABS Position Filter
545 R: 1 = enable real hardware resolution
547 Native absolute mode 6 byte packet format
548 -----------------------------------------
550 1 and 3 finger touch shares the same 6-byte packet format, except that
551 3 finger touch only reports the position of the center of all three fingers.
553 Firmware would send 12 bytes of data for 2 finger touch.
556 In case the box has unstable power supply or other electricity issues, or
557 when number of finger changes, F/W would send "debounce packet" to inform
558 driver that the hardware is in debounce status.
559 The debouce packet has the following signature::
568 When we encounter this kind of packet, we just ignore it.
570 One/Three finger touch
571 ^^^^^^^^^^^^^^^^^^^^^^
578 L, R = 1 when Left, Right mouse button pressed
579 n1..n0 = number of fingers on touchpad
584 p7 p6 p5 p4 x11 x10 x9 x8
589 x7 x6 x5 x4 x3 x2 x1 x0
591 x11..x0 = absolute x value (horizontal)
598 w3..w0 = width of the finger touch
603 p3 p1 p2 p0 y11 y10 y9 y8
610 y7 y6 y5 y4 y3 y2 y1 y0
612 y11..y0 = absolute y value (vertical)
617 The packet format is exactly the same for two finger touch, except the hardware
618 sends two 6 byte packets. The first packet contains data for the first finger,
619 the second packet has data for the second finger. So for two finger touch a
620 total of 12 bytes are sent.
633 A: 1 = enable absolute tracking
635 Native absolute mode 6 byte packet format
636 -----------------------------------------
638 v4 hardware is a true multitouch touchpad, capable of tracking up to 5 fingers.
639 Unfortunately, due to PS/2's limited bandwidth, its packet format is rather
642 Whenever the numbers or identities of the fingers changes, the hardware sends a
643 status packet to indicate how many and which fingers is on touchpad, followed by
644 head packets or motion packets. A head packet contains data of finger id, finger
645 position (absolute x, y values), width, and pressure. A motion packet contains
646 two fingers' position delta.
648 For example, when status packet tells there are 2 fingers on touchpad, then we
649 can expect two following head packets. If the finger status doesn't change,
650 the following packets would be motion packets, only sending delta of finger
651 position, until we receive a status packet.
653 One exception is one finger touch. when a status packet tells us there is only
654 one finger, the hardware would just send head packets afterwards.
664 L, R = 1 when Left, Right mouse button pressed
669 . . . ft4 ft3 ft2 ft1 ft0
671 ft4 ft3 ft2 ft1 ft0 ftn = 1 when finger n is on touchpad
703 L, R = 1 when Left, Right mouse button pressed
704 w3..w0 = finger width (spans how many trace lines)
709 p7 p6 p5 p4 x11 x10 x9 x8
714 x7 x6 x5 x4 x3 x2 x1 x0
716 x11..x0 = absolute x value (horizontal)
721 id2 id1 id0 1 0 0 0 1
728 p3 p1 p2 p0 y11 y10 y9 y8
735 y7 y6 y5 y4 y3 y2 y1 y0
737 y11..y0 = absolute y value (vertical)
745 id2 id1 id0 w 0 1 R L
747 L, R = 1 when Left, Right mouse button pressed
749 w = 1 when delta overflows (> 127 or < -128), in this case
750 firmware sends us (delta x / 5) and (delta y / 5)
755 x7 x6 x5 x4 x3 x2 x1 x0
757 x7..x0 = delta x (two's complement)
762 y7 y6 y5 y4 y3 y2 y1 y0
764 y7..y0 = delta y (two's complement)
769 id2 id1 id0 1 0 0 1 0
776 x7 x6 x5 x4 x3 x2 x1 x0
778 x7..x0 = delta x (two's complement)
783 y7 y6 y5 y4 y3 y2 y1 y0
785 y7..y0 = delta y (two's complement)
787 byte 0 ~ 2 for one finger
788 byte 3 ~ 5 for another
791 Trackpoint (for Hardware version 3 and 4)
792 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
797 No special registers have been identified.
799 Native relative mode 6 byte packet format
800 -----------------------------------------
828 x7 x6 x5 x4 x3 x2 x1 x0
833 y7 y6 y5 y4 y3 y2 y1 y0
836 x and y are written in two's complement spread
837 over 9 bits with sx/sy the relative top bit and
838 x7..x0 and y7..y0 the lower bits.
839 ~sx is the inverse of sx, ~sy is the inverse of sy.
840 The sign of y is opposite to what the input driver
841 expects for a relative movement