alps.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. ----------------------
  2. ALPS Touchpad Protocol
  3. ----------------------
  4. Introduction
  5. ------------
  6. Currently the ALPS touchpad driver supports seven protocol versions in use by
  7. ALPS touchpads, called versions 1, 2, 3, 4, 5, 6, 7 and 8.
  8. Since roughly mid-2010 several new ALPS touchpads have been released and
  9. integrated into a variety of laptops and netbooks. These new touchpads
  10. have enough behavior differences that the alps_model_data definition
  11. table, describing the properties of the different versions, is no longer
  12. adequate. The design choices were to re-define the alps_model_data
  13. table, with the risk of regression testing existing devices, or isolate
  14. the new devices outside of the alps_model_data table. The latter design
  15. choice was made. The new touchpad signatures are named: "Rushmore",
  16. "Pinnacle", and "Dolphin", which you will see in the alps.c code.
  17. For the purposes of this document, this group of ALPS touchpads will
  18. generically be called "new ALPS touchpads".
  19. We experimented with probing the ACPI interface _HID (Hardware ID)/_CID
  20. (Compatibility ID) definition as a way to uniquely identify the
  21. different ALPS variants but there did not appear to be a 1:1 mapping.
  22. In fact, it appeared to be an m:n mapping between the _HID and actual
  23. hardware type.
  24. Detection
  25. ---------
  26. All ALPS touchpads should respond to the "E6 report" command sequence:
  27. E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or
  28. 00-00-64 if no buttons are pressed. The bits 0-2 of the first byte will be 1s
  29. if some buttons are pressed.
  30. If the E6 report is successful, the touchpad model is identified using the "E7
  31. report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
  32. matched against known models in the alps_model_data_array.
  33. For older touchpads supporting protocol versions 3 and 4, the E7 report
  34. model signature is always 73-02-64. To differentiate between these
  35. versions, the response from the "Enter Command Mode" sequence must be
  36. inspected as described below.
  37. The new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but
  38. seem to be better differentiated by the EC Command Mode response.
  39. Command Mode
  40. ------------
  41. Protocol versions 3 and 4 have a command mode that is used to read and write
  42. one-byte device registers in a 16-bit address space. The command sequence
  43. EC-EC-EC-E9 places the device in command mode, and the device will respond
  44. with 88-07 followed by a third byte. This third byte can be used to determine
  45. whether the devices uses the version 3 or 4 protocol.
  46. To exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad.
  47. While in command mode, register addresses can be set by first sending a
  48. specific command, either EC for v3 devices or F5 for v4 devices. Then the
  49. address is sent one nibble at a time, where each nibble is encoded as a
  50. command with optional data. This encoding differs slightly between the v3 and
  51. v4 protocols.
  52. Once an address has been set, the addressed register can be read by sending
  53. PSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the
  54. address of the register being read, and the third contains the value of the
  55. register. Registers are written by writing the value one nibble at a time
  56. using the same encoding used for addresses.
  57. For the new ALPS touchpads, the EC command is used to enter command
  58. mode. The response in the new ALPS touchpads is significantly different,
  59. and more important in determining the behavior. This code has been
  60. separated from the original alps_model_data table and put in the
  61. alps_identify function. For example, there seem to be two hardware init
  62. sequences for the "Dolphin" touchpads as determined by the second byte
  63. of the EC response.
  64. Packet Format
  65. -------------
  66. In the following tables, the following notation is used::
  67. CAPITALS = stick, miniscules = touchpad
  68. ?'s can have different meanings on different models, such as wheel rotation,
  69. extra buttons, stick buttons on a dualpoint, etc.
  70. PS/2 packet format
  71. ------------------
  72. ::
  73. byte 0: 0 0 YSGN XSGN 1 M R L
  74. byte 1: X7 X6 X5 X4 X3 X2 X1 X0
  75. byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  76. Note that the device never signals overflow condition.
  77. For protocol version 2 devices when the trackpoint is used, and no fingers
  78. are on the touchpad, the M R L bits signal the combined status of both the
  79. pointingstick and touchpad buttons.
  80. ALPS Absolute Mode - Protocol Version 1
  81. ---------------------------------------
  82. ::
  83. byte 0: 1 0 0 0 1 x9 x8 x7
  84. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  85. byte 2: 0 ? ? l r ? fin ges
  86. byte 3: 0 ? ? ? ? y9 y8 y7
  87. byte 4: 0 y6 y5 y4 y3 y2 y1 y0
  88. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  89. ALPS Absolute Mode - Protocol Version 2
  90. ---------------------------------------
  91. ::
  92. byte 0: 1 ? ? ? 1 PSM PSR PSL
  93. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  94. byte 2: 0 x10 x9 x8 x7 ? fin ges
  95. byte 3: 0 y9 y8 y7 1 M R L
  96. byte 4: 0 y6 y5 y4 y3 y2 y1 y0
  97. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  98. Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
  99. the DualPoint Stick. The M, R and L bits signal the combined status of both
  100. the pointingstick and touchpad buttons, except for Dell dualpoint devices
  101. where the pointingstick buttons get reported separately in the PSM, PSR
  102. and PSL bits.
  103. Dualpoint device -- interleaved packet format
  104. ---------------------------------------------
  105. ::
  106. byte 0: 1 1 0 0 1 1 1 1
  107. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  108. byte 2: 0 x10 x9 x8 x7 0 fin ges
  109. byte 3: 0 0 YSGN XSGN 1 1 1 1
  110. byte 4: X7 X6 X5 X4 X3 X2 X1 X0
  111. byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  112. byte 6: 0 y9 y8 y7 1 m r l
  113. byte 7: 0 y6 y5 y4 y3 y2 y1 y0
  114. byte 8: 0 z6 z5 z4 z3 z2 z1 z0
  115. Devices which use the interleaving format normally send standard PS/2 mouse
  116. packets for the DualPoint Stick + ALPS Absolute Mode packets for the
  117. touchpad, switching to the interleaved packet format when both the stick and
  118. the touchpad are used at the same time.
  119. ALPS Absolute Mode - Protocol Version 3
  120. ---------------------------------------
  121. ALPS protocol version 3 has three different packet formats. The first two are
  122. associated with touchpad events, and the third is associated with trackstick
  123. events.
  124. The first type is the touchpad position packet::
  125. byte 0: 1 ? x1 x0 1 1 1 1
  126. byte 1: 0 x10 x9 x8 x7 x6 x5 x4
  127. byte 2: 0 y10 y9 y8 y7 y6 y5 y4
  128. byte 3: 0 M R L 1 m r l
  129. byte 4: 0 mt x3 x2 y3 y2 y1 y0
  130. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  131. Note that for some devices the trackstick buttons are reported in this packet,
  132. and on others it is reported in the trackstick packets.
  133. The second packet type contains bitmaps representing the x and y axes. In the
  134. bitmaps a given bit is set if there is a finger covering that position on the
  135. given axis. Thus the bitmap packet can be used for low-resolution multi-touch
  136. data, although finger tracking is not possible. This packet also encodes the
  137. number of contacts (f1 and f0 in the table below)::
  138. byte 0: 1 1 x1 x0 1 1 1 1
  139. byte 1: 0 x8 x7 x6 x5 x4 x3 x2
  140. byte 2: 0 y7 y6 y5 y4 y3 y2 y1
  141. byte 3: 0 y10 y9 y8 1 1 1 1
  142. byte 4: 0 x14 x13 x12 x11 x10 x9 y0
  143. byte 5: 0 1 ? ? ? ? f1 f0
  144. This packet only appears after a position packet with the mt bit set, and
  145. usually only appears when there are two or more contacts (although
  146. occasionally it's seen with only a single contact).
  147. The final v3 packet type is the trackstick packet::
  148. byte 0: 1 1 x7 y7 1 1 1 1
  149. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  150. byte 2: 0 y6 y5 y4 y3 y2 y1 y0
  151. byte 3: 0 1 TP SW 1 M R L
  152. byte 4: 0 z6 z5 z4 z3 z2 z1 z0
  153. byte 5: 0 0 1 1 1 1 1 1
  154. TP means Tap SW status when tap processing is enabled or Press status when press
  155. processing is enabled. SW means scroll up when 4 buttons are available.
  156. ALPS Absolute Mode - Protocol Version 4
  157. ---------------------------------------
  158. Protocol version 4 has an 8-byte packet format::
  159. byte 0: 1 ? x1 x0 1 1 1 1
  160. byte 1: 0 x10 x9 x8 x7 x6 x5 x4
  161. byte 2: 0 y10 y9 y8 y7 y6 y5 y4
  162. byte 3: 0 1 x3 x2 y3 y2 y1 y0
  163. byte 4: 0 ? ? ? 1 ? r l
  164. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  165. byte 6: bitmap data (described below)
  166. byte 7: bitmap data (described below)
  167. The last two bytes represent a partial bitmap packet, with 3 full packets
  168. required to construct a complete bitmap packet. Once assembled, the 6-byte
  169. bitmap packet has the following format::
  170. byte 0: 0 1 x7 x6 x5 x4 x3 x2
  171. byte 1: 0 x1 x0 y4 y3 y2 y1 y0
  172. byte 2: 0 0 ? x14 x13 x12 x11 x10
  173. byte 3: 0 x9 x8 y9 y8 y7 y6 y5
  174. byte 4: 0 0 0 0 0 0 0 0
  175. byte 5: 0 0 0 0 0 0 0 y10
  176. There are several things worth noting here.
  177. 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to
  178. identify the first fragment of a bitmap packet.
  179. 2) The bitmaps represent the same data as in the v3 bitmap packets, although
  180. the packet layout is different.
  181. 3) There doesn't seem to be a count of the contact points anywhere in the v4
  182. protocol packets. Deriving a count of contact points must be done by
  183. analyzing the bitmaps.
  184. 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore
  185. MT position can only be updated for every third ST position update, and
  186. the count of contact points can only be updated every third packet as
  187. well.
  188. So far no v4 devices with tracksticks have been encountered.
  189. ALPS Absolute Mode - Protocol Version 5
  190. ---------------------------------------
  191. This is basically Protocol Version 3 but with different logic for packet
  192. decode. It uses the same alps_process_touchpad_packet_v3 call with a
  193. specialized decode_fields function pointer to correctly interpret the
  194. packets. This appears to only be used by the Dolphin devices.
  195. For single-touch, the 6-byte packet format is::
  196. byte 0: 1 1 0 0 1 0 0 0
  197. byte 1: 0 x6 x5 x4 x3 x2 x1 x0
  198. byte 2: 0 y6 y5 y4 y3 y2 y1 y0
  199. byte 3: 0 M R L 1 m r l
  200. byte 4: y10 y9 y8 y7 x10 x9 x8 x7
  201. byte 5: 0 z6 z5 z4 z3 z2 z1 z0
  202. For mt, the format is::
  203. byte 0: 1 1 1 n3 1 n2 n1 x24
  204. byte 1: 1 y7 y6 y5 y4 y3 y2 y1
  205. byte 2: ? x2 x1 y12 y11 y10 y9 y8
  206. byte 3: 0 x23 x22 x21 x20 x19 x18 x17
  207. byte 4: 0 x9 x8 x7 x6 x5 x4 x3
  208. byte 5: 0 x16 x15 x14 x13 x12 x11 x10
  209. ALPS Absolute Mode - Protocol Version 6
  210. ---------------------------------------
  211. For trackstick packet, the format is::
  212. byte 0: 1 1 1 1 1 1 1 1
  213. byte 1: 0 X6 X5 X4 X3 X2 X1 X0
  214. byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  215. byte 3: ? Y7 X7 ? ? M R L
  216. byte 4: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0
  217. byte 5: 0 1 1 1 1 1 1 1
  218. For touchpad packet, the format is::
  219. byte 0: 1 1 1 1 1 1 1 1
  220. byte 1: 0 0 0 0 x3 x2 x1 x0
  221. byte 2: 0 0 0 0 y3 y2 y1 y0
  222. byte 3: ? x7 x6 x5 x4 ? r l
  223. byte 4: ? y7 y6 y5 y4 ? ? ?
  224. byte 5: z7 z6 z5 z4 z3 z2 z1 z0
  225. (v6 touchpad does not have middle button)
  226. ALPS Absolute Mode - Protocol Version 7
  227. ---------------------------------------
  228. For trackstick packet, the format is::
  229. byte 0: 0 1 0 0 1 0 0 0
  230. byte 1: 1 1 * * 1 M R L
  231. byte 2: X7 1 X5 X4 X3 X2 X1 X0
  232. byte 3: Z6 1 Y6 X6 1 Y2 Y1 Y0
  233. byte 4: Y7 0 Y5 Y4 Y3 1 1 0
  234. byte 5: T&P 0 Z5 Z4 Z3 Z2 Z1 Z0
  235. For touchpad packet, the format is::
  236. packet-fmt b7 b6 b5 b4 b3 b2 b1 b0
  237. byte 0: TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0
  238. byte 0: NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0
  239. byte 1: Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3
  240. byte 2: X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5
  241. byte 3: X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0
  242. byte 4: TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4
  243. byte 4: MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1
  244. byte 4: NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0
  245. byte 5: TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4
  246. byte 5: MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0
  247. L: Left button
  248. R / M: Non-clickpads: Right / Middle button
  249. Clickpads: When > 2 fingers are down, and some fingers
  250. are in the button area, then the 2 coordinates reported
  251. are for fingers outside the button area and these report
  252. extra fingers being present in the right / left button
  253. area. Note these fingers are not added to the F field!
  254. so if a TWO packet is received and R = 1 then there are
  255. 3 fingers down, etc.
  256. TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt
  257. 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt
  258. otherwise byte 0 bit 4 must be set and byte 0/4/5 are
  259. in NEW fmt
  260. F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...
  261. ALPS Absolute Mode - Protocol Version 8
  262. ---------------------------------------
  263. Spoken by SS4 (73 03 14) and SS5 (73 03 28) hardware.
  264. The packet type is given by the APD field, bits 4-5 of byte 3.
  265. Touchpad packet (APD = 0x2)::
  266. b7 b6 b5 b4 b3 b2 b1 b0
  267. byte 0: SWM SWR SWL 1 1 0 0 X7
  268. byte 1: 0 X6 X5 X4 X3 X2 X1 X0
  269. byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0
  270. byte 3: 0 T&P 1 0 1 0 0 Y7
  271. byte 4: 0 Z6 Z5 Z4 Z3 Z2 Z1 Z0
  272. byte 5: 0 0 0 0 0 0 0 0
  273. SWM, SWR, SWL: Middle, Right, and Left button states
  274. Touchpad 1 Finger packet (APD = 0x0)::
  275. b7 b6 b5 b4 b3 b2 b1 b0
  276. byte 0: SWM SWR SWL 1 1 X2 X1 X0
  277. byte 1: X9 X8 X7 1 X6 X5 X4 X3
  278. byte 2: 0 X11 X10 LFB Y3 Y2 Y1 Y0
  279. byte 3: Y5 Y4 0 0 1 TAPF2 TAPF1 TAPF0
  280. byte 4: Zv7 Y11 Y10 1 Y9 Y8 Y7 Y6
  281. byte 5: Zv6 Zv5 Zv4 0 Zv3 Zv2 Zv1 Zv0
  282. TAPF: ???
  283. LFB: ???
  284. Touchpad 2 Finger packet (APD = 0x1)::
  285. b7 b6 b5 b4 b3 b2 b1 b0
  286. byte 0: SWM SWR SWL 1 1 AX6 AX5 AX4
  287. byte 1: AX11 AX10 AX9 AX8 AX7 AZ1 AY4 AZ0
  288. byte 2: AY11 AY10 AY9 CONT AY8 AY7 AY6 AY5
  289. byte 3: 0 0 0 1 1 BX6 BX5 BX4
  290. byte 4: BX11 BX10 BX9 BX8 BX7 BZ1 BY4 BZ0
  291. byte 5: BY11 BY10 BY9 0 BY8 BY7 BY5 BY5
  292. CONT: A 3-or-4 Finger packet is to follow
  293. Touchpad 3-or-4 Finger packet (APD = 0x3)::
  294. b7 b6 b5 b4 b3 b2 b1 b0
  295. byte 0: SWM SWR SWL 1 1 AX6 AX5 AX4
  296. byte 1: AX11 AX10 AX9 AX8 AX7 AZ1 AY4 AZ0
  297. byte 2: AY11 AY10 AY9 OVF AY8 AY7 AY6 AY5
  298. byte 3: 0 0 1 1 1 BX6 BX5 BX4
  299. byte 4: BX11 BX10 BX9 BX8 BX7 BZ1 BY4 BZ0
  300. byte 5: BY11 BY10 BY9 0 BY8 BY7 BY5 BY5
  301. OVF: 5th finger detected