]>
Commit | Line | Data |
---|---|---|
db7721ba | 1 | diff -uNr a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile |
2 | --- a/drivers/input/mouse/Makefile 2004-10-18 17:53:43.000000000 -0400 | |
3 | +++ b/drivers/input/mouse/Makefile 2004-10-31 12:27:45.000000000 -0500 | |
4 | @@ -14,4 +14,4 @@ | |
5 | obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o | |
6 | obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o | |
7 | ||
8 | -psmouse-objs := psmouse-base.o logips2pp.o synaptics.o | |
9 | +psmouse-objs := psmouse-base.o logips2pp.o synaptics.o trackpoint.o | |
10 | diff -uNr a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c | |
11 | --- a/drivers/input/mouse/psmouse-base.c 2004-10-18 17:53:43.000000000 -0400 | |
12 | +++ b/drivers/input/mouse/psmouse-base.c 2004-11-07 00:28:29.000000000 -0500 | |
13 | @@ -21,6 +21,7 @@ | |
14 | #include "psmouse.h" | |
15 | #include "synaptics.h" | |
16 | #include "logips2pp.h" | |
17 | +#include "trackpoint.h" | |
18 | ||
19 | #define DRIVER_DESC "PS/2 mouse driver" | |
20 | ||
21 | @@ -468,6 +469,16 @@ | |
22 | int synaptics_hardware = 0; | |
23 | ||
24 | /* | |
25 | + * Try to initialize the IBM TrackPoint | |
26 | + */ | |
27 | + if (max_proto > PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) { | |
28 | + psmouse->vendor = "IBM"; | |
29 | + psmouse->name = "TrackPoint"; | |
30 | + | |
31 | + return PSMOUSE_PS2; | |
32 | + } | |
33 | + | |
34 | +/* | |
35 | * Try Synaptics TouchPad | |
36 | */ | |
37 | if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) { | |
38 | diff -uNr a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c | |
39 | --- a/drivers/input/mouse/trackpoint.c 1969-12-31 19:00:00.000000000 -0500 | |
40 | +++ b/drivers/input/mouse/trackpoint.c 2004-12-01 18:52:16.000000000 -0500 | |
41 | @@ -0,0 +1,424 @@ | |
42 | +/* | |
43 | + * Stephen Evanchik <evanchsa@gmail.com> | |
44 | + * | |
45 | + * This program is free software; you can redistribute it and/or modify it | |
46 | + * under the terms of the GNU General Public License version 2 as published by | |
47 | + * the Free Software Foundation. | |
48 | + * | |
49 | + * Trademarks are the property of their respective owners. | |
50 | + * | |
51 | + */ | |
52 | + | |
53 | +#include <linux/delay.h> | |
54 | +#include <linux/serio.h> | |
55 | +#include <linux/module.h> | |
56 | +#include <linux/moduleparam.h> | |
57 | +#include <linux/input.h> | |
58 | +#include <linux/proc_fs.h> | |
59 | +#include <asm/uaccess.h> | |
60 | +#include "psmouse.h" | |
61 | +#include "trackpoint.h" | |
62 | + | |
63 | + | |
64 | +int tp_sens = TP_DEF_SENS; | |
65 | +module_param_named(sens, tp_sens, uint, 0); | |
66 | +MODULE_PARM_DESC(sens, "Sensitivity"); | |
67 | + | |
68 | +int tp_speed = TP_DEF_SPEED; | |
69 | +module_param_named(speed, tp_speed, uint, 0); | |
70 | +MODULE_PARM_DESC(speed, "Speed of pointer"); | |
71 | + | |
72 | +int tp_backup = TP_DEF_BACKUP; | |
73 | +module_param_named(backup, tp_backup, uint, 0); | |
74 | +MODULE_PARM_DESC(backup, "Backup Range"); | |
75 | + | |
76 | +int tp_draghyst = TP_DEF_DRAG_HYST; | |
77 | +module_param_named(draghyst, tp_draghyst, uint, 0); | |
78 | +MODULE_PARM_DESC(draghyst, "Resistance to dragging"); | |
79 | + | |
80 | +int tp_mindrag = TP_DEF_MIN_DRAG; | |
81 | +module_param_named(mindrag, tp_mindrag, uint, 0); | |
82 | +MODULE_PARM_DESC(mindrag, "Drag threshold"); | |
83 | + | |
84 | +int tp_thresh = TP_DEF_THRESH; | |
85 | +module_param_named(thresh, tp_thresh, uint, 0); | |
86 | +MODULE_PARM_DESC(thresh, "Force necessary to trigger a press or release"); | |
87 | + | |
88 | +int tp_upthresh = TP_UP_THRESH; | |
89 | +module_param_named(upthresh, tp_upthresh, uint, 0); | |
90 | +MODULE_PARM_DESC(upthresh, "Force necessary to trigger a click"); | |
91 | + | |
92 | +int tp_ztime = TP_DEF_Z_TIME; | |
93 | +module_param_named(ztime, tp_ztime, uint, 0); | |
94 | +MODULE_PARM_DESC(ztime, "Determines how sharp a press is"); | |
95 | + | |
96 | +int tp_jenks = TP_DEF_JENKS_CURV; | |
97 | +module_param_named(jenks, tp_jenks, uint, 0); | |
98 | +MODULE_PARM_DESC(jenks, "Double click sensitivity"); | |
99 | + | |
100 | + | |
101 | +/* Toggles */ | |
102 | +int tp_pts = TP_DEF_PTS; | |
103 | +module_param_named(pts, tp_pts, uint, 0); | |
104 | +MODULE_PARM_DESC(pts, "Press to Select"); | |
105 | + | |
106 | +int tp_mb = TP_DEF_MB; | |
107 | +module_param_named(mb, tp_mb, uint, 0); | |
108 | +MODULE_PARM_DESC(pts, "Middle button is disabled"); | |
109 | + | |
110 | +/* | |
111 | + * Device IO: read, write and toggle bit | |
112 | + */ | |
113 | +static void trackpoint_read(struct psmouse *psmouse, unsigned char loc, unsigned char *results) | |
114 | +{ | |
115 | + psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)); | |
116 | + psmouse_command(psmouse, results, MAKE_PS2_CMD(0, 1, loc)); | |
117 | +} | |
118 | + | |
119 | +static void trackpoint_write(struct psmouse *psmouse, unsigned char loc, unsigned char val) | |
120 | +{ | |
121 | + psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)); | |
122 | + psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0,0, TP_WRITE_MEM)); | |
123 | + psmouse_command(psmouse, &val, MAKE_PS2_CMD(1,0, loc)); | |
124 | +} | |
125 | + | |
126 | +static int trackpoint_toggle_bit(struct psmouse *psmouse, unsigned char loc, unsigned char mask) | |
127 | +{ | |
128 | + /* Bad things will happen if the loc param isn't in this range */ | |
129 | + if(loc < 0x20 || loc >= 0x2F) | |
130 | + return -1; | |
131 | + | |
132 | + psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)); | |
133 | + psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_TOGGLE)); | |
134 | + psmouse_command(psmouse, &mask, MAKE_PS2_CMD(1, 0, loc)); | |
135 | + | |
136 | + return 0; | |
137 | +} | |
138 | + | |
139 | + | |
140 | +#ifdef CONFIG_PROC_FS | |
141 | + | |
142 | +#define PROC_READ_NAME(name) name##_read_func | |
143 | +#define PROC_WRITE_NAME(name) name##_write_func | |
144 | +#define PROC_TOGGLE_NAME(name) name##_toggle_func | |
145 | + | |
146 | +#define MAKE_PROC_READ(name, item) \ | |
147 | + static int name(char* page, char** start, off_t off, int count, int* eof, void* data) \ | |
148 | + { \ | |
149 | + int len; \ | |
150 | + struct psmouse *psmouse = (struct psmouse *)data; \ | |
151 | + struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \ | |
152 | + len = sprintf(page, "%d\n", tp->item); \ | |
153 | + *eof = 1; \ | |
154 | + return len; \ | |
155 | + } | |
156 | + | |
157 | +#define MAKE_PROC_WRITE(name, item, command) \ | |
158 | + static int name(struct file *file, const char __user *buffer, unsigned long count, void *data) \ | |
159 | + { \ | |
160 | + int len = count; \ | |
161 | + unsigned char tmp[5]; \ | |
162 | + struct psmouse *psmouse = (struct psmouse *)data; \ | |
163 | + struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \ | |
164 | + if(count > sizeof(tmp) - 1) \ | |
165 | + len = sizeof(tmp) - 1; \ | |
166 | + if(copy_from_user(tmp, buffer, len)) \ | |
167 | + return -EFAULT; \ | |
168 | + tmp[len] = '\0'; \ | |
169 | + tp->item = simple_strtoul(tmp, 0, 10); \ | |
170 | + trackpoint_write((struct psmouse *)data, command, tp->item); \ | |
171 | + return len; \ | |
172 | + } | |
173 | + | |
174 | +#define MAKE_PROC_TOGGLE(name, item, command, mask) \ | |
175 | + static int name(struct file *file, const char __user *buffer, unsigned long count, void *data) \ | |
176 | + { \ | |
177 | + int len = count; \ | |
178 | + unsigned char toggle, tmp[5]; \ | |
179 | + struct psmouse *psmouse = (struct psmouse *)data; \ | |
180 | + struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->private; \ | |
181 | + if(count > sizeof(tmp) - 1) \ | |
182 | + len = sizeof(tmp) - 1; \ | |
183 | + if(copy_from_user(tmp, buffer, len)) \ | |
184 | + return -EFAULT; \ | |
185 | + tmp[len] = '\0'; \ | |
186 | + toggle = (tmp[0] == '1') ? 1 : 0; \ | |
187 | + if( toggle != tp->item) { \ | |
188 | + tp->item = toggle; \ | |
189 | + trackpoint_toggle_bit(psmouse, command, mask); \ | |
190 | + } \ | |
191 | + return len; \ | |
192 | + } | |
193 | + | |
194 | + | |
195 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(sensitivity), sens, TP_SENS); | |
196 | +MAKE_PROC_READ(PROC_READ_NAME(sensitivity), sens); | |
197 | + | |
198 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(speed), speed, TP_SPEED); | |
199 | +MAKE_PROC_READ(PROC_READ_NAME(speed), speed); | |
200 | + | |
201 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(neg_inertia), inertia, TP_NEG_INERT); | |
202 | +MAKE_PROC_READ(PROC_READ_NAME(neg_inertia), inertia); | |
203 | + | |
204 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(backup), reach, TP_BACKUP); | |
205 | +MAKE_PROC_READ(PROC_READ_NAME(backup), reach); | |
206 | + | |
207 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(drag_hyst), draghys, TP_DRAG_HYST); | |
208 | +MAKE_PROC_READ(PROC_READ_NAME(drag_hyst), draghys); | |
209 | + | |
210 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(min_drag), mindrag, TP_MIN_DRAG); | |
211 | +MAKE_PROC_READ(PROC_READ_NAME(min_drag), mindrag); | |
212 | + | |
213 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(thresh), thresh, TP_THRESH); | |
214 | +MAKE_PROC_READ(PROC_READ_NAME(thresh), thresh); | |
215 | + | |
216 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(up_thresh), up_thresh, TP_UP_THRESH); | |
217 | +MAKE_PROC_READ(PROC_READ_NAME(up_thresh), up_thresh); | |
218 | + | |
219 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(z_time), z_time, TP_Z_TIME); | |
220 | +MAKE_PROC_READ(PROC_READ_NAME(z_time), z_time); | |
221 | + | |
222 | +MAKE_PROC_WRITE(PROC_WRITE_NAME(jenks_curv), jenks_curv, TP_JENKS_CURV); | |
223 | +MAKE_PROC_READ(PROC_READ_NAME(jenks_curv), jenks_curv); | |
224 | + | |
225 | +MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(ptson), ptson, TP_TOGGLE_PTS, TP_MASK_PTS); | |
226 | +MAKE_PROC_READ(PROC_READ_NAME(ptson), ptson); | |
227 | + | |
228 | +MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(skip_back), skipback, TP_TOGGLE_SKIP_BACK, TP_MASK_SKIP_BACK); | |
229 | +MAKE_PROC_READ(PROC_READ_NAME(skip_back), skipback); | |
230 | + | |
231 | +MAKE_PROC_TOGGLE(PROC_TOGGLE_NAME(mb), mb, TP_TOGGLE_MB, TP_MASK_MB); | |
232 | +MAKE_PROC_READ(PROC_READ_NAME(mb), mb); | |
233 | + | |
234 | + | |
235 | + | |
236 | +#define NEW_PROC_ENTRY(name) \ | |
237 | + entry = create_proc_entry(#name, 0644, tp_dir); \ | |
238 | + if(!entry) \ | |
239 | + goto no_##name; \ | |
240 | + entry->owner = THIS_MODULE; \ | |
241 | + entry->data = psmouse; \ | |
242 | + entry->read_proc = PROC_READ_NAME(name); \ | |
243 | + entry->write_proc = PROC_WRITE_NAME(name); | |
244 | + | |
245 | + | |
246 | +#define NEW_PROC_TOGGLE_ENTRY(name) \ | |
247 | + entry = create_proc_entry(#name, 0644, tp_dir); \ | |
248 | + if(!entry) \ | |
249 | + goto no_##name; \ | |
250 | + entry->owner = THIS_MODULE; \ | |
251 | + entry->data = psmouse; \ | |
252 | + entry->read_proc = PROC_READ_NAME(name); \ | |
253 | + entry->write_proc = PROC_TOGGLE_NAME(name); | |
254 | + | |
255 | + | |
256 | + | |
257 | +static struct proc_dir_entry *tp_dir = NULL; | |
258 | + | |
259 | + | |
260 | +static int trackpoint_proc_init(struct psmouse *psmouse) | |
261 | +{ | |
262 | + struct proc_dir_entry *entry = NULL; | |
263 | + | |
264 | + tp_dir = proc_mkdir("trackpoint", NULL); | |
265 | + if(!tp_dir) | |
266 | + return -ENOMEM; | |
267 | + | |
268 | + tp_dir->owner = THIS_MODULE; | |
269 | + | |
270 | + NEW_PROC_ENTRY(sensitivity); | |
271 | + NEW_PROC_ENTRY(speed); | |
272 | + NEW_PROC_ENTRY(neg_inertia); | |
273 | + NEW_PROC_ENTRY(backup); | |
274 | + NEW_PROC_ENTRY(drag_hyst); | |
275 | + NEW_PROC_ENTRY(min_drag); | |
276 | + NEW_PROC_ENTRY(thresh); | |
277 | + NEW_PROC_ENTRY(up_thresh); | |
278 | + NEW_PROC_ENTRY(z_time); | |
279 | + NEW_PROC_ENTRY(jenks_curv); | |
280 | + | |
281 | + NEW_PROC_TOGGLE_ENTRY(ptson); | |
282 | + NEW_PROC_TOGGLE_ENTRY(skip_back); | |
283 | + NEW_PROC_TOGGLE_ENTRY(mb); | |
284 | + | |
285 | + return 0; | |
286 | + | |
287 | +no_mb: | |
288 | + remove_proc_entry("skip_back", tp_dir); | |
289 | + | |
290 | +no_skip_back: | |
291 | + remove_proc_entry("ptson", tp_dir); | |
292 | + | |
293 | +no_ptson: | |
294 | + remove_proc_entry("jenks_curv", tp_dir); | |
295 | + | |
296 | +no_jenks_curv: | |
297 | + remove_proc_entry("z_time", tp_dir); | |
298 | + | |
299 | +no_z_time: | |
300 | + remove_proc_entry("up_thresh", tp_dir); | |
301 | + | |
302 | +no_up_thresh: | |
303 | + remove_proc_entry("thresh", tp_dir); | |
304 | + | |
305 | +no_thresh: | |
306 | + remove_proc_entry("min_drag", tp_dir); | |
307 | + | |
308 | +no_min_drag: | |
309 | + remove_proc_entry("drag_hyst", tp_dir); | |
310 | + | |
311 | +no_drag_hyst: | |
312 | + remove_proc_entry("backup", tp_dir); | |
313 | + | |
314 | +no_backup: | |
315 | + remove_proc_entry("neg_inertia", tp_dir); | |
316 | + | |
317 | +no_neg_inertia: | |
318 | + remove_proc_entry("speed", tp_dir); | |
319 | + | |
320 | +no_speed: | |
321 | + remove_proc_entry("sensitivity", tp_dir); | |
322 | + | |
323 | +no_sensitivity: | |
324 | + remove_proc_entry("trackpoint", NULL); | |
325 | + | |
326 | + return -ENOMEM; | |
327 | +} | |
328 | + | |
329 | +static void trackpoint_proc_remove(void) | |
330 | +{ | |
331 | + remove_proc_entry("mb", tp_dir); | |
332 | + remove_proc_entry("skip_back", tp_dir); | |
333 | + remove_proc_entry("ptson", tp_dir); | |
334 | + remove_proc_entry("jenks_curv", tp_dir); | |
335 | + remove_proc_entry("z_time", tp_dir); | |
336 | + remove_proc_entry("up_thresh", tp_dir); | |
337 | + remove_proc_entry("thresh", tp_dir); | |
338 | + remove_proc_entry("min_drag", tp_dir); | |
339 | + remove_proc_entry("drag_hyst", tp_dir); | |
340 | + remove_proc_entry("backup", tp_dir); | |
341 | + remove_proc_entry("neg_inertia", tp_dir); | |
342 | + remove_proc_entry("speed", tp_dir); | |
343 | + remove_proc_entry("sensitivity", tp_dir); | |
344 | + remove_proc_entry("trackpoint", NULL); | |
345 | +} | |
346 | + | |
347 | +#else | |
348 | +static int trackpoint_proc_init(struct psmouse *psmouse) { return 0; } | |
349 | +static void trackpoint_proc_remove(void) { do {} while(0); } | |
350 | +#endif | |
351 | + | |
352 | + | |
353 | +void trackpoint_disconnect(struct psmouse *psmouse) | |
354 | +{ | |
355 | + trackpoint_proc_remove(); | |
356 | + | |
357 | + kfree(psmouse->private); | |
358 | +} | |
359 | + | |
360 | +int trackpoint_reconnect(struct psmouse *psmouse) | |
361 | +{ | |
362 | + unsigned char toggle; | |
363 | + struct trackpoint_data *tp = psmouse->private; | |
364 | + | |
365 | + /* Push the config to the device */ | |
366 | + | |
367 | + trackpoint_write(psmouse, TP_SENS, tp->sens); | |
368 | + trackpoint_write(psmouse, TP_NEG_INERT, tp->inertia); | |
369 | + trackpoint_write(psmouse, TP_SPEED, tp->speed); | |
370 | + | |
371 | + trackpoint_write(psmouse, TP_BACKUP, tp->reach); | |
372 | + trackpoint_write(psmouse, TP_DRAG_HYST, tp->draghys); | |
373 | + trackpoint_write(psmouse, TP_MIN_DRAG, tp->mindrag); | |
374 | + | |
375 | + trackpoint_write(psmouse, TP_THRESH, tp->thresh); | |
376 | + trackpoint_write(psmouse, TP_UP_THRESH, tp->up_thresh); | |
377 | + | |
378 | + trackpoint_write(psmouse, TP_Z_TIME, tp->z_time); | |
379 | + trackpoint_write(psmouse, TP_JENKS_CURV, tp->jenks_curv); | |
380 | + | |
381 | + | |
382 | + trackpoint_read(psmouse, TP_TOGGLE_PTS, &toggle); | |
383 | + if(((toggle & TP_MASK_PTS) == TP_MASK_PTS)!= tp->ptson) | |
384 | + trackpoint_toggle_bit(psmouse, TP_TOGGLE_PTS, TP_MASK_PTS); | |
385 | + | |
386 | + trackpoint_read(psmouse, TP_TOGGLE_MB, &toggle); | |
387 | + if(((toggle & TP_MASK_MB) == TP_MASK_MB) != tp->mb) | |
388 | + trackpoint_toggle_bit(psmouse, TP_TOGGLE_MB, TP_MASK_MB); | |
389 | + | |
390 | + trackpoint_read(psmouse, TP_TOGGLE_SKIP_BACK, &toggle); | |
391 | + if(((toggle & TP_MASK_SKIP_BACK) == TP_MASK_SKIP_BACK) != tp->skipback) | |
392 | + trackpoint_toggle_bit(psmouse, TP_TOGGLE_SKIP_BACK, TP_MASK_SKIP_BACK); | |
393 | + | |
394 | + /* TODO: Add external device pass through */ | |
395 | + | |
396 | + return 0; | |
397 | +} | |
398 | + | |
399 | +static void trackpoint_defaults(struct trackpoint_data *tp) | |
400 | +{ | |
401 | + tp->sens = tp_sens; | |
402 | + tp->speed = tp_speed; | |
403 | + tp->reach = tp_backup; | |
404 | + | |
405 | + tp->draghys = tp_draghyst; | |
406 | + tp->mindrag = tp_mindrag; | |
407 | + | |
408 | + tp->thresh = tp_thresh; | |
409 | + tp->up_thresh = tp_upthresh; | |
410 | + | |
411 | + tp->z_time = tp_ztime; | |
412 | + tp->jenks_curv = tp_jenks; | |
413 | + | |
414 | + tp->ptson = tp_pts; | |
415 | + tp->mb = tp_mb; | |
416 | + tp->skipback = TP_DEF_SKIP_BACK; | |
417 | +} | |
418 | + | |
419 | + | |
420 | + | |
421 | +int trackpoint_init(struct psmouse *psmouse) | |
422 | +{ | |
423 | + unsigned char param[2]; | |
424 | + struct trackpoint_data *priv; | |
425 | + | |
426 | + param[0] = param[1] = 0; | |
427 | + | |
428 | + /* The real driver disables, queries and | |
429 | + then enables so we'll do that too | |
430 | + */ | |
431 | + psmouse_command(psmouse, param, MAKE_PS2_CMD(0, 2, TP_DISABLE)); | |
432 | + | |
433 | + psmouse_command(psmouse, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)); | |
434 | + if(param[0] != TP_MAGIC_IDENT) | |
435 | + return -1; | |
436 | + | |
437 | + psmouse_command(psmouse, param, MAKE_PS2_CMD(0, 2, TP_ENABLE)); | |
438 | + | |
439 | + psmouse->private = priv = kmalloc(sizeof(struct trackpoint_data), GFP_KERNEL); | |
440 | + | |
441 | + if(!priv) | |
442 | + return -1; | |
443 | + | |
444 | + memset(priv, 0, sizeof(struct trackpoint_data)); | |
445 | + | |
446 | + priv->firmware_id = param[1]; | |
447 | + | |
448 | + | |
449 | + psmouse->reconnect = trackpoint_reconnect; | |
450 | + psmouse->disconnect = trackpoint_disconnect; | |
451 | + | |
452 | + /* | |
453 | + * Initialize the device's default settings | |
454 | + */ | |
455 | + trackpoint_defaults(priv); | |
456 | + trackpoint_reconnect(psmouse); | |
457 | + | |
458 | + trackpoint_proc_init(psmouse); | |
459 | + | |
460 | + printk("IBM TrackPoint firmware: 0x%02X\n", param[1]); | |
461 | + | |
462 | + return 0; | |
463 | +} | |
464 | + | |
465 | + | |
466 | diff -uNr a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h | |
467 | --- a/drivers/input/mouse/trackpoint.h 1969-12-31 19:00:00.000000000 -0500 | |
468 | +++ b/drivers/input/mouse/trackpoint.h 2004-12-01 18:59:01.000000000 -0500 | |
469 | @@ -0,0 +1,151 @@ | |
470 | +/* | |
471 | + * IBM TrackPoint PS/2 mouse driver | |
472 | + * | |
473 | + * Stephen Evanchik <evanchsa@clarkson.edu> | |
474 | + * | |
475 | + * This program is free software; you can redistribute it and/or modify it | |
476 | + * under the terms of the GNU General Public License version 2 as published by | |
477 | + * the Free Software Foundation. | |
478 | + */ | |
479 | + | |
480 | +#ifndef _TRACKPOINT_H | |
481 | +#define _TRACKPOINT_H | |
482 | + | |
483 | +/* | |
484 | + * These constants are from the TrackPoint System | |
485 | + * Engineering documentation Version 4 from IBM Watson | |
486 | + * research: | |
487 | + * http://wwwcssrv.almaden.ibm.com/trackpoint/download.html | |
488 | + */ | |
489 | + | |
490 | +#define TP_DISABLE (0xF5) | |
491 | +#define TP_ENABLE (0xF4) | |
492 | + | |
493 | +#define TP_READ_ID (0xE1) /* Sent for device identification */ | |
494 | +#define TP_MAGIC_IDENT (0x01) /* Sent after a TP_READ_ID followed */ | |
495 | + /* by the firmware ID */ | |
496 | + | |
497 | +#define TP_COMMAND (0xE2) /* Commands start with this */ | |
498 | + | |
499 | + | |
500 | +/* | |
501 | + * Commands | |
502 | + */ | |
503 | +#define TP_RECALIB (0x51) /* Recalibrate */ | |
504 | +#define TP_POWER_DOWN (0x44) /* Can only be undone through HW reset */ | |
505 | +#define TP_EXT_DEV (0x21) /* Determines if external device is connected (RO) */ | |
506 | +#define TP_EXT_BTN (0x4B) /* Read extended button status */ | |
507 | +#define TP_POR (0x7F) /* Execute Power on Reset */ | |
508 | +#define TP_POR_RESULTS (0x25) /* Read Power on Self test results */ | |
509 | + | |
510 | +/* | |
511 | + * Mode manipulation | |
512 | + */ | |
513 | +#define TP_SET_SOFT_TRANS (0x4E) /* Set mode */ | |
514 | +#define TP_CAN_SOFT_TRANS (0xB9) /* Cancel mode */ | |
515 | +#define TP_SET_HARD_TRANS (0x45) /* Mode can only be set */ | |
516 | + | |
517 | + | |
518 | +/* | |
519 | + * Register oriented commands/properties | |
520 | + */ | |
521 | +#define TP_WRITE_MEM (0x81) | |
522 | +#define TP_READ_MEM (0x80) /* Not used in this implementation */ | |
523 | + | |
524 | +/* | |
525 | +* RAM Locations for properties | |
526 | + */ | |
527 | +#define TP_SENS (0x4A) /* Sensitivity */ | |
528 | +#define TP_MB (0x4C) /* Read Middle Button Status (RO) */ | |
529 | +#define TP_NEG_INERT (0x4D) /* Negative Inertia */ | |
530 | +#define TP_SPEED (0x60) /* Speed of TP Cursor */ | |
531 | +#define TP_BACKUP (0x57) /* Backup for Z-axis press */ | |
532 | +#define TP_DRAG_HYST (0x58) /* Drag Hysteresis */ | |
533 | + /* (how hard it is to drag */ | |
534 | + /* with Z-axis pressed) */ | |
535 | + | |
536 | +#define TP_MIN_DRAG (0x59) /* Minimum amount of force needed */ | |
537 | + /* to trigger dragging */ | |
538 | + | |
539 | +#define TP_THRESH (0x5C) /* Minimum value for a Z-axis press */ | |
540 | +#define TP_UP_THRESH (0x5A) /* Used to generate a 'click' on Z-axis */ | |
541 | +#define TP_Z_TIME (0x5E) /* How sharp of a press */ | |
542 | +#define TP_JENKS_CURV (0x5D) /* Minimum curvature for double click */ | |
543 | + | |
544 | +/* | |
545 | + * Toggling Flag bits | |
546 | + */ | |
547 | +#define TP_TOGGLE (0x47) /* Toggle command */ | |
548 | + | |
549 | +#define TP_TOGGLE_MB (0x23) /* Disable/Enable Middle Button */ | |
550 | +#define TP_TOGGLE_DRIFT (0x23) /* Drift Correction */ | |
551 | +#define TP_TOGGLE_BURST (0x28) /* Burst Mode */ | |
552 | +#define TP_TOGGLE_PTS (0x2C) /* Press to Select */ | |
553 | +#define TP_TOGGLE_HARD_TRANS (0x2C) /* Alternate method to set Hard Transparency */ | |
554 | +#define TP_TOGGLE_TWOHAND (0x2D) /* Two handed */ | |
555 | +#define TP_TOGGLE_STICKY_TWO (0x2D) /* Sticky two handed */ | |
556 | +#define TP_TOGGLE_SKIP_BACK (0x2D) /* Suppress movement */ | |
557 | + /* after drag release */ | |
558 | + | |
559 | +/* | |
560 | + * Various makses for registers | |
561 | + * XOR'd to current contents for new value | |
562 | + */ | |
563 | +#define TP_MASK_PTS (0x01) | |
564 | +#define TP_MASK_SKIP_BACK (0x08) | |
565 | +#define TP_MASK_TWOHAND (0x01) | |
566 | +#define TP_MASK_STICKY_TWO (0x04) | |
567 | +#define TP_MASK_HARD_TRANS (0x80) | |
568 | +#define TP_MASK_BURST (0x80) | |
569 | +#define TP_MASK_MB (0x01) | |
570 | +#define TP_MASK_DRIFT (0x80) | |
571 | + | |
572 | +/* Power on Self Test Results */ | |
573 | +#define TP_POR_SUCCESS (0x3B) | |
574 | + | |
575 | +/* | |
576 | + * Default power on values | |
577 | + */ | |
578 | +#define TP_DEF_SENS (0x80) | |
579 | +#define TP_DEF_NEG_INT (0x06) | |
580 | +#define TP_DEF_SPEED (0x61) | |
581 | +#define TP_DEF_BACKUP (0x0A) | |
582 | + | |
583 | +#define TP_DEF_DRAG_HYST (0xFF) | |
584 | +#define TP_DEF_MIN_DRAG (0x14) | |
585 | + | |
586 | +#define TP_DEF_THRESH (0x08) | |
587 | +#define TP_DEF_UP_THRESH (0xFF) | |
588 | +#define TP_DEF_Z_TIME (0x26) | |
589 | +#define TP_DEF_JENKS_CURV (0x87) | |
590 | + | |
591 | +/* Toggles */ | |
592 | +#define TP_DEF_MB (0x00) | |
593 | +#define TP_DEF_PTS (0x00) | |
594 | +#define TP_DEF_SKIP_BACK (0x00) | |
595 | + | |
596 | +#define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) | |
597 | + | |
598 | +enum | |
599 | +{ TP_SOFT_TRANS, TP_HARD_TRANS }; | |
600 | + | |
601 | +struct trackpoint_data | |
602 | +{ | |
603 | + unsigned char firmware_id; | |
604 | + | |
605 | + unsigned char mode; /* Transparency mode */ | |
606 | + | |
607 | + unsigned char sens, speed, inertia, reach; | |
608 | + unsigned char draghys, mindrag; | |
609 | + unsigned char thresh, up_thresh; | |
610 | + unsigned char z_time, jenks_curv; | |
611 | + | |
612 | + unsigned char ptson; /* Press to Select */ | |
613 | + unsigned char twohand, skipback; | |
614 | + unsigned char mb; | |
615 | +}; | |
616 | + | |
617 | +extern int trackpoint_init (struct psmouse *psmouse); | |
618 | + | |
619 | + | |
620 | +#endif /* _TRACKPOINT_H */ |