elantech.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. Elantech Touchpad Driver
  2. ========================
  3. Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
  4. Extra information for hardware version 1 found and
  5. provided by Steve Havelka
  6. Version 2 (EeePC) hardware support based on patches
  7. received from Woody at Xandros and forwarded to me
  8. by user StewieGriffin at the eeeuser.com forum
  9. Contents
  10. ~~~~~~~~
  11. 1. Introduction
  12. 2. Extra knobs
  13. 3. Hardware version 1
  14. 3.1 Registers
  15. 3.2 Native relative mode 4 byte packet format
  16. 3.3 Native absolute mode 4 byte packet format
  17. 4. Hardware version 2
  18. 4.1 Registers
  19. 4.2 Native absolute mode 6 byte packet format
  20. 4.2.1 One finger touch
  21. 4.2.2 Two finger touch
  22. 1. Introduction
  23. ~~~~~~~~~~~~
  24. Currently the Linux Elantech touchpad driver is aware of two different
  25. hardware versions unimaginatively called version 1 and version 2. Version 1
  26. is found in "older" laptops and uses 4 bytes per packet. Version 2 seems to
  27. be introduced with the EeePC and uses 6 bytes per packet.
  28. The driver tries to support both hardware versions and should be compatible
  29. with the Xorg Synaptics touchpad driver and its graphical configuration
  30. utilities.
  31. Additionally the operation of the touchpad can be altered by adjusting the
  32. contents of some of its internal registers. These registers are represented
  33. by the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio?
  34. that can be read from and written to.
  35. Currently only the registers for hardware version 1 are somewhat understood.
  36. Hardware version 2 seems to use some of the same registers but it is not
  37. known whether the bits in the registers represent the same thing or might
  38. have changed their meaning.
  39. On top of that, some register settings have effect only when the touchpad is
  40. in relative mode and not in absolute mode. As the Linux Elantech touchpad
  41. driver always puts the hardware into absolute mode not all information
  42. mentioned below can be used immediately. But because there is no freely
  43. available Elantech documentation the information is provided here anyway for
  44. completeness sake.
  45. /////////////////////////////////////////////////////////////////////////////
  46. 2. Extra knobs
  47. ~~~~~~~~~~~
  48. Currently the Linux Elantech touchpad driver provides two extra knobs under
  49. /sys/bus/serio/drivers/psmouse/serio? for the user.
  50. * debug
  51. Turn different levels of debugging ON or OFF.
  52. By echoing "0" to this file all debugging will be turned OFF.
  53. Currently a value of "1" will turn on some basic debugging and a value of
  54. "2" will turn on packet debugging. For hardware version 1 the default is
  55. OFF. For version 2 the default is "1".
  56. Turning packet debugging on will make the driver dump every packet
  57. received to the syslog before processing it. Be warned that this can
  58. generate quite a lot of data!
  59. * paritycheck
  60. Turns parity checking ON or OFF.
  61. By echoing "0" to this file parity checking will be turned OFF. Any
  62. non-zero value will turn it ON. For hardware version 1 the default is ON.
  63. For version 2 the default it is OFF.
  64. Hardware version 1 provides basic data integrity verification by
  65. calculating a parity bit for the last 3 bytes of each packet. The driver
  66. can check these bits and reject any packet that appears corrupted. Using
  67. this knob you can bypass that check.
  68. It is not known yet whether hardware version 2 provides the same parity
  69. bits. Hence checking is disabled by default. Currently even turning it on
  70. will do nothing.
  71. /////////////////////////////////////////////////////////////////////////////
  72. 3. Hardware version 1
  73. ==================
  74. 3.1 Registers
  75. ~~~~~~~~~
  76. By echoing a hexadecimal value to a register it contents can be altered.
  77. For example:
  78. echo -n 0x16 > reg_10
  79. * reg_10
  80. bit 7 6 5 4 3 2 1 0
  81. B C T D L A S E
  82. E: 1 = enable smart edges unconditionally
  83. S: 1 = enable smart edges only when dragging
  84. A: 1 = absolute mode (needs 4 byte packets, see reg_11)
  85. L: 1 = enable drag lock (see reg_22)
  86. D: 1 = disable dynamic resolution
  87. T: 1 = disable tapping
  88. C: 1 = enable corner tap
  89. B: 1 = swap left and right button
  90. * reg_11
  91. bit 7 6 5 4 3 2 1 0
  92. 1 0 0 H V 1 F P
  93. P: 1 = enable parity checking for relative mode
  94. F: 1 = enable native 4 byte packet mode
  95. V: 1 = enable vertical scroll area
  96. H: 1 = enable horizontal scroll area
  97. * reg_20
  98. single finger width?
  99. * reg_21
  100. scroll area width (small: 0x40 ... wide: 0xff)
  101. * reg_22
  102. drag lock time out (short: 0x14 ... long: 0xfe;
  103. 0xff = tap again to release)
  104. * reg_23
  105. tap make timeout?
  106. * reg_24
  107. tap release timeout?
  108. * reg_25
  109. smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)
  110. * reg_26
  111. smart edge activation area width?
  112. 3.2 Native relative mode 4 byte packet format
  113. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. byte 0:
  115. bit 7 6 5 4 3 2 1 0
  116. c c p2 p1 1 M R L
  117. L, R, M = 1 when Left, Right, Middle mouse button pressed
  118. some models have M as byte 3 odd parity bit
  119. when parity checking is enabled (reg_11, P = 1):
  120. p1..p2 = byte 1 and 2 odd parity bit
  121. c = 1 when corner tap detected
  122. byte 1:
  123. bit 7 6 5 4 3 2 1 0
  124. dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
  125. dx7..dx0 = x movement; positive = right, negative = left
  126. byte 1 = 0xf0 when corner tap detected
  127. byte 2:
  128. bit 7 6 5 4 3 2 1 0
  129. dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
  130. dy7..dy0 = y movement; positive = up, negative = down
  131. byte 3:
  132. parity checking enabled (reg_11, P = 1):
  133. bit 7 6 5 4 3 2 1 0
  134. w h n1 n0 ds3 ds2 ds1 ds0
  135. normally:
  136. ds3..ds0 = scroll wheel amount and direction
  137. positive = down or left
  138. negative = up or right
  139. when corner tap detected:
  140. ds0 = 1 when top right corner tapped
  141. ds1 = 1 when bottom right corner tapped
  142. ds2 = 1 when bottom left corner tapped
  143. ds3 = 1 when top left corner tapped
  144. n1..n0 = number of fingers on touchpad
  145. only models with firmware 2.x report this, models with
  146. firmware 1.x seem to map one, two and three finger taps
  147. directly to L, M and R mouse buttons
  148. h = 1 when horizontal scroll action
  149. w = 1 when wide finger touch?
  150. otherwise (reg_11, P = 0):
  151. bit 7 6 5 4 3 2 1 0
  152. ds7 ds6 ds5 ds4 ds3 ds2 ds1 ds0
  153. ds7..ds0 = vertical scroll amount and direction
  154. negative = up
  155. positive = down
  156. 3.3 Native absolute mode 4 byte packet format
  157. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158. byte 0:
  159. firmware version 1.x:
  160. bit 7 6 5 4 3 2 1 0
  161. D U p1 p2 1 p3 R L
  162. L, R = 1 when Left, Right mouse button pressed
  163. p1..p3 = byte 1..3 odd parity bit
  164. D, U = 1 when rocker switch pressed Up, Down
  165. firmware version 2.x:
  166. bit 7 6 5 4 3 2 1 0
  167. n1 n0 p2 p1 1 p3 R L
  168. L, R = 1 when Left, Right mouse button pressed
  169. p1..p3 = byte 1..3 odd parity bit
  170. n1..n0 = number of fingers on touchpad
  171. byte 1:
  172. firmware version 1.x:
  173. bit 7 6 5 4 3 2 1 0
  174. f 0 th tw x9 x8 y9 y8
  175. tw = 1 when two finger touch
  176. th = 1 when three finger touch
  177. f = 1 when finger touch
  178. firmware version 2.x:
  179. bit 7 6 5 4 3 2 1 0
  180. . . . . x9 x8 y9 y8
  181. byte 2:
  182. bit 7 6 5 4 3 2 1 0
  183. x7 x6 x5 x4 x3 x2 x1 x0
  184. x9..x0 = absolute x value (horizontal)
  185. byte 3:
  186. bit 7 6 5 4 3 2 1 0
  187. y7 y6 y5 y4 y3 y2 y1 y0
  188. y9..y0 = absolute y value (vertical)
  189. /////////////////////////////////////////////////////////////////////////////
  190. 4. Hardware version 2
  191. ==================
  192. 4.1 Registers
  193. ~~~~~~~~~
  194. By echoing a hexadecimal value to a register it contents can be altered.
  195. For example:
  196. echo -n 0x56 > reg_10
  197. * reg_10
  198. bit 7 6 5 4 3 2 1 0
  199. 0 1 0 1 0 1 D 0
  200. D: 1 = enable drag and drop
  201. * reg_11
  202. bit 7 6 5 4 3 2 1 0
  203. 1 0 0 0 S 0 1 0
  204. S: 1 = enable vertical scroll
  205. * reg_21
  206. unknown (0x00)
  207. * reg_22
  208. drag and drop release time out (short: 0x70 ... long 0x7e;
  209. 0x7f = never i.e. tap again to release)
  210. 4.2 Native absolute mode 6 byte packet format
  211. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  212. 4.2.1 One finger touch
  213. ~~~~~~~~~~~~~~~~
  214. byte 0:
  215. bit 7 6 5 4 3 2 1 0
  216. n1 n0 . . . . R L
  217. L, R = 1 when Left, Right mouse button pressed
  218. n1..n0 = numbers of fingers on touchpad
  219. byte 1:
  220. bit 7 6 5 4 3 2 1 0
  221. x15 x14 x13 x12 x11 x10 x9 x8
  222. byte 2:
  223. bit 7 6 5 4 3 2 1 0
  224. x7 x6 x5 x4 x4 x2 x1 x0
  225. x15..x0 = absolute x value (horizontal)
  226. byte 3:
  227. bit 7 6 5 4 3 2 1 0
  228. . . . . . . . .
  229. byte 4:
  230. bit 7 6 5 4 3 2 1 0
  231. y15 y14 y13 y12 y11 y10 y8 y8
  232. byte 5:
  233. bit 7 6 5 4 3 2 1 0
  234. y7 y6 y5 y4 y3 y2 y1 y0
  235. y15..y0 = absolute y value (vertical)
  236. 4.2.2 Two finger touch
  237. ~~~~~~~~~~~~~~~~
  238. byte 0:
  239. bit 7 6 5 4 3 2 1 0
  240. n1 n0 ay8 ax8 . . R L
  241. L, R = 1 when Left, Right mouse button pressed
  242. n1..n0 = numbers of fingers on touchpad
  243. byte 1:
  244. bit 7 6 5 4 3 2 1 0
  245. ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
  246. ax8..ax0 = first finger absolute x value
  247. byte 2:
  248. bit 7 6 5 4 3 2 1 0
  249. ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0
  250. ay8..ay0 = first finger absolute y value
  251. byte 3:
  252. bit 7 6 5 4 3 2 1 0
  253. . . by8 bx8 . . . .
  254. byte 4:
  255. bit 7 6 5 4 3 2 1 0
  256. bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
  257. bx8..bx0 = second finger absolute x value
  258. byte 5:
  259. bit 7 6 5 4 3 2 1 0
  260. by7 by8 by5 by4 by3 by2 by1 by0
  261. by8..by0 = second finger absolute y value