alps.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. ALPS Touchpad Protocol
  2. ----------------------
  3. Introduction
  4. ------------
  5. Currently the ALPS touchpad driver supports four protocol versions in use by
  6. ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various
  7. protocol versions is contained in the following sections.
  8. Detection
  9. ---------
  10. All ALPS touchpads should respond to the "E6 report" command sequence:
  11. E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or
  12. 00-00-64.
  13. If the E6 report is successful, the touchpad model is identified using the "E7
  14. report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
  15. matched against known models in the alps_model_data_array.
  16. With protocol versions 3 and 4, the E7 report model signature is always
  17. 73-02-64. To differentiate between these versions, the response from the
  18. "Enter Command Mode" sequence must be inspected as described below.
  19. Command Mode
  20. ------------
  21. Protocol versions 3 and 4 have a command mode that is used to read and write
  22. one-byte device registers in a 16-bit address space. The command sequence
  23. EC-EC-EC-E9 places the device in command mode, and the device will respond
  24. with 88-07 followed by a third byte. This third byte can be used to determine
  25. whether the devices uses the version 3 or 4 protocol.
  26. To exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad.
  27. While in command mode, register addresses can be set by first sending a
  28. specific command, either EC for v3 devices or F5 for v4 devices. Then the
  29. address is sent one nibble at a time, where each nibble is encoded as a
  30. command with optional data. This enoding differs slightly between the v3 and
  31. v4 protocols.
  32. Once an address has been set, the addressed register can be read by sending
  33. PSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the
  34. address of the register being read, and the third contains the value of the
  35. register. Registers are written by writing the value one nibble at a time
  36. using the same encoding used for addresses.
  37. Packet Format
  38. -------------
  39. In the following tables, the following notation is used.
  40. CAPITALS = stick, miniscules = touchpad
  41. ?'s can have different meanings on different models, such as wheel rotation,
  42. extra buttons, stick buttons on a dualpoint, etc.
  43. PS/2 packet format
  44. ------------------
  45. byte 0: 0 0 YSGN XSGN 1 M R L
  46. byte 1: X7 X6 X5 X4 X3 X2 X1 X0
  47. byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  48. Note that the device never signals overflow condition.
  49. ALPS Absolute Mode - Protocol Verion 1
  50. --------------------------------------
  51. byte 0: 1 0 0 0 1 x9 x8 x7
  52. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  53. byte 2: 0 ? ? l r ? fin ges
  54. byte 3: 0 ? ? ? ? y9 y8 y7
  55. byte 4: 0 y6 y5 y4 y3 y2 y1 y0
  56. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  57. ALPS Absolute Mode - Protocol Version 2
  58. ---------------------------------------
  59. byte 0: 1 ? ? ? 1 ? ? ?
  60. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  61. byte 2: 0 x10 x9 x8 x7 ? fin ges
  62. byte 3: 0 y9 y8 y7 1 M R L
  63. byte 4: 0 y6 y5 y4 y3 y2 y1 y0
  64. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  65. Dualpoint device -- interleaved packet format
  66. ---------------------------------------------
  67. byte 0: 1 1 0 0 1 1 1 1
  68. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  69. byte 2: 0 x10 x9 x8 x7 0 fin ges
  70. byte 3: 0 0 YSGN XSGN 1 1 1 1
  71. byte 4: X7 X6 X5 X4 X3 X2 X1 X0
  72. byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  73. byte 6: 0 y9 y8 y7 1 m r l
  74. byte 7: 0 y6 y5 y4 y3 y2 y1 y0
  75. byte 8: 0 z6 z5 z4 z3 z2 z1 z0
  76. ALPS Absolute Mode - Protocol Version 3
  77. ---------------------------------------
  78. ALPS protocol version 3 has three different packet formats. The first two are
  79. associated with touchpad events, and the third is associatd with trackstick
  80. events.
  81. The first type is the touchpad position packet.
  82. byte 0: 1 ? x1 x0 1 1 1 1
  83. byte 1: 0 x10 x9 x8 x7 x6 x5 x4
  84. byte 2: 0 y10 y9 y8 y7 y6 y5 y4
  85. byte 3: 0 M R L 1 m r l
  86. byte 4: 0 mt x3 x2 y3 y2 y1 y0
  87. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  88. Note that for some devices the trackstick buttons are reported in this packet,
  89. and on others it is reported in the trackstick packets.
  90. The second packet type contains bitmaps representing the x and y axes. In the
  91. bitmaps a given bit is set if there is a finger covering that position on the
  92. given axis. Thus the bitmap packet can be used for low-resolution multi-touch
  93. data, although finger tracking is not possible. This packet also encodes the
  94. number of contacts (f1 and f0 in the table below).
  95. byte 0: 1 1 x1 x0 1 1 1 1
  96. byte 1: 0 x8 x7 x6 x5 x4 x3 x2
  97. byte 2: 0 y7 y6 y5 y4 y3 y2 y1
  98. byte 3: 0 y10 y9 y8 1 1 1 1
  99. byte 4: 0 x14 x13 x12 x11 x10 x9 y0
  100. byte 5: 0 1 ? ? ? ? f1 f0
  101. This packet only appears after a position packet with the mt bit set, and
  102. ususally only appears when there are two or more contacts (although
  103. ocassionally it's seen with only a single contact).
  104. The final v3 packet type is the trackstick packet.
  105. byte 0: 1 1 x7 y7 1 1 1 1
  106. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  107. byte 2: 0 y6 y5 y4 y3 y2 y1 y0
  108. byte 3: 0 1 0 0 1 0 0 0
  109. byte 4: 0 z4 z3 z2 z1 z0 ? ?
  110. byte 5: 0 0 1 1 1 1 1 1
  111. ALPS Absolute Mode - Protocol Version 4
  112. ---------------------------------------
  113. Protocol version 4 has an 8-byte packet format.
  114. byte 0: 1 ? x1 x0 1 1 1 1
  115. byte 1: 0 x10 x9 x8 x7 x6 x5 x4
  116. byte 2: 0 y10 y9 y8 y7 y6 y5 y4
  117. byte 3: 0 1 x3 x2 y3 y2 y1 y0
  118. byte 4: 0 ? ? ? 1 ? r l
  119. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  120. byte 6: bitmap data (described below)
  121. byte 7: bitmap data (described below)
  122. The last two bytes represent a partial bitmap packet, with 3 full packets
  123. required to construct a complete bitmap packet. Once assembled, the 6-byte
  124. bitmap packet has the following format:
  125. byte 0: 0 1 x7 x6 x5 x4 x3 x2
  126. byte 1: 0 x1 x0 y4 y3 y2 y1 y0
  127. byte 2: 0 0 ? x14 x13 x12 x11 x10
  128. byte 3: 0 x9 x8 y9 y8 y7 y6 y5
  129. byte 4: 0 0 0 0 0 0 0 0
  130. byte 5: 0 0 0 0 0 0 0 y10
  131. There are several things worth noting here.
  132. 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to
  133. identify the first fragment of a bitmap packet.
  134. 2) The bitmaps represent the same data as in the v3 bitmap packets, although
  135. the packet layout is different.
  136. 3) There doesn't seem to be a count of the contact points anywhere in the v4
  137. protocol packets. Deriving a count of contact points must be done by
  138. analyzing the bitmaps.
  139. 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore
  140. MT position can only be updated for every third ST position update, and
  141. the count of contact points can only be updated every third packet as
  142. well.
  143. So far no v4 devices with tracksticks have been encountered.