18c2ecf20Sopenharmony_ciElantech Touchpad Driver
28c2ecf20Sopenharmony_ci========================
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci	Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci	Extra information for hardware version 1 found and
78c2ecf20Sopenharmony_ci	provided by Steve Havelka
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci	Version 2 (EeePC) hardware support based on patches
108c2ecf20Sopenharmony_ci	received from Woody at Xandros and forwarded to me
118c2ecf20Sopenharmony_ci	by user StewieGriffin at the eeeuser.com forum
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci.. Contents
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci 1. Introduction
168c2ecf20Sopenharmony_ci 2. Extra knobs
178c2ecf20Sopenharmony_ci 3. Differentiating hardware versions
188c2ecf20Sopenharmony_ci 4. Hardware version 1
198c2ecf20Sopenharmony_ci    4.1 Registers
208c2ecf20Sopenharmony_ci    4.2 Native relative mode 4 byte packet format
218c2ecf20Sopenharmony_ci    4.3 Native absolute mode 4 byte packet format
228c2ecf20Sopenharmony_ci 5. Hardware version 2
238c2ecf20Sopenharmony_ci    5.1 Registers
248c2ecf20Sopenharmony_ci    5.2 Native absolute mode 6 byte packet format
258c2ecf20Sopenharmony_ci        5.2.1 Parity checking and packet re-synchronization
268c2ecf20Sopenharmony_ci        5.2.2 One/Three finger touch
278c2ecf20Sopenharmony_ci        5.2.3 Two finger touch
288c2ecf20Sopenharmony_ci 6. Hardware version 3
298c2ecf20Sopenharmony_ci    6.1 Registers
308c2ecf20Sopenharmony_ci    6.2 Native absolute mode 6 byte packet format
318c2ecf20Sopenharmony_ci        6.2.1 One/Three finger touch
328c2ecf20Sopenharmony_ci        6.2.2 Two finger touch
338c2ecf20Sopenharmony_ci 7. Hardware version 4
348c2ecf20Sopenharmony_ci    7.1 Registers
358c2ecf20Sopenharmony_ci    7.2 Native absolute mode 6 byte packet format
368c2ecf20Sopenharmony_ci        7.2.1 Status packet
378c2ecf20Sopenharmony_ci        7.2.2 Head packet
388c2ecf20Sopenharmony_ci        7.2.3 Motion packet
398c2ecf20Sopenharmony_ci 8. Trackpoint (for Hardware version 3 and 4)
408c2ecf20Sopenharmony_ci    8.1 Registers
418c2ecf20Sopenharmony_ci    8.2 Native relative mode 6 byte packet format
428c2ecf20Sopenharmony_ci        8.2.1 Status Packet
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciIntroduction
478c2ecf20Sopenharmony_ci~~~~~~~~~~~~
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciCurrently the Linux Elantech touchpad driver is aware of four different
508c2ecf20Sopenharmony_cihardware versions unimaginatively called version 1,version 2, version 3
518c2ecf20Sopenharmony_ciand version 4. Version 1 is found in "older" laptops and uses 4 bytes per
528c2ecf20Sopenharmony_cipacket. Version 2 seems to be introduced with the EeePC and uses 6 bytes
538c2ecf20Sopenharmony_ciper packet, and provides additional features such as position of two fingers,
548c2ecf20Sopenharmony_ciand width of the touch.  Hardware version 3 uses 6 bytes per packet (and
558c2ecf20Sopenharmony_cifor 2 fingers the concatenation of two 6 bytes packets) and allows tracking
568c2ecf20Sopenharmony_ciof up to 3 fingers. Hardware version 4 uses 6 bytes per packet, and can
578c2ecf20Sopenharmony_cicombine a status packet with multiple head or motion packets. Hardware version
588c2ecf20Sopenharmony_ci4 allows tracking up to 5 fingers.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciSome Hardware version 3 and version 4 also have a trackpoint which uses a
618c2ecf20Sopenharmony_ciseparate packet format. It is also 6 bytes per packet.
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciThe driver tries to support both hardware versions and should be compatible
648c2ecf20Sopenharmony_ciwith the Xorg Synaptics touchpad driver and its graphical configuration
658c2ecf20Sopenharmony_ciutilities.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciNote that a mouse button is also associated with either the touchpad or the
688c2ecf20Sopenharmony_citrackpoint when a trackpoint is available.  Disabling the Touchpad in xorg
698c2ecf20Sopenharmony_ci(TouchPadOff=0) will also disable the buttons associated with the touchpad.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciAdditionally the operation of the touchpad can be altered by adjusting the
728c2ecf20Sopenharmony_cicontents of some of its internal registers. These registers are represented
738c2ecf20Sopenharmony_ciby the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio?
748c2ecf20Sopenharmony_cithat can be read from and written to.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciCurrently only the registers for hardware version 1 are somewhat understood.
778c2ecf20Sopenharmony_ciHardware version 2 seems to use some of the same registers but it is not
788c2ecf20Sopenharmony_ciknown whether the bits in the registers represent the same thing or might
798c2ecf20Sopenharmony_cihave changed their meaning.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciOn top of that, some register settings have effect only when the touchpad is
828c2ecf20Sopenharmony_ciin relative mode and not in absolute mode. As the Linux Elantech touchpad
838c2ecf20Sopenharmony_cidriver always puts the hardware into absolute mode not all information
848c2ecf20Sopenharmony_cimentioned below can be used immediately. But because there is no freely
858c2ecf20Sopenharmony_ciavailable Elantech documentation the information is provided here anyway for
868c2ecf20Sopenharmony_cicompleteness sake.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciExtra knobs
908c2ecf20Sopenharmony_ci~~~~~~~~~~~
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ciCurrently the Linux Elantech touchpad driver provides three extra knobs under
938c2ecf20Sopenharmony_ci/sys/bus/serio/drivers/psmouse/serio? for the user.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci* debug
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci   Turn different levels of debugging ON or OFF.
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci   By echoing "0" to this file all debugging will be turned OFF.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci   Currently a value of "1" will turn on some basic debugging and a value of
1028c2ecf20Sopenharmony_ci   "2" will turn on packet debugging. For hardware version 1 the default is
1038c2ecf20Sopenharmony_ci   OFF. For version 2 the default is "1".
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci   Turning packet debugging on will make the driver dump every packet
1068c2ecf20Sopenharmony_ci   received to the syslog before processing it. Be warned that this can
1078c2ecf20Sopenharmony_ci   generate quite a lot of data!
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci* paritycheck
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci   Turns parity checking ON or OFF.
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci   By echoing "0" to this file parity checking will be turned OFF. Any
1148c2ecf20Sopenharmony_ci   non-zero value will turn it ON. For hardware version 1 the default is ON.
1158c2ecf20Sopenharmony_ci   For version 2 the default it is OFF.
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci   Hardware version 1 provides basic data integrity verification by
1188c2ecf20Sopenharmony_ci   calculating a parity bit for the last 3 bytes of each packet. The driver
1198c2ecf20Sopenharmony_ci   can check these bits and reject any packet that appears corrupted. Using
1208c2ecf20Sopenharmony_ci   this knob you can bypass that check.
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci   Hardware version 2 does not provide the same parity bits. Only some basic
1238c2ecf20Sopenharmony_ci   data consistency checking can be done. For now checking is disabled by
1248c2ecf20Sopenharmony_ci   default. Currently even turning it on will do nothing.
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci* crc_enabled
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci   Sets crc_enabled to 0/1. The name "crc_enabled" is the official name of
1298c2ecf20Sopenharmony_ci   this integrity check, even though it is not an actual cyclic redundancy
1308c2ecf20Sopenharmony_ci   check.
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci   Depending on the state of crc_enabled, certain basic data integrity
1338c2ecf20Sopenharmony_ci   verification is done by the driver on hardware version 3 and 4. The
1348c2ecf20Sopenharmony_ci   driver will reject any packet that appears corrupted. Using this knob,
1358c2ecf20Sopenharmony_ci   The state of crc_enabled can be altered with this knob.
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci   Reading the crc_enabled value will show the active value. Echoing
1388c2ecf20Sopenharmony_ci   "0" or "1" to this file will set the state to "0" or "1".
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciDifferentiating hardware versions
1418c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ciTo detect the hardware version, read the version number as param[0].param[1].param[2]::
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci 4 bytes version: (after the arrow is the name given in the Dell-provided driver)
1468c2ecf20Sopenharmony_ci 02.00.22 => EF013
1478c2ecf20Sopenharmony_ci 02.06.00 => EF019
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ciIn the wild, there appear to be more versions, such as 00.01.64, 01.00.21,
1508c2ecf20Sopenharmony_ci02.00.00, 02.00.04, 02.00.06::
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci 6 bytes:
1538c2ecf20Sopenharmony_ci 02.00.30 => EF113
1548c2ecf20Sopenharmony_ci 02.08.00 => EF023
1558c2ecf20Sopenharmony_ci 02.08.XX => EF123
1568c2ecf20Sopenharmony_ci 02.0B.00 => EF215
1578c2ecf20Sopenharmony_ci 04.01.XX => Scroll_EF051
1588c2ecf20Sopenharmony_ci 04.02.XX => EF051
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ciIn the wild, there appear to be more versions, such as 04.03.01, 04.04.11. There
1618c2ecf20Sopenharmony_ciappears to be almost no difference, except for EF113, which does not report
1628c2ecf20Sopenharmony_cipressure/width and has different data consistency checks.
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ciProbably all the versions with param[0] <= 01 can be considered as
1658c2ecf20Sopenharmony_ci4 bytes/firmware 1. The versions < 02.08.00, with the exception of 02.00.30, as
1668c2ecf20Sopenharmony_ci4 bytes/firmware 2. Everything >= 02.08.00 can be considered as 6 bytes.
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ciHardware version 1
1708c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ciRegisters
1738c2ecf20Sopenharmony_ci---------
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ciBy echoing a hexadecimal value to a register it contents can be altered.
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ciFor example::
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci   echo -n 0x16 > reg_10
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci* reg_10::
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
1848c2ecf20Sopenharmony_ci         B   C   T   D   L   A   S   E
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci         E: 1 = enable smart edges unconditionally
1878c2ecf20Sopenharmony_ci         S: 1 = enable smart edges only when dragging
1888c2ecf20Sopenharmony_ci         A: 1 = absolute mode (needs 4 byte packets, see reg_11)
1898c2ecf20Sopenharmony_ci         L: 1 = enable drag lock (see reg_22)
1908c2ecf20Sopenharmony_ci         D: 1 = disable dynamic resolution
1918c2ecf20Sopenharmony_ci         T: 1 = disable tapping
1928c2ecf20Sopenharmony_ci         C: 1 = enable corner tap
1938c2ecf20Sopenharmony_ci         B: 1 = swap left and right button
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci* reg_11::
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
1988c2ecf20Sopenharmony_ci         1   0   0   H   V   1   F   P
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci         P: 1 = enable parity checking for relative mode
2018c2ecf20Sopenharmony_ci         F: 1 = enable native 4 byte packet mode
2028c2ecf20Sopenharmony_ci         V: 1 = enable vertical scroll area
2038c2ecf20Sopenharmony_ci         H: 1 = enable horizontal scroll area
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci* reg_20::
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci         single finger width?
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci* reg_21::
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci         scroll area width (small: 0x40 ... wide: 0xff)
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci* reg_22::
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci         drag lock time out (short: 0x14 ... long: 0xfe;
2168c2ecf20Sopenharmony_ci                             0xff = tap again to release)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci* reg_23::
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci         tap make timeout?
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci* reg_24::
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci         tap release timeout?
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci* reg_25::
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci         smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci* reg_26::
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci         smart edge activation area width?
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ciNative relative mode 4 byte packet format
2368c2ecf20Sopenharmony_ci-----------------------------------------
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_cibyte 0::
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
2418c2ecf20Sopenharmony_ci         c   c  p2  p1   1   M   R   L
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci         L, R, M = 1 when Left, Right, Middle mouse button pressed
2448c2ecf20Sopenharmony_ci            some models have M as byte 3 odd parity bit
2458c2ecf20Sopenharmony_ci         when parity checking is enabled (reg_11, P = 1):
2468c2ecf20Sopenharmony_ci            p1..p2 = byte 1 and 2 odd parity bit
2478c2ecf20Sopenharmony_ci         c = 1 when corner tap detected
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_cibyte 1::
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
2528c2ecf20Sopenharmony_ci        dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci         dx7..dx0 = x movement;   positive = right, negative = left
2558c2ecf20Sopenharmony_ci         byte 1 = 0xf0 when corner tap detected
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_cibyte 2::
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
2608c2ecf20Sopenharmony_ci        dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci         dy7..dy0 = y movement;   positive = up,    negative = down
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_cibyte 3::
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci   parity checking enabled (reg_11, P = 1):
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
2698c2ecf20Sopenharmony_ci            w   h  n1  n0  ds3 ds2 ds1 ds0
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci            normally:
2728c2ecf20Sopenharmony_ci               ds3..ds0 = scroll wheel amount and direction
2738c2ecf20Sopenharmony_ci                          positive = down or left
2748c2ecf20Sopenharmony_ci                          negative = up or right
2758c2ecf20Sopenharmony_ci            when corner tap detected:
2768c2ecf20Sopenharmony_ci               ds0 = 1 when top right corner tapped
2778c2ecf20Sopenharmony_ci               ds1 = 1 when bottom right corner tapped
2788c2ecf20Sopenharmony_ci               ds2 = 1 when bottom left corner tapped
2798c2ecf20Sopenharmony_ci               ds3 = 1 when top left corner tapped
2808c2ecf20Sopenharmony_ci            n1..n0 = number of fingers on touchpad
2818c2ecf20Sopenharmony_ci               only models with firmware 2.x report this, models with
2828c2ecf20Sopenharmony_ci               firmware 1.x seem to map one, two and three finger taps
2838c2ecf20Sopenharmony_ci               directly to L, M and R mouse buttons
2848c2ecf20Sopenharmony_ci            h = 1 when horizontal scroll action
2858c2ecf20Sopenharmony_ci            w = 1 when wide finger touch?
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci   otherwise (reg_11, P = 0):
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
2908c2ecf20Sopenharmony_ci           ds7 ds6 ds5 ds4 ds3 ds2 ds1 ds0
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci            ds7..ds0 = vertical scroll amount and direction
2938c2ecf20Sopenharmony_ci                       negative = up
2948c2ecf20Sopenharmony_ci                       positive = down
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ciNative absolute mode 4 byte packet format
2988c2ecf20Sopenharmony_ci-----------------------------------------
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ciEF013 and EF019 have a special behaviour (due to a bug in the firmware?), and
3018c2ecf20Sopenharmony_ciwhen 1 finger is touching, the first 2 position reports must be discarded.
3028c2ecf20Sopenharmony_ciThis counting is reset whenever a different number of fingers is reported.
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cibyte 0::
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci   firmware version 1.x:
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
3098c2ecf20Sopenharmony_ci            D   U  p1  p2   1  p3   R   L
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci            L, R = 1 when Left, Right mouse button pressed
3128c2ecf20Sopenharmony_ci            p1..p3 = byte 1..3 odd parity bit
3138c2ecf20Sopenharmony_ci            D, U = 1 when rocker switch pressed Up, Down
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci   firmware version 2.x:
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
3188c2ecf20Sopenharmony_ci           n1  n0  p2  p1   1  p3   R   L
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci            L, R = 1 when Left, Right mouse button pressed
3218c2ecf20Sopenharmony_ci            p1..p3 = byte 1..3 odd parity bit
3228c2ecf20Sopenharmony_ci            n1..n0 = number of fingers on touchpad
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_cibyte 1::
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci   firmware version 1.x:
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
3298c2ecf20Sopenharmony_ci            f   0  th  tw  x9  x8  y9  y8
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci            tw = 1 when two finger touch
3328c2ecf20Sopenharmony_ci            th = 1 when three finger touch
3338c2ecf20Sopenharmony_ci            f  = 1 when finger touch
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci   firmware version 2.x:
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci      bit   7   6   5   4   3   2   1   0
3388c2ecf20Sopenharmony_ci            .   .   .   .  x9  x8  y9  y8
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_cibyte 2::
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
3438c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci         x9..x0 = absolute x value (horizontal)
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_cibyte 3::
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
3508c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci         y9..y0 = absolute y value (vertical)
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ciHardware version 2
3568c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ciRegisters
3608c2ecf20Sopenharmony_ci---------
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ciBy echoing a hexadecimal value to a register it contents can be altered.
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ciFor example::
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci   echo -n 0x56 > reg_10
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci* reg_10::
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
3718c2ecf20Sopenharmony_ci         0   1   0   1   0   1   D   0
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci         D: 1 = enable drag and drop
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci* reg_11::
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
3788c2ecf20Sopenharmony_ci         1   0   0   0   S   0   1   0
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci         S: 1 = enable vertical scroll
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci* reg_21::
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci         unknown (0x00)
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci* reg_22::
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci         drag and drop release time out (short: 0x70 ... long 0x7e;
3898c2ecf20Sopenharmony_ci                                   0x7f = never i.e. tap again to release)
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ciNative absolute mode 6 byte packet format
3938c2ecf20Sopenharmony_ci-----------------------------------------
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ciParity checking and packet re-synchronization
3968c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ciThere is no parity checking, however some consistency checks can be performed.
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ciFor instance for EF113::
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci        SA1= packet[0];
4038c2ecf20Sopenharmony_ci        A1 = packet[1];
4048c2ecf20Sopenharmony_ci        B1 = packet[2];
4058c2ecf20Sopenharmony_ci        SB1= packet[3];
4068c2ecf20Sopenharmony_ci        C1 = packet[4];
4078c2ecf20Sopenharmony_ci        D1 = packet[5];
4088c2ecf20Sopenharmony_ci        if( (((SA1 & 0x3C) != 0x3C) && ((SA1 & 0xC0) != 0x80)) || // check Byte 1
4098c2ecf20Sopenharmony_ci            (((SA1 & 0x0C) != 0x0C) && ((SA1 & 0xC0) == 0x80)) || // check Byte 1 (one finger pressed)
4108c2ecf20Sopenharmony_ci            (((SA1 & 0xC0) != 0x80) && (( A1 & 0xF0) != 0x00)) || // check Byte 2
4118c2ecf20Sopenharmony_ci            (((SB1 & 0x3E) != 0x38) && ((SA1 & 0xC0) != 0x80)) || // check Byte 4
4128c2ecf20Sopenharmony_ci            (((SB1 & 0x0E) != 0x08) && ((SA1 & 0xC0) == 0x80)) || // check Byte 4 (one finger pressed)
4138c2ecf20Sopenharmony_ci            (((SA1 & 0xC0) != 0x80) && (( C1 & 0xF0) != 0x00))  ) // check Byte 5
4148c2ecf20Sopenharmony_ci		// error detected
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ciFor all the other ones, there are just a few constant bits::
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci        if( ((packet[0] & 0x0C) != 0x04) ||
4198c2ecf20Sopenharmony_ci            ((packet[3] & 0x0f) != 0x02) )
4208c2ecf20Sopenharmony_ci		// error detected
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ciIn case an error is detected, all the packets are shifted by one (and packet[0] is discarded).
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ciOne/Three finger touch
4268c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_cibyte 0::
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4318c2ecf20Sopenharmony_ci	 n1  n0  w3  w2   .   .   R   L
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci         L, R = 1 when Left, Right mouse button pressed
4348c2ecf20Sopenharmony_ci         n1..n0 = number of fingers on touchpad
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_cibyte 1::
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4398c2ecf20Sopenharmony_ci	 p7  p6  p5  p4 x11 x10 x9  x8
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_cibyte 2::
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4448c2ecf20Sopenharmony_ci	 x7  x6  x5  x4  x3  x2  x1  x0
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci         x11..x0 = absolute x value (horizontal)
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cibyte 3::
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4518c2ecf20Sopenharmony_ci	 n4  vf  w1  w0   .   .   .  b2
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci	 n4 = set if more than 3 fingers (only in 3 fingers mode)
4548c2ecf20Sopenharmony_ci	 vf = a kind of flag ? (only on EF123, 0 when finger is over one
4558c2ecf20Sopenharmony_ci	      of the buttons, 1 otherwise)
4568c2ecf20Sopenharmony_ci	 w3..w0 = width of the finger touch (not EF113)
4578c2ecf20Sopenharmony_ci	 b2 (on EF113 only, 0 otherwise), b2.R.L indicates one button pressed:
4588c2ecf20Sopenharmony_ci		0 = none
4598c2ecf20Sopenharmony_ci		1 = Left
4608c2ecf20Sopenharmony_ci		2 = Right
4618c2ecf20Sopenharmony_ci		3 = Middle (Left and Right)
4628c2ecf20Sopenharmony_ci		4 = Forward
4638c2ecf20Sopenharmony_ci		5 = Back
4648c2ecf20Sopenharmony_ci		6 = Another one
4658c2ecf20Sopenharmony_ci		7 = Another one
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_cibyte 4::
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4708c2ecf20Sopenharmony_ci        p3  p1  p2  p0  y11 y10 y9  y8
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci	 p7..p0 = pressure (not EF113)
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cibyte 5::
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4778c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci         y11..y0 = absolute y value (vertical)
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ciTwo finger touch
4838c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ciNote that the two pairs of coordinates are not exactly the coordinates of the
4868c2ecf20Sopenharmony_citwo fingers, but only the pair of the lower-left and upper-right coordinates.
4878c2ecf20Sopenharmony_ciSo the actual fingers might be situated on the other diagonal of the square
4888c2ecf20Sopenharmony_cidefined by these two points.
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cibyte 0::
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
4938c2ecf20Sopenharmony_ci        n1  n0  ay8 ax8  .   .   R   L
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci         L, R = 1 when Left, Right mouse button pressed
4968c2ecf20Sopenharmony_ci         n1..n0 = number of fingers on touchpad
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_cibyte 1::
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5018c2ecf20Sopenharmony_ci        ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	 ax8..ax0 = lower-left finger absolute x value
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_cibyte 2::
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5088c2ecf20Sopenharmony_ci        ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci	 ay8..ay0 = lower-left finger absolute y value
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_cibyte 3::
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5158c2ecf20Sopenharmony_ci         .   .  by8 bx8  .   .   .   .
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_cibyte 4::
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5208c2ecf20Sopenharmony_ci        bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci         bx8..bx0 = upper-right finger absolute x value
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_cibyte 5::
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5278c2ecf20Sopenharmony_ci        by7 by8 by5 by4 by3 by2 by1 by0
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci         by8..by0 = upper-right finger absolute y value
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ciHardware version 3
5328c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ciRegisters
5358c2ecf20Sopenharmony_ci---------
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_ci* reg_10::
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5408c2ecf20Sopenharmony_ci         0   0   0   0   R   F   T   A
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci         A: 1 = enable absolute tracking
5438c2ecf20Sopenharmony_ci         T: 1 = enable two finger mode auto correct
5448c2ecf20Sopenharmony_ci         F: 1 = disable ABS Position Filter
5458c2ecf20Sopenharmony_ci         R: 1 = enable real hardware resolution
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ciNative absolute mode 6 byte packet format
5488c2ecf20Sopenharmony_ci-----------------------------------------
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci1 and 3 finger touch shares the same 6-byte packet format, except that
5518c2ecf20Sopenharmony_ci3 finger touch only reports the position of the center of all three fingers.
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ciFirmware would send 12 bytes of data for 2 finger touch.
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ciNote on debounce:
5568c2ecf20Sopenharmony_ciIn case the box has unstable power supply or other electricity issues, or
5578c2ecf20Sopenharmony_ciwhen number of finger changes, F/W would send "debounce packet" to inform
5588c2ecf20Sopenharmony_cidriver that the hardware is in debounce status.
5598c2ecf20Sopenharmony_ciThe debouce packet has the following signature::
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci    byte 0: 0xc4
5628c2ecf20Sopenharmony_ci    byte 1: 0xff
5638c2ecf20Sopenharmony_ci    byte 2: 0xff
5648c2ecf20Sopenharmony_ci    byte 3: 0x02
5658c2ecf20Sopenharmony_ci    byte 4: 0xff
5668c2ecf20Sopenharmony_ci    byte 5: 0xff
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ciWhen we encounter this kind of packet, we just ignore it.
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ciOne/Three finger touch
5718c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_cibyte 0::
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5768c2ecf20Sopenharmony_ci        n1  n0  w3  w2   0   1   R   L
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci        L, R = 1 when Left, Right mouse button pressed
5798c2ecf20Sopenharmony_ci        n1..n0 = number of fingers on touchpad
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_cibyte 1::
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5848c2ecf20Sopenharmony_ci        p7  p6  p5  p4 x11 x10  x9  x8
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_cibyte 2::
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5898c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci        x11..x0 = absolute x value (horizontal)
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_cibyte 3::
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
5968c2ecf20Sopenharmony_ci         0   0  w1  w0   0   0   1   0
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci         w3..w0 = width of the finger touch
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_cibyte 4::
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6038c2ecf20Sopenharmony_ci        p3  p1  p2  p0  y11 y10 y9  y8
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci        p7..p0 = pressure
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_cibyte 5::
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6108c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci        y11..y0 = absolute y value (vertical)
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ciTwo finger touch
6158c2ecf20Sopenharmony_ci^^^^^^^^^^^^^^^^
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ciThe packet format is exactly the same for two finger touch, except the hardware
6188c2ecf20Sopenharmony_cisends two 6 byte packets. The first packet contains data for the first finger,
6198c2ecf20Sopenharmony_cithe second packet has data for the second finger. So for two finger touch a
6208c2ecf20Sopenharmony_citotal of 12 bytes are sent.
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ciHardware version 4
6238c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ciRegisters
6268c2ecf20Sopenharmony_ci---------
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci* reg_07::
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6318c2ecf20Sopenharmony_ci         0   0   0   0   0   0   0   A
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci         A: 1 = enable absolute tracking
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ciNative absolute mode 6 byte packet format
6368c2ecf20Sopenharmony_ci-----------------------------------------
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_civ4 hardware is a true multitouch touchpad, capable of tracking up to 5 fingers.
6398c2ecf20Sopenharmony_ciUnfortunately, due to PS/2's limited bandwidth, its packet format is rather
6408c2ecf20Sopenharmony_cicomplex.
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ciWhenever the numbers or identities of the fingers changes, the hardware sends a
6438c2ecf20Sopenharmony_cistatus packet to indicate how many and which fingers is on touchpad, followed by
6448c2ecf20Sopenharmony_cihead packets or motion packets. A head packet contains data of finger id, finger
6458c2ecf20Sopenharmony_ciposition (absolute x, y values), width, and pressure. A motion packet contains
6468c2ecf20Sopenharmony_citwo fingers' position delta.
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ciFor example, when status packet tells there are 2 fingers on touchpad, then we
6498c2ecf20Sopenharmony_cican expect two following head packets. If the finger status doesn't change,
6508c2ecf20Sopenharmony_cithe following packets would be motion packets, only sending delta of finger
6518c2ecf20Sopenharmony_ciposition, until we receive a status packet.
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ciOne exception is one finger touch. when a status packet tells us there is only
6548c2ecf20Sopenharmony_cione finger, the hardware would just send head packets afterwards.
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_ciStatus packet
6578c2ecf20Sopenharmony_ci^^^^^^^^^^^^^
6588c2ecf20Sopenharmony_ci
6598c2ecf20Sopenharmony_cibyte 0::
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6628c2ecf20Sopenharmony_ci         .   .   .   .   0   1   R   L
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci         L, R = 1 when Left, Right mouse button pressed
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_cibyte 1::
6678c2ecf20Sopenharmony_ci
6688c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6698c2ecf20Sopenharmony_ci         .   .   . ft4 ft3 ft2 ft1 ft0
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_ci         ft4 ft3 ft2 ft1 ft0 ftn = 1 when finger n is on touchpad
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_cibyte 2::
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_ci   not used
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_cibyte 3::
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6808c2ecf20Sopenharmony_ci         .   .   .   1   0   0   0   0
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci         constant bits
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_cibyte 4::
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
6878c2ecf20Sopenharmony_ci         p   .   .   .   .   .   .   .
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_ci         p = 1 for palm
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_cibyte 5::
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci   not used
6948c2ecf20Sopenharmony_ci
6958c2ecf20Sopenharmony_ciHead packet
6968c2ecf20Sopenharmony_ci^^^^^^^^^^^
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_cibyte 0::
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7018c2ecf20Sopenharmony_ci        w3  w2  w1  w0   0   1   R   L
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci        L, R = 1 when Left, Right mouse button pressed
7048c2ecf20Sopenharmony_ci        w3..w0 = finger width (spans how many trace lines)
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_cibyte 1::
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7098c2ecf20Sopenharmony_ci        p7  p6  p5  p4 x11 x10  x9  x8
7108c2ecf20Sopenharmony_ci
7118c2ecf20Sopenharmony_cibyte 2::
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7148c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci        x11..x0 = absolute x value (horizontal)
7178c2ecf20Sopenharmony_ci
7188c2ecf20Sopenharmony_cibyte 3::
7198c2ecf20Sopenharmony_ci
7208c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7218c2ecf20Sopenharmony_ci       id2 id1 id0   1   0   0   0   1
7228c2ecf20Sopenharmony_ci
7238c2ecf20Sopenharmony_ci       id2..id0 = finger id
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_cibyte 4::
7268c2ecf20Sopenharmony_ci
7278c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7288c2ecf20Sopenharmony_ci        p3  p1  p2  p0  y11 y10 y9  y8
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci        p7..p0 = pressure
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_cibyte 5::
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7358c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci        y11..y0 = absolute y value (vertical)
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ciMotion packet
7408c2ecf20Sopenharmony_ci^^^^^^^^^^^^^
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_cibyte 0::
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7458c2ecf20Sopenharmony_ci       id2 id1 id0   w   0   1   R   L
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci       L, R = 1 when Left, Right mouse button pressed
7488c2ecf20Sopenharmony_ci       id2..id0 = finger id
7498c2ecf20Sopenharmony_ci       w = 1 when delta overflows (> 127 or < -128), in this case
7508c2ecf20Sopenharmony_ci       firmware sends us (delta x / 5) and (delta y  / 5)
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_cibyte 1::
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7558c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_ci        x7..x0 = delta x (two's complement)
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_cibyte 2::
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7628c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_ci        y7..y0 = delta y (two's complement)
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_cibyte 3::
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7698c2ecf20Sopenharmony_ci       id2 id1 id0   1   0   0   1   0
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci       id2..id0 = finger id
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_cibyte 4::
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7768c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci        x7..x0 = delta x (two's complement)
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_cibyte 5::
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
7838c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci        y7..y0 = delta y (two's complement)
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci        byte 0 ~ 2 for one finger
7888c2ecf20Sopenharmony_ci        byte 3 ~ 5 for another
7898c2ecf20Sopenharmony_ci
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ciTrackpoint (for Hardware version 3 and 4)
7928c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ciRegisters
7958c2ecf20Sopenharmony_ci---------
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ciNo special registers have been identified.
7988c2ecf20Sopenharmony_ci
7998c2ecf20Sopenharmony_ciNative relative mode 6 byte packet format
8008c2ecf20Sopenharmony_ci-----------------------------------------
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ciStatus Packet
8038c2ecf20Sopenharmony_ci^^^^^^^^^^^^^
8048c2ecf20Sopenharmony_ci
8058c2ecf20Sopenharmony_cibyte 0::
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8088c2ecf20Sopenharmony_ci         0   0  sx  sy   0   M   R   L
8098c2ecf20Sopenharmony_ci
8108c2ecf20Sopenharmony_cibyte 1::
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8138c2ecf20Sopenharmony_ci       ~sx   0   0   0   0   0   0   0
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_cibyte 2::
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8188c2ecf20Sopenharmony_ci       ~sy   0   0   0   0   0   0   0
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_cibyte 3::
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8238c2ecf20Sopenharmony_ci         0   0 ~sy ~sx   0   1   1   0
8248c2ecf20Sopenharmony_ci
8258c2ecf20Sopenharmony_cibyte 4::
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8288c2ecf20Sopenharmony_ci        x7  x6  x5  x4  x3  x2  x1  x0
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_cibyte 5::
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ci   bit   7   6   5   4   3   2   1   0
8338c2ecf20Sopenharmony_ci        y7  y6  y5  y4  y3  y2  y1  y0
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_ci         x and y are written in two's complement spread
8378c2ecf20Sopenharmony_ci             over 9 bits with sx/sy the relative top bit and
8388c2ecf20Sopenharmony_ci             x7..x0 and y7..y0 the lower bits.
8398c2ecf20Sopenharmony_ci	 ~sx is the inverse of sx, ~sy is the inverse of sy.
8408c2ecf20Sopenharmony_ci         The sign of y is opposite to what the input driver
8418c2ecf20Sopenharmony_ci             expects for a relative movement
842