xref: /openbmc/linux/Documentation/input/devices/elantech.rst (revision a976c2951d8f376112361830aa7762beff83a205)
1*b08c118cSDmitry TorokhovElantech Touchpad Driver
2*b08c118cSDmitry Torokhov========================
3*b08c118cSDmitry Torokhov
4*b08c118cSDmitry Torokhov	Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
5*b08c118cSDmitry Torokhov
6*b08c118cSDmitry Torokhov	Extra information for hardware version 1 found and
7*b08c118cSDmitry Torokhov	provided by Steve Havelka
8*b08c118cSDmitry Torokhov
9*b08c118cSDmitry Torokhov	Version 2 (EeePC) hardware support based on patches
10*b08c118cSDmitry Torokhov	received from Woody at Xandros and forwarded to me
11*b08c118cSDmitry Torokhov	by user StewieGriffin at the eeeuser.com forum
12*b08c118cSDmitry Torokhov
13*b08c118cSDmitry Torokhov.. Contents
14*b08c118cSDmitry Torokhov
15*b08c118cSDmitry Torokhov 1. Introduction
16*b08c118cSDmitry Torokhov 2. Extra knobs
17*b08c118cSDmitry Torokhov 3. Differentiating hardware versions
18*b08c118cSDmitry Torokhov 4. Hardware version 1
19*b08c118cSDmitry Torokhov    4.1 Registers
20*b08c118cSDmitry Torokhov    4.2 Native relative mode 4 byte packet format
21*b08c118cSDmitry Torokhov    4.3 Native absolute mode 4 byte packet format
22*b08c118cSDmitry Torokhov 5. Hardware version 2
23*b08c118cSDmitry Torokhov    5.1 Registers
24*b08c118cSDmitry Torokhov    5.2 Native absolute mode 6 byte packet format
25*b08c118cSDmitry Torokhov        5.2.1 Parity checking and packet re-synchronization
26*b08c118cSDmitry Torokhov        5.2.2 One/Three finger touch
27*b08c118cSDmitry Torokhov        5.2.3 Two finger touch
28*b08c118cSDmitry Torokhov 6. Hardware version 3
29*b08c118cSDmitry Torokhov    6.1 Registers
30*b08c118cSDmitry Torokhov    6.2 Native absolute mode 6 byte packet format
31*b08c118cSDmitry Torokhov        6.2.1 One/Three finger touch
32*b08c118cSDmitry Torokhov        6.2.2 Two finger touch
33*b08c118cSDmitry Torokhov 7. Hardware version 4
34*b08c118cSDmitry Torokhov    7.1 Registers
35*b08c118cSDmitry Torokhov    7.2 Native absolute mode 6 byte packet format
36*b08c118cSDmitry Torokhov        7.2.1 Status packet
37*b08c118cSDmitry Torokhov        7.2.2 Head packet
38*b08c118cSDmitry Torokhov        7.2.3 Motion packet
39*b08c118cSDmitry Torokhov 8. Trackpoint (for Hardware version 3 and 4)
40*b08c118cSDmitry Torokhov    8.1 Registers
41*b08c118cSDmitry Torokhov    8.2 Native relative mode 6 byte packet format
42*b08c118cSDmitry Torokhov        8.2.1 Status Packet
43*b08c118cSDmitry Torokhov
44*b08c118cSDmitry Torokhov
45*b08c118cSDmitry Torokhov
46*b08c118cSDmitry TorokhovIntroduction
47*b08c118cSDmitry Torokhov~~~~~~~~~~~~
48*b08c118cSDmitry Torokhov
49*b08c118cSDmitry TorokhovCurrently the Linux Elantech touchpad driver is aware of four different
50*b08c118cSDmitry Torokhovhardware versions unimaginatively called version 1,version 2, version 3
51*b08c118cSDmitry Torokhovand version 4. Version 1 is found in "older" laptops and uses 4 bytes per
52*b08c118cSDmitry Torokhovpacket. Version 2 seems to be introduced with the EeePC and uses 6 bytes
53*b08c118cSDmitry Torokhovper packet, and provides additional features such as position of two fingers,
54*b08c118cSDmitry Torokhovand width of the touch.  Hardware version 3 uses 6 bytes per packet (and
55*b08c118cSDmitry Torokhovfor 2 fingers the concatenation of two 6 bytes packets) and allows tracking
56*b08c118cSDmitry Torokhovof up to 3 fingers. Hardware version 4 uses 6 bytes per packet, and can
57*b08c118cSDmitry Torokhovcombine a status packet with multiple head or motion packets. Hardware version
58*b08c118cSDmitry Torokhov4 allows tracking up to 5 fingers.
59*b08c118cSDmitry Torokhov
60*b08c118cSDmitry TorokhovSome Hardware version 3 and version 4 also have a trackpoint which uses a
61*b08c118cSDmitry Torokhovseparate packet format. It is also 6 bytes per packet.
62*b08c118cSDmitry Torokhov
63*b08c118cSDmitry TorokhovThe driver tries to support both hardware versions and should be compatible
64*b08c118cSDmitry Torokhovwith the Xorg Synaptics touchpad driver and its graphical configuration
65*b08c118cSDmitry Torokhovutilities.
66*b08c118cSDmitry Torokhov
67*b08c118cSDmitry TorokhovNote that a mouse button is also associated with either the touchpad or the
68*b08c118cSDmitry Torokhovtrackpoint when a trackpoint is available.  Disabling the Touchpad in xorg
69*b08c118cSDmitry Torokhov(TouchPadOff=0) will also disable the buttons associated with the touchpad.
70*b08c118cSDmitry Torokhov
71*b08c118cSDmitry TorokhovAdditionally the operation of the touchpad can be altered by adjusting the
72*b08c118cSDmitry Torokhovcontents of some of its internal registers. These registers are represented
73*b08c118cSDmitry Torokhovby the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio?
74*b08c118cSDmitry Torokhovthat can be read from and written to.
75*b08c118cSDmitry Torokhov
76*b08c118cSDmitry TorokhovCurrently only the registers for hardware version 1 are somewhat understood.
77*b08c118cSDmitry TorokhovHardware version 2 seems to use some of the same registers but it is not
78*b08c118cSDmitry Torokhovknown whether the bits in the registers represent the same thing or might
79*b08c118cSDmitry Torokhovhave changed their meaning.
80*b08c118cSDmitry Torokhov
81*b08c118cSDmitry TorokhovOn top of that, some register settings have effect only when the touchpad is
82*b08c118cSDmitry Torokhovin relative mode and not in absolute mode. As the Linux Elantech touchpad
83*b08c118cSDmitry Torokhovdriver always puts the hardware into absolute mode not all information
84*b08c118cSDmitry Torokhovmentioned below can be used immediately. But because there is no freely
85*b08c118cSDmitry Torokhovavailable Elantech documentation the information is provided here anyway for
86*b08c118cSDmitry Torokhovcompleteness sake.
87*b08c118cSDmitry Torokhov
88*b08c118cSDmitry Torokhov
89*b08c118cSDmitry TorokhovExtra knobs
90*b08c118cSDmitry Torokhov~~~~~~~~~~~
91*b08c118cSDmitry Torokhov
92*b08c118cSDmitry TorokhovCurrently the Linux Elantech touchpad driver provides three extra knobs under
93*b08c118cSDmitry Torokhov/sys/bus/serio/drivers/psmouse/serio? for the user.
94*b08c118cSDmitry Torokhov
95*b08c118cSDmitry Torokhov* debug
96*b08c118cSDmitry Torokhov
97*b08c118cSDmitry Torokhov   Turn different levels of debugging ON or OFF.
98*b08c118cSDmitry Torokhov
99*b08c118cSDmitry Torokhov   By echoing "0" to this file all debugging will be turned OFF.
100*b08c118cSDmitry Torokhov
101*b08c118cSDmitry Torokhov   Currently a value of "1" will turn on some basic debugging and a value of
102*b08c118cSDmitry Torokhov   "2" will turn on packet debugging. For hardware version 1 the default is
103*b08c118cSDmitry Torokhov   OFF. For version 2 the default is "1".
104*b08c118cSDmitry Torokhov
105*b08c118cSDmitry Torokhov   Turning packet debugging on will make the driver dump every packet
106*b08c118cSDmitry Torokhov   received to the syslog before processing it. Be warned that this can
107*b08c118cSDmitry Torokhov   generate quite a lot of data!
108*b08c118cSDmitry Torokhov
109*b08c118cSDmitry Torokhov* paritycheck
110*b08c118cSDmitry Torokhov
111*b08c118cSDmitry Torokhov   Turns parity checking ON or OFF.
112*b08c118cSDmitry Torokhov
113*b08c118cSDmitry Torokhov   By echoing "0" to this file parity checking will be turned OFF. Any
114*b08c118cSDmitry Torokhov   non-zero value will turn it ON. For hardware version 1 the default is ON.
115*b08c118cSDmitry Torokhov   For version 2 the default it is OFF.
116*b08c118cSDmitry Torokhov
117*b08c118cSDmitry Torokhov   Hardware version 1 provides basic data integrity verification by
118*b08c118cSDmitry Torokhov   calculating a parity bit for the last 3 bytes of each packet. The driver
119*b08c118cSDmitry Torokhov   can check these bits and reject any packet that appears corrupted. Using
120*b08c118cSDmitry Torokhov   this knob you can bypass that check.
121*b08c118cSDmitry Torokhov
122*b08c118cSDmitry Torokhov   Hardware version 2 does not provide the same parity bits. Only some basic
123*b08c118cSDmitry Torokhov   data consistency checking can be done. For now checking is disabled by
124*b08c118cSDmitry Torokhov   default. Currently even turning it on will do nothing.
125*b08c118cSDmitry Torokhov
126*b08c118cSDmitry Torokhov* crc_enabled
127*b08c118cSDmitry Torokhov
128*b08c118cSDmitry Torokhov   Sets crc_enabled to 0/1. The name "crc_enabled" is the official name of
129*b08c118cSDmitry Torokhov   this integrity check, even though it is not an actual cyclic redundancy
130*b08c118cSDmitry Torokhov   check.
131*b08c118cSDmitry Torokhov
132*b08c118cSDmitry Torokhov   Depending on the state of crc_enabled, certain basic data integrity
133*b08c118cSDmitry Torokhov   verification is done by the driver on hardware version 3 and 4. The
134*b08c118cSDmitry Torokhov   driver will reject any packet that appears corrupted. Using this knob,
135*b08c118cSDmitry Torokhov   The state of crc_enabled can be altered with this knob.
136*b08c118cSDmitry Torokhov
137*b08c118cSDmitry Torokhov   Reading the crc_enabled value will show the active value. Echoing
138*b08c118cSDmitry Torokhov   "0" or "1" to this file will set the state to "0" or "1".
139*b08c118cSDmitry Torokhov
140*b08c118cSDmitry TorokhovDifferentiating hardware versions
141*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142*b08c118cSDmitry Torokhov
143*b08c118cSDmitry TorokhovTo detect the hardware version, read the version number as param[0].param[1].param[2]::
144*b08c118cSDmitry Torokhov
145*b08c118cSDmitry Torokhov 4 bytes version: (after the arrow is the name given in the Dell-provided driver)
146*b08c118cSDmitry Torokhov 02.00.22 => EF013
147*b08c118cSDmitry Torokhov 02.06.00 => EF019
148*b08c118cSDmitry Torokhov
149*b08c118cSDmitry TorokhovIn the wild, there appear to be more versions, such as 00.01.64, 01.00.21,
150*b08c118cSDmitry Torokhov02.00.00, 02.00.04, 02.00.06::
151*b08c118cSDmitry Torokhov
152*b08c118cSDmitry Torokhov 6 bytes:
153*b08c118cSDmitry Torokhov 02.00.30 => EF113
154*b08c118cSDmitry Torokhov 02.08.00 => EF023
155*b08c118cSDmitry Torokhov 02.08.XX => EF123
156*b08c118cSDmitry Torokhov 02.0B.00 => EF215
157*b08c118cSDmitry Torokhov 04.01.XX => Scroll_EF051
158*b08c118cSDmitry Torokhov 04.02.XX => EF051
159*b08c118cSDmitry Torokhov
160*b08c118cSDmitry TorokhovIn the wild, there appear to be more versions, such as 04.03.01, 04.04.11. There
161*b08c118cSDmitry Torokhovappears to be almost no difference, except for EF113, which does not report
162*b08c118cSDmitry Torokhovpressure/width and has different data consistency checks.
163*b08c118cSDmitry Torokhov
164*b08c118cSDmitry TorokhovProbably all the versions with param[0] <= 01 can be considered as
165*b08c118cSDmitry Torokhov4 bytes/firmware 1. The versions < 02.08.00, with the exception of 02.00.30, as
166*b08c118cSDmitry Torokhov4 bytes/firmware 2. Everything >= 02.08.00 can be considered as 6 bytes.
167*b08c118cSDmitry Torokhov
168*b08c118cSDmitry Torokhov
169*b08c118cSDmitry TorokhovHardware version 1
170*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~
171*b08c118cSDmitry Torokhov
172*b08c118cSDmitry TorokhovRegisters
173*b08c118cSDmitry Torokhov---------
174*b08c118cSDmitry Torokhov
175*b08c118cSDmitry TorokhovBy echoing a hexadecimal value to a register it contents can be altered.
176*b08c118cSDmitry Torokhov
177*b08c118cSDmitry TorokhovFor example::
178*b08c118cSDmitry Torokhov
179*b08c118cSDmitry Torokhov   echo -n 0x16 > reg_10
180*b08c118cSDmitry Torokhov
181*b08c118cSDmitry Torokhov* reg_10::
182*b08c118cSDmitry Torokhov
183*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
184*b08c118cSDmitry Torokhov         B   C   T   D   L   A   S   E
185*b08c118cSDmitry Torokhov
186*b08c118cSDmitry Torokhov         E: 1 = enable smart edges unconditionally
187*b08c118cSDmitry Torokhov         S: 1 = enable smart edges only when dragging
188*b08c118cSDmitry Torokhov         A: 1 = absolute mode (needs 4 byte packets, see reg_11)
189*b08c118cSDmitry Torokhov         L: 1 = enable drag lock (see reg_22)
190*b08c118cSDmitry Torokhov         D: 1 = disable dynamic resolution
191*b08c118cSDmitry Torokhov         T: 1 = disable tapping
192*b08c118cSDmitry Torokhov         C: 1 = enable corner tap
193*b08c118cSDmitry Torokhov         B: 1 = swap left and right button
194*b08c118cSDmitry Torokhov
195*b08c118cSDmitry Torokhov* reg_11::
196*b08c118cSDmitry Torokhov
197*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
198*b08c118cSDmitry Torokhov         1   0   0   H   V   1   F   P
199*b08c118cSDmitry Torokhov
200*b08c118cSDmitry Torokhov         P: 1 = enable parity checking for relative mode
201*b08c118cSDmitry Torokhov         F: 1 = enable native 4 byte packet mode
202*b08c118cSDmitry Torokhov         V: 1 = enable vertical scroll area
203*b08c118cSDmitry Torokhov         H: 1 = enable horizontal scroll area
204*b08c118cSDmitry Torokhov
205*b08c118cSDmitry Torokhov* reg_20::
206*b08c118cSDmitry Torokhov
207*b08c118cSDmitry Torokhov         single finger width?
208*b08c118cSDmitry Torokhov
209*b08c118cSDmitry Torokhov* reg_21::
210*b08c118cSDmitry Torokhov
211*b08c118cSDmitry Torokhov         scroll area width (small: 0x40 ... wide: 0xff)
212*b08c118cSDmitry Torokhov
213*b08c118cSDmitry Torokhov* reg_22::
214*b08c118cSDmitry Torokhov
215*b08c118cSDmitry Torokhov         drag lock time out (short: 0x14 ... long: 0xfe;
216*b08c118cSDmitry Torokhov                             0xff = tap again to release)
217*b08c118cSDmitry Torokhov
218*b08c118cSDmitry Torokhov* reg_23::
219*b08c118cSDmitry Torokhov
220*b08c118cSDmitry Torokhov         tap make timeout?
221*b08c118cSDmitry Torokhov
222*b08c118cSDmitry Torokhov* reg_24::
223*b08c118cSDmitry Torokhov
224*b08c118cSDmitry Torokhov         tap release timeout?
225*b08c118cSDmitry Torokhov
226*b08c118cSDmitry Torokhov* reg_25::
227*b08c118cSDmitry Torokhov
228*b08c118cSDmitry Torokhov         smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)
229*b08c118cSDmitry Torokhov
230*b08c118cSDmitry Torokhov* reg_26::
231*b08c118cSDmitry Torokhov
232*b08c118cSDmitry Torokhov         smart edge activation area width?
233*b08c118cSDmitry Torokhov
234*b08c118cSDmitry Torokhov
235*b08c118cSDmitry TorokhovNative relative mode 4 byte packet format
236*b08c118cSDmitry Torokhov-----------------------------------------
237*b08c118cSDmitry Torokhov
238*b08c118cSDmitry Torokhovbyte 0::
239*b08c118cSDmitry Torokhov
240*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
241*b08c118cSDmitry Torokhov         c   c  p2  p1   1   M   R   L
242*b08c118cSDmitry Torokhov
243*b08c118cSDmitry Torokhov         L, R, M = 1 when Left, Right, Middle mouse button pressed
244*b08c118cSDmitry Torokhov            some models have M as byte 3 odd parity bit
245*b08c118cSDmitry Torokhov         when parity checking is enabled (reg_11, P = 1):
246*b08c118cSDmitry Torokhov            p1..p2 = byte 1 and 2 odd parity bit
247*b08c118cSDmitry Torokhov         c = 1 when corner tap detected
248*b08c118cSDmitry Torokhov
249*b08c118cSDmitry Torokhovbyte 1::
250*b08c118cSDmitry Torokhov
251*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
252*b08c118cSDmitry Torokhov        dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
253*b08c118cSDmitry Torokhov
254*b08c118cSDmitry Torokhov         dx7..dx0 = x movement;   positive = right, negative = left
255*b08c118cSDmitry Torokhov         byte 1 = 0xf0 when corner tap detected
256*b08c118cSDmitry Torokhov
257*b08c118cSDmitry Torokhovbyte 2::
258*b08c118cSDmitry Torokhov
259*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
260*b08c118cSDmitry Torokhov        dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
261*b08c118cSDmitry Torokhov
262*b08c118cSDmitry Torokhov         dy7..dy0 = y movement;   positive = up,    negative = down
263*b08c118cSDmitry Torokhov
264*b08c118cSDmitry Torokhovbyte 3::
265*b08c118cSDmitry Torokhov
266*b08c118cSDmitry Torokhov   parity checking enabled (reg_11, P = 1):
267*b08c118cSDmitry Torokhov
268*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
269*b08c118cSDmitry Torokhov            w   h  n1  n0  ds3 ds2 ds1 ds0
270*b08c118cSDmitry Torokhov
271*b08c118cSDmitry Torokhov            normally:
272*b08c118cSDmitry Torokhov               ds3..ds0 = scroll wheel amount and direction
273*b08c118cSDmitry Torokhov                          positive = down or left
274*b08c118cSDmitry Torokhov                          negative = up or right
275*b08c118cSDmitry Torokhov            when corner tap detected:
276*b08c118cSDmitry Torokhov               ds0 = 1 when top right corner tapped
277*b08c118cSDmitry Torokhov               ds1 = 1 when bottom right corner tapped
278*b08c118cSDmitry Torokhov               ds2 = 1 when bottom left corner tapped
279*b08c118cSDmitry Torokhov               ds3 = 1 when top left corner tapped
280*b08c118cSDmitry Torokhov            n1..n0 = number of fingers on touchpad
281*b08c118cSDmitry Torokhov               only models with firmware 2.x report this, models with
282*b08c118cSDmitry Torokhov               firmware 1.x seem to map one, two and three finger taps
283*b08c118cSDmitry Torokhov               directly to L, M and R mouse buttons
284*b08c118cSDmitry Torokhov            h = 1 when horizontal scroll action
285*b08c118cSDmitry Torokhov            w = 1 when wide finger touch?
286*b08c118cSDmitry Torokhov
287*b08c118cSDmitry Torokhov   otherwise (reg_11, P = 0):
288*b08c118cSDmitry Torokhov
289*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
290*b08c118cSDmitry Torokhov           ds7 ds6 ds5 ds4 ds3 ds2 ds1 ds0
291*b08c118cSDmitry Torokhov
292*b08c118cSDmitry Torokhov            ds7..ds0 = vertical scroll amount and direction
293*b08c118cSDmitry Torokhov                       negative = up
294*b08c118cSDmitry Torokhov                       positive = down
295*b08c118cSDmitry Torokhov
296*b08c118cSDmitry Torokhov
297*b08c118cSDmitry TorokhovNative absolute mode 4 byte packet format
298*b08c118cSDmitry Torokhov-----------------------------------------
299*b08c118cSDmitry Torokhov
300*b08c118cSDmitry TorokhovEF013 and EF019 have a special behaviour (due to a bug in the firmware?), and
301*b08c118cSDmitry Torokhovwhen 1 finger is touching, the first 2 position reports must be discarded.
302*b08c118cSDmitry TorokhovThis counting is reset whenever a different number of fingers is reported.
303*b08c118cSDmitry Torokhov
304*b08c118cSDmitry Torokhovbyte 0::
305*b08c118cSDmitry Torokhov
306*b08c118cSDmitry Torokhov   firmware version 1.x:
307*b08c118cSDmitry Torokhov
308*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
309*b08c118cSDmitry Torokhov            D   U  p1  p2   1  p3   R   L
310*b08c118cSDmitry Torokhov
311*b08c118cSDmitry Torokhov            L, R = 1 when Left, Right mouse button pressed
312*b08c118cSDmitry Torokhov            p1..p3 = byte 1..3 odd parity bit
313*b08c118cSDmitry Torokhov            D, U = 1 when rocker switch pressed Up, Down
314*b08c118cSDmitry Torokhov
315*b08c118cSDmitry Torokhov   firmware version 2.x:
316*b08c118cSDmitry Torokhov
317*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
318*b08c118cSDmitry Torokhov           n1  n0  p2  p1   1  p3   R   L
319*b08c118cSDmitry Torokhov
320*b08c118cSDmitry Torokhov            L, R = 1 when Left, Right mouse button pressed
321*b08c118cSDmitry Torokhov            p1..p3 = byte 1..3 odd parity bit
322*b08c118cSDmitry Torokhov            n1..n0 = number of fingers on touchpad
323*b08c118cSDmitry Torokhov
324*b08c118cSDmitry Torokhovbyte 1::
325*b08c118cSDmitry Torokhov
326*b08c118cSDmitry Torokhov   firmware version 1.x:
327*b08c118cSDmitry Torokhov
328*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
329*b08c118cSDmitry Torokhov            f   0  th  tw  x9  x8  y9  y8
330*b08c118cSDmitry Torokhov
331*b08c118cSDmitry Torokhov            tw = 1 when two finger touch
332*b08c118cSDmitry Torokhov            th = 1 when three finger touch
333*b08c118cSDmitry Torokhov            f  = 1 when finger touch
334*b08c118cSDmitry Torokhov
335*b08c118cSDmitry Torokhov   firmware version 2.x:
336*b08c118cSDmitry Torokhov
337*b08c118cSDmitry Torokhov      bit   7   6   5   4   3   2   1   0
338*b08c118cSDmitry Torokhov            .   .   .   .  x9  x8  y9  y8
339*b08c118cSDmitry Torokhov
340*b08c118cSDmitry Torokhovbyte 2::
341*b08c118cSDmitry Torokhov
342*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
343*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
344*b08c118cSDmitry Torokhov
345*b08c118cSDmitry Torokhov         x9..x0 = absolute x value (horizontal)
346*b08c118cSDmitry Torokhov
347*b08c118cSDmitry Torokhovbyte 3::
348*b08c118cSDmitry Torokhov
349*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
350*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
351*b08c118cSDmitry Torokhov
352*b08c118cSDmitry Torokhov         y9..y0 = absolute y value (vertical)
353*b08c118cSDmitry Torokhov
354*b08c118cSDmitry Torokhov
355*b08c118cSDmitry TorokhovHardware version 2
356*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~
357*b08c118cSDmitry Torokhov
358*b08c118cSDmitry Torokhov
359*b08c118cSDmitry TorokhovRegisters
360*b08c118cSDmitry Torokhov---------
361*b08c118cSDmitry Torokhov
362*b08c118cSDmitry TorokhovBy echoing a hexadecimal value to a register it contents can be altered.
363*b08c118cSDmitry Torokhov
364*b08c118cSDmitry TorokhovFor example::
365*b08c118cSDmitry Torokhov
366*b08c118cSDmitry Torokhov   echo -n 0x56 > reg_10
367*b08c118cSDmitry Torokhov
368*b08c118cSDmitry Torokhov* reg_10::
369*b08c118cSDmitry Torokhov
370*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
371*b08c118cSDmitry Torokhov         0   1   0   1   0   1   D   0
372*b08c118cSDmitry Torokhov
373*b08c118cSDmitry Torokhov         D: 1 = enable drag and drop
374*b08c118cSDmitry Torokhov
375*b08c118cSDmitry Torokhov* reg_11::
376*b08c118cSDmitry Torokhov
377*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
378*b08c118cSDmitry Torokhov         1   0   0   0   S   0   1   0
379*b08c118cSDmitry Torokhov
380*b08c118cSDmitry Torokhov         S: 1 = enable vertical scroll
381*b08c118cSDmitry Torokhov
382*b08c118cSDmitry Torokhov* reg_21::
383*b08c118cSDmitry Torokhov
384*b08c118cSDmitry Torokhov         unknown (0x00)
385*b08c118cSDmitry Torokhov
386*b08c118cSDmitry Torokhov* reg_22::
387*b08c118cSDmitry Torokhov
388*b08c118cSDmitry Torokhov         drag and drop release time out (short: 0x70 ... long 0x7e;
389*b08c118cSDmitry Torokhov                                   0x7f = never i.e. tap again to release)
390*b08c118cSDmitry Torokhov
391*b08c118cSDmitry Torokhov
392*b08c118cSDmitry TorokhovNative absolute mode 6 byte packet format
393*b08c118cSDmitry Torokhov-----------------------------------------
394*b08c118cSDmitry Torokhov
395*b08c118cSDmitry TorokhovParity checking and packet re-synchronization
396*b08c118cSDmitry Torokhov^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
397*b08c118cSDmitry Torokhov
398*b08c118cSDmitry TorokhovThere is no parity checking, however some consistency checks can be performed.
399*b08c118cSDmitry Torokhov
400*b08c118cSDmitry TorokhovFor instance for EF113::
401*b08c118cSDmitry Torokhov
402*b08c118cSDmitry Torokhov        SA1= packet[0];
403*b08c118cSDmitry Torokhov        A1 = packet[1];
404*b08c118cSDmitry Torokhov        B1 = packet[2];
405*b08c118cSDmitry Torokhov        SB1= packet[3];
406*b08c118cSDmitry Torokhov        C1 = packet[4];
407*b08c118cSDmitry Torokhov        D1 = packet[5];
408*b08c118cSDmitry Torokhov        if( (((SA1 & 0x3C) != 0x3C) && ((SA1 & 0xC0) != 0x80)) || // check Byte 1
409*b08c118cSDmitry Torokhov            (((SA1 & 0x0C) != 0x0C) && ((SA1 & 0xC0) == 0x80)) || // check Byte 1 (one finger pressed)
410*b08c118cSDmitry Torokhov            (((SA1 & 0xC0) != 0x80) && (( A1 & 0xF0) != 0x00)) || // check Byte 2
411*b08c118cSDmitry Torokhov            (((SB1 & 0x3E) != 0x38) && ((SA1 & 0xC0) != 0x80)) || // check Byte 4
412*b08c118cSDmitry Torokhov            (((SB1 & 0x0E) != 0x08) && ((SA1 & 0xC0) == 0x80)) || // check Byte 4 (one finger pressed)
413*b08c118cSDmitry Torokhov            (((SA1 & 0xC0) != 0x80) && (( C1 & 0xF0) != 0x00))  ) // check Byte 5
414*b08c118cSDmitry Torokhov		// error detected
415*b08c118cSDmitry Torokhov
416*b08c118cSDmitry TorokhovFor all the other ones, there are just a few constant bits::
417*b08c118cSDmitry Torokhov
418*b08c118cSDmitry Torokhov        if( ((packet[0] & 0x0C) != 0x04) ||
419*b08c118cSDmitry Torokhov            ((packet[3] & 0x0f) != 0x02) )
420*b08c118cSDmitry Torokhov		// error detected
421*b08c118cSDmitry Torokhov
422*b08c118cSDmitry Torokhov
423*b08c118cSDmitry TorokhovIn case an error is detected, all the packets are shifted by one (and packet[0] is discarded).
424*b08c118cSDmitry Torokhov
425*b08c118cSDmitry TorokhovOne/Three finger touch
426*b08c118cSDmitry Torokhov^^^^^^^^^^^^^^^^^^^^^^
427*b08c118cSDmitry Torokhov
428*b08c118cSDmitry Torokhovbyte 0::
429*b08c118cSDmitry Torokhov
430*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
431*b08c118cSDmitry Torokhov	 n1  n0  w3  w2   .   .   R   L
432*b08c118cSDmitry Torokhov
433*b08c118cSDmitry Torokhov         L, R = 1 when Left, Right mouse button pressed
434*b08c118cSDmitry Torokhov         n1..n0 = number of fingers on touchpad
435*b08c118cSDmitry Torokhov
436*b08c118cSDmitry Torokhovbyte 1::
437*b08c118cSDmitry Torokhov
438*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
439*b08c118cSDmitry Torokhov	 p7  p6  p5  p4 x11 x10 x9  x8
440*b08c118cSDmitry Torokhov
441*b08c118cSDmitry Torokhovbyte 2::
442*b08c118cSDmitry Torokhov
443*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
444*b08c118cSDmitry Torokhov	 x7  x6  x5  x4  x3  x2  x1  x0
445*b08c118cSDmitry Torokhov
446*b08c118cSDmitry Torokhov         x11..x0 = absolute x value (horizontal)
447*b08c118cSDmitry Torokhov
448*b08c118cSDmitry Torokhovbyte 3::
449*b08c118cSDmitry Torokhov
450*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
451*b08c118cSDmitry Torokhov	 n4  vf  w1  w0   .   .   .  b2
452*b08c118cSDmitry Torokhov
453*b08c118cSDmitry Torokhov	 n4 = set if more than 3 fingers (only in 3 fingers mode)
454*b08c118cSDmitry Torokhov	 vf = a kind of flag ? (only on EF123, 0 when finger is over one
455*b08c118cSDmitry Torokhov	      of the buttons, 1 otherwise)
456*b08c118cSDmitry Torokhov	 w3..w0 = width of the finger touch (not EF113)
457*b08c118cSDmitry Torokhov	 b2 (on EF113 only, 0 otherwise), b2.R.L indicates one button pressed:
458*b08c118cSDmitry Torokhov		0 = none
459*b08c118cSDmitry Torokhov		1 = Left
460*b08c118cSDmitry Torokhov		2 = Right
461*b08c118cSDmitry Torokhov		3 = Middle (Left and Right)
462*b08c118cSDmitry Torokhov		4 = Forward
463*b08c118cSDmitry Torokhov		5 = Back
464*b08c118cSDmitry Torokhov		6 = Another one
465*b08c118cSDmitry Torokhov		7 = Another one
466*b08c118cSDmitry Torokhov
467*b08c118cSDmitry Torokhovbyte 4::
468*b08c118cSDmitry Torokhov
469*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
470*b08c118cSDmitry Torokhov        p3  p1  p2  p0  y11 y10 y9  y8
471*b08c118cSDmitry Torokhov
472*b08c118cSDmitry Torokhov	 p7..p0 = pressure (not EF113)
473*b08c118cSDmitry Torokhov
474*b08c118cSDmitry Torokhovbyte 5::
475*b08c118cSDmitry Torokhov
476*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
477*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
478*b08c118cSDmitry Torokhov
479*b08c118cSDmitry Torokhov         y11..y0 = absolute y value (vertical)
480*b08c118cSDmitry Torokhov
481*b08c118cSDmitry Torokhov
482*b08c118cSDmitry TorokhovTwo finger touch
483*b08c118cSDmitry Torokhov^^^^^^^^^^^^^^^^
484*b08c118cSDmitry Torokhov
485*b08c118cSDmitry TorokhovNote that the two pairs of coordinates are not exactly the coordinates of the
486*b08c118cSDmitry Torokhovtwo fingers, but only the pair of the lower-left and upper-right coordinates.
487*b08c118cSDmitry TorokhovSo the actual fingers might be situated on the other diagonal of the square
488*b08c118cSDmitry Torokhovdefined by these two points.
489*b08c118cSDmitry Torokhov
490*b08c118cSDmitry Torokhovbyte 0::
491*b08c118cSDmitry Torokhov
492*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
493*b08c118cSDmitry Torokhov        n1  n0  ay8 ax8  .   .   R   L
494*b08c118cSDmitry Torokhov
495*b08c118cSDmitry Torokhov         L, R = 1 when Left, Right mouse button pressed
496*b08c118cSDmitry Torokhov         n1..n0 = number of fingers on touchpad
497*b08c118cSDmitry Torokhov
498*b08c118cSDmitry Torokhovbyte 1::
499*b08c118cSDmitry Torokhov
500*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
501*b08c118cSDmitry Torokhov        ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
502*b08c118cSDmitry Torokhov
503*b08c118cSDmitry Torokhov	 ax8..ax0 = lower-left finger absolute x value
504*b08c118cSDmitry Torokhov
505*b08c118cSDmitry Torokhovbyte 2::
506*b08c118cSDmitry Torokhov
507*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
508*b08c118cSDmitry Torokhov        ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0
509*b08c118cSDmitry Torokhov
510*b08c118cSDmitry Torokhov	 ay8..ay0 = lower-left finger absolute y value
511*b08c118cSDmitry Torokhov
512*b08c118cSDmitry Torokhovbyte 3::
513*b08c118cSDmitry Torokhov
514*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
515*b08c118cSDmitry Torokhov         .   .  by8 bx8  .   .   .   .
516*b08c118cSDmitry Torokhov
517*b08c118cSDmitry Torokhovbyte 4::
518*b08c118cSDmitry Torokhov
519*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
520*b08c118cSDmitry Torokhov        bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
521*b08c118cSDmitry Torokhov
522*b08c118cSDmitry Torokhov         bx8..bx0 = upper-right finger absolute x value
523*b08c118cSDmitry Torokhov
524*b08c118cSDmitry Torokhovbyte 5::
525*b08c118cSDmitry Torokhov
526*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
527*b08c118cSDmitry Torokhov        by7 by8 by5 by4 by3 by2 by1 by0
528*b08c118cSDmitry Torokhov
529*b08c118cSDmitry Torokhov         by8..by0 = upper-right finger absolute y value
530*b08c118cSDmitry Torokhov
531*b08c118cSDmitry TorokhovHardware version 3
532*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~
533*b08c118cSDmitry Torokhov
534*b08c118cSDmitry TorokhovRegisters
535*b08c118cSDmitry Torokhov---------
536*b08c118cSDmitry Torokhov
537*b08c118cSDmitry Torokhov* reg_10::
538*b08c118cSDmitry Torokhov
539*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
540*b08c118cSDmitry Torokhov         0   0   0   0   R   F   T   A
541*b08c118cSDmitry Torokhov
542*b08c118cSDmitry Torokhov         A: 1 = enable absolute tracking
543*b08c118cSDmitry Torokhov         T: 1 = enable two finger mode auto correct
544*b08c118cSDmitry Torokhov         F: 1 = disable ABS Position Filter
545*b08c118cSDmitry Torokhov         R: 1 = enable real hardware resolution
546*b08c118cSDmitry Torokhov
547*b08c118cSDmitry TorokhovNative absolute mode 6 byte packet format
548*b08c118cSDmitry Torokhov-----------------------------------------
549*b08c118cSDmitry Torokhov
550*b08c118cSDmitry Torokhov1 and 3 finger touch shares the same 6-byte packet format, except that
551*b08c118cSDmitry Torokhov3 finger touch only reports the position of the center of all three fingers.
552*b08c118cSDmitry Torokhov
553*b08c118cSDmitry TorokhovFirmware would send 12 bytes of data for 2 finger touch.
554*b08c118cSDmitry Torokhov
555*b08c118cSDmitry TorokhovNote on debounce:
556*b08c118cSDmitry TorokhovIn case the box has unstable power supply or other electricity issues, or
557*b08c118cSDmitry Torokhovwhen number of finger changes, F/W would send "debounce packet" to inform
558*b08c118cSDmitry Torokhovdriver that the hardware is in debounce status.
559*b08c118cSDmitry TorokhovThe debouce packet has the following signature::
560*b08c118cSDmitry Torokhov
561*b08c118cSDmitry Torokhov    byte 0: 0xc4
562*b08c118cSDmitry Torokhov    byte 1: 0xff
563*b08c118cSDmitry Torokhov    byte 2: 0xff
564*b08c118cSDmitry Torokhov    byte 3: 0x02
565*b08c118cSDmitry Torokhov    byte 4: 0xff
566*b08c118cSDmitry Torokhov    byte 5: 0xff
567*b08c118cSDmitry Torokhov
568*b08c118cSDmitry TorokhovWhen we encounter this kind of packet, we just ignore it.
569*b08c118cSDmitry Torokhov
570*b08c118cSDmitry TorokhovOne/Three finger touch
571*b08c118cSDmitry Torokhov^^^^^^^^^^^^^^^^^^^^^^
572*b08c118cSDmitry Torokhov
573*b08c118cSDmitry Torokhovbyte 0::
574*b08c118cSDmitry Torokhov
575*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
576*b08c118cSDmitry Torokhov        n1  n0  w3  w2   0   1   R   L
577*b08c118cSDmitry Torokhov
578*b08c118cSDmitry Torokhov        L, R = 1 when Left, Right mouse button pressed
579*b08c118cSDmitry Torokhov        n1..n0 = number of fingers on touchpad
580*b08c118cSDmitry Torokhov
581*b08c118cSDmitry Torokhovbyte 1::
582*b08c118cSDmitry Torokhov
583*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
584*b08c118cSDmitry Torokhov        p7  p6  p5  p4 x11 x10  x9  x8
585*b08c118cSDmitry Torokhov
586*b08c118cSDmitry Torokhovbyte 2::
587*b08c118cSDmitry Torokhov
588*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
589*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
590*b08c118cSDmitry Torokhov
591*b08c118cSDmitry Torokhov        x11..x0 = absolute x value (horizontal)
592*b08c118cSDmitry Torokhov
593*b08c118cSDmitry Torokhovbyte 3::
594*b08c118cSDmitry Torokhov
595*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
596*b08c118cSDmitry Torokhov         0   0  w1  w0   0   0   1   0
597*b08c118cSDmitry Torokhov
598*b08c118cSDmitry Torokhov         w3..w0 = width of the finger touch
599*b08c118cSDmitry Torokhov
600*b08c118cSDmitry Torokhovbyte 4::
601*b08c118cSDmitry Torokhov
602*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
603*b08c118cSDmitry Torokhov        p3  p1  p2  p0  y11 y10 y9  y8
604*b08c118cSDmitry Torokhov
605*b08c118cSDmitry Torokhov        p7..p0 = pressure
606*b08c118cSDmitry Torokhov
607*b08c118cSDmitry Torokhovbyte 5::
608*b08c118cSDmitry Torokhov
609*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
610*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
611*b08c118cSDmitry Torokhov
612*b08c118cSDmitry Torokhov        y11..y0 = absolute y value (vertical)
613*b08c118cSDmitry Torokhov
614*b08c118cSDmitry TorokhovTwo finger touch
615*b08c118cSDmitry Torokhov^^^^^^^^^^^^^^^^
616*b08c118cSDmitry Torokhov
617*b08c118cSDmitry TorokhovThe packet format is exactly the same for two finger touch, except the hardware
618*b08c118cSDmitry Torokhovsends two 6 byte packets. The first packet contains data for the first finger,
619*b08c118cSDmitry Torokhovthe second packet has data for the second finger. So for two finger touch a
620*b08c118cSDmitry Torokhovtotal of 12 bytes are sent.
621*b08c118cSDmitry Torokhov
622*b08c118cSDmitry TorokhovHardware version 4
623*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~
624*b08c118cSDmitry Torokhov
625*b08c118cSDmitry TorokhovRegisters
626*b08c118cSDmitry Torokhov---------
627*b08c118cSDmitry Torokhov
628*b08c118cSDmitry Torokhov* reg_07::
629*b08c118cSDmitry Torokhov
630*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
631*b08c118cSDmitry Torokhov         0   0   0   0   0   0   0   A
632*b08c118cSDmitry Torokhov
633*b08c118cSDmitry Torokhov         A: 1 = enable absolute tracking
634*b08c118cSDmitry Torokhov
635*b08c118cSDmitry TorokhovNative absolute mode 6 byte packet format
636*b08c118cSDmitry Torokhov-----------------------------------------
637*b08c118cSDmitry Torokhov
638*b08c118cSDmitry Torokhovv4 hardware is a true multitouch touchpad, capable of tracking up to 5 fingers.
639*b08c118cSDmitry TorokhovUnfortunately, due to PS/2's limited bandwidth, its packet format is rather
640*b08c118cSDmitry Torokhovcomplex.
641*b08c118cSDmitry Torokhov
642*b08c118cSDmitry TorokhovWhenever the numbers or identities of the fingers changes, the hardware sends a
643*b08c118cSDmitry Torokhovstatus packet to indicate how many and which fingers is on touchpad, followed by
644*b08c118cSDmitry Torokhovhead packets or motion packets. A head packet contains data of finger id, finger
645*b08c118cSDmitry Torokhovposition (absolute x, y values), width, and pressure. A motion packet contains
646*b08c118cSDmitry Torokhovtwo fingers' position delta.
647*b08c118cSDmitry Torokhov
648*b08c118cSDmitry TorokhovFor example, when status packet tells there are 2 fingers on touchpad, then we
649*b08c118cSDmitry Torokhovcan expect two following head packets. If the finger status doesn't change,
650*b08c118cSDmitry Torokhovthe following packets would be motion packets, only sending delta of finger
651*b08c118cSDmitry Torokhovposition, until we receive a status packet.
652*b08c118cSDmitry Torokhov
653*b08c118cSDmitry TorokhovOne exception is one finger touch. when a status packet tells us there is only
654*b08c118cSDmitry Torokhovone finger, the hardware would just send head packets afterwards.
655*b08c118cSDmitry Torokhov
656*b08c118cSDmitry TorokhovStatus packet
657*b08c118cSDmitry Torokhov^^^^^^^^^^^^^
658*b08c118cSDmitry Torokhov
659*b08c118cSDmitry Torokhovbyte 0::
660*b08c118cSDmitry Torokhov
661*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
662*b08c118cSDmitry Torokhov         .   .   .   .   0   1   R   L
663*b08c118cSDmitry Torokhov
664*b08c118cSDmitry Torokhov         L, R = 1 when Left, Right mouse button pressed
665*b08c118cSDmitry Torokhov
666*b08c118cSDmitry Torokhovbyte 1::
667*b08c118cSDmitry Torokhov
668*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
669*b08c118cSDmitry Torokhov         .   .   . ft4 ft3 ft2 ft1 ft0
670*b08c118cSDmitry Torokhov
671*b08c118cSDmitry Torokhov         ft4 ft3 ft2 ft1 ft0 ftn = 1 when finger n is on touchpad
672*b08c118cSDmitry Torokhov
673*b08c118cSDmitry Torokhovbyte 2::
674*b08c118cSDmitry Torokhov
675*b08c118cSDmitry Torokhov   not used
676*b08c118cSDmitry Torokhov
677*b08c118cSDmitry Torokhovbyte 3::
678*b08c118cSDmitry Torokhov
679*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
680*b08c118cSDmitry Torokhov         .   .   .   1   0   0   0   0
681*b08c118cSDmitry Torokhov
682*b08c118cSDmitry Torokhov         constant bits
683*b08c118cSDmitry Torokhov
684*b08c118cSDmitry Torokhovbyte 4::
685*b08c118cSDmitry Torokhov
686*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
687*b08c118cSDmitry Torokhov         p   .   .   .   .   .   .   .
688*b08c118cSDmitry Torokhov
689*b08c118cSDmitry Torokhov         p = 1 for palm
690*b08c118cSDmitry Torokhov
691*b08c118cSDmitry Torokhovbyte 5::
692*b08c118cSDmitry Torokhov
693*b08c118cSDmitry Torokhov   not used
694*b08c118cSDmitry Torokhov
695*b08c118cSDmitry TorokhovHead packet
696*b08c118cSDmitry Torokhov^^^^^^^^^^^
697*b08c118cSDmitry Torokhov
698*b08c118cSDmitry Torokhovbyte 0::
699*b08c118cSDmitry Torokhov
700*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
701*b08c118cSDmitry Torokhov        w3  w2  w1  w0   0   1   R   L
702*b08c118cSDmitry Torokhov
703*b08c118cSDmitry Torokhov        L, R = 1 when Left, Right mouse button pressed
704*b08c118cSDmitry Torokhov        w3..w0 = finger width (spans how many trace lines)
705*b08c118cSDmitry Torokhov
706*b08c118cSDmitry Torokhovbyte 1::
707*b08c118cSDmitry Torokhov
708*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
709*b08c118cSDmitry Torokhov        p7  p6  p5  p4 x11 x10  x9  x8
710*b08c118cSDmitry Torokhov
711*b08c118cSDmitry Torokhovbyte 2::
712*b08c118cSDmitry Torokhov
713*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
714*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
715*b08c118cSDmitry Torokhov
716*b08c118cSDmitry Torokhov        x11..x0 = absolute x value (horizontal)
717*b08c118cSDmitry Torokhov
718*b08c118cSDmitry Torokhovbyte 3::
719*b08c118cSDmitry Torokhov
720*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
721*b08c118cSDmitry Torokhov       id2 id1 id0   1   0   0   0   1
722*b08c118cSDmitry Torokhov
723*b08c118cSDmitry Torokhov       id2..id0 = finger id
724*b08c118cSDmitry Torokhov
725*b08c118cSDmitry Torokhovbyte 4::
726*b08c118cSDmitry Torokhov
727*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
728*b08c118cSDmitry Torokhov        p3  p1  p2  p0  y11 y10 y9  y8
729*b08c118cSDmitry Torokhov
730*b08c118cSDmitry Torokhov        p7..p0 = pressure
731*b08c118cSDmitry Torokhov
732*b08c118cSDmitry Torokhovbyte 5::
733*b08c118cSDmitry Torokhov
734*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
735*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
736*b08c118cSDmitry Torokhov
737*b08c118cSDmitry Torokhov        y11..y0 = absolute y value (vertical)
738*b08c118cSDmitry Torokhov
739*b08c118cSDmitry TorokhovMotion packet
740*b08c118cSDmitry Torokhov^^^^^^^^^^^^^
741*b08c118cSDmitry Torokhov
742*b08c118cSDmitry Torokhovbyte 0::
743*b08c118cSDmitry Torokhov
744*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
745*b08c118cSDmitry Torokhov       id2 id1 id0   w   0   1   R   L
746*b08c118cSDmitry Torokhov
747*b08c118cSDmitry Torokhov       L, R = 1 when Left, Right mouse button pressed
748*b08c118cSDmitry Torokhov       id2..id0 = finger id
749*b08c118cSDmitry Torokhov       w = 1 when delta overflows (> 127 or < -128), in this case
750*b08c118cSDmitry Torokhov       firmware sends us (delta x / 5) and (delta y  / 5)
751*b08c118cSDmitry Torokhov
752*b08c118cSDmitry Torokhovbyte 1::
753*b08c118cSDmitry Torokhov
754*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
755*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
756*b08c118cSDmitry Torokhov
757*b08c118cSDmitry Torokhov        x7..x0 = delta x (two's complement)
758*b08c118cSDmitry Torokhov
759*b08c118cSDmitry Torokhovbyte 2::
760*b08c118cSDmitry Torokhov
761*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
762*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
763*b08c118cSDmitry Torokhov
764*b08c118cSDmitry Torokhov        y7..y0 = delta y (two's complement)
765*b08c118cSDmitry Torokhov
766*b08c118cSDmitry Torokhovbyte 3::
767*b08c118cSDmitry Torokhov
768*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
769*b08c118cSDmitry Torokhov       id2 id1 id0   1   0   0   1   0
770*b08c118cSDmitry Torokhov
771*b08c118cSDmitry Torokhov       id2..id0 = finger id
772*b08c118cSDmitry Torokhov
773*b08c118cSDmitry Torokhovbyte 4::
774*b08c118cSDmitry Torokhov
775*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
776*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
777*b08c118cSDmitry Torokhov
778*b08c118cSDmitry Torokhov        x7..x0 = delta x (two's complement)
779*b08c118cSDmitry Torokhov
780*b08c118cSDmitry Torokhovbyte 5::
781*b08c118cSDmitry Torokhov
782*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
783*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
784*b08c118cSDmitry Torokhov
785*b08c118cSDmitry Torokhov        y7..y0 = delta y (two's complement)
786*b08c118cSDmitry Torokhov
787*b08c118cSDmitry Torokhov        byte 0 ~ 2 for one finger
788*b08c118cSDmitry Torokhov        byte 3 ~ 5 for another
789*b08c118cSDmitry Torokhov
790*b08c118cSDmitry Torokhov
791*b08c118cSDmitry TorokhovTrackpoint (for Hardware version 3 and 4)
792*b08c118cSDmitry Torokhov~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
793*b08c118cSDmitry Torokhov
794*b08c118cSDmitry TorokhovRegisters
795*b08c118cSDmitry Torokhov---------
796*b08c118cSDmitry Torokhov
797*b08c118cSDmitry TorokhovNo special registers have been identified.
798*b08c118cSDmitry Torokhov
799*b08c118cSDmitry TorokhovNative relative mode 6 byte packet format
800*b08c118cSDmitry Torokhov-----------------------------------------
801*b08c118cSDmitry Torokhov
802*b08c118cSDmitry TorokhovStatus Packet
803*b08c118cSDmitry Torokhov^^^^^^^^^^^^^
804*b08c118cSDmitry Torokhov
805*b08c118cSDmitry Torokhovbyte 0::
806*b08c118cSDmitry Torokhov
807*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
808*b08c118cSDmitry Torokhov         0   0  sx  sy   0   M   R   L
809*b08c118cSDmitry Torokhov
810*b08c118cSDmitry Torokhovbyte 1::
811*b08c118cSDmitry Torokhov
812*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
813*b08c118cSDmitry Torokhov       ~sx   0   0   0   0   0   0   0
814*b08c118cSDmitry Torokhov
815*b08c118cSDmitry Torokhovbyte 2::
816*b08c118cSDmitry Torokhov
817*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
818*b08c118cSDmitry Torokhov       ~sy   0   0   0   0   0   0   0
819*b08c118cSDmitry Torokhov
820*b08c118cSDmitry Torokhovbyte 3::
821*b08c118cSDmitry Torokhov
822*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
823*b08c118cSDmitry Torokhov         0   0 ~sy ~sx   0   1   1   0
824*b08c118cSDmitry Torokhov
825*b08c118cSDmitry Torokhovbyte 4::
826*b08c118cSDmitry Torokhov
827*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
828*b08c118cSDmitry Torokhov        x7  x6  x5  x4  x3  x2  x1  x0
829*b08c118cSDmitry Torokhov
830*b08c118cSDmitry Torokhovbyte 5::
831*b08c118cSDmitry Torokhov
832*b08c118cSDmitry Torokhov   bit   7   6   5   4   3   2   1   0
833*b08c118cSDmitry Torokhov        y7  y6  y5  y4  y3  y2  y1  y0
834*b08c118cSDmitry Torokhov
835*b08c118cSDmitry Torokhov
836*b08c118cSDmitry Torokhov         x and y are written in two's complement spread
837*b08c118cSDmitry Torokhov             over 9 bits with sx/sy the relative top bit and
838*b08c118cSDmitry Torokhov             x7..x0 and y7..y0 the lower bits.
839*b08c118cSDmitry Torokhov	 ~sx is the inverse of sx, ~sy is the inverse of sy.
840*b08c118cSDmitry Torokhov         The sign of y is opposite to what the input driver
841*b08c118cSDmitry Torokhov             expects for a relative movement
842