2 * $Id: db9.c,v 1.13 2002/04/07 20:13:37 vojtech Exp $
4 * Copyright (c) 1999-2001 Vojtech Pavlik
6 * Based on the work of:
7 * Andree Borrmann Mats Sjövall
11 * Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver for Linux
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 * Should you need to contact me, the author, you can do so either by
30 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
31 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
34 #include <linux/kernel.h>
35 #include <linux/module.h>
36 #include <linux/moduleparam.h>
37 #include <linux/delay.h>
38 #include <linux/init.h>
39 #include <linux/parport.h>
40 #include <linux/input.h>
42 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
43 MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver");
44 MODULE_LICENSE("GPL");
46 static int db9[] __initdata = { -1, 0 };
47 static int db9_nargs __initdata = 0;
48 module_param_array_named(dev, db9, int, &db9_nargs, 0);
49 MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)");
51 static int db9_2[] __initdata = { -1, 0 };
52 static int db9_nargs_2 __initdata = 0;
53 module_param_array_named(dev2, db9_2, int, &db9_nargs_2, 0);
54 MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)");
56 static int db9_3[] __initdata = { -1, 0 };
57 static int db9_nargs_3 __initdata = 0;
58 module_param_array_named(dev3, db9_3, int, &db9_nargs_3, 0);
59 MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)");
61 __obsolete_setup("db9=");
62 __obsolete_setup("db9_2=");
63 __obsolete_setup("db9_3=");
65 #define DB9_MULTI_STICK 0x01
66 #define DB9_MULTI2_STICK 0x02
67 #define DB9_GENESIS_PAD 0x03
68 #define DB9_GENESIS5_PAD 0x05
69 #define DB9_GENESIS6_PAD 0x06
70 #define DB9_SATURN_PAD 0x07
71 #define DB9_MULTI_0802 0x08
72 #define DB9_MULTI_0802_2 0x09
73 #define DB9_CD32_PAD 0x0A
74 #define DB9_SATURN_DPP 0x0B
75 #define DB9_SATURN_DPP_2 0x0C
76 #define DB9_MAX_PAD 0x0D
81 #define DB9_RIGHT 0x08
82 #define DB9_FIRE1 0x10
83 #define DB9_FIRE2 0x20
84 #define DB9_FIRE3 0x40
85 #define DB9_FIRE4 0x80
87 #define DB9_NORMAL 0x0a
88 #define DB9_NOSELECT 0x08
90 #define DB9_MAX_DEVICES 2
92 #define DB9_GENESIS6_DELAY 14
93 #define DB9_REFRESH_TIME HZ/100
96 struct input_dev dev[DB9_MAX_DEVICES];
97 struct timer_list timer;
101 struct semaphore sem;
105 static struct db9 *db9_base[3];
107 static short db9_multi_btn[] = { BTN_TRIGGER, BTN_THUMB };
108 static short db9_genesis_btn[] = { BTN_START, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_MODE };
109 static short db9_cd32_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_START };
111 static char db9_buttons[DB9_MAX_PAD] = { 0, 1, 2, 4, 0, 6, 8, 9, 1, 1, 7, 9, 9 };
112 static short *db9_btn[DB9_MAX_PAD] = { NULL, db9_multi_btn, db9_multi_btn, db9_genesis_btn, NULL, db9_genesis_btn,
113 db9_genesis_btn, db9_cd32_btn, db9_multi_btn, db9_multi_btn, db9_cd32_btn,
114 db9_cd32_btn, db9_cd32_btn };
115 static char *db9_name[DB9_MAX_PAD] = { NULL, "Multisystem joystick", "Multisystem joystick (2 fire)", "Genesis pad",
116 NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick",
117 "Multisystem (0.8.0.2-dual) joystick", "Amiga CD-32 pad", "Saturn dpp", "Saturn dpp dual" };
119 static const int db9_max_pads[DB9_MAX_PAD] = { 0, 1, 1, 1, 0, 1, 1, 6, 1, 2, 1, 6, 12 };
120 static const int db9_num_axis[DB9_MAX_PAD] = { 0, 2, 2, 2, 0, 2, 2, 7, 2, 2, 2 ,7, 7 };
121 static const short db9_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_RZ, ABS_Z, ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y };
122 static const int db9_bidirectional[DB9_MAX_PAD] = { 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0 };
123 static const int db9_reverse[DB9_MAX_PAD] = { 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0 };
128 #define DB9_SATURN_DELAY 300
129 static const int db9_saturn_byte[] = { 1, 1, 1, 2, 2, 2, 2, 2, 1 };
130 static const unsigned char db9_saturn_mask[] = { 0x04, 0x01, 0x02, 0x40, 0x20, 0x10, 0x08, 0x80, 0x08 };
133 * db9_saturn_write_sub() writes 2 bit data.
135 static void db9_saturn_write_sub(struct parport *port, int type, unsigned char data, int powered, int pwr_sub)
141 c = 0x80 | 0x30 | (powered ? 0x08 : 0) | (pwr_sub ? 0x04 : 0) | data;
142 parport_write_data(port, c);
145 c = 0x40 | data << 4 | (powered ? 0x08 : 0) | (pwr_sub ? 0x04 : 0) | 0x03;
146 parport_write_data(port, c);
149 c = ((((data & 2) ? 2 : 0) | ((data & 1) ? 4 : 0)) ^ 0x02) | !powered;
150 parport_write_control(port, c);
156 * gc_saturn_read_sub() reads 4 bit data.
158 static unsigned char db9_saturn_read_sub(struct parport *port, int type)
164 data = parport_read_status(port) ^ 0x80;
165 return (data & 0x80 ? 1 : 0) | (data & 0x40 ? 2 : 0)
166 | (data & 0x20 ? 4 : 0) | (data & 0x10 ? 8 : 0);
169 data = parport_read_data(port) & 0x0f;
170 return (data & 0x8 ? 1 : 0) | (data & 0x4 ? 2 : 0)
171 | (data & 0x2 ? 4 : 0) | (data & 0x1 ? 8 : 0);
176 * db9_saturn_read_analog() sends clock and reads 8 bit data.
178 static unsigned char db9_saturn_read_analog(struct parport *port, int type, int powered)
182 db9_saturn_write_sub(port, type, 0, powered, 0);
183 udelay(DB9_SATURN_DELAY);
184 data = db9_saturn_read_sub(port, type) << 4;
185 db9_saturn_write_sub(port, type, 2, powered, 0);
186 udelay(DB9_SATURN_DELAY);
187 data |= db9_saturn_read_sub(port, type);
192 * db9_saturn_read_packet() reads whole saturn packet at connector
193 * and returns device identifier code.
195 static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char *data, int type, int powered)
200 db9_saturn_write_sub(port, type, 3, powered, 0);
201 data[0] = db9_saturn_read_sub(port, type);
202 switch (data[0] & 0x0f) {
205 return data[0] = 0xff;
206 case 0x4: case 0x4 | 0x8:
207 /* ?100 : digital controller */
208 db9_saturn_write_sub(port, type, 0, powered, 1);
209 data[2] = db9_saturn_read_sub(port, type) << 4;
210 db9_saturn_write_sub(port, type, 2, powered, 1);
211 data[1] = db9_saturn_read_sub(port, type) << 4;
212 db9_saturn_write_sub(port, type, 1, powered, 1);
213 data[1] |= db9_saturn_read_sub(port, type);
214 db9_saturn_write_sub(port, type, 3, powered, 1);
215 /* data[2] |= db9_saturn_read_sub(port, type); */
217 return data[0] = 0x02;
219 /* 0001 : analog controller or multitap */
220 db9_saturn_write_sub(port, type, 2, powered, 0);
221 udelay(DB9_SATURN_DELAY);
222 data[0] = db9_saturn_read_analog(port, type, powered);
223 if (data[0] != 0x41) {
224 /* read analog controller */
225 for (i = 0; i < (data[0] & 0x0f); i++)
226 data[i + 1] = db9_saturn_read_analog(port, type, powered);
227 db9_saturn_write_sub(port, type, 3, powered, 0);
231 if (db9_saturn_read_analog(port, type, powered) != 0x60)
232 return data[0] = 0xff;
233 for (i = 0; i < 60; i += 10) {
234 data[i] = db9_saturn_read_analog(port, type, powered);
237 for (j = 0; j < (data[i] & 0x0f); j++)
238 data[i + j + 1] = db9_saturn_read_analog(port, type, powered);
240 db9_saturn_write_sub(port, type, 3, powered, 0);
245 db9_saturn_write_sub(port, type, 2, powered, 0);
246 udelay(DB9_SATURN_DELAY);
247 tmp = db9_saturn_read_analog(port, type, powered);
249 for (i = 0; i < 3; i++)
250 data[i + 1] = db9_saturn_read_analog(port, type, powered);
251 db9_saturn_write_sub(port, type, 3, powered, 0);
252 return data[0] = 0xe3;
260 * db9_saturn_report() analyzes packet and reports.
262 static int db9_saturn_report(unsigned char id, unsigned char data[60], struct input_dev *dev, int n, int max_pads)
266 tmp = (id == 0x41) ? 60 : 10;
267 for (j = 0; (j < tmp) && (n < max_pads); j += 10, n++) {
269 case 0x16: /* multi controller (analog 4 axis) */
270 input_report_abs(dev + n, db9_abs[5], data[j + 6]);
271 case 0x15: /* mission stick (analog 3 axis) */
272 input_report_abs(dev + n, db9_abs[3], data[j + 4]);
273 input_report_abs(dev + n, db9_abs[4], data[j + 5]);
274 case 0x13: /* racing controller (analog 1 axis) */
275 input_report_abs(dev + n, db9_abs[2], data[j + 3]);
276 case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */
277 case 0x02: /* digital pad (digital 2 axis + buttons) */
278 input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
279 input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
280 for (i = 0; i < 9; i++)
281 input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
283 case 0x19: /* mission stick x2 (analog 6 axis + buttons) */
284 input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
285 input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16));
286 for (i = 0; i < 9; i++)
287 input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]);
288 input_report_abs(dev + n, db9_abs[2], data[j + 3]);
289 input_report_abs(dev + n, db9_abs[3], data[j + 4]);
290 input_report_abs(dev + n, db9_abs[4], data[j + 5]);
292 input_report_abs(dev + n, db9_abs[8], (data[j + 6] & 128 ? 0 : 1) - (data[j + 6] & 64 ? 0 : 1));
293 input_report_abs(dev + n, db9_abs[9], (data[j + 6] & 32 ? 0 : 1) - (data[j + 6] & 16 ? 0 : 1));
295 input_report_abs(dev + n, db9_abs[6], data[j + 7]);
296 input_report_abs(dev + n, db9_abs[7], data[j + 8]);
297 input_report_abs(dev + n, db9_abs[5], data[j + 9]);
299 case 0xd3: /* sankyo ff (analog 1 axis + stop btn) */
300 input_report_key(dev + n, BTN_A, data[j + 3] & 0x80);
301 input_report_abs(dev + n, db9_abs[2], data[j + 3] & 0x7f);
303 case 0xe3: /* shuttle mouse (analog 2 axis + buttons. signed value) */
304 input_report_key(dev + n, BTN_START, data[j + 1] & 0x08);
305 input_report_key(dev + n, BTN_A, data[j + 1] & 0x04);
306 input_report_key(dev + n, BTN_C, data[j + 1] & 0x02);
307 input_report_key(dev + n, BTN_B, data[j + 1] & 0x01);
308 input_report_abs(dev + n, db9_abs[2], data[j + 2] ^ 0x80);
309 input_report_abs(dev + n, db9_abs[3], (0xff-(data[j + 3] ^ 0x80))+1); /* */
312 default: /* no pad */
313 input_report_abs(dev + n, db9_abs[0], 0);
314 input_report_abs(dev + n, db9_abs[1], 0);
315 for (i = 0; i < 9; i++)
316 input_report_key(dev + n, db9_cd32_btn[i], 0);
323 static int db9_saturn(int mode, struct parport *port, struct input_dev *dev)
325 unsigned char id, data[60];
326 int type, n, max_pads;
338 case DB9_SATURN_DPP_2:
345 max_pads = min(db9_max_pads[mode], DB9_MAX_DEVICES);
346 for (tmp = 0, i = 0; i < n; i++) {
347 id = db9_saturn_read_packet(port, data, type + i, 1);
348 tmp = db9_saturn_report(id, data, dev, tmp, max_pads);
353 static void db9_timer(unsigned long private)
355 struct db9 *db9 = (void *) private;
356 struct parport *port = db9->pd->port;
357 struct input_dev *dev = db9->dev;
361 case DB9_MULTI_0802_2:
363 data = parport_read_data(port) >> 3;
365 input_report_abs(dev + 1, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
366 input_report_abs(dev + 1, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
367 input_report_key(dev + 1, BTN_TRIGGER, ~data & DB9_FIRE1);
371 data = parport_read_status(port) >> 3;
373 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
374 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
375 input_report_key(dev, BTN_TRIGGER, data & DB9_FIRE1);
378 case DB9_MULTI_STICK:
380 data = parport_read_data(port);
382 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
383 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
384 input_report_key(dev, BTN_TRIGGER, ~data & DB9_FIRE1);
387 case DB9_MULTI2_STICK:
389 data = parport_read_data(port);
391 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
392 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
393 input_report_key(dev, BTN_TRIGGER, ~data & DB9_FIRE1);
394 input_report_key(dev, BTN_THUMB, ~data & DB9_FIRE2);
397 case DB9_GENESIS_PAD:
399 parport_write_control(port, DB9_NOSELECT);
400 data = parport_read_data(port);
402 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
403 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
404 input_report_key(dev, BTN_B, ~data & DB9_FIRE1);
405 input_report_key(dev, BTN_C, ~data & DB9_FIRE2);
407 parport_write_control(port, DB9_NORMAL);
408 data=parport_read_data(port);
410 input_report_key(dev, BTN_A, ~data & DB9_FIRE1);
411 input_report_key(dev, BTN_START, ~data & DB9_FIRE2);
414 case DB9_GENESIS5_PAD:
416 parport_write_control(port, DB9_NOSELECT);
417 data=parport_read_data(port);
419 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
420 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
421 input_report_key(dev, BTN_B, ~data & DB9_FIRE1);
422 input_report_key(dev, BTN_C, ~data & DB9_FIRE2);
424 parport_write_control(port, DB9_NORMAL);
425 data=parport_read_data(port);
427 input_report_key(dev, BTN_A, ~data & DB9_FIRE1);
428 input_report_key(dev, BTN_X, ~data & DB9_FIRE2);
429 input_report_key(dev, BTN_Y, ~data & DB9_LEFT);
430 input_report_key(dev, BTN_START, ~data & DB9_RIGHT);
433 case DB9_GENESIS6_PAD:
435 parport_write_control(port, DB9_NOSELECT); /* 1 */
436 udelay(DB9_GENESIS6_DELAY);
437 data=parport_read_data(port);
439 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
440 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
441 input_report_key(dev, BTN_B, ~data & DB9_FIRE1);
442 input_report_key(dev, BTN_C, ~data & DB9_FIRE2);
444 parport_write_control(port, DB9_NORMAL);
445 udelay(DB9_GENESIS6_DELAY);
446 data=parport_read_data(port);
448 input_report_key(dev, BTN_A, ~data & DB9_FIRE1);
449 input_report_key(dev, BTN_START, ~data & DB9_FIRE2);
451 parport_write_control(port, DB9_NOSELECT); /* 2 */
452 udelay(DB9_GENESIS6_DELAY);
453 parport_write_control(port, DB9_NORMAL);
454 udelay(DB9_GENESIS6_DELAY);
455 parport_write_control(port, DB9_NOSELECT); /* 3 */
456 udelay(DB9_GENESIS6_DELAY);
457 data=parport_read_data(port);
459 input_report_key(dev, BTN_X, ~data & DB9_LEFT);
460 input_report_key(dev, BTN_Y, ~data & DB9_DOWN);
461 input_report_key(dev, BTN_Z, ~data & DB9_UP);
462 input_report_key(dev, BTN_MODE, ~data & DB9_RIGHT);
464 parport_write_control(port, DB9_NORMAL);
465 udelay(DB9_GENESIS6_DELAY);
466 parport_write_control(port, DB9_NOSELECT); /* 4 */
467 udelay(DB9_GENESIS6_DELAY);
468 parport_write_control(port, DB9_NORMAL);
473 case DB9_SATURN_DPP_2:
475 db9_saturn(db9->mode, port, dev);
480 data=parport_read_data(port);
482 input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
483 input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
485 parport_write_control(port, 0x0a);
487 for (i = 0; i < 7; i++) {
488 data = parport_read_data(port);
489 parport_write_control(port, 0x02);
490 parport_write_control(port, 0x0a);
491 input_report_key(dev, db9_cd32_btn[i], ~data & DB9_FIRE2);
494 parport_write_control(port, 0x00);
500 mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME);
503 static int db9_open(struct input_dev *dev)
505 struct db9 *db9 = dev->private;
506 struct parport *port = db9->pd->port;
509 err = down_interruptible(&db9->sem);
514 parport_claim(db9->pd);
515 parport_write_data(port, 0xff);
516 if (db9_reverse[db9->mode]) {
517 parport_data_reverse(port);
518 parport_write_control(port, DB9_NORMAL);
520 mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME);
527 static void db9_close(struct input_dev *dev)
529 struct db9 *db9 = dev->private;
530 struct parport *port = db9->pd->port;
534 del_timer_sync(&db9->timer);
535 parport_write_control(port, 0x00);
536 parport_data_forward(port);
537 parport_release(db9->pd);
542 static struct db9 __init *db9_probe(int *config, int nargs)
552 printk(KERN_ERR "db9.c: Device type must be specified.\n");
556 if (config[1] < 1 || config[1] >= DB9_MAX_PAD || !db9_buttons[config[1]]) {
557 printk(KERN_ERR "db9.c: bad config\n");
561 pp = parport_find_number(config[0]);
563 printk(KERN_ERR "db9.c: no such parport\n");
567 if (db9_bidirectional[config[1]]) {
568 if (!(pp->modes & PARPORT_MODE_TRISTATE)) {
569 printk(KERN_ERR "db9.c: specified parport is not bidirectional\n");
570 parport_put_port(pp);
575 if (!(db9 = kzalloc(sizeof(struct db9), GFP_KERNEL))) {
576 parport_put_port(pp);
580 init_MUTEX(&db9->sem);
581 db9->mode = config[1];
582 init_timer(&db9->timer);
583 db9->timer.data = (long) db9;
584 db9->timer.function = db9_timer;
586 db9->pd = parport_register_device(pp, "db9", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
587 parport_put_port(pp);
590 printk(KERN_ERR "db9.c: parport busy already - lp.o loaded?\n");
595 for (i = 0; i < (min(db9_max_pads[db9->mode], DB9_MAX_DEVICES)); i++) {
597 sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i);
599 db9->dev[i].private = db9;
600 db9->dev[i].open = db9_open;
601 db9->dev[i].close = db9_close;
603 db9->dev[i].name = db9_name[db9->mode];
604 db9->dev[i].phys = db9->phys[i];
605 db9->dev[i].id.bustype = BUS_PARPORT;
606 db9->dev[i].id.vendor = 0x0002;
607 db9->dev[i].id.product = config[1];
608 db9->dev[i].id.version = 0x0100;
610 db9->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
611 for (j = 0; j < db9_buttons[db9->mode]; j++)
612 set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit);
613 for (j = 0; j < db9_num_axis[db9->mode]; j++) {
614 set_bit(db9_abs[j], db9->dev[i].absbit);
616 db9->dev[i].absmin[db9_abs[j]] = -1;
617 db9->dev[i].absmax[db9_abs[j]] = 1;
619 db9->dev[i].absmin[db9_abs[j]] = 1;
620 db9->dev[i].absmax[db9_abs[j]] = 255;
621 db9->dev[i].absflat[db9_abs[j]] = 0;
624 input_register_device(db9->dev + i);
625 printk(KERN_INFO "input: %s on %s\n", db9->dev[i].name, db9->pd->port->name);
631 static int __init db9_init(void)
633 db9_base[0] = db9_probe(db9, db9_nargs);
634 db9_base[1] = db9_probe(db9_2, db9_nargs_2);
635 db9_base[2] = db9_probe(db9_3, db9_nargs_3);
637 if (db9_base[0] || db9_base[1] || db9_base[2])
643 static void __exit db9_exit(void)
647 for (i = 0; i < 3; i++)
649 for (j = 0; j < min(db9_max_pads[db9_base[i]->mode], DB9_MAX_DEVICES); j++)
650 input_unregister_device(db9_base[i]->dev + j);
651 parport_unregister_device(db9_base[i]->pd);
655 module_init(db9_init);
656 module_exit(db9_exit);