diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-08-28 22:00:09 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-08-28 22:00:09 +0000 |
commit | 1a1d77dd589de5a567fa95e36aa6999c704ceca4 (patch) | |
tree | 141e31f89f18b9fe0831f31852e0435ceaccafc5 /drivers/char/joystick | |
parent | fb9c690a18b3d66925a65b17441c37fa14d4370b (diff) |
Merge with 2.4.0-test7.
Diffstat (limited to 'drivers/char/joystick')
-rw-r--r-- | drivers/char/joystick/Config.in | 60 | ||||
-rw-r--r-- | drivers/char/joystick/Makefile | 16 | ||||
-rw-r--r-- | drivers/char/joystick/amijoy.c | 21 | ||||
-rw-r--r-- | drivers/char/joystick/db9.c | 104 | ||||
-rw-r--r-- | drivers/char/joystick/gamecon.c | 28 | ||||
-rw-r--r-- | drivers/char/joystick/iforce.c | 342 | ||||
-rw-r--r-- | drivers/char/joystick/ns558.c | 38 | ||||
-rw-r--r-- | drivers/char/joystick/sidewinder.c | 6 | ||||
-rw-r--r-- | drivers/char/joystick/spaceball.c | 47 |
9 files changed, 520 insertions, 142 deletions
diff --git a/drivers/char/joystick/Config.in b/drivers/char/joystick/Config.in index b020f1728..e99afa949 100644 --- a/drivers/char/joystick/Config.in +++ b/drivers/char/joystick/Config.in @@ -5,50 +5,50 @@ mainmenu_option next_comment comment 'Joysticks' -tristate 'Joystick support' CONFIG_JOYSTICK +dep_mbool 'Joystick support' CONFIG_JOYSTICK $CONFIG_INPUT if [ "$CONFIG_JOYSTICK" != "n" ]; then - define_tristate CONFIG_INPUT_JOYDEV $CONFIG_JOYSTICK - comment 'Game port support' - dep_tristate ' ns558 gameports' CONFIG_INPUT_NS558 $CONFIG_JOYSTICK - dep_tristate ' PDPI Lightning 4 gamecard' CONFIG_INPUT_LIGHTNING $CONFIG_JOYSTICK - dep_tristate ' Aureal Vortex and Trident 4DWave gameports' CONFIG_INPUT_PCIGAME $CONFIG_JOYSTICK + dep_tristate ' ns558 gameports' CONFIG_INPUT_NS558 $CONFIG_INPUT + dep_tristate ' PDPI Lightning 4 gamecard' CONFIG_INPUT_LIGHTNING $CONFIG_INPUT + dep_tristate ' Aureal Vortex and Trident 4DWave gameports' CONFIG_INPUT_PCIGAME $CONFIG_INPUT comment 'Gameport joysticks' - dep_tristate ' Classic PC analog joysticks and gamepads' CONFIG_INPUT_ANALOG $CONFIG_JOYSTICK - dep_tristate ' Assasin 3D and MadCatz Panther devices' CONFIG_INPUT_A3D $CONFIG_JOYSTICK - dep_tristate ' Logitech ADI digital joysticks and gamepads' CONFIG_INPUT_ADI $CONFIG_JOYSTICK - dep_tristate ' Creative Labs Blaster Cobra gamepad' CONFIG_INPUT_COBRA $CONFIG_JOYSTICK - dep_tristate ' Genius Flight2000 Digital joysticks and gamepads' CONFIG_INPUT_GF2K $CONFIG_JOYSTICK - dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_INPUT_GRIP $CONFIG_JOYSTICK - dep_tristate ' InterAct digital joysticks and gamepads' CONFIG_INPUT_INTERACT $CONFIG_JOYSTICK - dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_INPUT_TMDC $CONFIG_JOYSTICK - dep_tristate ' Microsoft SideWinder digital joysticks and gamepads' CONFIG_INPUT_SIDEWINDER $CONFIG_JOYSTICK + dep_tristate ' Classic PC analog joysticks and gamepads' CONFIG_INPUT_ANALOG $CONFIG_INPUT + dep_tristate ' Assasin 3D and MadCatz Panther devices' CONFIG_INPUT_A3D $CONFIG_INPUT + dep_tristate ' Logitech ADI digital joysticks and gamepads' CONFIG_INPUT_ADI $CONFIG_INPUT + dep_tristate ' Creative Labs Blaster Cobra gamepad' CONFIG_INPUT_COBRA $CONFIG_INPUT + dep_tristate ' Genius Flight2000 Digital joysticks and gamepads' CONFIG_INPUT_GF2K $CONFIG_INPUT + dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_INPUT_GRIP $CONFIG_INPUT + dep_tristate ' InterAct digital joysticks and gamepads' CONFIG_INPUT_INTERACT $CONFIG_INPUT + dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_INPUT_TMDC $CONFIG_INPUT + dep_tristate ' Microsoft SideWinder digital joysticks and gamepads' CONFIG_INPUT_SIDEWINDER $CONFIG_INPUT comment 'Serial port support' - dep_tristate ' Serial port input line discipline' CONFIG_INPUT_SERPORT $CONFIG_JOYSTICK + dep_tristate ' Serial port input line discipline' CONFIG_INPUT_SERPORT $CONFIG_INPUT comment 'Serial port joysticks' - dep_tristate ' Logitech WingMan Warrior joystick' CONFIG_INPUT_WARRIOR $CONFIG_JOYSTICK - dep_tristate ' LogiCad3d Magellan/SpaceMouse 6dof controller' CONFIG_INPUT_MAGELLAN $CONFIG_JOYSTICK - dep_tristate ' SpaceTec SpaceOrb/Avenger 6dof controller' CONFIG_INPUT_SPACEORB $CONFIG_JOYSTICK - dep_tristate ' SpaceTec SpaceBall 4000 FLX 6dof controller' CONFIG_INPUT_SPACEBALL $CONFIG_JOYSTICK - dep_tristate ' I-Force joysticks/wheels' CONFIG_INPUT_IFORCE_232 $CONFIG_JOYSTICK - if [ "$CONFIG_INPUT_IFORCE_232" != "n" ]; then - define_tristate CONFIG_INPUT_IFORCE $CONFIG_INPUT_IFORCE_232 - fi + dep_tristate ' Logitech WingMan Warrior joystick' CONFIG_INPUT_WARRIOR $CONFIG_INPUT + dep_tristate ' LogiCad3d Magellan/SpaceMouse 6dof controller' CONFIG_INPUT_MAGELLAN $CONFIG_INPUT + dep_tristate ' SpaceTec SpaceOrb/Avenger 6dof controller' CONFIG_INPUT_SPACEORB $CONFIG_INPUT + dep_tristate ' SpaceTec SpaceBall 4000 FLX 6dof controller' CONFIG_INPUT_SPACEBALL $CONFIG_INPUT + dep_tristate ' I-Force/Serial controllers' CONFIG_INPUT_IFORCE_232 $CONFIG_INPUT + dep_tristate ' I-Force/USB controllers' CONFIG_INPUT_IFORCE_USB $CONFIG_INPUT $CONFIG_USB - if [ "$CONFIG_PARPORT" != "n" ]; then comment 'Parallel port joysticks' - dep_tristate ' Multisystem, Sega Genesis, Saturn joysticks and gamepads' CONFIG_INPUT_DB9 $CONFIG_JOYSTICK - dep_tristate ' Multisystem, NES, SNES, N64, PSX joysticks and gamepads' CONFIG_INPUT_GAMECON $CONFIG_JOYSTICK - dep_tristate ' Multisystem joysticks via TurboGraFX device' CONFIG_INPUT_TURBOGRAFX $CONFIG_JOYSTICK + if [ "$CONFIG_PARPORT" != "n" ]; then + dep_tristate ' Multisystem, Sega Genesis, Saturn joysticks and gamepads' CONFIG_INPUT_DB9 $CONFIG_INPUT $CONFIG_PARPORT + dep_tristate ' Multisystem, NES, SNES, N64, PSX joysticks and gamepads' CONFIG_INPUT_GAMECON $CONFIG_INPUT $CONFIG_PARPORT + dep_tristate ' Multisystem joysticks via TurboGraFX device' CONFIG_INPUT_TURBOGRAFX $CONFIG_INPUT $CONFIG_PARPORT + else + comment ' Parport support is needed for parallel port joysticks' fi if [ "$CONFIG_AMIGA" = "y" ]; then comment 'System joysticks' - dep_tristate ' Amiga joysticks' CONFIG_INPUT_AMIJOY $CONFIG_JOYSTICK + dep_tristate ' Amiga joysticks' CONFIG_INPUT_AMIJOY $CONFIG_INPUT fi +else + comment 'Input core support is needed for joysticks' fi - + endmenu diff --git a/drivers/char/joystick/Makefile b/drivers/char/joystick/Makefile index ae6a42cb8..e8eadc870 100644 --- a/drivers/char/joystick/Makefile +++ b/drivers/char/joystick/Makefile @@ -19,6 +19,19 @@ O_OBJS := export-objs := serio.o gameport.o +# I-Force may need both USB and RS-232 + +ifeq ($(CONFIG_INPUT_IFORCE_232),m) + ifeq ($(CONFIG_INPUT_IFORCE_USB),y) + CONFIG_INPUT_IFORCE_USB := m + endif +endif +ifeq ($(CONFIG_INPUT_IFORCE_USB),m) + ifeq ($(CONFIG_INPUT_IFORCE_232),y) + CONFIG_INPUT_IFORCE_232 := m + endif +endif + # Object file lists. obj-y := @@ -38,7 +51,8 @@ obj-$(CONFIG_INPUT_WARRIOR) += warrior.o serio.o obj-$(CONFIG_INPUT_MAGELLAN) += magellan.o serio.o obj-$(CONFIG_INPUT_SPACEORB) += spaceorb.o serio.o obj-$(CONFIG_INPUT_SPACEBALL) += spaceball.o serio.o -obj-$(CONFIG_INPUT_IFORCE_232) += serio.o +obj-$(CONFIG_INPUT_IFORCE_232) += iforce.o serio.o +obj-$(CONFIG_INPUT_IFORCE_USB) += iforce.o obj-$(CONFIG_INPUT_ANALOG) += analog.o gameport.o obj-$(CONFIG_INPUT_A3D) += a3d.o gameport.o diff --git a/drivers/char/joystick/amijoy.c b/drivers/char/joystick/amijoy.c index f17aeda24..452d173d7 100644 --- a/drivers/char/joystick/amijoy.c +++ b/drivers/char/joystick/amijoy.c @@ -1,5 +1,5 @@ /* - * $Id: amijoy.c,v 1.4 2000/05/29 10:39:54 vojtech Exp $ + * $Id: amijoy.c,v 1.5 2000/07/21 22:52:24 vojtech Exp $ * * Copyright (c) 1998-2000 Vojtech Pavlik * @@ -77,7 +77,7 @@ static int amijoy_open(struct input_dev *dev) return 0; if (request_irq(IRQ_AMIGA_VERTB, amijoy_interrupt, 0, "amijoy", NULL)) { - amijoy_used--; + (*used)--; printk(KERN_ERR "amijoy.c: Can't allocate irq %d\n", amijoy_irq); return -EBUSY; } @@ -89,7 +89,7 @@ static void amijoy_close(struct input_dev *dev) { int *used = dev->private; - if (!--(*port->used)) + if (!--(*used)) free_irq(IRQ_AMIGA_VERTB, amijoy_interrupt); } @@ -112,13 +112,21 @@ static int __init amijoy_init(void) for (i = 0; i < 2; i++) if (amijoy[i]) { + if (!request_mem_region(CUSTOM_PHYSADDR+10+i*2, 2, + amijoy [Denise]")) { + if (i == 1 && amijoy[0]) { + input_unregister_device(amijoy_dev); + release_mem_region(CUSTOM_PHYSADDR+10, 2); + } + return -EBUSY; + } amijoy_dev[i].open = amijoy_open; amijoy_dev[i].close = amijoy_close; amijoy_dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); amijoy_dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); amijoy_dev[i].keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) { amijoy_dev[i].absmin[ABS_X + j] = -1; amijoy_dev[i].absmax[ABS_X + j] = 1; } @@ -134,6 +142,7 @@ static int __init amijoy_init(void) input_register_device(amijoy_dev + i); printk(KERN_INFO "input%d: %s at joy%ddat\n", amijoy_dev[i].number, amijoy_name, i); } + return 0; } static void _exit amijoy_exit(void) @@ -141,8 +150,10 @@ static void _exit amijoy_exit(void) int i; for (i = 0; i < 2; i++) - if (amijoy[i]) + if (amijoy[i]) { input_unregister_device(amijoy_dev + i); + release_mem_region(CUSTOM_PHYSADDR+10+i*2, 2); + } } module_init(amijoy_init); diff --git a/drivers/char/joystick/db9.c b/drivers/char/joystick/db9.c index f9edd0755..4277e7f3d 100644 --- a/drivers/char/joystick/db9.c +++ b/drivers/char/joystick/db9.c @@ -1,5 +1,5 @@ /* - * $Id: db9.c,v 1.5 2000/05/29 20:39:38 vojtech Exp $ + * $Id: db9.c,v 1.6 2000/06/25 10:57:50 vojtech Exp $ * * Copyright (c) 1999 Vojtech Pavlik * @@ -95,7 +95,7 @@ static short db9_genesis_btn[] = { BTN_START, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, static short db9_cd32_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_START }; static char db9_buttons[DB9_MAX_PAD] = { 0, 1, 2, 4, 0, 6, 8, 8, 1, 1, 7 }; -static short *db9_btn[DB9_MAX_PAD] = { db9_multi_btn, db9_multi_btn, db9_genesis_btn, NULL, db9_genesis_btn, +static short *db9_btn[DB9_MAX_PAD] = { NULL, db9_multi_btn, db9_multi_btn, db9_genesis_btn, NULL, db9_genesis_btn, db9_genesis_btn, db9_cd32_btn, db9_multi_btn, db9_multi_btn, db9_cd32_btn }; static char *db9_name[DB9_MAX_PAD] = { NULL, "Multisystem joystick", "Multisystem joystick (2 fire)", "Genesis pad", NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick", @@ -113,36 +113,36 @@ static void db9_timer(unsigned long private) data = parport_read_data(port) >> 3; - input_report_abs(dev + 1, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev + 1, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev + 1, BTN_TRIGGER, ~data&DB9_FIRE1); + input_report_abs(dev + 1, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev + 1, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev + 1, BTN_TRIGGER, ~data & DB9_FIRE1); case DB9_MULTI_0802: data = parport_read_status(port) >> 3; - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_TRIGGER, data&DB9_FIRE1); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_TRIGGER, data & DB9_FIRE1); break; case DB9_MULTI_STICK: data = parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_TRIGGER, ~data&DB9_FIRE1); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_TRIGGER, ~data & DB9_FIRE1); break; case DB9_MULTI2_STICK: data = parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_TRIGGER, ~data&DB9_FIRE1); - input_report_key(dev, BTN_THUMB, ~data&DB9_FIRE2); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_TRIGGER, ~data & DB9_FIRE1); + input_report_key(dev, BTN_THUMB, ~data & DB9_FIRE2); break; case DB9_GENESIS_PAD: @@ -150,16 +150,16 @@ static void db9_timer(unsigned long private) parport_write_control(port, DB9_NOSELECT); data = parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_B, ~data&DB9_FIRE1); - input_report_key(dev, BTN_C, ~data&DB9_FIRE2); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_B, ~data & DB9_FIRE1); + input_report_key(dev, BTN_C, ~data & DB9_FIRE2); parport_write_control(port, DB9_NORMAL); data=parport_read_data(port); - input_report_key(dev, BTN_A, ~data&DB9_FIRE1); - input_report_key(dev, BTN_START, ~data&DB9_FIRE2); + input_report_key(dev, BTN_A, ~data & DB9_FIRE1); + input_report_key(dev, BTN_START, ~data & DB9_FIRE2); break; case DB9_GENESIS5_PAD: @@ -167,18 +167,18 @@ static void db9_timer(unsigned long private) parport_write_control(port, DB9_NOSELECT); data=parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_B, ~data&DB9_FIRE1); - input_report_key(dev, BTN_C, ~data&DB9_FIRE2); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_B, ~data & DB9_FIRE1); + input_report_key(dev, BTN_C, ~data & DB9_FIRE2); parport_write_control(port, DB9_NORMAL); data=parport_read_data(port); - input_report_key(dev, BTN_A, ~data&DB9_FIRE1); - input_report_key(dev, BTN_X, ~data&DB9_FIRE2); - input_report_key(dev, BTN_Y, ~data&DB9_LEFT); - input_report_key(dev, BTN_START, ~data&DB9_RIGHT); + input_report_key(dev, BTN_A, ~data & DB9_FIRE1); + input_report_key(dev, BTN_X, ~data & DB9_FIRE2); + input_report_key(dev, BTN_Y, ~data & DB9_LEFT); + input_report_key(dev, BTN_START, ~data & DB9_RIGHT); break; case DB9_GENESIS6_PAD: @@ -187,17 +187,17 @@ static void db9_timer(unsigned long private) udelay(DB9_GENESIS6_DELAY); data=parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); - input_report_key(dev, BTN_B, ~data&DB9_FIRE1); - input_report_key(dev, BTN_C, ~data&DB9_FIRE2); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); + input_report_key(dev, BTN_B, ~data & DB9_FIRE1); + input_report_key(dev, BTN_C, ~data & DB9_FIRE2); parport_write_control(port, DB9_NORMAL); udelay(DB9_GENESIS6_DELAY); data=parport_read_data(port); - input_report_key(dev, BTN_A, ~data&DB9_FIRE1); - input_report_key(dev, BTN_X, ~data&DB9_FIRE2); + input_report_key(dev, BTN_A, ~data & DB9_FIRE1); + input_report_key(dev, BTN_X, ~data & DB9_FIRE2); parport_write_control(port, DB9_NOSELECT); /* 2 */ udelay(DB9_GENESIS6_DELAY); @@ -207,10 +207,10 @@ static void db9_timer(unsigned long private) udelay(DB9_GENESIS6_DELAY); data=parport_read_data(port); - input_report_key(dev, BTN_Y, ~data&DB9_LEFT); - input_report_key(dev, BTN_Z, ~data&DB9_DOWN); - input_report_key(dev, BTN_MODE, ~data&DB9_UP); - input_report_key(dev, BTN_START, ~data&DB9_RIGHT); + input_report_key(dev, BTN_Y, ~data & DB9_LEFT); + input_report_key(dev, BTN_Z, ~data & DB9_DOWN); + input_report_key(dev, BTN_MODE, ~data & DB9_UP); + input_report_key(dev, BTN_START, ~data & DB9_RIGHT); parport_write_control(port, DB9_NORMAL); udelay(DB9_GENESIS6_DELAY); @@ -224,32 +224,32 @@ static void db9_timer(unsigned long private) parport_write_control(port, DB9_SATURN0); data = parport_read_data(port); - input_report_key(dev, BTN_Y, ~data&DB9_LEFT); - input_report_key(dev, BTN_Z, ~data&DB9_DOWN); - input_report_key(dev, BTN_TL,~data&DB9_UP); - input_report_key(dev, BTN_TR,~data&DB9_RIGHT); + input_report_key(dev, BTN_Y, ~data & DB9_LEFT); + input_report_key(dev, BTN_Z, ~data & DB9_DOWN); + input_report_key(dev, BTN_TL, ~data & DB9_UP); + input_report_key(dev, BTN_TR, ~data & DB9_RIGHT); parport_write_control(port, DB9_SATURN2); data = parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); parport_write_control(port, DB9_NORMAL); data = parport_read_data(port); - input_report_key(dev, BTN_A, ~data&DB9_LEFT); - input_report_key(dev, BTN_B, ~data&DB9_UP); - input_report_key(dev, BTN_C, ~data&DB9_DOWN); - input_report_key(dev, BTN_X, ~data&DB9_RIGHT); + input_report_key(dev, BTN_A, ~data & DB9_LEFT); + input_report_key(dev, BTN_B, ~data & DB9_UP); + input_report_key(dev, BTN_C, ~data & DB9_DOWN); + input_report_key(dev, BTN_X, ~data & DB9_RIGHT); break; case DB9_CD32_PAD: data=parport_read_data(port); - input_report_abs(dev, ABS_X, (data&DB9_DOWN ?0:1) - (data&DB9_UP ?0:1)); - input_report_abs(dev, ABS_Y, (data&DB9_RIGHT?0:1) - (data&DB9_LEFT?0:1)); + input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); + input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); parport_write_control(port, 0x0a); @@ -257,7 +257,7 @@ static void db9_timer(unsigned long private) data = parport_read_data(port); parport_write_control(port, 0x02); parport_write_control(port, 0x0a); - input_report_key(dev, db9_cd32_btn[i], ~data&DB9_FIRE2); + input_report_key(dev, db9_cd32_btn[i], ~data & DB9_FIRE2); } parport_write_control(port, 0x00); diff --git a/drivers/char/joystick/gamecon.c b/drivers/char/joystick/gamecon.c index a92ef58a9..c1d37248f 100644 --- a/drivers/char/joystick/gamecon.c +++ b/drivers/char/joystick/gamecon.c @@ -1,5 +1,5 @@ /* - * $Id: gamecon.c,v 1.4 2000/05/29 21:08:45 vojtech Exp $ + * $Id: gamecon.c,v 1.5 2000/06/25 09:56:58 vojtech Exp $ * * Copyright (c) 1999-2000 Vojtech Pavlik * @@ -157,7 +157,7 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data) static unsigned char gc_nes_bytes[] = { 0, 1, 2, 3 }; static unsigned char gc_snes_bytes[] = { 8, 0, 2, 3, 9, 1, 10, 11 }; -static short gc_snes_btn[] = { BTN_A, BTN_B, BTN_START, BTN_SELECT, BTN_X, BTN_Y, BTN_TL, BTN_TR }; +static short gc_snes_btn[] = { BTN_A, BTN_B, BTN_SELECT, BTN_START, BTN_X, BTN_Y, BTN_TL, BTN_TR }; /* * gc_nes_read_packet() reads a NES/SNES packet. @@ -515,7 +515,7 @@ static struct gc __init *gc_probe(int *config) case GC_N64: for (j = 0; j < 10; j++) - set_bit(gc_n64_btn[j], gc->dev[j].keybit); + set_bit(gc_n64_btn[j], gc->dev[i].keybit); for (j = 0; j < 2; j++) { set_bit(ABS_X + j, gc->dev[i].absbit); @@ -530,18 +530,15 @@ static struct gc __init *gc_probe(int *config) break; case GC_SNES: - for (j = 0; j < 8; j++) - set_bit(gc_snes_btn[j], gc->dev[j].keybit); - break; - + for (j = 4; j < 8; j++) + set_bit(gc_snes_btn[j], gc->dev[i].keybit); case GC_NES: for (j = 0; j < 4; j++) - set_bit(gc_snes_btn[j], gc->dev[j].keybit); + set_bit(gc_snes_btn[j], gc->dev[i].keybit); break; case GC_MULTI2: set_bit(BTN_THUMB, gc->dev[i].keybit); - case GC_MULTI: set_bit(BTN_TRIGGER, gc->dev[i].keybit); break; @@ -656,12 +653,13 @@ void __exit gc_exit(void) { int i, j; - for (i = 0; i < 3; i++) { - for (j = 0; j < 5; j++) - if (gc_base[i]->pads[0] & gc_status_bit[j]) - input_unregister_device(gc_base[i]->dev + j); - parport_unregister_device(gc_base[i]->pd); - } + for (i = 0; i < 3; i++) + if (gc_base[i]) { + for (j = 0; j < 5; j++) + if (gc_base[i]->pads[0] & gc_status_bit[j]) + input_unregister_device(gc_base[i]->dev + j); + parport_unregister_device(gc_base[i]->pd); + } } module_init(gc_init); diff --git a/drivers/char/joystick/iforce.c b/drivers/char/joystick/iforce.c new file mode 100644 index 000000000..acb0bfe5b --- /dev/null +++ b/drivers/char/joystick/iforce.c @@ -0,0 +1,342 @@ +/* + * $Id: iforce.c,v 1.7 2000/06/04 14:03:36 vojtech Exp $ + * + * Copyright (c) 2000 Vojtech Pavlik + * + * USB/RS232 I-Force joysticks and wheels. + * + * Sponsored by SuSE + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so either by + * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include <linux/kernel.h> +#include <linux/malloc.h> +#include <linux/input.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/usb.h> +#include <linux/serio.h> +#include <linux/config.h> + +MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); +MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); + +#define USB_VENDOR_ID_LOGITECH 0x046d +#define USB_DEVICE_ID_LOGITECH_WMFORCE 0xc281 + +#define IFORCE_MAX_LENGTH 16 + +#if defined(CONFIG_INPUT_IFORCE_232) || defined(CONFIG_INPUT_IFORCE_232_MODULE) +#define IFORCE_232 +#endif +#if defined(CONFIG_INPUT_IFORCE_USB) || defined(CONFIG_INPUT_IFORCE_USB_MODULE) +#define IFORCE_USB +#endif + +struct iforce { + signed char data[IFORCE_MAX_LENGTH]; + struct input_dev dev; + struct urb irq; + int open; + int idx, pkt, len, id; + unsigned char csum; +}; + +static struct { + __s32 x; + __s32 y; +} iforce_hat_to_axis[16] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; + +static char *iforce_name = "I-Force joystick/wheel"; + +static void iforce_process_packet(struct input_dev *dev, unsigned char id, int idx, unsigned char *data) +{ + switch (id) { + + case 1: /* joystick position data */ + case 3: /* wheel position data */ + + if (id == 1) { + input_report_abs(dev, ABS_X, (__s16) (((__s16)data[1] << 8) | data[0])); + input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[3] << 8) | data[2])); + input_report_abs(dev, ABS_THROTTLE, 255 - data[4]); + } else { + input_report_abs(dev, ABS_WHEEL, (__s16) (((__s16)data[1] << 8) | data[0])); + input_report_abs(dev, ABS_GAS, 255 - data[2]); + input_report_abs(dev, ABS_BRAKE, 255 - data[3]); + } + + input_report_abs(dev, ABS_HAT0X, iforce_hat_to_axis[data[6] >> 4].x); + input_report_abs(dev, ABS_HAT0Y, iforce_hat_to_axis[data[6] >> 4].y); + + input_report_key(dev, BTN_TRIGGER, data[5] & 0x01); + input_report_key(dev, BTN_TOP, data[5] & 0x02); + input_report_key(dev, BTN_THUMB, data[5] & 0x04); + input_report_key(dev, BTN_TOP2, data[5] & 0x08); + input_report_key(dev, BTN_BASE, data[5] & 0x10); + input_report_key(dev, BTN_BASE2, data[5] & 0x20); + input_report_key(dev, BTN_BASE3, data[5] & 0x40); + input_report_key(dev, BTN_BASE4, data[5] & 0x80); + input_report_key(dev, BTN_BASE5, data[6] & 0x01); + input_report_key(dev, BTN_A, data[6] & 0x02); + input_report_key(dev, BTN_B, data[6] & 0x04); + input_report_key(dev, BTN_C, data[6] & 0x08); + break; + + case 2: /* force feedback effect status */ + break; + } +} + +#ifdef IFORCE_USB + +static int iforce_open(struct input_dev *dev) +{ + struct iforce *iforce = dev->private; + + if (dev->idbus == BUS_USB && !iforce->open++) + if (usb_submit_urb(&iforce->irq)) + return -EIO; + + return 0; +} + +static void iforce_close(struct input_dev *dev) +{ + struct iforce *iforce = dev->private; + + if (dev->idbus == BUS_USB && !--iforce->open) + usb_unlink_urb(&iforce->irq); +} + +#endif + +static void iforce_input_setup(struct iforce *iforce) +{ + int i; + + iforce->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + iforce->dev.keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_TOP) | BIT(BTN_THUMB) | BIT(BTN_TOP2) | + BIT(BTN_BASE) | BIT(BTN_BASE2) | BIT(BTN_BASE3) | BIT(BTN_BASE4) | BIT(BTN_BASE5); + iforce->dev.keybit[LONG(BTN_GAMEPAD)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C); + iforce->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) + | BIT(ABS_WHEEL) | BIT(ABS_GAS) | BIT(ABS_BRAKE); + + for (i = ABS_X; i <= ABS_Y; i++) { + iforce->dev.absmax[i] = 1920; + iforce->dev.absmin[i] = -1920; + iforce->dev.absflat[i] = 128; + iforce->dev.absfuzz[i] = 16; + } + + for (i = ABS_THROTTLE; i <= ABS_RUDDER; i++) { + iforce->dev.absmax[i] = 255; + iforce->dev.absmin[i] = 0; + } + + for (i = ABS_HAT0X; i <= ABS_HAT0Y; i++) { + iforce->dev.absmax[i] = 1; + iforce->dev.absmin[i] = -1; + } + + iforce->dev.private = iforce; + +#ifdef IFORCE_USB + iforce->dev.open = iforce_open; + iforce->dev.close = iforce_close; +#endif + + input_register_device(&iforce->dev); +} + +#ifdef IFORCE_USB + +static void iforce_usb_irq(struct urb *urb) +{ + struct iforce *iforce = urb->context; + if (urb->status) return; + iforce_process_packet(&iforce->dev, iforce->data[0], 8, iforce->data + 1); +} + +static void *iforce_usb_probe(struct usb_device *dev, unsigned int ifnum) +{ + struct usb_endpoint_descriptor *endpoint; + struct iforce *iforce; + + if (dev->descriptor.idVendor != USB_VENDOR_ID_LOGITECH || + dev->descriptor.idProduct != USB_DEVICE_ID_LOGITECH_WMFORCE) + return NULL; + + endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0; + + if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL))) return NULL; + memset(iforce, 0, sizeof(struct iforce)); + + iforce->dev.name = iforce_name; + iforce->dev.idbus = BUS_USB; + iforce->dev.idvendor = dev->descriptor.idVendor; + iforce->dev.idproduct = dev->descriptor.idProduct; + iforce->dev.idversion = dev->descriptor.bcdDevice; + + FILL_INT_URB(&iforce->irq, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress), + iforce->data, 8, iforce_usb_irq, iforce, endpoint->bInterval); + + iforce_input_setup(iforce); + + printk(KERN_INFO "input%d: %s on usb%d:%d.%d\n", + iforce->dev.number, iforce_name, dev->bus->busnum, dev->devnum, ifnum); + + return iforce; +} + +static void iforce_usb_disconnect(struct usb_device *dev, void *ptr) +{ + struct iforce *iforce = ptr; + usb_unlink_urb(&iforce->irq); + input_unregister_device(&iforce->dev); + kfree(iforce); +} + +static struct usb_driver iforce_usb_driver = { + name: "iforce", + probe: iforce_usb_probe, + disconnect: iforce_usb_disconnect, +}; + +#endif + +#ifdef IFORCE_232 + +static void iforce_serio_irq(struct serio *serio, unsigned char data, unsigned int flags) +{ + struct iforce* iforce = serio->private; + + if (!iforce->pkt) { + if (data != 0x2b) { + return; + } + iforce->pkt = 1; + return; + } + + if (!iforce->id) { + if (data > 3) { + iforce->pkt = 0; + return; + } + iforce->id = data; + return; + } + + if (!iforce->len) { + if (data > IFORCE_MAX_LENGTH) { + iforce->pkt = 0; + iforce->id = 0; + return; + } + iforce->len = data; + return; + } + + if (iforce->idx < iforce->len) { + iforce->csum += iforce->data[iforce->idx++] = data; + return; + } + + if (iforce->idx == iforce->len) { + iforce_process_packet(&iforce->dev, iforce->id, iforce->idx, iforce->data); + iforce->pkt = 0; + iforce->id = 0; + iforce->len = 0; + iforce->idx = 0; + iforce->csum = 0; + } +} + +static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev) +{ + struct iforce *iforce; + + if (serio->type != (SERIO_RS232 | SERIO_IFORCE)) + return; + + if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL))) return; + memset(iforce, 0, sizeof(struct iforce)); + + iforce->dev.name = iforce_name; + iforce->dev.idbus = BUS_RS232; + iforce->dev.idvendor = SERIO_IFORCE; + iforce->dev.idproduct = 0x0001; + iforce->dev.idversion = 0x0100; + + serio->private = iforce; + + if (serio_open(serio, dev)) { + kfree(iforce); + return; + } + + iforce_input_setup(iforce); + + printk(KERN_INFO "input%d: %s on serio%d\n", + iforce->dev.number, iforce_name, serio->number); +} + +static void iforce_serio_disconnect(struct serio *serio) +{ + struct iforce* iforce = serio->private; + input_unregister_device(&iforce->dev); + serio_close(serio); + kfree(iforce); +} + +static struct serio_dev iforce_serio_dev = { + interrupt: iforce_serio_irq, + connect: iforce_serio_connect, + disconnect: iforce_serio_disconnect, +}; + +#endif + +static int __init iforce_init(void) +{ +#ifdef IFORCE_USB + usb_register(&iforce_usb_driver); +#endif +#ifdef IFORCE_232 + serio_register_device(&iforce_serio_dev); +#endif + return 0; +} + +static void __exit iforce_exit(void) +{ +#ifdef IFORCE_USB + usb_deregister(&iforce_usb_driver); +#endif +#ifdef IFORCE_232 + serio_unregister_device(&iforce_serio_dev); +#endif +} + +module_init(iforce_init); +module_exit(iforce_exit); diff --git a/drivers/char/joystick/ns558.c b/drivers/char/joystick/ns558.c index f34a18640..9ea833113 100644 --- a/drivers/char/joystick/ns558.c +++ b/drivers/char/joystick/ns558.c @@ -1,5 +1,5 @@ /* - * $Id: ns558.c,v 1.11 2000/06/20 23:35:03 vojtech Exp $ + * $Id: ns558.c,v 1.16 2000/08/17 20:03:56 vojtech Exp $ * * Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999 Brian Gerst @@ -138,7 +138,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next) port->next = next; port->type = NS558_ISA; - port->gameport.io = io; + port->gameport.io = io & (-1 << i); port->gameport.size = (1 << i); request_region(port->gameport.io, port->gameport.size, "ns558-isa"); @@ -182,6 +182,7 @@ static int __devinit ns558_pci_probe(struct pci_dev *pdev, const struct pci_devi if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) { printk(KERN_ERR "Memory allocation failed.\n"); + release_region(ioport, iolen); return -ENOMEM; } memset(port, 0, sizeof(struct ns558)); @@ -208,6 +209,7 @@ static void __devexit ns558_pci_remove(struct pci_dev *pdev) { struct ns558 *port = (struct ns558 *)pdev->driver_data; release_region(port->gameport.io, port->gameport.size); + kfree(port); } static struct pci_driver ns558_pci_driver = { @@ -216,10 +218,16 @@ static struct pci_driver ns558_pci_driver = { probe: ns558_pci_probe, remove: ns558_pci_remove, }; +#else +static struct pci_driver ns558_pci_driver; #endif /* CONFIG_PCI */ -#ifdef CONFIG_ISAPNP +#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) +#define NSS558_ISAPNP +#endif + +#ifdef NSS558_ISAPNP /* * PnP IDs: * @@ -297,7 +305,7 @@ deactivate: int __init ns558_init(void) { int i = 0; -#ifdef CONFIG_ISAPNP +#ifdef NSS558_ISAPNP struct pci_dev *dev = NULL; struct pnp_devid *devid; #endif @@ -310,17 +318,10 @@ int __init ns558_init(void) ns558 = ns558_isa_probe(ns558_isa_portlist[i++], ns558); /* - * Probe for PCI ports. - */ -#ifdef CONFIG_PCI - pci_register_driver(&ns558_pci_driver); -#endif - -/* * Probe for PnP ports. */ -#ifdef CONFIG_ISAPNP +#ifdef NSS558_ISAPNP for (devid = pnp_devids; devid->vendor; devid++) { while ((dev = isapnp_find_dev(NULL, devid->vendor, devid->device, dev))) { ns558 = ns558_pnp_probe(dev, ns558); @@ -328,7 +329,14 @@ int __init ns558_init(void) } #endif - return -!ns558; +/* + * Probe for PCI ports. + */ + + if (!ns558 && pci_module_init(&ns558_pci_driver)) + return -ENODEV; + + return 0; } void __exit ns558_exit(void) @@ -339,7 +347,7 @@ void __exit ns558_exit(void) gameport_unregister_port(&port->gameport); switch (port->type) { -#ifdef CONFIG_ISAPNP +#ifdef NSS558_ISAPNP case NS558_PNP: if (port->dev->deactivate) port->dev->deactivate(port->dev); @@ -357,9 +365,7 @@ void __exit ns558_exit(void) port = port->next; } -#ifdef CONFIG_PCI pci_unregister_driver(&ns558_pci_driver); -#endif } module_init(ns558_init); diff --git a/drivers/char/joystick/sidewinder.c b/drivers/char/joystick/sidewinder.c index 861966b4e..85be9f8b1 100644 --- a/drivers/char/joystick/sidewinder.c +++ b/drivers/char/joystick/sidewinder.c @@ -1,5 +1,5 @@ /* - * $Id: sidewinder.c,v 1.14 2000/05/29 11:27:55 vojtech Exp $ + * $Id: sidewinder.c,v 1.16 2000/07/14 09:02:41 vojtech Exp $ * * Copyright (c) 1998-2000 Vojtech Pavlik * @@ -330,8 +330,8 @@ static int sw_parse(unsigned char *buf, struct sw *sw) if (sw_parity(GB(i*15,15))) return -1; - input_report_key(dev + i, ABS_X, GB(i*15+3,1) - GB(i*15+2,1)); - input_report_key(dev + i, ABS_Y, GB(i*15+0,1) - GB(i*15+1,1)); + input_report_abs(dev + i, ABS_X, GB(i*15+3,1) - GB(i*15+2,1)); + input_report_abs(dev + i, ABS_Y, GB(i*15+0,1) - GB(i*15+1,1)); for (j = 0; j < 10; j++) input_report_key(dev, sw_btn[SW_ID_GP][j], !GB(i*15+j+4,1)); diff --git a/drivers/char/joystick/spaceball.c b/drivers/char/joystick/spaceball.c index 4f5059330..8e2936f73 100644 --- a/drivers/char/joystick/spaceball.c +++ b/drivers/char/joystick/spaceball.c @@ -1,5 +1,5 @@ /* - * $Id: spaceball.c,v 1.6 2000/05/29 11:19:51 vojtech Exp $ + * $Id: spaceball.c,v 1.7 2000/06/24 11:55:40 vojtech Exp $ * * Copyright (c) 1999-2000 Vojtech Pavlik * @@ -46,7 +46,7 @@ */ #define JS_SBALL_MAX_LENGTH 128 -static int spaceball_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ }; +static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY }; static char *spaceball_name = "SpaceTec SpaceBall 4000 FLX"; /* @@ -70,10 +70,12 @@ static void spaceball_process_packet(struct spaceball* spaceball) { struct input_dev *dev = &spaceball->dev; unsigned char *data = spaceball->data; - int i, d; + int i; if (spaceball->idx < 2) return; + printk("%c %d\n", spaceball->data[0], spaceball->idx); + switch (spaceball->data[0]) { case '@': /* Reset packet */ @@ -84,17 +86,17 @@ static void spaceball_process_packet(struct spaceball* spaceball) break; case 'D': /* Ball data */ - if (spaceball->idx != 16) return; + if (spaceball->idx != 15) return; for (i = 0; i < 6; i++) { - d = ((data[2 * i + 3] << 8) | data[2 * i + 2]); - input_report_abs(dev, spaceball_axes[i], d - ((d & 0x8000) ? 0x10000 : 0)); + input_report_abs(dev, spaceball_axes[i], + (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); } break; case '.': /* Button data, part2 */ - if (spaceball->idx != 4) return; - input_report_key(dev, BTN_LEFT, data[2] & 1); - input_report_key(dev, BTN_RIGHT, data[2] & 2); + if (spaceball->idx != 3) return; + input_report_key(dev, BTN_0, data[2] & 1); + input_report_key(dev, BTN_1, data[2] & 2); break; case '?': /* Error packet */ @@ -118,22 +120,27 @@ static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigne switch (data) { case 0xd: - if (spaceball->idx) - spaceball_process_packet(spaceball); + spaceball_process_packet(spaceball); spaceball->idx = 0; spaceball->escape = 0; return; + case '^': + if (!spaceball->escape) { + spaceball->escape ^= 1; + return; + } + spaceball->escape = 0; case 'M': case 'Q': case 'S': - if (spaceball->escape) + if (spaceball->escape) { + spaceball->escape = 0; data = 0xd; - case '^': - spaceball->escape ^= 1; + } default: if (spaceball->escape) { - printk(KERN_WARNING "spaceball.c: Unknown escaped character: %#x\n", data); spaceball->escape = 0; + printk(KERN_WARNING "spaceball.c: Unknown escaped character: %#x (%c)\n", data, data); } if (spaceball->idx < JS_SBALL_MAX_LENGTH) spaceball->data[spaceball->idx++] = data; @@ -172,15 +179,15 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) memset(spaceball, 0, sizeof(struct spaceball)); spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - spaceball->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); + spaceball->dev.keybit[LONG(BTN_0)] = BIT(BTN_0) | BIT(BTN_1); for (i = 0; i < 6; i++) { t = spaceball_axes[i]; set_bit(t, spaceball->dev.absbit); - spaceball->dev.absmin[t] = i < 3 ? -10000 : -2000; - spaceball->dev.absmax[t] = i < 3 ? 10000 : 2000; - spaceball->dev.absflat[t] = i < 3 ? 50 : 10; - spaceball->dev.absfuzz[t] = i < 3 ? 12 : 2; + spaceball->dev.absmin[t] = i < 3 ? -8000 : -1600; + spaceball->dev.absmax[t] = i < 3 ? 8000 : 1600; + spaceball->dev.absflat[t] = i < 3 ? 40 : 8; + spaceball->dev.absfuzz[t] = i < 3 ? 8 : 2; } spaceball->serio = serio; |