18c2ecf20Sopenharmony_ci----------------------
28c2ecf20Sopenharmony_ciALPS Touchpad Protocol
38c2ecf20Sopenharmony_ci----------------------
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciIntroduction
68c2ecf20Sopenharmony_ci------------
78c2ecf20Sopenharmony_ciCurrently the ALPS touchpad driver supports seven protocol versions in use by
88c2ecf20Sopenharmony_ciALPS touchpads, called versions 1, 2, 3, 4, 5, 6, 7 and 8.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciSince roughly mid-2010 several new ALPS touchpads have been released and
118c2ecf20Sopenharmony_ciintegrated into a variety of laptops and netbooks.  These new touchpads
128c2ecf20Sopenharmony_cihave enough behavior differences that the alps_model_data definition
138c2ecf20Sopenharmony_citable, describing the properties of the different versions, is no longer
148c2ecf20Sopenharmony_ciadequate.  The design choices were to re-define the alps_model_data
158c2ecf20Sopenharmony_citable, with the risk of regression testing existing devices, or isolate
168c2ecf20Sopenharmony_cithe new devices outside of the alps_model_data table.  The latter design
178c2ecf20Sopenharmony_cichoice was made.  The new touchpad signatures are named: "Rushmore",
188c2ecf20Sopenharmony_ci"Pinnacle", and "Dolphin", which you will see in the alps.c code.
198c2ecf20Sopenharmony_ciFor the purposes of this document, this group of ALPS touchpads will
208c2ecf20Sopenharmony_cigenerically be called "new ALPS touchpads".
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciWe experimented with probing the ACPI interface _HID (Hardware ID)/_CID
238c2ecf20Sopenharmony_ci(Compatibility ID) definition as a way to uniquely identify the
248c2ecf20Sopenharmony_cidifferent ALPS variants but there did not appear to be a 1:1 mapping.
258c2ecf20Sopenharmony_ciIn fact, it appeared to be an m:n mapping between the _HID and actual
268c2ecf20Sopenharmony_cihardware type.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciDetection
298c2ecf20Sopenharmony_ci---------
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciAll ALPS touchpads should respond to the "E6 report" command sequence:
328c2ecf20Sopenharmony_ciE8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or
338c2ecf20Sopenharmony_ci00-00-64 if no buttons are pressed. The bits 0-2 of the first byte will be 1s
348c2ecf20Sopenharmony_ciif some buttons are pressed.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciIf the E6 report is successful, the touchpad model is identified using the "E7
378c2ecf20Sopenharmony_cireport" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
388c2ecf20Sopenharmony_cimatched against known models in the alps_model_data_array.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciFor older touchpads supporting protocol versions 3 and 4, the E7 report
418c2ecf20Sopenharmony_cimodel signature is always 73-02-64. To differentiate between these
428c2ecf20Sopenharmony_civersions, the response from the "Enter Command Mode" sequence must be
438c2ecf20Sopenharmony_ciinspected as described below.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciThe new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but
468c2ecf20Sopenharmony_ciseem to be better differentiated by the EC Command Mode response.
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciCommand Mode
498c2ecf20Sopenharmony_ci------------
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciProtocol versions 3 and 4 have a command mode that is used to read and write
528c2ecf20Sopenharmony_cione-byte device registers in a 16-bit address space. The command sequence
538c2ecf20Sopenharmony_ciEC-EC-EC-E9 places the device in command mode, and the device will respond
548c2ecf20Sopenharmony_ciwith 88-07 followed by a third byte. This third byte can be used to determine
558c2ecf20Sopenharmony_ciwhether the devices uses the version 3 or 4 protocol.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciTo exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciWhile in command mode, register addresses can be set by first sending a
608c2ecf20Sopenharmony_cispecific command, either EC for v3 devices or F5 for v4 devices. Then the
618c2ecf20Sopenharmony_ciaddress is sent one nibble at a time, where each nibble is encoded as a
628c2ecf20Sopenharmony_cicommand with optional data. This encoding differs slightly between the v3 and
638c2ecf20Sopenharmony_civ4 protocols.
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciOnce an address has been set, the addressed register can be read by sending
668c2ecf20Sopenharmony_ciPSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the
678c2ecf20Sopenharmony_ciaddress of the register being read, and the third contains the value of the
688c2ecf20Sopenharmony_ciregister. Registers are written by writing the value one nibble at a time
698c2ecf20Sopenharmony_ciusing the same encoding used for addresses.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciFor the new ALPS touchpads, the EC command is used to enter command
728c2ecf20Sopenharmony_cimode. The response in the new ALPS touchpads is significantly different,
738c2ecf20Sopenharmony_ciand more important in determining the behavior.  This code has been
748c2ecf20Sopenharmony_ciseparated from the original alps_model_data table and put in the
758c2ecf20Sopenharmony_cialps_identify function.  For example, there seem to be two hardware init
768c2ecf20Sopenharmony_cisequences for the "Dolphin" touchpads as determined by the second byte
778c2ecf20Sopenharmony_ciof the EC response.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciPacket Format
808c2ecf20Sopenharmony_ci-------------
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciIn the following tables, the following notation is used::
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci CAPITALS = stick, miniscules = touchpad
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci?'s can have different meanings on different models, such as wheel rotation,
878c2ecf20Sopenharmony_ciextra buttons, stick buttons on a dualpoint, etc.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciPS/2 packet format
908c2ecf20Sopenharmony_ci------------------
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci::
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci byte 0:  0    0 YSGN XSGN    1    M    R    L
958c2ecf20Sopenharmony_ci byte 1: X7   X6   X5   X4   X3   X2   X1   X0
968c2ecf20Sopenharmony_ci byte 2: Y7   Y6   Y5   Y4   Y3   Y2   Y1   Y0
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciNote that the device never signals overflow condition.
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciFor protocol version 2 devices when the trackpoint is used, and no fingers
1018c2ecf20Sopenharmony_ciare on the touchpad, the M R L bits signal the combined status of both the
1028c2ecf20Sopenharmony_cipointingstick and touchpad buttons.
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 1
1058c2ecf20Sopenharmony_ci---------------------------------------
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci::
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci byte 0:  1    0    0    0    1   x9   x8   x7
1108c2ecf20Sopenharmony_ci byte 1:  0   x6   x5   x4   x3   x2   x1   x0
1118c2ecf20Sopenharmony_ci byte 2:  0    ?    ?    l    r    ?  fin  ges
1128c2ecf20Sopenharmony_ci byte 3:  0    ?    ?    ?    ?   y9   y8   y7
1138c2ecf20Sopenharmony_ci byte 4:  0   y6   y5   y4   y3   y2   y1   y0
1148c2ecf20Sopenharmony_ci byte 5:  0   z6   z5   z4   z3   z2   z1   z0
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 2
1178c2ecf20Sopenharmony_ci---------------------------------------
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci::
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci byte 0:  1    ?    ?    ?    1  PSM  PSR  PSL
1228c2ecf20Sopenharmony_ci byte 1:  0   x6   x5   x4   x3   x2   x1   x0
1238c2ecf20Sopenharmony_ci byte 2:  0  x10   x9   x8   x7    ?  fin  ges
1248c2ecf20Sopenharmony_ci byte 3:  0   y9   y8   y7    1    M    R    L
1258c2ecf20Sopenharmony_ci byte 4:  0   y6   y5   y4   y3   y2   y1   y0
1268c2ecf20Sopenharmony_ci byte 5:  0   z6   z5   z4   z3   z2   z1   z0
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ciProtocol Version 2 DualPoint devices send standard PS/2 mouse packets for
1298c2ecf20Sopenharmony_cithe DualPoint Stick. The M, R and L bits signal the combined status of both
1308c2ecf20Sopenharmony_cithe pointingstick and touchpad buttons, except for Dell dualpoint devices
1318c2ecf20Sopenharmony_ciwhere the pointingstick buttons get reported separately in the PSM, PSR
1328c2ecf20Sopenharmony_ciand PSL bits.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ciDualpoint device -- interleaved packet format
1358c2ecf20Sopenharmony_ci---------------------------------------------
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci::
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci byte 0:    1    1    0    0    1    1    1    1
1408c2ecf20Sopenharmony_ci byte 1:    0   x6   x5   x4   x3   x2   x1   x0
1418c2ecf20Sopenharmony_ci byte 2:    0  x10   x9   x8   x7    0  fin  ges
1428c2ecf20Sopenharmony_ci byte 3:    0    0 YSGN XSGN    1    1    1    1
1438c2ecf20Sopenharmony_ci byte 4:   X7   X6   X5   X4   X3   X2   X1   X0
1448c2ecf20Sopenharmony_ci byte 5:   Y7   Y6   Y5   Y4   Y3   Y2   Y1   Y0
1458c2ecf20Sopenharmony_ci byte 6:    0   y9   y8   y7    1    m    r    l
1468c2ecf20Sopenharmony_ci byte 7:    0   y6   y5   y4   y3   y2   y1   y0
1478c2ecf20Sopenharmony_ci byte 8:    0   z6   z5   z4   z3   z2   z1   z0
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ciDevices which use the interleaving format normally send standard PS/2 mouse
1508c2ecf20Sopenharmony_cipackets for the DualPoint Stick + ALPS Absolute Mode packets for the
1518c2ecf20Sopenharmony_citouchpad, switching to the interleaved packet format when both the stick and
1528c2ecf20Sopenharmony_cithe touchpad are used at the same time.
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 3
1558c2ecf20Sopenharmony_ci---------------------------------------
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ciALPS protocol version 3 has three different packet formats. The first two are
1588c2ecf20Sopenharmony_ciassociated with touchpad events, and the third is associated with trackstick
1598c2ecf20Sopenharmony_cievents.
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ciThe first type is the touchpad position packet::
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci byte 0:    1    ?   x1   x0    1    1    1    1
1648c2ecf20Sopenharmony_ci byte 1:    0  x10   x9   x8   x7   x6   x5   x4
1658c2ecf20Sopenharmony_ci byte 2:    0  y10   y9   y8   y7   y6   y5   y4
1668c2ecf20Sopenharmony_ci byte 3:    0    M    R    L    1    m    r    l
1678c2ecf20Sopenharmony_ci byte 4:    0   mt   x3   x2   y3   y2   y1   y0
1688c2ecf20Sopenharmony_ci byte 5:    0   z6   z5   z4   z3   z2   z1   z0
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ciNote that for some devices the trackstick buttons are reported in this packet,
1718c2ecf20Sopenharmony_ciand on others it is reported in the trackstick packets.
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ciThe second packet type contains bitmaps representing the x and y axes. In the
1748c2ecf20Sopenharmony_cibitmaps a given bit is set if there is a finger covering that position on the
1758c2ecf20Sopenharmony_cigiven axis. Thus the bitmap packet can be used for low-resolution multi-touch
1768c2ecf20Sopenharmony_cidata, although finger tracking is not possible.  This packet also encodes the
1778c2ecf20Sopenharmony_cinumber of contacts (f1 and f0 in the table below)::
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci byte 0:    1    1   x1   x0    1    1    1    1
1808c2ecf20Sopenharmony_ci byte 1:    0   x8   x7   x6   x5   x4   x3   x2
1818c2ecf20Sopenharmony_ci byte 2:    0   y7   y6   y5   y4   y3   y2   y1
1828c2ecf20Sopenharmony_ci byte 3:    0  y10   y9   y8    1    1    1    1
1838c2ecf20Sopenharmony_ci byte 4:    0  x14  x13  x12  x11  x10   x9   y0
1848c2ecf20Sopenharmony_ci byte 5:    0    1    ?    ?    ?    ?   f1   f0
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ciThis packet only appears after a position packet with the mt bit set, and
1878c2ecf20Sopenharmony_ciusually only appears when there are two or more contacts (although
1888c2ecf20Sopenharmony_cioccasionally it's seen with only a single contact).
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ciThe final v3 packet type is the trackstick packet::
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci byte 0:    1    1   x7   y7    1    1    1    1
1938c2ecf20Sopenharmony_ci byte 1:    0   x6   x5   x4   x3   x2   x1   x0
1948c2ecf20Sopenharmony_ci byte 2:    0   y6   y5   y4   y3   y2   y1   y0
1958c2ecf20Sopenharmony_ci byte 3:    0    1   TP   SW    1    M    R    L
1968c2ecf20Sopenharmony_ci byte 4:    0   z6   z5   z4   z3   z2   z1   z0
1978c2ecf20Sopenharmony_ci byte 5:    0    0    1    1    1    1    1    1
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ciTP means Tap SW status when tap processing is enabled or Press status when press
2008c2ecf20Sopenharmony_ciprocessing is enabled. SW means scroll up when 4 buttons are available.
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 4
2038c2ecf20Sopenharmony_ci---------------------------------------
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciProtocol version 4 has an 8-byte packet format::
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci byte 0:    1    ?   x1   x0    1    1    1    1
2088c2ecf20Sopenharmony_ci byte 1:    0  x10   x9   x8   x7   x6   x5   x4
2098c2ecf20Sopenharmony_ci byte 2:    0  y10   y9   y8   y7   y6   y5   y4
2108c2ecf20Sopenharmony_ci byte 3:    0    1   x3   x2   y3   y2   y1   y0
2118c2ecf20Sopenharmony_ci byte 4:    0    ?    ?    ?    1    ?    r    l
2128c2ecf20Sopenharmony_ci byte 5:    0   z6   z5   z4   z3   z2   z1   z0
2138c2ecf20Sopenharmony_ci byte 6:    bitmap data (described below)
2148c2ecf20Sopenharmony_ci byte 7:    bitmap data (described below)
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ciThe last two bytes represent a partial bitmap packet, with 3 full packets
2178c2ecf20Sopenharmony_cirequired to construct a complete bitmap packet.  Once assembled, the 6-byte
2188c2ecf20Sopenharmony_cibitmap packet has the following format::
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci byte 0:    0    1   x7   x6   x5   x4   x3   x2
2218c2ecf20Sopenharmony_ci byte 1:    0   x1   x0   y4   y3   y2   y1   y0
2228c2ecf20Sopenharmony_ci byte 2:    0    0    ?  x14  x13  x12  x11  x10
2238c2ecf20Sopenharmony_ci byte 3:    0   x9   x8   y9   y8   y7   y6   y5
2248c2ecf20Sopenharmony_ci byte 4:    0    0    0    0    0    0    0    0
2258c2ecf20Sopenharmony_ci byte 5:    0    0    0    0    0    0    0  y10
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ciThere are several things worth noting here.
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to
2308c2ecf20Sopenharmony_ci    identify the first fragment of a bitmap packet.
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci 2) The bitmaps represent the same data as in the v3 bitmap packets, although
2338c2ecf20Sopenharmony_ci    the packet layout is different.
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci 3) There doesn't seem to be a count of the contact points anywhere in the v4
2368c2ecf20Sopenharmony_ci    protocol packets. Deriving a count of contact points must be done by
2378c2ecf20Sopenharmony_ci    analyzing the bitmaps.
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore
2408c2ecf20Sopenharmony_ci    MT position can only be updated for every third ST position update, and
2418c2ecf20Sopenharmony_ci    the count of contact points can only be updated every third packet as
2428c2ecf20Sopenharmony_ci    well.
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ciSo far no v4 devices with tracksticks have been encountered.
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 5
2478c2ecf20Sopenharmony_ci---------------------------------------
2488c2ecf20Sopenharmony_ciThis is basically Protocol Version 3 but with different logic for packet
2498c2ecf20Sopenharmony_cidecode.  It uses the same alps_process_touchpad_packet_v3 call with a
2508c2ecf20Sopenharmony_cispecialized decode_fields function pointer to correctly interpret the
2518c2ecf20Sopenharmony_cipackets.  This appears to only be used by the Dolphin devices.
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ciFor single-touch, the 6-byte packet format is::
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci byte 0:    1    1    0    0    1    0    0    0
2568c2ecf20Sopenharmony_ci byte 1:    0   x6   x5   x4   x3   x2   x1   x0
2578c2ecf20Sopenharmony_ci byte 2:    0   y6   y5   y4   y3   y2   y1   y0
2588c2ecf20Sopenharmony_ci byte 3:    0    M    R    L    1    m    r    l
2598c2ecf20Sopenharmony_ci byte 4:   y10  y9   y8   y7  x10   x9   x8   x7
2608c2ecf20Sopenharmony_ci byte 5:    0   z6   z5   z4   z3   z2   z1   z0
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ciFor mt, the format is::
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci byte 0:    1    1    1    n3   1   n2   n1   x24
2658c2ecf20Sopenharmony_ci byte 1:    1   y7   y6    y5  y4   y3   y2    y1
2668c2ecf20Sopenharmony_ci byte 2:    ?   x2   x1   y12 y11  y10   y9    y8
2678c2ecf20Sopenharmony_ci byte 3:    0  x23  x22   x21 x20  x19  x18   x17
2688c2ecf20Sopenharmony_ci byte 4:    0   x9   x8    x7  x6   x5   x4    x3
2698c2ecf20Sopenharmony_ci byte 5:    0  x16  x15   x14 x13  x12  x11   x10
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 6
2728c2ecf20Sopenharmony_ci---------------------------------------
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciFor trackstick packet, the format is::
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci byte 0:    1    1    1    1    1    1    1    1
2778c2ecf20Sopenharmony_ci byte 1:    0   X6   X5   X4   X3   X2   X1   X0
2788c2ecf20Sopenharmony_ci byte 2:    0   Y6   Y5   Y4   Y3   Y2   Y1   Y0
2798c2ecf20Sopenharmony_ci byte 3:    ?   Y7   X7    ?    ?    M    R    L
2808c2ecf20Sopenharmony_ci byte 4:   Z7   Z6   Z5   Z4   Z3   Z2   Z1   Z0
2818c2ecf20Sopenharmony_ci byte 5:    0    1    1    1    1    1    1    1
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ciFor touchpad packet, the format is::
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci byte 0:    1    1    1    1    1    1    1    1
2868c2ecf20Sopenharmony_ci byte 1:    0    0    0    0   x3   x2   x1   x0
2878c2ecf20Sopenharmony_ci byte 2:    0    0    0    0   y3   y2   y1   y0
2888c2ecf20Sopenharmony_ci byte 3:    ?   x7   x6   x5   x4    ?    r    l
2898c2ecf20Sopenharmony_ci byte 4:    ?   y7   y6   y5   y4    ?    ?    ?
2908c2ecf20Sopenharmony_ci byte 5:   z7   z6   z5   z4   z3   z2   z1   z0
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci(v6 touchpad does not have middle button)
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 7
2958c2ecf20Sopenharmony_ci---------------------------------------
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ciFor trackstick packet, the format is::
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci byte 0:    0    1    0    0    1    0    0    0
3008c2ecf20Sopenharmony_ci byte 1:    1    1    *    *    1    M    R    L
3018c2ecf20Sopenharmony_ci byte 2:   X7    1   X5   X4   X3   X2   X1   X0
3028c2ecf20Sopenharmony_ci byte 3:   Z6    1   Y6   X6    1   Y2   Y1   Y0
3038c2ecf20Sopenharmony_ci byte 4:   Y7    0   Y5   Y4   Y3    1    1    0
3048c2ecf20Sopenharmony_ci byte 5:  T&P    0   Z5   Z4   Z3   Z2   Z1   Z0
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ciFor touchpad packet, the format is::
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci         packet-fmt     b7     b6     b5     b4     b3     b2     b1     b0
3098c2ecf20Sopenharmony_ci byte 0: TWO & MULTI     L      1      R      M      1   Y0-2   Y0-1   Y0-0
3108c2ecf20Sopenharmony_ci byte 0: NEW             L      1   X1-5      1      1   Y0-2   Y0-1   Y0-0
3118c2ecf20Sopenharmony_ci byte 1:             Y0-10   Y0-9   Y0-8   Y0-7   Y0-6   Y0-5   Y0-4   Y0-3
3128c2ecf20Sopenharmony_ci byte 2:             X0-11      1  X0-10   X0-9   X0-8   X0-7   X0-6   X0-5
3138c2ecf20Sopenharmony_ci byte 3:             X1-11      1   X0-4   X0-3      1   X0-2   X0-1   X0-0
3148c2ecf20Sopenharmony_ci byte 4: TWO         X1-10    TWO   X1-9   X1-8   X1-7   X1-6   X1-5   X1-4
3158c2ecf20Sopenharmony_ci byte 4: MULTI       X1-10    TWO   X1-9   X1-8   X1-7   X1-6   Y1-5      1
3168c2ecf20Sopenharmony_ci byte 4: NEW         X1-10    TWO   X1-9   X1-8   X1-7   X1-6      0      0
3178c2ecf20Sopenharmony_ci byte 5: TWO & NEW   Y1-10      0   Y1-9   Y1-8   Y1-7   Y1-6   Y1-5   Y1-4
3188c2ecf20Sopenharmony_ci byte 5: MULTI       Y1-10      0   Y1-9   Y1-8   Y1-7   Y1-6    F-1    F-0
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci L:         Left button
3218c2ecf20Sopenharmony_ci R / M:     Non-clickpads: Right / Middle button
3228c2ecf20Sopenharmony_ci            Clickpads: When > 2 fingers are down, and some fingers
3238c2ecf20Sopenharmony_ci            are in the button area, then the 2 coordinates reported
3248c2ecf20Sopenharmony_ci            are for fingers outside the button area and these report
3258c2ecf20Sopenharmony_ci            extra fingers being present in the right / left button
3268c2ecf20Sopenharmony_ci            area. Note these fingers are not added to the F field!
3278c2ecf20Sopenharmony_ci            so if a TWO packet is received and R = 1 then there are
3288c2ecf20Sopenharmony_ci            3 fingers down, etc.
3298c2ecf20Sopenharmony_ci TWO:       1: Two touches present, byte 0/4/5 are in TWO fmt
3308c2ecf20Sopenharmony_ci            0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt
3318c2ecf20Sopenharmony_ci               otherwise byte 0 bit 4 must be set and byte 0/4/5 are
3328c2ecf20Sopenharmony_ci               in NEW fmt
3338c2ecf20Sopenharmony_ci F:         Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ciALPS Absolute Mode - Protocol Version 8
3378c2ecf20Sopenharmony_ci---------------------------------------
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ciSpoken by SS4 (73 03 14) and SS5 (73 03 28) hardware.
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ciThe packet type is given by the APD field, bits 4-5 of byte 3.
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ciTouchpad packet (APD = 0x2)::
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci           b7   b6   b5   b4   b3   b2   b1   b0
3468c2ecf20Sopenharmony_ci byte 0:  SWM  SWR  SWL    1    1    0    0   X7
3478c2ecf20Sopenharmony_ci byte 1:    0   X6   X5   X4   X3   X2   X1   X0
3488c2ecf20Sopenharmony_ci byte 2:    0   Y6   Y5   Y4   Y3   Y2   Y1   Y0
3498c2ecf20Sopenharmony_ci byte 3:    0  T&P    1    0    1    0    0   Y7
3508c2ecf20Sopenharmony_ci byte 4:    0   Z6   Z5   Z4   Z3   Z2   Z1   Z0
3518c2ecf20Sopenharmony_ci byte 5:    0    0    0    0    0    0    0    0
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ciSWM, SWR, SWL: Middle, Right, and Left button states
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ciTouchpad 1 Finger packet (APD = 0x0)::
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci           b7   b6   b5   b4   b3   b2   b1   b0
3588c2ecf20Sopenharmony_ci byte 0:  SWM  SWR  SWL    1    1   X2   X1   X0
3598c2ecf20Sopenharmony_ci byte 1:   X9   X8   X7    1   X6   X5   X4   X3
3608c2ecf20Sopenharmony_ci byte 2:    0  X11  X10  LFB   Y3   Y2   Y1   Y0
3618c2ecf20Sopenharmony_ci byte 3:   Y5   Y4    0    0    1 TAPF2 TAPF1 TAPF0
3628c2ecf20Sopenharmony_ci byte 4:  Zv7  Y11  Y10    1   Y9   Y8   Y7   Y6
3638c2ecf20Sopenharmony_ci byte 5:  Zv6  Zv5  Zv4    0  Zv3  Zv2  Zv1  Zv0
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ciTAPF: ???
3668c2ecf20Sopenharmony_ciLFB:  ???
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ciTouchpad 2 Finger packet (APD = 0x1)::
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci           b7   b6   b5   b4   b3   b2   b1   b0
3718c2ecf20Sopenharmony_ci byte 0:  SWM  SWR  SWL    1    1  AX6  AX5  AX4
3728c2ecf20Sopenharmony_ci byte 1: AX11 AX10  AX9  AX8  AX7  AZ1  AY4  AZ0
3738c2ecf20Sopenharmony_ci byte 2: AY11 AY10  AY9  CONT AY8  AY7  AY6  AY5
3748c2ecf20Sopenharmony_ci byte 3:    0    0    0    1    1  BX6  BX5  BX4
3758c2ecf20Sopenharmony_ci byte 4: BX11 BX10  BX9  BX8  BX7  BZ1  BY4  BZ0
3768c2ecf20Sopenharmony_ci byte 5: BY11 BY10  BY9    0  BY8  BY7  BY5  BY5
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ciCONT: A 3-or-4 Finger packet is to follow
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ciTouchpad 3-or-4 Finger packet (APD = 0x3)::
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci           b7   b6   b5   b4   b3   b2   b1   b0
3838c2ecf20Sopenharmony_ci byte 0:  SWM  SWR  SWL    1    1  AX6  AX5  AX4
3848c2ecf20Sopenharmony_ci byte 1: AX11 AX10  AX9  AX8  AX7  AZ1  AY4  AZ0
3858c2ecf20Sopenharmony_ci byte 2: AY11 AY10  AY9  OVF  AY8  AY7  AY6  AY5
3868c2ecf20Sopenharmony_ci byte 3:    0    0    1    1    1  BX6  BX5  BX4
3878c2ecf20Sopenharmony_ci byte 4: BX11 BX10  BX9  BX8  BX7  BZ1  BY4  BZ0
3888c2ecf20Sopenharmony_ci byte 5: BY11 BY10  BY9    0  BY8  BY7  BY5  BY5
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ciOVF: 5th finger detected
391