Commit 31079ce2 authored by Linus Torvalds's avatar Linus Torvalds

Merge penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/joystick

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 89c70763 c20c3375
...@@ -115,6 +115,7 @@ static inline unsigned long do_fast_gettimeoffset(void) ...@@ -115,6 +115,7 @@ static inline unsigned long do_fast_gettimeoffset(void)
#define TICK_SIZE tick #define TICK_SIZE tick
spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED; spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL(i8253_lock);
extern spinlock_t i8259A_lock; extern spinlock_t i8259A_lock;
......
...@@ -25,8 +25,6 @@ MODULE_LICENSE("GPL"); ...@@ -25,8 +25,6 @@ MODULE_LICENSE("GPL");
#define CS461X_FULL_MAP #define CS461X_FULL_MAP
*/ */
#define COOKED_MODE
#ifndef PCI_VENDOR_ID_CIRRUS #ifndef PCI_VENDOR_ID_CIRRUS
#define PCI_VENDOR_ID_CIRRUS 0x1013 #define PCI_VENDOR_ID_CIRRUS 0x1013
...@@ -122,6 +120,9 @@ MODULE_LICENSE("GPL"); ...@@ -122,6 +120,9 @@ MODULE_LICENSE("GPL");
static unsigned long ba0_addr; static unsigned long ba0_addr;
static unsigned int *ba0; static unsigned int *ba0;
static char phys[32];
static char name[] = "CS416x Gameport";
#ifdef CS461X_FULL_MAP #ifdef CS461X_FULL_MAP
static unsigned long ba1_addr; static unsigned long ba1_addr;
static union ba1_t { static union ba1_t {
...@@ -206,14 +207,11 @@ static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int ...@@ -206,14 +207,11 @@ static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int
static int cs461x_gameport_open(struct gameport *gameport, int mode) static int cs461x_gameport_open(struct gameport *gameport, int mode)
{ {
switch (mode) { switch (mode) {
#ifdef COOKED_MODE case GAMEPORT_MODE_COOKED:
case GAMEPORT_MODE_COOKED: case GAMEPORT_MODE_RAW:
return 0; return 0;
#endif default:
case GAMEPORT_MODE_RAW: return -1;
return 0;
default:
return -1;
} }
return 0; return 0;
} }
...@@ -274,9 +272,7 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev ...@@ -274,9 +272,7 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev
return -ENOMEM; return -ENOMEM;
} }
#endif #endif
printk(KERN_INFO "CS461x PCI: %lx[%d]\n",
ba0_addr, CS461X_BA0_SIZE);
if (!(port = kmalloc(sizeof(struct gameport), GFP_KERNEL))) { if (!(port = kmalloc(sizeof(struct gameport), GFP_KERNEL))) {
printk(KERN_ERR "Memory allocation failed.\n"); printk(KERN_ERR "Memory allocation failed.\n");
cs461x_free(pdev); cs461x_free(pdev);
...@@ -287,19 +283,25 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev ...@@ -287,19 +283,25 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev
pci_set_drvdata(pdev, port); pci_set_drvdata(pdev, port);
port->open = cs461x_gameport_open; port->open = cs461x_gameport_open;
port->read = cs461x_gameport_read;
port->trigger = cs461x_gameport_trigger; port->trigger = cs461x_gameport_trigger;
#ifdef COOKED_MODE port->read = cs461x_gameport_read;
port->cooked_read = cs461x_gameport_cooked_read; port->cooked_read = cs461x_gameport_cooked_read;
#endif
sprintf(phys, "pci%s/gameport0", pdev->slot_name);
port->name = name;
port->phys = phys;
port->idbus = BUS_PCI;
port->idvendor = pdev->vendor;
port->idproduct = pdev->device;
cs461x_pokeBA0(BA0_JSIO, 0xFF); // ? cs461x_pokeBA0(BA0_JSIO, 0xFF); // ?
cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW); cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);
gameport_register_port(port); gameport_register_port(port);
printk(KERN_INFO "gameport%d: CS461x Gameport speed %d kHz\n", printk(KERN_INFO "gameport: %s on pci%s speed %d kHz\n",
port->number, port->speed); name, pdev->slot_name, port->speed);
return 0; return 0;
} }
...@@ -310,22 +312,22 @@ static void __devexit cs461x_pci_remove(struct pci_dev *pdev) ...@@ -310,22 +312,22 @@ static void __devexit cs461x_pci_remove(struct pci_dev *pdev)
} }
static struct pci_driver cs461x_pci_driver = { static struct pci_driver cs461x_pci_driver = {
name: "PCI Gameport", name: "CS461x Gameport",
id_table: cs461x_pci_tbl, id_table: cs461x_pci_tbl,
probe: cs461x_pci_probe, probe: cs461x_pci_probe,
remove: __devexit_p(cs461x_pci_remove), remove: __devexit_p(cs461x_pci_remove),
}; };
int __init js_cs461x_init(void) int __init cs461x_init(void)
{ {
return pci_module_init(&cs461x_pci_driver); return pci_module_init(&cs461x_pci_driver);
} }
void __exit js_cs461x_exit(void) void __exit cs461x_exit(void)
{ {
pci_unregister_driver(&cs461x_pci_driver); pci_unregister_driver(&cs461x_pci_driver);
} }
module_init(js_cs461x_init); module_init(cs461x_init);
module_exit(js_cs461x_exit); module_exit(cs461x_exit);
/* /*
* $Id: emu10k1-gp.c,v 1.2 2001/04/24 07:48:56 vojtech Exp $ * $Id: emu10k1-gp.c,v 1.8 2002/01/22 20:40:46 vojtech Exp $
* *
* Copyright (c) 2001 Vojtech Pavlik * Copyright (c) 2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
* EMU10k1 - SB Live! - gameport driver for Linux * EMU10k1 - SB Live / Audigy - gameport driver for Linux
*/ */
/* /*
...@@ -27,7 +25,7 @@ ...@@ -27,7 +25,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/io.h> #include <asm/io.h>
...@@ -41,6 +39,7 @@ ...@@ -41,6 +39,7 @@
#include <linux/pci.h> #include <linux/pci.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("EMU10k1 gameport driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
struct emu { struct emu {
...@@ -48,10 +47,12 @@ struct emu { ...@@ -48,10 +47,12 @@ struct emu {
struct emu *next; struct emu *next;
struct gameport gameport; struct gameport gameport;
int size; int size;
char phys[32];
}; };
static struct pci_device_id emu_tbl[] __devinitdata = { static struct pci_device_id emu_tbl[] __devinitdata = {
{ 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live! gameport */ { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
{ 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
{ 0, } { 0, }
}; };
...@@ -60,15 +61,10 @@ MODULE_DEVICE_TABLE(pci, emu_tbl); ...@@ -60,15 +61,10 @@ MODULE_DEVICE_TABLE(pci, emu_tbl);
static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
int ioport, iolen; int ioport, iolen;
int rc; struct emu *emu;
struct emu *port;
rc = pci_enable_device(pdev); if (pci_enable_device(pdev))
if (rc) { return -EBUSY;
printk(KERN_ERR "emu10k1-gp: Cannot enable emu10k1 gameport (bus %d, devfn %d) error=%d\n",
pdev->bus->number, pdev->devfn, rc);
return rc;
}
ioport = pci_resource_start(pdev, 0); ioport = pci_resource_start(pdev, 0);
iolen = pci_resource_len(pdev, 0); iolen = pci_resource_len(pdev, 0);
...@@ -76,32 +72,41 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id ...@@ -76,32 +72,41 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id
if (!request_region(ioport, iolen, "emu10k1-gp")) if (!request_region(ioport, iolen, "emu10k1-gp"))
return -EBUSY; return -EBUSY;
if (!(port = kmalloc(sizeof(struct emu), GFP_KERNEL))) { if (!(emu = kmalloc(sizeof(struct emu), GFP_KERNEL))) {
printk(KERN_ERR "emu10k1-gp: Memory allocation failed.\n"); printk(KERN_ERR "emu10k1-gp: Memory allocation failed.\n");
release_region(ioport, iolen); release_region(ioport, iolen);
return -ENOMEM; return -ENOMEM;
} }
memset(port, 0, sizeof(struct emu)); memset(emu, 0, sizeof(struct emu));
sprintf(emu->phys, "pci%s/gameport0", pdev->slot_name);
emu->size = iolen;
emu->dev = pdev;
emu->gameport.io = ioport;
emu->gameport.name = pdev->name;
emu->gameport.phys = emu->phys;
emu->gameport.idbus = BUS_PCI;
emu->gameport.idvendor = pdev->vendor;
emu->gameport.idproduct = pdev->device;
port->gameport.io = ioport; pci_set_drvdata(pdev, emu);
port->size = iolen;
port->dev = pdev;
pci_set_drvdata(pdev, port);
gameport_register_port(&port->gameport); gameport_register_port(&emu->gameport);
printk(KERN_INFO "gameport%d: Emu10k1 Gameport at %#x size %d speed %d kHz\n", printk(KERN_INFO "gameport: %s at pci%s speed %d kHz\n",
port->gameport.number, port->gameport.io, iolen, port->gameport.speed); pdev->name, pdev->slot_name, emu->gameport.speed);
return 0; return 0;
} }
static void __devexit emu_remove(struct pci_dev *pdev) static void __devexit emu_remove(struct pci_dev *pdev)
{ {
struct emu *port = pci_get_drvdata(pdev); struct emu *emu = pci_get_drvdata(pdev);
gameport_unregister_port(&port->gameport); gameport_unregister_port(&emu->gameport);
release_region(port->gameport.io, port->size); release_region(emu->gameport.io, emu->size);
kfree(port); kfree(emu);
} }
static struct pci_driver emu_driver = { static struct pci_driver emu_driver = {
......
/* /*
* $Id: gameport.c,v 1.5 2000/05/29 10:54:53 vojtech Exp $ * $Id: gameport.c,v 1.18 2002/01/22 20:41:14 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/io.h> #include <asm/io.h>
...@@ -40,7 +38,8 @@ ...@@ -40,7 +38,8 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/delay.h> #include <linux/delay.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Generic gameport layer");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(gameport_register_port); EXPORT_SYMBOL(gameport_register_port);
...@@ -54,7 +53,6 @@ EXPORT_SYMBOL(gameport_cooked_read); ...@@ -54,7 +53,6 @@ EXPORT_SYMBOL(gameport_cooked_read);
static struct gameport *gameport_list; static struct gameport *gameport_list;
static struct gameport_dev *gameport_dev; static struct gameport_dev *gameport_dev;
static int gameport_number;
/* /*
* gameport_measure_speed() measures the gameport i/o speed. * gameport_measure_speed() measures the gameport i/o speed.
...@@ -122,7 +120,6 @@ void gameport_rescan(struct gameport *gameport) ...@@ -122,7 +120,6 @@ void gameport_rescan(struct gameport *gameport)
void gameport_register_port(struct gameport *gameport) void gameport_register_port(struct gameport *gameport)
{ {
gameport->number = gameport_number++;
gameport->next = gameport_list; gameport->next = gameport_list;
gameport_list = gameport; gameport_list = gameport;
...@@ -140,8 +137,6 @@ void gameport_unregister_port(struct gameport *gameport) ...@@ -140,8 +137,6 @@ void gameport_unregister_port(struct gameport *gameport)
if (gameport->dev && gameport->dev->disconnect) if (gameport->dev && gameport->dev->disconnect)
gameport->dev->disconnect(gameport); gameport->dev->disconnect(gameport);
gameport_number--;
} }
void gameport_register_device(struct gameport_dev *dev) void gameport_register_device(struct gameport_dev *dev)
......
/* /*
* $Id: lightning.c,v 1.13 2001/04/26 10:24:46 vojtech Exp $ * $Id: lightning.c,v 1.20 2002/01/22 20:41:31 vojtech Exp $
* *
* Copyright (c) 1998-2001 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/io.h> #include <asm/io.h>
...@@ -51,14 +49,18 @@ ...@@ -51,14 +49,18 @@
#define L4_BUSY 0x01 #define L4_BUSY 0x01
#define L4_TIMEOUT 80 /* 80 us */ #define L4_TIMEOUT 80 /* 80 us */
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("PDPI Lightning 4 gamecard driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
struct l4 { struct l4 {
struct gameport gameport; struct gameport gameport;
unsigned char port; unsigned char port;
char phys[32];
} *l4_port[8]; } *l4_port[8];
char l4_name[] = "PDPI Lightning 4";
/* /*
* l4_wait_ready() waits for the L4 to become ready. * l4_wait_ready() waits for the L4 to become ready.
*/ */
...@@ -77,7 +79,7 @@ static int l4_wait_ready(void) ...@@ -77,7 +79,7 @@ static int l4_wait_ready(void)
static int l4_cooked_read(struct gameport *gameport, int *axes, int *buttons) static int l4_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{ {
struct l4 *l4 = gameport->private; struct l4 *l4 = gameport->driver;
unsigned char status; unsigned char status;
int i, result = -1; int i, result = -1;
...@@ -110,7 +112,7 @@ fail: outb(L4_SELECT_ANALOG, L4_PORT); ...@@ -110,7 +112,7 @@ fail: outb(L4_SELECT_ANALOG, L4_PORT);
static int l4_open(struct gameport *gameport, int mode) static int l4_open(struct gameport *gameport, int mode)
{ {
struct l4 *l4 = gameport->private; struct l4 *l4 = gameport->driver;
if (l4->port != 0 && mode != GAMEPORT_MODE_COOKED) if (l4->port != 0 && mode != GAMEPORT_MODE_COOKED)
return -1; return -1;
outb(L4_SELECT_ANALOG, L4_PORT); outb(L4_SELECT_ANALOG, L4_PORT);
...@@ -188,7 +190,7 @@ static int l4_calibrate(struct gameport *gameport, int *axes, int *max) ...@@ -188,7 +190,7 @@ static int l4_calibrate(struct gameport *gameport, int *axes, int *max)
{ {
int i, t; int i, t;
int cal[4]; int cal[4];
struct l4 *l4 = gameport->private; struct l4 *l4 = gameport->driver;
if (l4_getcal(l4->port, cal)) if (l4_getcal(l4->port, cal))
return -1; return -1;
...@@ -247,12 +249,18 @@ int __init l4_init(void) ...@@ -247,12 +249,18 @@ int __init l4_init(void)
l4 = l4_port[i * 4 + j] = l4_port[i * 4] + j; l4 = l4_port[i * 4 + j] = l4_port[i * 4] + j;
l4->port = i * 4 + j; l4->port = i * 4 + j;
sprintf(l4->phys, "isa%04x/gameport%d", L4_PORT, 4 * i + j);
gameport = &l4->gameport; gameport = &l4->gameport;
gameport->private = l4; gameport->driver = l4;
gameport->open = l4_open; gameport->open = l4_open;
gameport->cooked_read = l4_cooked_read; gameport->cooked_read = l4_cooked_read;
gameport->calibrate = l4_calibrate; gameport->calibrate = l4_calibrate;
gameport->name = l4_name;
gameport->phys = l4->phys;
gameport->idbus = BUS_ISA;
if (!i && !j) if (!i && !j)
gameport->io = L4_PORT; gameport->io = L4_PORT;
...@@ -262,9 +270,7 @@ int __init l4_init(void) ...@@ -262,9 +270,7 @@ int __init l4_init(void)
gameport_register_port(gameport); gameport_register_port(gameport);
} }
printk(KERN_INFO "gameport%d,%d,%d,%d: PDPI Lightning 4 %s card v%d.%d at %#x\n", printk(KERN_INFO "gameport: PDPI Lightning 4 %s card v%d.%d at %#x\n",
l4_port[i * 4 + 0]->gameport.number, l4_port[i * 4 + 1]->gameport.number,
l4_port[i * 4 + 2]->gameport.number, l4_port[i * 4 + 3]->gameport.number,
i ? "secondary" : "primary", rev >> 4, rev, L4_PORT); i ? "secondary" : "primary", rev >> 4, rev, L4_PORT);
cards++; cards++;
......
/* /*
* $Id: ns558.c,v 1.29 2001/04/24 07:48:56 vojtech Exp $ * $Id: ns558.c,v 1.43 2002/01/24 19:23:21 vojtech Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* Copyright (c) 1999 Brian Gerst * Copyright (c) 1999 Brian Gerst
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -28,7 +26,7 @@ ...@@ -28,7 +26,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/io.h> #include <asm/io.h>
...@@ -42,6 +40,7 @@ ...@@ -42,6 +40,7 @@
#include <linux/isapnp.h> #include <linux/isapnp.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Classic gameport (ISA/PnP) driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define NS558_ISA 1 #define NS558_ISA 1
...@@ -56,6 +55,8 @@ struct ns558 { ...@@ -56,6 +55,8 @@ struct ns558 {
struct pci_dev *dev; struct pci_dev *dev;
struct ns558 *next; struct ns558 *next;
struct gameport gameport; struct gameport gameport;
char phys[32];
char name[32];
}; };
static struct ns558 *ns558; static struct ns558 *ns558;
...@@ -141,12 +142,18 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next) ...@@ -141,12 +142,18 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
port->type = NS558_ISA; port->type = NS558_ISA;
port->size = (1 << i); port->size = (1 << i);
port->gameport.io = io & (-1 << i); port->gameport.io = io & (-1 << i);
port->gameport.phys = port->phys;
port->gameport.name = port->name;
port->gameport.idbus = BUS_ISA;
sprintf(port->phys, "isa%04x/gameport0", io & (-1 << i));
sprintf(port->name, "NS558 ISA");
request_region(port->gameport.io, (1 << i), "ns558-isa"); request_region(port->gameport.io, (1 << i), "ns558-isa");
gameport_register_port(&port->gameport); gameport_register_port(&port->gameport);
printk(KERN_INFO "gameport%d: NS558 ISA at %#x", port->gameport.number, port->gameport.io); printk(KERN_INFO "gameport: NS558 ISA at %#x", port->gameport.io);
if (port->size > 1) printk(" size %d", port->size); if (port->size > 1) printk(" size %d", port->size);
printk(" speed %d kHz\n", port->gameport.speed); printk(" speed %d kHz\n", port->gameport.speed);
...@@ -155,17 +162,33 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next) ...@@ -155,17 +162,33 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
#ifdef __ISAPNP__ #ifdef __ISAPNP__
#define NS558_DEVICE(a,b,c,d)\
card_vendor: ISAPNP_ANY_ID, card_device: ISAPNP_ANY_ID,\
vendor: ISAPNP_VENDOR(a,b,c), function: ISAPNP_DEVICE(d)
static struct isapnp_device_id pnp_devids[] = { static struct isapnp_device_id pnp_devids[] = {
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('@','P','@'), ISAPNP_DEVICE(0x0001), 0 }, { NS558_DEVICE('@','P','@',0x0001) }, /* ALS 100 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('@','P','@'), ISAPNP_DEVICE(0x2001), 0 }, { NS558_DEVICE('@','P','@',0x0020) }, /* ALS 200 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x7001), 0 }, { NS558_DEVICE('@','P','@',0x1001) }, /* ALS 100+ */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x7002), 0 }, { NS558_DEVICE('@','P','@',0x2001) }, /* ALS 120 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), ISAPNP_DEVICE(0x0010), 0 }, { NS558_DEVICE('A','S','B',0x16fd) }, /* AdLib NSC16 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), ISAPNP_DEVICE(0x0110), 0 }, { NS558_DEVICE('A','Z','T',0x3001) }, /* AZT1008 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), ISAPNP_DEVICE(0x0b35), 0 }, { NS558_DEVICE('C','D','C',0x0001) }, /* Opl3-SAx */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), ISAPNP_DEVICE(0x0010), 0 }, { NS558_DEVICE('C','S','C',0x0001) }, /* CS4232 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), ISAPNP_DEVICE(0x0110), 0 }, { NS558_DEVICE('C','S','C',0x000f) }, /* CS4236 */
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('P','N','P'), ISAPNP_DEVICE(0xb02f), 0 }, { NS558_DEVICE('C','S','C',0x0101) }, /* CS4327 */
{ NS558_DEVICE('C','T','L',0x7001) }, /* SB16 */
{ NS558_DEVICE('C','T','L',0x7002) }, /* AWE64 */
{ NS558_DEVICE('C','T','L',0x7005) }, /* Vibra16 */
{ NS558_DEVICE('E','N','S',0x2020) }, /* SoundscapeVIVO */
{ NS558_DEVICE('E','S','S',0x0001) }, /* ES1869 */
{ NS558_DEVICE('E','S','S',0x0005) }, /* ES1878 */
{ NS558_DEVICE('E','S','S',0x6880) }, /* ES688 */
{ NS558_DEVICE('I','B','M',0x0012) }, /* CS4232 */
{ NS558_DEVICE('O','P','T',0x0001) }, /* OPTi Audio16 */
{ NS558_DEVICE('Y','M','H',0x0006) }, /* Opl3-SA */
{ NS558_DEVICE('Y','M','H',0x0022) }, /* Opl3-SAx */
{ NS558_DEVICE('P','N','P',0xb02f) }, /* Generic */
{ 0, }, { 0, },
}; };
...@@ -203,13 +226,24 @@ static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next) ...@@ -203,13 +226,24 @@ static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next)
port->next = next; port->next = next;
port->type = NS558_PNP; port->type = NS558_PNP;
port->gameport.io = ioport;
port->size = iolen; port->size = iolen;
port->dev = dev; port->dev = dev;
port->gameport.io = ioport;
port->gameport.phys = port->phys;
port->gameport.name = port->name;
port->gameport.idbus = BUS_ISAPNP;
port->gameport.idvendor = dev->vendor;
port->gameport.idproduct = dev->device;
port->gameport.idversion = 0x100;
sprintf(port->phys, "isapnp%d.%d/gameport0", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
sprintf(port->name, "%s", dev->name[0] ? dev->name : "NS558 PnP Gameport");
gameport_register_port(&port->gameport); gameport_register_port(&port->gameport);
printk(KERN_INFO "gameport%d: NS558 PnP at %#x", port->gameport.number, port->gameport.io); printk(KERN_INFO "gameport: NS558 PnP at isapnp%d.%d io %#x",
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), port->gameport.io);
if (iolen > 1) printk(" size %d", iolen); if (iolen > 1) printk(" size %d", iolen);
printk(" speed %d kHz\n", port->gameport.speed); printk(" speed %d kHz\n", port->gameport.speed);
......
/* /*
* $Id: a3d.c,v 1.14 2001/04/26 10:24:46 vojtech Exp $ * $Id: a3d.c,v 1.21 2002/01/22 20:11:50 vojtech Exp $
* *
* Copyright (c) 1998-2001 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,6 +35,10 @@ ...@@ -37,6 +35,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver");
MODULE_LICENSE("GPL");
#define A3D_MAX_START 400 /* 400 us */ #define A3D_MAX_START 400 /* 400 us */
#define A3D_MAX_STROBE 60 /* 40 us */ #define A3D_MAX_STROBE 60 /* 40 us */
#define A3D_DELAY_READ 3 /* 3 ms */ #define A3D_DELAY_READ 3 /* 3 ms */
...@@ -63,6 +65,8 @@ struct a3d { ...@@ -63,6 +65,8 @@ struct a3d {
int used; int used;
int reads; int reads;
int bads; int bads;
char phys[32];
char adcphys[32];
}; };
/* /*
...@@ -190,7 +194,7 @@ static void a3d_timer(unsigned long private) ...@@ -190,7 +194,7 @@ static void a3d_timer(unsigned long private)
int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons) int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{ {
struct a3d *a3d = gameport->private; struct a3d *a3d = gameport->driver;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1; axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1;
...@@ -205,7 +209,7 @@ int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons) ...@@ -205,7 +209,7 @@ int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons)
int a3d_adc_open(struct gameport *gameport, int mode) int a3d_adc_open(struct gameport *gameport, int mode)
{ {
struct a3d *a3d = gameport->private; struct a3d *a3d = gameport->driver;
if (mode != GAMEPORT_MODE_COOKED) if (mode != GAMEPORT_MODE_COOKED)
return -1; return -1;
if (!a3d->used++) if (!a3d->used++)
...@@ -219,7 +223,7 @@ int a3d_adc_open(struct gameport *gameport, int mode) ...@@ -219,7 +223,7 @@ int a3d_adc_open(struct gameport *gameport, int mode)
static void a3d_adc_close(struct gameport *gameport) static void a3d_adc_close(struct gameport *gameport)
{ {
struct a3d *a3d = gameport->private; struct a3d *a3d = gameport->driver;
if (!--a3d->used) if (!--a3d->used)
del_timer(&a3d->timer); del_timer(&a3d->timer);
} }
...@@ -280,10 +284,12 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -280,10 +284,12 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
if (!a3d->mode || a3d->mode > 5) { if (!a3d->mode || a3d->mode > 5) {
printk(KERN_WARNING "a3d.c: Unknown A3D device detected " printk(KERN_WARNING "a3d.c: Unknown A3D device detected "
"(gameport%d, id=%d), contact <vojtech@suse.cz>\n", gameport->number, a3d->mode); "(%s, id=%d), contact <vojtech@ucw.cz>\n", gameport->phys, a3d->mode);
goto fail2; goto fail2;
} }
sprintf(a3d->phys, "%s/input0", gameport->phys);
sprintf(a3d->adcphys, "%s/gameport0", gameport->phys);
if (a3d->mode == A3D_MODE_PXL) { if (a3d->mode == A3D_MODE_PXL) {
...@@ -323,17 +329,23 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -323,17 +329,23 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y); a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);
a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE);
a3d->adc.private = a3d; a3d->adc.driver = a3d;
a3d->adc.open = a3d_adc_open; a3d->adc.open = a3d_adc_open;
a3d->adc.close = a3d_adc_close; a3d->adc.close = a3d_adc_close;
a3d->adc.cooked_read = a3d_adc_cooked_read; a3d->adc.cooked_read = a3d_adc_cooked_read;
a3d->adc.fuzz = 1; a3d->adc.fuzz = 1;
a3d->adc.name = a3d_names[a3d->mode];
a3d->adc.phys = a3d->adcphys;
a3d->adc.idbus = BUS_GAMEPORT;
a3d->adc.idvendor = GAMEPORT_ID_VENDOR_MADCATZ;
a3d->adc.idproduct = a3d->mode;
a3d->adc.idversion = 0x0100;
a3d_read(a3d, data); a3d_read(a3d, data);
gameport_register_port(&a3d->adc); gameport_register_port(&a3d->adc);
printk(KERN_INFO "gameport%d: %s on gameport%d.0\n", printk(KERN_INFO "gameport: %s on %s\n", a3d_names[a3d->mode], gameport->phys);
a3d->adc.number, a3d_names[a3d->mode], gameport->number);
} }
a3d->dev.private = a3d; a3d->dev.private = a3d;
...@@ -341,14 +353,14 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -341,14 +353,14 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
a3d->dev.close = a3d_close; a3d->dev.close = a3d_close;
a3d->dev.name = a3d_names[a3d->mode]; a3d->dev.name = a3d_names[a3d->mode];
a3d->dev.phys = a3d->phys;
a3d->dev.idbus = BUS_GAMEPORT; a3d->dev.idbus = BUS_GAMEPORT;
a3d->dev.idvendor = GAMEPORT_ID_VENDOR_MADCATZ; a3d->dev.idvendor = GAMEPORT_ID_VENDOR_MADCATZ;
a3d->dev.idproduct = a3d->mode; a3d->dev.idproduct = a3d->mode;
a3d->dev.idversion = 0x0100; a3d->dev.idversion = 0x0100;
input_register_device(&a3d->dev); input_register_device(&a3d->dev);
printk(KERN_INFO "input%d: %s on gameport%d.0\n", printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys);
a3d->dev.number, a3d_names[a3d->mode], gameport->number);
return; return;
fail2: gameport_close(gameport); fail2: gameport_close(gameport);
...@@ -384,5 +396,3 @@ void __exit a3d_exit(void) ...@@ -384,5 +396,3 @@ void __exit a3d_exit(void)
module_init(a3d_init); module_init(a3d_init);
module_exit(a3d_exit); module_exit(a3d_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: adi.c,v 1.15 2001/01/09 13:32:39 vojtech Exp $ * $Id: adi.c,v 1.23 2002/01/22 20:26:17 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -39,6 +37,10 @@ ...@@ -39,6 +37,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/init.h> #include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Logitech ADI joystick family driver");
MODULE_LICENSE("GPL");
/* /*
* Times, array sizes, flags, ids. * Times, array sizes, flags, ids.
*/ */
...@@ -55,6 +57,7 @@ ...@@ -55,6 +57,7 @@
#define ADI_MIN_ID_LENGTH 66 #define ADI_MIN_ID_LENGTH 66
#define ADI_MAX_NAME_LENGTH 48 #define ADI_MAX_NAME_LENGTH 48
#define ADI_MAX_CNAME_LENGTH 16 #define ADI_MAX_CNAME_LENGTH 16
#define ADI_MAX_PHYS_LENGTH 32
#define ADI_FLAG_HAT 0x04 #define ADI_FLAG_HAT 0x04
#define ADI_FLAG_10BIT 0x08 #define ADI_FLAG_10BIT 0x08
...@@ -118,6 +121,7 @@ struct adi { ...@@ -118,6 +121,7 @@ struct adi {
short *key; short *key;
char name[ADI_MAX_NAME_LENGTH]; char name[ADI_MAX_NAME_LENGTH];
char cname[ADI_MAX_CNAME_LENGTH]; char cname[ADI_MAX_CNAME_LENGTH];
char phys[ADI_MAX_PHYS_LENGTH];
unsigned char data[ADI_MAX_LENGTH]; unsigned char data[ADI_MAX_LENGTH];
}; };
...@@ -392,7 +396,7 @@ static void adi_id_decode(struct adi *adi, struct adi_port *port) ...@@ -392,7 +396,7 @@ static void adi_id_decode(struct adi *adi, struct adi_port *port)
} }
} }
static void adi_init_input(struct adi *adi, struct adi_port *port) static void adi_init_input(struct adi *adi, struct adi_port *port, int half)
{ {
int i, t; int i, t;
char buf[ADI_MAX_NAME_LENGTH]; char buf[ADI_MAX_NAME_LENGTH];
...@@ -403,6 +407,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port) ...@@ -403,6 +407,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port)
sprintf(buf, adi_names[t], adi->id); sprintf(buf, adi_names[t], adi->id);
sprintf(adi->name, "Logitech %s", buf); sprintf(adi->name, "Logitech %s", buf);
sprintf(adi->phys, "%s/input%d", port->gameport->phys, half);
adi->abs = adi_abs[t]; adi->abs = adi_abs[t];
adi->key = adi_key[t]; adi->key = adi_key[t];
...@@ -411,6 +416,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port) ...@@ -411,6 +416,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port)
adi->dev.close = adi_close; adi->dev.close = adi_close;
adi->dev.name = adi->name; adi->dev.name = adi->name;
adi->dev.phys = adi->phys;
adi->dev.idbus = BUS_GAMEPORT; adi->dev.idbus = BUS_GAMEPORT;
adi->dev.idvendor = GAMEPORT_ID_VENDOR_LOGITECH; adi->dev.idvendor = GAMEPORT_ID_VENDOR_LOGITECH;
adi->dev.idproduct = adi->id; adi->dev.idproduct = adi->id;
...@@ -419,7 +425,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port) ...@@ -419,7 +425,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port)
adi->dev.private = port; adi->dev.private = port;
adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad > 0)) * 2; i++) for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++)
set_bit(adi->abs[i], &adi->dev.absbit); set_bit(adi->abs[i], &adi->dev.absbit);
for (i = 0; i < adi->buttons; i++) for (i = 0; i < adi->buttons; i++)
...@@ -432,7 +438,7 @@ static void adi_init_center(struct adi *adi) ...@@ -432,7 +438,7 @@ static void adi_init_center(struct adi *adi)
if (!adi->length) return; if (!adi->length) return;
for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad > 0)) * 2; i++) { for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++) {
t = adi->abs[i]; t = adi->abs[i];
x = adi->dev.abs[t]; x = adi->dev.abs[t];
...@@ -495,7 +501,7 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -495,7 +501,7 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev)
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
adi_id_decode(port->adi + i, port); adi_id_decode(port->adi + i, port);
adi_init_input(port->adi + i, port); adi_init_input(port->adi + i, port, i);
} }
if (!port->adi[0].length && !port->adi[1].length) { if (!port->adi[0].length && !port->adi[1].length) {
...@@ -514,8 +520,8 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -514,8 +520,8 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev)
if (port->adi[i].length > 0) { if (port->adi[i].length > 0) {
adi_init_center(port->adi + i); adi_init_center(port->adi + i);
input_register_device(&port->adi[i].dev); input_register_device(&port->adi[i].dev);
printk(KERN_INFO "input%d: %s [%s] on gameport%d.%d\n", printk(KERN_INFO "input: %s [%s] on %s\n",
port->adi[i].dev.number, port->adi[i].name, port->adi[i].cname, gameport->number, i); port->adi[i].name, port->adi[i].cname, gameport->phys);
} }
} }
...@@ -553,5 +559,3 @@ void __exit adi_exit(void) ...@@ -553,5 +559,3 @@ void __exit adi_exit(void)
module_init(adi_init); module_init(adi_init);
module_exit(adi_exit); module_exit(adi_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: amijoy.c,v 1.5 2000/07/21 22:52:24 vojtech Exp $ * $Id: amijoy.c,v 1.13 2002/01/22 20:26:32 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -40,13 +38,15 @@ ...@@ -40,13 +38,15 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/amigahw.h> #include <asm/amigahw.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Driver for Amiga joysticks");
MODULE_PARM(amijoy, "1-2i"); MODULE_PARM(amijoy, "1-2i");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int amijoy[2] = { 0, 1 }; static int amijoy[2] = { 0, 1 };
static int amijoy_used[2] = { 0, 0 }; static int amijoy_used[2] = { 0, 0 };
static struct input_dev amijoy_dev[2]; static struct input_dev amijoy_dev[2];
static char *amijoy_phys[2] = { "amijoy/input0", "amijoy/input1" };
static char *amijoy_name = "Amiga joystick"; static char *amijoy_name = "Amiga joystick";
...@@ -64,9 +64,9 @@ static void amijoy_interrupt(int irq, void *dummy, struct pt_regs *fp) ...@@ -64,9 +64,9 @@ static void amijoy_interrupt(int irq, void *dummy, struct pt_regs *fp)
input_report_key(amijoy_dev + i, BTN_TRIGGER, button); input_report_key(amijoy_dev + i, BTN_TRIGGER, button);
input_report_abs(amijoy_dev + i, ABS_X, ((data >> 1) & 1) - ((data >> 9) & 1); input_report_abs(amijoy_dev + i, ABS_X, ((data >> 1) & 1) - ((data >> 9) & 1));
data = ~(data ^ (data << 1)); data = ~(data ^ (data << 1));
input_report_abs(amijoy_dev + i, ABS_Y, ((data >> 1) & 1) - ((data >> 9) & 1); input_report_abs(amijoy_dev + i, ABS_Y, ((data >> 1) & 1) - ((data >> 9) & 1));
} }
} }
...@@ -133,6 +133,7 @@ static int __init amijoy_init(void) ...@@ -133,6 +133,7 @@ static int __init amijoy_init(void)
} }
amijoy->dev[i].name = amijoy_name; amijoy->dev[i].name = amijoy_name;
amijoy->dev[i].phys = amijoy_phys[i];
amijoy->dev[i].idbus = BUS_AMIGA; amijoy->dev[i].idbus = BUS_AMIGA;
amijoy->dev[i].idvendor = 0x0001; amijoy->dev[i].idvendor = 0x0001;
amijoy->dev[i].idproduct = 0x0003; amijoy->dev[i].idproduct = 0x0003;
...@@ -141,7 +142,7 @@ static int __init amijoy_init(void) ...@@ -141,7 +142,7 @@ static int __init amijoy_init(void)
amijoy_dev[i].private = amijoy_used + i; amijoy_dev[i].private = amijoy_used + i;
input_register_device(amijoy_dev + i); input_register_device(amijoy_dev + i);
printk(KERN_INFO "input%d: %s at joy%ddat\n", amijoy_dev[i].number, amijoy_name, i); printk(KERN_INFO "input: %s at joy%ddat\n", amijoy_name, i);
} }
return 0; return 0;
} }
......
/* /*
* $Id: analog.c,v 1.52 2000/06/07 13:07:06 vojtech Exp $ * $Id: analog.c,v 1.68 2002/01/22 20:18:32 vojtech Exp $
* *
* Copyright (c) 1996-2000 Vojtech Pavlik * Copyright (c) 1996-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -41,8 +39,8 @@ ...@@ -41,8 +39,8 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <asm/timex.h> #include <asm/timex.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Analog joystick and gamepad driver for Linux"); MODULE_DESCRIPTION("Analog joystick and gamepad driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* /*
...@@ -95,6 +93,7 @@ MODULE_PARM_DESC(js, "Analog joystick options"); ...@@ -95,6 +93,7 @@ MODULE_PARM_DESC(js, "Analog joystick options");
#define ANALOG_FUZZ_MAGIC 36 /* 36 u*ms/loop */ #define ANALOG_FUZZ_MAGIC 36 /* 36 u*ms/loop */
#define ANALOG_MAX_NAME_LENGTH 128 #define ANALOG_MAX_NAME_LENGTH 128
#define ANALOG_MAX_PHYS_LENGTH 32
static short analog_axes[] = { ABS_X, ABS_Y, ABS_RUDDER, ABS_THROTTLE }; static short analog_axes[] = { ABS_X, ABS_Y, ABS_RUDDER, ABS_THROTTLE };
static short analog_hats[] = { ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y }; static short analog_hats[] = { ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y };
...@@ -111,6 +110,7 @@ struct analog { ...@@ -111,6 +110,7 @@ struct analog {
int mask; int mask;
short *buttons; short *buttons;
char name[ANALOG_MAX_NAME_LENGTH]; char name[ANALOG_MAX_NAME_LENGTH];
char phys[ANALOG_MAX_PHYS_LENGTH];
}; };
struct analog_port { struct analog_port {
...@@ -138,15 +138,29 @@ struct analog_port { ...@@ -138,15 +138,29 @@ struct analog_port {
#ifdef __i386__ #ifdef __i386__
#define TSC_PRESENT (test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability)) #define TSC_PRESENT (test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability))
#define GET_TIME(x) do { if (TSC_PRESENT) rdtscl(x); else { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } } while (0) #define GET_TIME(x) do { if (TSC_PRESENT) rdtscl(x); else x = get_time_pit(); } while (0)
#define DELTA(x,y) (TSC_PRESENT?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0))) #define DELTA(x,y) (TSC_PRESENT?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
#define TIME_NAME (TSC_PRESENT?"TSC":"PIT") #define TIME_NAME (TSC_PRESENT?"TSC":"PIT")
static unsigned int get_time_pit(void)
{
extern spinlock_t i8253_lock;
unsigned long flags;
unsigned int count;
spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x00, 0x43);
count = inb_p(0x40);
count |= inb_p(0x40) << 8;
spin_unlock_irqrestore(&i8253_lock, flags);
return count;
}
#elif __x86_64__ #elif __x86_64__
#define GET_TIME(x) rdtscl(x) #define GET_TIME(x) rdtscl(x)
#define DELTA(x,y) ((y)-(x)) #define DELTA(x,y) ((y)-(x))
#define TIME_NAME "TSC" #define TIME_NAME "TSC"
#elif __alpha__ #elif __alpha__
#define GET_TIME(x) ((x) = get_cycles()) #define GET_TIME(x) do { x = get_cycles(x); } while (0)
#define DELTA(x,y) ((y)-(x)) #define DELTA(x,y) ((y)-(x))
#define TIME_NAME "PCC" #define TIME_NAME "PCC"
#else #else
...@@ -418,10 +432,12 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, ...@@ -418,10 +432,12 @@ static void analog_init_device(struct analog_port *port, struct analog *analog,
int i, j, t, v, w, x, y, z; int i, j, t, v, w, x, y, z;
analog_name(analog); analog_name(analog);
sprintf(analog->phys, "%s/input%d", port->gameport->phys, index);
analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn; analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn;
analog->dev.name = analog->name; analog->dev.name = analog->name;
analog->dev.phys = analog->phys;
analog->dev.idbus = BUS_GAMEPORT; analog->dev.idbus = BUS_GAMEPORT;
analog->dev.idvendor = GAMEPORT_ID_VENDOR_ANALOG; analog->dev.idvendor = GAMEPORT_ID_VENDOR_ANALOG;
analog->dev.idproduct = analog->mask >> 4; analog->dev.idproduct = analog->mask >> 4;
...@@ -491,15 +507,14 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, ...@@ -491,15 +507,14 @@ static void analog_init_device(struct analog_port *port, struct analog *analog,
input_register_device(&analog->dev); input_register_device(&analog->dev);
printk(KERN_INFO "input%d: %s at gameport%d.%d", printk(KERN_INFO "input: %s at %s", analog->name, port->gameport->phys);
analog->dev.number, analog->name, port->gameport->number, index);
if (port->cooked) if (port->cooked)
printk(" [ADC port]\n"); printk(" [ADC port]\n");
else else
printk(" [%s timer, %d %sHz clock, %d ns res]\n", TIME_NAME, printk(" [%s timer, %d %sHz clock, %d ns res]\n", TIME_NAME,
port->speed > 10000 ? (port->speed + 800) / 1000 : port->speed, port->speed > 10000 ? (port->speed + 800) / 1000 : port->speed,
port->speed > 10000 ? "M" : "k", port->speed > 10000 ? "M" : "k",
port->speed > 10000 ? (port->loop * 1000) / (port->speed / 1000) port->speed > 10000 ? (port->loop * 1000) / (port->speed / 1000)
: (port->loop * 1000000) / port->speed); : (port->loop * 1000000) / port->speed);
} }
...@@ -519,12 +534,13 @@ static int analog_init_masks(struct analog_port *port) ...@@ -519,12 +534,13 @@ static int analog_init_masks(struct analog_port *port)
if ((port->mask & 3) != 3 && port->mask != 0xc) { if ((port->mask & 3) != 3 && port->mask != 0xc) {
printk(KERN_WARNING "analog.c: Unknown joystick device found " printk(KERN_WARNING "analog.c: Unknown joystick device found "
"(data=%#x, gameport%d), probably not analog joystick.\n", "(data=%#x, %s), probably not analog joystick.\n",
port->mask, port->gameport->number); port->mask, port->gameport->phys);
return -1; return -1;
} }
i = port->gameport->number < ANALOG_PORTS ? analog_options[port->gameport->number] : 0xff;
i = analog_options[0]; /* FIXME !!! - need to specify options for different ports */
analog[0].mask = i & 0xfffff; analog[0].mask = i & 0xfffff;
...@@ -604,8 +620,8 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, ...@@ -604,8 +620,8 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev,
gameport_trigger(gameport); gameport_trigger(gameport);
while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++;
if (v < (u >> 1) && port->gameport->number < ANALOG_PORTS) { if (v < (u >> 1)) { /* FIXME - more than one port */
analog_options[port->gameport->number] |= analog_options[0] |= /* FIXME - more than one port */
ANALOG_SAITEK | ANALOG_BTNS_CHF | ANALOG_HBTN_CHF | ANALOG_HAT1_CHF; ANALOG_SAITEK | ANALOG_BTNS_CHF | ANALOG_HBTN_CHF | ANALOG_HAT1_CHF;
return 0; return 0;
} }
...@@ -666,9 +682,9 @@ static void analog_disconnect(struct gameport *gameport) ...@@ -666,9 +682,9 @@ static void analog_disconnect(struct gameport *gameport)
if (port->analog[i].mask) if (port->analog[i].mask)
input_unregister_device(&port->analog[i].dev); input_unregister_device(&port->analog[i].dev);
gameport_close(gameport); gameport_close(gameport);
printk(KERN_INFO "analog.c: %d out of %d reads (%d%%) on gameport%d failed\n", printk(KERN_INFO "analog.c: %d out of %d reads (%d%%) on %s failed\n",
port->bads, port->reads, port->reads ? (port->bads * 100 / port->reads) : 0, port->bads, port->reads, port->reads ? (port->bads * 100 / port->reads) : 0,
port->gameport->number); port->gameport->phys);
kfree(port); kfree(port);
} }
......
/* /*
* $Id: cobra.c,v 1.10 2000/06/08 10:23:45 vojtech Exp $ * $Id: cobra.c,v 1.19 2002/01/22 20:26:52 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
* Creative Labd Blaster GamePad Cobra driver for Linux * Creative Labs Blaster GamePad Cobra driver for Linux
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,6 +35,10 @@ ...@@ -37,6 +35,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Creative Labs Blaster GamePad Cobra driver");
MODULE_LICENSE("GPL");
#define COBRA_MAX_STROBE 45 /* 45 us max wait for first strobe */ #define COBRA_MAX_STROBE 45 /* 45 us max wait for first strobe */
#define COBRA_REFRESH_TIME HZ/50 /* 20 ms between reads */ #define COBRA_REFRESH_TIME HZ/50 /* 20 ms between reads */
#define COBRA_LENGTH 36 #define COBRA_LENGTH 36
...@@ -53,6 +55,7 @@ struct cobra { ...@@ -53,6 +55,7 @@ struct cobra {
int reads; int reads;
int bads; int bads;
unsigned char exists; unsigned char exists;
char phys[2][32];
}; };
static unsigned char cobra_read_packet(struct gameport *gameport, unsigned int *data) static unsigned char cobra_read_packet(struct gameport *gameport, unsigned int *data)
...@@ -121,6 +124,7 @@ static void cobra_timer(unsigned long private) ...@@ -121,6 +124,7 @@ static void cobra_timer(unsigned long private)
if ((r = cobra_read_packet(cobra->gameport, data)) != cobra->exists) if ((r = cobra_read_packet(cobra->gameport, data)) != cobra->exists)
cobra->bads++; cobra->bads++;
else
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if (cobra->exists & r & (1 << i)) { if (cobra->exists & r & (1 << i)) {
...@@ -177,8 +181,8 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -177,8 +181,8 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if ((cobra->exists >> i) & data[i] & 1) { if ((cobra->exists >> i) & data[i] & 1) {
printk(KERN_WARNING "cobra.c: Device on gameport%d.%d has the Ext bit set. ID is: %d" printk(KERN_WARNING "cobra.c: Device %d on %s has the Ext bit set. ID is: %d"
" Contact vojtech@suse.cz\n", gameport->number, i, (data[i] >> 2) & 7); " Contact vojtech@ucw.cz\n", i, gameport->phys, (data[i] >> 2) & 7);
cobra->exists &= ~(1 << i); cobra->exists &= ~(1 << i);
} }
...@@ -188,11 +192,14 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -188,11 +192,14 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if ((cobra->exists >> i) & 1) { if ((cobra->exists >> i) & 1) {
sprintf(cobra->phys[i], "%s/input%d", gameport->phys, i);
cobra->dev[i].private = cobra; cobra->dev[i].private = cobra;
cobra->dev[i].open = cobra_open; cobra->dev[i].open = cobra_open;
cobra->dev[i].close = cobra_close; cobra->dev[i].close = cobra_close;
cobra->dev[i].name = cobra_name; cobra->dev[i].name = cobra_name;
cobra->dev[i].phys = cobra->phys[i];
cobra->dev[i].idbus = BUS_GAMEPORT; cobra->dev[i].idbus = BUS_GAMEPORT;
cobra->dev[i].idvendor = GAMEPORT_ID_VENDOR_CREATIVE; cobra->dev[i].idvendor = GAMEPORT_ID_VENDOR_CREATIVE;
cobra->dev[i].idproduct = 0x0008; cobra->dev[i].idproduct = 0x0008;
...@@ -208,11 +215,9 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -208,11 +215,9 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
cobra->dev[i].absmin[ABS_Y] = -1; cobra->dev[i].absmax[ABS_Y] = 1; cobra->dev[i].absmin[ABS_Y] = -1; cobra->dev[i].absmax[ABS_Y] = 1;
input_register_device(cobra->dev + i); input_register_device(cobra->dev + i);
printk(KERN_INFO "input%d: %s on gameport%d.%d\n", printk(KERN_INFO "input: %s on %s\n", cobra_name, gameport->phys);
cobra->dev[i].number, cobra_name, gameport->number, i);
} }
return; return;
fail2: gameport_close(gameport); fail2: gameport_close(gameport);
fail1: kfree(cobra); fail1: kfree(cobra);
...@@ -248,5 +253,3 @@ void __exit cobra_exit(void) ...@@ -248,5 +253,3 @@ void __exit cobra_exit(void)
module_init(cobra_init); module_init(cobra_init);
module_exit(cobra_exit); module_exit(cobra_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: db9.c,v 1.6 2000/06/25 10:57:50 vojtech Exp $ * $Id: db9.c,v 1.12 2002/01/22 20:27:05 vojtech Exp $
* *
* Copyright (c) 1999 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* Andree Borrmann Mats Sjvall * Andree Borrmann Mats Sjvall
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -29,8 +27,8 @@ ...@@ -29,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -40,8 +38,10 @@ ...@@ -40,8 +38,10 @@
#include <linux/parport.h> #include <linux/parport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(db9, "2i"); MODULE_PARM(db9, "2i");
MODULE_PARM(db9_2, "2i"); MODULE_PARM(db9_2, "2i");
MODULE_PARM(db9_3, "2i"); MODULE_PARM(db9_3, "2i");
...@@ -87,6 +87,7 @@ struct db9 { ...@@ -87,6 +87,7 @@ struct db9 {
struct pardevice *pd; struct pardevice *pd;
int mode; int mode;
int used; int used;
char phys[2][32];
}; };
static struct db9 *db9_base[3]; static struct db9 *db9_base[3];
...@@ -342,11 +343,14 @@ static struct db9 __init *db9_probe(int *config) ...@@ -342,11 +343,14 @@ static struct db9 __init *db9_probe(int *config)
for (i = 0; i < 1 + (db9->mode == DB9_MULTI_0802_2); i++) { for (i = 0; i < 1 + (db9->mode == DB9_MULTI_0802_2); i++) {
sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i);
db9->dev[i].private = db9; db9->dev[i].private = db9;
db9->dev[i].open = db9_open; db9->dev[i].open = db9_open;
db9->dev[i].close = db9_close; db9->dev[i].close = db9_close;
db9->dev[i].name = db9_name[db9->mode]; db9->dev[i].name = db9_name[db9->mode];
db9->dev[i].phys = db9->phys[i];
db9->dev[i].idbus = BUS_PARPORT; db9->dev[i].idbus = BUS_PARPORT;
db9->dev[i].idvendor = 0x0002; db9->dev[i].idvendor = 0x0002;
db9->dev[i].idproduct = config[1]; db9->dev[i].idproduct = config[1];
...@@ -362,8 +366,7 @@ static struct db9 __init *db9_probe(int *config) ...@@ -362,8 +366,7 @@ static struct db9 __init *db9_probe(int *config)
db9->dev[i].absmin[ABS_Y] = -1; db9->dev[i].absmax[ABS_Y] = 1; db9->dev[i].absmin[ABS_Y] = -1; db9->dev[i].absmax[ABS_Y] = 1;
input_register_device(db9->dev + i); input_register_device(db9->dev + i);
printk(KERN_INFO "input%d: %s on %s\n", printk(KERN_INFO "input: %s on %s\n", db9->dev[i].name, db9->pd->port->name);
db9->dev[i].number, db9_name[db9->mode], db9->pd->port->name);
} }
return db9; return db9;
......
/* /*
* $Id: gamecon.c,v 1.14 2001/04/29 22:42:14 vojtech Exp $ * $Id: gamecon.c,v 1.21 2002/01/22 20:27:27 vojtech Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* Andree Borrmann John Dahlstrom * Andree Borrmann John Dahlstrom
* David Kuder Nathan Hand * David Kuder Nathan Hand
*
* Sponsored by SuSE
*/ */
/* /*
* NES, SNES, N64, Multi1, Multi2, PSX gamepad driver for Linux * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux
*/ */
/* /*
...@@ -30,8 +28,8 @@ ...@@ -30,8 +28,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -41,8 +39,10 @@ ...@@ -41,8 +39,10 @@
#include <linux/parport.h> #include <linux/parport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(gc, "2-6i"); MODULE_PARM(gc, "2-6i");
MODULE_PARM(gc_2,"2-6i"); MODULE_PARM(gc_2,"2-6i");
MODULE_PARM(gc_3,"2-6i"); MODULE_PARM(gc_3,"2-6i");
...@@ -65,6 +65,7 @@ struct gc { ...@@ -65,6 +65,7 @@ struct gc {
struct timer_list timer; struct timer_list timer;
unsigned char pads[GC_MAX + 1]; unsigned char pads[GC_MAX + 1];
int used; int used;
char phys[5][32];
}; };
static struct gc *gc_base[3]; static struct gc *gc_base[3];
...@@ -585,12 +586,15 @@ static struct gc __init *gc_probe(int *config) ...@@ -585,12 +586,15 @@ static struct gc __init *gc_probe(int *config)
default: default:
gc->pads[GC_PSX] &= ~gc_status_bit[i]; gc->pads[GC_PSX] &= ~gc_status_bit[i];
printk(KERN_WARNING "gamecon.c: Unsupported PSX controller %#x," printk(KERN_WARNING "gamecon.c: Unsupported PSX controller %#x,"
" please report to <vojtech@suse.cz>.\n", psx); " please report to <vojtech@ucw.cz>.\n", psx);
} }
break; break;
} }
sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);
gc->dev[i].name = gc_names[config[i + 1]]; gc->dev[i].name = gc_names[config[i + 1]];
gc->dev[i].phys = gc->phys[i];
gc->dev[i].idbus = BUS_PARPORT; gc->dev[i].idbus = BUS_PARPORT;
gc->dev[i].idvendor = 0x0001; gc->dev[i].idvendor = 0x0001;
gc->dev[i].idproduct = config[i + 1]; gc->dev[i].idproduct = config[i + 1];
...@@ -608,7 +612,7 @@ static struct gc __init *gc_probe(int *config) ...@@ -608,7 +612,7 @@ static struct gc __init *gc_probe(int *config)
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
if (gc->pads[0] & gc_status_bit[i]) { if (gc->pads[0] & gc_status_bit[i]) {
input_register_device(gc->dev + i); input_register_device(gc->dev + i);
printk(KERN_INFO "input%d: %s on %s\n", gc->dev[i].number, gc->dev[i].name, gc->pd->port->name); printk(KERN_INFO "input: %s on %s\n", gc->dev[i].name, gc->pd->port->name);
} }
return gc; return gc;
......
/* /*
* $Id: gf2k.c,v 1.12 2000/06/04 14:53:44 vojtech Exp $ * $Id: gf2k.c,v 1.19 2002/01/22 20:27:43 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -38,6 +36,10 @@ ...@@ -38,6 +36,10 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/gameport.h> #include <linux/gameport.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Genius Flight 2000 joystick driver");
MODULE_LICENSE("GPL");
#define GF2K_START 400 /* The time we wait for the first bit [400 us] */ #define GF2K_START 400 /* The time we wait for the first bit [400 us] */
#define GF2K_STROBE 40 /* The time we wait for the first bit [40 us] */ #define GF2K_STROBE 40 /* The time we wait for the first bit [40 us] */
#define GF2K_TIMEOUT 4 /* Wait for everything to settle [4 ms] */ #define GF2K_TIMEOUT 4 /* Wait for everything to settle [4 ms] */
...@@ -85,6 +87,7 @@ struct gf2k { ...@@ -85,6 +87,7 @@ struct gf2k {
int used; int used;
unsigned char id; unsigned char id;
unsigned char length; unsigned char length;
char phys[32];
}; };
/* /*
...@@ -278,11 +281,13 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -278,11 +281,13 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
#endif #endif
if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) { if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) {
printk(KERN_WARNING "gf2k.c: Not yet supported joystick on gameport%d. [id: %d type:%s]\n", printk(KERN_WARNING "gf2k.c: Not yet supported joystick on %s. [id: %d type:%s]\n",
gameport->number, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]); gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]);
goto fail2; goto fail2;
} }
sprintf(gf2k->phys, "%s/input0", gameport->phys);
gf2k->length = gf2k_lens[gf2k->id]; gf2k->length = gf2k_lens[gf2k->id];
gf2k->dev.private = gf2k; gf2k->dev.private = gf2k;
...@@ -291,6 +296,7 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -291,6 +296,7 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
gf2k->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); gf2k->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
gf2k->dev.name = gf2k_names[gf2k->id]; gf2k->dev.name = gf2k_names[gf2k->id];
gf2k->dev.phys = gf2k->phys;
gf2k->dev.idbus = BUS_GAMEPORT; gf2k->dev.idbus = BUS_GAMEPORT;
gf2k->dev.idvendor = GAMEPORT_ID_VENDOR_GENIUS; gf2k->dev.idvendor = GAMEPORT_ID_VENDOR_GENIUS;
gf2k->dev.idproduct = gf2k->id; gf2k->dev.idproduct = gf2k->id;
...@@ -323,8 +329,7 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -323,8 +329,7 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
} }
input_register_device(&gf2k->dev); input_register_device(&gf2k->dev);
printk(KERN_INFO "input%d: %s on gameport%d.0\n", printk(KERN_INFO "input: %s on %s\n", gf2k_names[gf2k->id], gameport->phys);
gf2k->dev.number, gf2k_names[gf2k->id], gameport->number);
return; return;
fail2: gameport_close(gameport); fail2: gameport_close(gameport);
...@@ -357,5 +362,3 @@ void __exit gf2k_exit(void) ...@@ -357,5 +362,3 @@ void __exit gf2k_exit(void)
module_init(gf2k_init); module_init(gf2k_init);
module_exit(gf2k_exit); module_exit(gf2k_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: grip.c,v 1.14 2000/06/06 21:13:36 vojtech Exp $ * $Id: grip.c,v 1.21 2002/01/22 20:27:57 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,6 +35,10 @@ ...@@ -37,6 +35,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Gravis GrIP protocol joystick driver");
MODULE_LICENSE("GPL");
#define GRIP_MODE_GPP 1 #define GRIP_MODE_GPP 1
#define GRIP_MODE_BD 2 #define GRIP_MODE_BD 2
#define GRIP_MODE_XT 3 #define GRIP_MODE_XT 3
...@@ -59,6 +61,7 @@ struct grip { ...@@ -59,6 +61,7 @@ struct grip {
int used; int used;
int reads; int reads;
int bads; int bads;
char phys[2][32];
}; };
static int grip_btn_gpp[] = { BTN_START, BTN_SELECT, BTN_TR2, BTN_Y, 0, BTN_TL2, BTN_A, BTN_B, BTN_X, 0, BTN_TL, BTN_TR, -1 }; static int grip_btn_gpp[] = { BTN_START, BTN_SELECT, BTN_TR2, BTN_Y, 0, BTN_TL2, BTN_A, BTN_B, BTN_X, 0, BTN_TL, BTN_TR, -1 };
...@@ -340,12 +343,15 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -340,12 +343,15 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if (grip->mode[i]) { if (grip->mode[i]) {
sprintf(grip->phys[i], "%s/input%d", gameport->phys, i);
grip->dev[i].private = grip; grip->dev[i].private = grip;
grip->dev[i].open = grip_open; grip->dev[i].open = grip_open;
grip->dev[i].close = grip_close; grip->dev[i].close = grip_close;
grip->dev[i].name = grip_name[grip->mode[i]]; grip->dev[i].name = grip_name[grip->mode[i]];
grip->dev[i].phys = grip->phys[i];
grip->dev[i].idbus = BUS_GAMEPORT; grip->dev[i].idbus = BUS_GAMEPORT;
grip->dev[i].idvendor = GAMEPORT_ID_VENDOR_GRAVIS; grip->dev[i].idvendor = GAMEPORT_ID_VENDOR_GRAVIS;
grip->dev[i].idproduct = grip->mode[i]; grip->dev[i].idproduct = grip->mode[i];
...@@ -382,8 +388,8 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -382,8 +388,8 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
input_register_device(grip->dev + i); input_register_device(grip->dev + i);
printk(KERN_INFO "input%d: %s on gameport%d.%d\n", printk(KERN_INFO "input: %s on %s\n",
grip->dev[i].number, grip_name[grip->mode[i]], gameport->number, i); grip_name[grip->mode[i]], gameport->phys);
} }
return; return;
...@@ -421,5 +427,3 @@ void __exit grip_exit(void) ...@@ -421,5 +427,3 @@ void __exit grip_exit(void)
module_init(grip_init); module_init(grip_init);
module_exit(grip_exit); module_exit(grip_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: interact.c,v 1.8 2000/05/29 11:19:51 vojtech Exp $ * $Id: interact.c,v 1.16 2002/01/22 20:28:25 vojtech Exp $
* *
* Copyright (c) 2000 Vojtech Pavlik * Copyright (c) 2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* Toby Deshane * Toby Deshane
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -29,8 +27,8 @@ ...@@ -29,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -41,6 +39,10 @@ ...@@ -41,6 +39,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("InterAct digital joystick driver");
MODULE_LICENSE("GPL");
#define INTERACT_MAX_START 400 /* 400 us */ #define INTERACT_MAX_START 400 /* 400 us */
#define INTERACT_MAX_STROBE 40 /* 40 us */ #define INTERACT_MAX_STROBE 40 /* 40 us */
#define INTERACT_MAX_LENGTH 32 /* 32 bits */ #define INTERACT_MAX_LENGTH 32 /* 32 bits */
...@@ -58,6 +60,7 @@ struct interact { ...@@ -58,6 +60,7 @@ struct interact {
int reads; int reads;
unsigned char type; unsigned char type;
unsigned char length; unsigned char length;
char phys[32];
}; };
static short interact_abs_hhfx[] = static short interact_abs_hhfx[] =
...@@ -137,40 +140,41 @@ static void interact_timer(unsigned long private) ...@@ -137,40 +140,41 @@ static void interact_timer(unsigned long private)
if (interact_read_packet(interact->gameport, interact->length, data) < interact->length) { if (interact_read_packet(interact->gameport, interact->length, data) < interact->length) {
interact->bads++; interact->bads++;
} else } else {
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
data[i] <<= INTERACT_MAX_LENGTH - interact->length; data[i] <<= INTERACT_MAX_LENGTH - interact->length;
switch (interact->type) { switch (interact->type) {
case INTERACT_TYPE_HHFX: case INTERACT_TYPE_HHFX:
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
input_report_abs(dev, interact_abs_hhfx[i], (data[i & 1] >> ((i >> 1) << 3)) & 0xff); input_report_abs(dev, interact_abs_hhfx[i], (data[i & 1] >> ((i >> 1) << 3)) & 0xff);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
input_report_abs(dev, ABS_HAT0Y - i, input_report_abs(dev, ABS_HAT0Y - i,
((data[1] >> ((i << 1) + 17)) & 1) - ((data[1] >> ((i << 1) + 16)) & 1)); ((data[1] >> ((i << 1) + 17)) & 1) - ((data[1] >> ((i << 1) + 16)) & 1));
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
input_report_key(dev, interact_btn_hhfx[i], (data[0] >> (i + 16)) & 1); input_report_key(dev, interact_btn_hhfx[i], (data[0] >> (i + 16)) & 1);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
input_report_key(dev, interact_btn_hhfx[i + 8], (data[1] >> (i + 20)) & 1); input_report_key(dev, interact_btn_hhfx[i + 8], (data[1] >> (i + 20)) & 1);
break; break;
case INTERACT_TYPE_PP8D: case INTERACT_TYPE_PP8D:
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
input_report_abs(dev, interact_abs_pp8d[i], input_report_abs(dev, interact_abs_pp8d[i],
((data[0] >> ((i << 1) + 20)) & 1) - ((data[0] >> ((i << 1) + 21)) & 1)); ((data[0] >> ((i << 1) + 20)) & 1) - ((data[0] >> ((i << 1) + 21)) & 1));
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
input_report_key(dev, interact_btn_pp8d[i], (data[1] >> (i + 16)) & 1); input_report_key(dev, interact_btn_pp8d[i], (data[1] >> (i + 16)) & 1);
break; break;
}
} }
mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME); mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);
...@@ -235,11 +239,13 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev ...@@ -235,11 +239,13 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev
break; break;
if (!interact_type[i].length) { if (!interact_type[i].length) {
printk(KERN_WARNING "interact.c: Unknown joystick on gameport%d. [len %d d0 %08x d1 %08x i2 %08x]\n", printk(KERN_WARNING "interact.c: Unknown joystick on %s. [len %d d0 %08x d1 %08x i2 %08x]\n",
gameport->number, i, data[0], data[1], data[2]); gameport->phys, i, data[0], data[1], data[2]);
goto fail2; goto fail2;
} }
sprintf(interact->phys, "%s/input0", gameport->phys);
interact->type = i; interact->type = i;
interact->length = interact_type[i].length; interact->length = interact_type[i].length;
...@@ -248,6 +254,7 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev ...@@ -248,6 +254,7 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev
interact->dev.close = interact_close; interact->dev.close = interact_close;
interact->dev.name = interact_type[i].name; interact->dev.name = interact_type[i].name;
interact->dev.phys = interact->phys;
interact->dev.idbus = BUS_GAMEPORT; interact->dev.idbus = BUS_GAMEPORT;
interact->dev.idvendor = GAMEPORT_ID_VENDOR_INTERACT; interact->dev.idvendor = GAMEPORT_ID_VENDOR_INTERACT;
interact->dev.idproduct = interact_type[i].id; interact->dev.idproduct = interact_type[i].id;
...@@ -270,8 +277,8 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev ...@@ -270,8 +277,8 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev
set_bit(t, interact->dev.keybit); set_bit(t, interact->dev.keybit);
input_register_device(&interact->dev); input_register_device(&interact->dev);
printk(KERN_INFO "input%d: %s on gameport%d.0\n", printk(KERN_INFO "input: %s on %s\n",
interact->dev.number, interact_type[interact->type].name, gameport->number); interact_type[interact->type].name, gameport->phys);
return; return;
fail2: gameport_close(gameport); fail2: gameport_close(gameport);
...@@ -304,5 +311,3 @@ void __exit interact_exit(void) ...@@ -304,5 +311,3 @@ void __exit interact_exit(void)
module_init(interact_init); module_init(interact_init);
module_exit(interact_exit); module_exit(interact_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: magellan.c,v 1.8 2000/05/31 13:17:12 vojtech Exp $ * $Id: magellan.c,v 1.16 2002/01/22 20:28:39 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -27,7 +25,7 @@ ...@@ -27,7 +25,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,15 +35,19 @@ ...@@ -37,15 +35,19 @@
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/init.h> #include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Magellan and SpaceMouse 6dof controller driver");
MODULE_LICENSE("GPL");
/* /*
* Definitions & global arrays. * Definitions & global arrays.
*/ */
#define MAGELLAN_MAX_LENGTH 32 #define MAGELLAN_MAX_LENGTH 32
static int magellan_buttons[] = { BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8}; static int magellan_buttons[] = { BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8 };
static int magellan_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ}; static int magellan_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ };
static char *magellan_name = "LogiCad3D Magellan"; static char *magellan_name = "LogiCad3D Magellan / SpaceMouse";
/* /*
* Per-Magellan data. * Per-Magellan data.
...@@ -55,6 +57,7 @@ struct magellan { ...@@ -55,6 +57,7 @@ struct magellan {
struct input_dev dev; struct input_dev dev;
int idx; int idx;
unsigned char data[MAGELLAN_MAX_LENGTH]; unsigned char data[MAGELLAN_MAX_LENGTH];
char phys[32];
}; };
/* /*
...@@ -162,8 +165,11 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) ...@@ -162,8 +165,11 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
magellan->dev.absmax[t] = 360; magellan->dev.absmax[t] = 360;
} }
sprintf(magellan->phys, "%s/input0", serio->phys);
magellan->dev.private = magellan; magellan->dev.private = magellan;
magellan->dev.name = magellan_name; magellan->dev.name = magellan_name;
magellan->dev.phys = magellan->phys;
magellan->dev.idbus = BUS_RS232; magellan->dev.idbus = BUS_RS232;
magellan->dev.idvendor = SERIO_MAGELLAN; magellan->dev.idvendor = SERIO_MAGELLAN;
magellan->dev.idproduct = 0x0001; magellan->dev.idproduct = 0x0001;
...@@ -178,7 +184,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) ...@@ -178,7 +184,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
input_register_device(&magellan->dev); input_register_device(&magellan->dev);
printk(KERN_INFO "input%d: %s on serio%d\n", magellan->dev.number, magellan_name, serio->number); printk(KERN_INFO "input: %s on %s\n", magellan_name, serio->phys);
} }
/* /*
...@@ -208,5 +214,3 @@ void __exit magellan_exit(void) ...@@ -208,5 +214,3 @@ void __exit magellan_exit(void)
module_init(magellan_init); module_init(magellan_init);
module_exit(magellan_exit); module_exit(magellan_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: sidewinder.c,v 1.20 2001/05/19 08:14:54 vojtech Exp $ * $Id: sidewinder.c,v 1.29 2002/01/22 20:28:51 vojtech Exp $
* *
* Copyright (c) 1998-2001 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -26,8 +24,8 @@ ...@@ -26,8 +24,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -38,12 +36,16 @@ ...@@ -38,12 +36,16 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/gameport.h> #include <linux/gameport.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Microsoft SideWinder joystick family driver");
MODULE_LICENSE("GPL");
/* /*
* These are really magic values. Changing them can make a problem go away, * These are really magic values. Changing them can make a problem go away,
* as well as break everything. * as well as break everything.
*/ */
#undef SW_DEBUG #define SW_DEBUG
#define SW_START 400 /* The time we wait for the first bit [400 us] */ #define SW_START 400 /* The time we wait for the first bit [400 us] */
#define SW_STROBE 45 /* Max time per bit [45 us] */ #define SW_STROBE 45 /* Max time per bit [45 us] */
...@@ -114,6 +116,7 @@ struct sw { ...@@ -114,6 +116,7 @@ struct sw {
struct timer_list timer; struct timer_list timer;
struct input_dev dev[4]; struct input_dev dev[4];
char name[64]; char name[64];
char phys[4][32];
int length; int length;
int type; int type;
int bits; int bits;
...@@ -411,8 +414,8 @@ static int sw_read(struct sw *sw) ...@@ -411,8 +414,8 @@ static int sw_read(struct sw *sw)
if (sw->type == SW_ID_3DP && sw->length == 66 && i != 66) { /* Broken packet, try to fix */ if (sw->type == SW_ID_3DP && sw->length == 66 && i != 66) { /* Broken packet, try to fix */
if (i == 64 && !sw_check(sw_get_bits(buf,0,64,1))) { /* Last init failed, 1 bit mode */ if (i == 64 && !sw_check(sw_get_bits(buf,0,64,1))) { /* Last init failed, 1 bit mode */
printk(KERN_WARNING "sidewinder.c: Joystick in wrong mode on gameport%d" printk(KERN_WARNING "sidewinder.c: Joystick in wrong mode on %s"
" - going to reinitialize.\n", sw->gameport->number); " - going to reinitialize.\n", sw->gameport->phys);
sw->fail = SW_FAIL; /* Reinitialize */ sw->fail = SW_FAIL; /* Reinitialize */
i = 128; /* Bogus value */ i = 128; /* Bogus value */
} }
...@@ -437,8 +440,8 @@ static int sw_read(struct sw *sw) ...@@ -437,8 +440,8 @@ static int sw_read(struct sw *sw)
if (sw->type == SW_ID_3DP && sw->length == 66 /* Many packets OK */ if (sw->type == SW_ID_3DP && sw->length == 66 /* Many packets OK */
&& sw->ok > SW_OK) { && sw->ok > SW_OK) {
printk(KERN_INFO "sidewinder.c: No more trouble on gameport%d" printk(KERN_INFO "sidewinder.c: No more trouble on %s"
" - enabling optimization again.\n", sw->gameport->number); " - enabling optimization again.\n", sw->gameport->phys);
sw->length = 22; sw->length = 22;
} }
...@@ -450,15 +453,15 @@ static int sw_read(struct sw *sw) ...@@ -450,15 +453,15 @@ static int sw_read(struct sw *sw)
if (sw->type == SW_ID_3DP && sw->length == 22 && sw->fail > SW_BAD) { /* Consecutive bad packets */ if (sw->type == SW_ID_3DP && sw->length == 22 && sw->fail > SW_BAD) { /* Consecutive bad packets */
printk(KERN_INFO "sidewinder.c: Many bit errors on gameport%d" printk(KERN_INFO "sidewinder.c: Many bit errors on %s"
" - disabling optimization.\n", sw->gameport->number); " - disabling optimization.\n", sw->gameport->phys);
sw->length = 66; sw->length = 66;
} }
if (sw->fail < SW_FAIL) return -1; /* Not enough, don't reinitialize yet */ if (sw->fail < SW_FAIL) return -1; /* Not enough, don't reinitialize yet */
printk(KERN_WARNING "sidewinder.c: Too many bit errors on gameport%d" printk(KERN_WARNING "sidewinder.c: Too many bit errors on %s"
" - reinitializing joystick.\n", sw->gameport->number); " - reinitializing joystick.\n", sw->gameport->phys);
if (!i && sw->type == SW_ID_3DP) { /* 3D Pro can be in analog mode */ if (!i && sw->type == SW_ID_3DP) { /* 3D Pro can be in analog mode */
udelay(3 * SW_TIMEOUT); udelay(3 * SW_TIMEOUT);
...@@ -582,8 +585,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -582,8 +585,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW)) if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
goto fail1; goto fail1;
dbg("Init 0: Opened gameport %d, io %#x, speed %d", dbg("Init 0: Opened %s, io %#x, speed %d",
gameport->number, gameport->io, gameport->speed); gameport->phys, gameport->io, gameport->speed);
i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */ i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */
m |= sw_guess_mode(buf, i); /* Data packet (1-bit) can carry mode info [FSP] */ m |= sw_guess_mode(buf, i); /* Data packet (1-bit) can carry mode info [FSP] */
...@@ -673,7 +676,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -673,7 +676,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
if (sw->type == -1) { if (sw->type == -1) {
printk(KERN_WARNING "sidewinder.c: unknown joystick device detected " printk(KERN_WARNING "sidewinder.c: unknown joystick device detected "
"on gameport%d, contact <vojtech@suse.cz>\n", gameport->number); "on %s, contact <vojtech@ucw.cz>\n", gameport->phys);
sw_print_packet("ID", j * 3, idbuf, 3); sw_print_packet("ID", j * 3, idbuf, 3);
sw_print_packet("Data", i * m, buf, m); sw_print_packet("Data", i * m, buf, m);
goto fail2; goto fail2;
...@@ -691,6 +694,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -691,6 +694,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
int bits, code; int bits, code;
sprintf(sw->name, "Microsoft SideWinder %s", sw_name[sw->type]); sprintf(sw->name, "Microsoft SideWinder %s", sw_name[sw->type]);
sprintf(sw->phys[i], "%s/input%d", gameport->phys, i);
sw->dev[i].private = sw; sw->dev[i].private = sw;
...@@ -698,6 +702,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -698,6 +702,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
sw->dev[i].close = sw_close; sw->dev[i].close = sw_close;
sw->dev[i].name = sw->name; sw->dev[i].name = sw->name;
sw->dev[i].phys = sw->phys[i];
sw->dev[i].idbus = BUS_GAMEPORT; sw->dev[i].idbus = BUS_GAMEPORT;
sw->dev[i].idvendor = GAMEPORT_ID_VENDOR_MICROSOFT; sw->dev[i].idvendor = GAMEPORT_ID_VENDOR_MICROSOFT;
sw->dev[i].idproduct = sw->type; sw->dev[i].idproduct = sw->type;
...@@ -719,8 +724,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -719,8 +724,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
set_bit(code, sw->dev[i].keybit); set_bit(code, sw->dev[i].keybit);
input_register_device(sw->dev + i); input_register_device(sw->dev + i);
printk(KERN_INFO "input%d: %s%s on gameport%d.%d [%d-bit id %d data %d]\n", printk(KERN_INFO "input: %s%s on %s [%d-bit id %d data %d]\n",
sw->dev[i].number, sw->name, comment, gameport->number, i, m, l, k); sw->name, comment, gameport->phys, m, l, k);
} }
return; return;
...@@ -757,5 +762,3 @@ void __exit sw_exit(void) ...@@ -757,5 +762,3 @@ void __exit sw_exit(void)
module_init(sw_init); module_init(sw_init);
module_exit(sw_exit); module_exit(sw_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: spaceball.c,v 1.8 2000/11/23 11:42:39 vojtech Exp $ * $Id: spaceball.c,v 1.17 2002/01/22 20:29:03 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* David Thompson * David Thompson
* Joseph Krahn * Joseph Krahn
*
* Sponsored by SuSE
*/ */
/* /*
* SpaceTec SpaceBall 4000 FLX driver for Linux * SpaceTec SpaceBall 2003/3003/4000 FLX driver for Linux
*/ */
/* /*
...@@ -30,8 +28,8 @@ ...@@ -30,8 +28,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -41,13 +39,29 @@ ...@@ -41,13 +39,29 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/serio.h> #include <linux/serio.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("SpaceTec SpaceBall 2003/3003/4000 FLX driver");
MODULE_LICENSE("GPL");
/* /*
* Constants. * Constants.
*/ */
#define JS_SBALL_MAX_LENGTH 128 #define SPACEBALL_MAX_LENGTH 128
#define SPACEBALL_MAX_ID 8
#define SPACEBALL_1003 1
#define SPACEBALL_2003B 3
#define SPACEBALL_2003C 4
#define SPACEBALL_3003C 7
#define SPACEBALL_4000FLX 8
#define SPACEBALL_4000FLX_L 9
static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY }; static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY };
static char *spaceball_name = "SpaceTec SpaceBall 4000 FLX"; static char *spaceball_names[] = {
"?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B",
"SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController",
"SpaceTec SpaceBall 3003C", "SpaceTec SpaceBall 4000FLX", "SpaceTec SpaceBall 4000FLX Lefty" };
/* /*
* Per-Ball data. * Per-Ball data.
...@@ -58,7 +72,8 @@ struct spaceball { ...@@ -58,7 +72,8 @@ struct spaceball {
struct serio *serio; struct serio *serio;
int idx; int idx;
int escape; int escape;
unsigned char data[JS_SBALL_MAX_LENGTH]; unsigned char data[SPACEBALL_MAX_LENGTH];
char phys[32];
}; };
/* /*
...@@ -74,35 +89,53 @@ static void spaceball_process_packet(struct spaceball* spaceball) ...@@ -74,35 +89,53 @@ static void spaceball_process_packet(struct spaceball* spaceball)
if (spaceball->idx < 2) return; if (spaceball->idx < 2) return;
printk("%c %d\n", spaceball->data[0], spaceball->idx);
switch (spaceball->data[0]) { switch (spaceball->data[0]) {
case '@': /* Reset packet */
spaceball->data[spaceball->idx - 1] = 0;
for (i = 1; i < spaceball->idx && spaceball->data[i] == ' '; i++);
printk(KERN_INFO "input%d: %s [%s] on serio%d\n",
spaceball->dev.number, spaceball_name, spaceball->data + i, spaceball->serio->number);
break;
case 'D': /* Ball data */ case 'D': /* Ball data */
if (spaceball->idx != 15) return; if (spaceball->idx != 15) return;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++)
input_report_abs(dev, spaceball_axes[i], input_report_abs(dev, spaceball_axes[i],
(__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2]));
}
break; break;
case '.': /* Button data, part2 */ case 'K': /* Button data */
if (spaceball->idx != 3) return; if (spaceball->idx != 3) return;
input_report_key(dev, BTN_0, data[2] & 1); input_report_key(dev, BTN_1, (data[2] & 0x01) || (data[2] & 0x20));
input_report_key(dev, BTN_1, data[2] & 2); input_report_key(dev, BTN_2, data[2] & 0x02);
input_report_key(dev, BTN_3, data[2] & 0x04);
input_report_key(dev, BTN_4, data[2] & 0x08);
input_report_key(dev, BTN_5, data[1] & 0x01);
input_report_key(dev, BTN_6, data[1] & 0x02);
input_report_key(dev, BTN_7, data[1] & 0x04);
input_report_key(dev, BTN_8, data[1] & 0x10);
break; break;
case '?': /* Error packet */ case '.': /* Advanced button data */
if (spaceball->idx != 3) return;
input_report_key(dev, BTN_1, data[2] & 0x01);
input_report_key(dev, BTN_2, data[2] & 0x02);
input_report_key(dev, BTN_3, data[2] & 0x04);
input_report_key(dev, BTN_4, data[2] & 0x08);
input_report_key(dev, BTN_5, data[2] & 0x10);
input_report_key(dev, BTN_6, data[2] & 0x20);
input_report_key(dev, BTN_7, data[2] & 0x80);
input_report_key(dev, BTN_8, data[1] & 0x01);
input_report_key(dev, BTN_9, data[1] & 0x02);
input_report_key(dev, BTN_A, data[1] & 0x04);
input_report_key(dev, BTN_B, data[1] & 0x08);
input_report_key(dev, BTN_C, data[1] & 0x10);
input_report_key(dev, BTN_MODE, data[1] & 0x20);
break;
case 'E': /* Device error */
spaceball->data[spaceball->idx - 1] = 0; spaceball->data[spaceball->idx - 1] = 0;
printk(KERN_ERR "spaceball: Device error. [%s]\n", spaceball->data + 1); printk(KERN_ERR "spaceball: Device error. [%s]\n", spaceball->data + 1);
break; break;
case '?': /* Bad command packet */
spaceball->data[spaceball->idx - 1] = 0;
printk(KERN_ERR "spaceball: Bad command. [%s]\n", spaceball->data + 1);
break;
} }
} }
...@@ -136,11 +169,9 @@ static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigne ...@@ -136,11 +169,9 @@ static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigne
data &= 0x1f; data &= 0x1f;
} }
default: default:
if (spaceball->escape) { if (spaceball->escape)
spaceball->escape = 0; spaceball->escape = 0;
printk(KERN_WARNING "spaceball.c: Unknown escaped character: %#x (%c)\n", data, data); if (spaceball->idx < SPACEBALL_MAX_LENGTH)
}
if (spaceball->idx < JS_SBALL_MAX_LENGTH)
spaceball->data[spaceball->idx++] = data; spaceball->data[spaceball->idx++] = data;
return; return;
} }
...@@ -167,9 +198,12 @@ static void spaceball_disconnect(struct serio *serio) ...@@ -167,9 +198,12 @@ static void spaceball_disconnect(struct serio *serio)
static void spaceball_connect(struct serio *serio, struct serio_dev *dev) static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
{ {
struct spaceball *spaceball; struct spaceball *spaceball;
int i, t; int i, t, id;
if (serio->type != (SERIO_RS232 | SERIO_SPACEBALL)) if ((serio->type & ~SERIO_ID) != (SERIO_RS232 | SERIO_SPACEBALL))
return;
if ((id = (serio->type & SERIO_ID) >> 8) > SPACEBALL_MAX_ID)
return; return;
if (!(spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL))) if (!(spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL)))
...@@ -177,7 +211,18 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) ...@@ -177,7 +211,18 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
memset(spaceball, 0, sizeof(struct spaceball)); memset(spaceball, 0, sizeof(struct spaceball));
spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
spaceball->dev.keybit[LONG(BTN_0)] = BIT(BTN_0) | BIT(BTN_1);
switch (id) {
case SPACEBALL_4000FLX:
case SPACEBALL_4000FLX_L:
spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_9);
spaceball->dev.keybit[LONG(BTN_A)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_MODE);
default:
spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4)
| BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7) | BIT(BTN_8);
case SPACEBALL_3003C:
spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_1) | BIT(BTN_8);
}
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
t = spaceball_axes[i]; t = spaceball_axes[i];
...@@ -191,10 +236,13 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) ...@@ -191,10 +236,13 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
spaceball->serio = serio; spaceball->serio = serio;
spaceball->dev.private = spaceball; spaceball->dev.private = spaceball;
spaceball->dev.name = spaceball_name; sprintf(spaceball->phys, "%s/input0", serio->phys);
spaceball->dev.name = spaceball_names[id];
spaceball->dev.phys = spaceball->phys;
spaceball->dev.idbus = BUS_RS232; spaceball->dev.idbus = BUS_RS232;
spaceball->dev.idvendor = SERIO_SPACEBALL; spaceball->dev.idvendor = SERIO_SPACEBALL;
spaceball->dev.idproduct = 0x0001; spaceball->dev.idproduct = id;
spaceball->dev.idversion = 0x0100; spaceball->dev.idversion = 0x0100;
serio->private = spaceball; serio->private = spaceball;
...@@ -205,6 +253,9 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) ...@@ -205,6 +253,9 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
} }
input_register_device(&spaceball->dev); input_register_device(&spaceball->dev);
printk(KERN_INFO "input: %s on serio%s\n",
spaceball_names[id], serio->phys);
} }
/* /*
...@@ -234,5 +285,3 @@ void __exit spaceball_exit(void) ...@@ -234,5 +285,3 @@ void __exit spaceball_exit(void)
module_init(spaceball_init); module_init(spaceball_init);
module_exit(spaceball_exit); module_exit(spaceball_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: spaceorb.c,v 1.7 2000/05/29 11:19:51 vojtech Exp $ * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* David Thompson * David Thompson
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -29,8 +27,8 @@ ...@@ -29,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -40,15 +38,19 @@ ...@@ -40,15 +38,19 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/serio.h> #include <linux/serio.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("SpaceTec SpaceOrb 360 and Avenger 6dof controller driver");
MODULE_LICENSE("GPL");
/* /*
* Constants. * Constants.
*/ */
#define SPACEORB_MAX_LENGTH 64 #define SPACEORB_MAX_LENGTH 64
static int spaceorb_buttons[] = { BTN_TL, BTN_TR, BTN_Y, BTN_X, BTN_B, BTN_A, BTN_MODE}; static int spaceorb_buttons[] = { BTN_TL, BTN_TR, BTN_Y, BTN_X, BTN_B, BTN_A };
static int spaceorb_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ}; static int spaceorb_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ };
static char *spaceorb_name = "SpaceTec SpaceOrb 360"; static char *spaceorb_name = "SpaceTec SpaceOrb 360 / Avenger";
/* /*
* Per-Orb data. * Per-Orb data.
...@@ -59,6 +61,7 @@ struct spaceorb { ...@@ -59,6 +61,7 @@ struct spaceorb {
struct serio *serio; struct serio *serio;
int idx; int idx;
unsigned char data[SPACEORB_MAX_LENGTH]; unsigned char data[SPACEORB_MAX_LENGTH];
char phys[32];
}; };
static unsigned char spaceorb_xor[] = "SpaceWare"; static unsigned char spaceorb_xor[] = "SpaceWare";
...@@ -88,8 +91,8 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb) ...@@ -88,8 +91,8 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb)
case 'R': /* Reset packet */ case 'R': /* Reset packet */
spaceorb->data[spaceorb->idx - 1] = 0; spaceorb->data[spaceorb->idx - 1] = 0;
for (i = 1; i < spaceorb->idx && spaceorb->data[i] == ' '; i++); for (i = 1; i < spaceorb->idx && spaceorb->data[i] == ' '; i++);
printk(KERN_INFO "input%d: %s [%s] on serio%d\n", printk(KERN_INFO "input: %s [%s] on %s\n",
spaceorb->dev.number, spaceorb_name, spaceorb->data + i, spaceorb->serio->number); spaceorb_name, spaceorb->data + i, spaceorb->serio->phys);
break; break;
case 'D': /* Ball + button data */ case 'D': /* Ball + button data */
...@@ -103,7 +106,7 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb) ...@@ -103,7 +106,7 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb)
axes[5] = ((data[9] & 0x3f) << 4) | (data[10] >> 3); axes[5] = ((data[9] & 0x3f) << 4) | (data[10] >> 3);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
input_report_abs(dev, spaceorb_axes[i], axes[i] - ((axes[i] & 0x200) ? 1024 : 0)); input_report_abs(dev, spaceorb_axes[i], axes[i] - ((axes[i] & 0x200) ? 1024 : 0));
for (i = 0; i < 8; i++) for (i = 0; i < 6; i++)
input_report_key(dev, spaceorb_buttons[i], (data[1] >> i) & 1); input_report_key(dev, spaceorb_buttons[i], (data[1] >> i) & 1);
break; break;
...@@ -167,8 +170,8 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) ...@@ -167,8 +170,8 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < 7; i++) for (i = 0; i < 6; i++)
set_bit(spaceorb_buttons[i], &spaceorb->dev.keybit); set_bit(spaceorb_buttons[i], spaceorb->dev.keybit);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
t = spaceorb_axes[i]; t = spaceorb_axes[i];
...@@ -180,7 +183,10 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) ...@@ -180,7 +183,10 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
spaceorb->serio = serio; spaceorb->serio = serio;
spaceorb->dev.private = spaceorb; spaceorb->dev.private = spaceorb;
sprintf(spaceorb->phys, "%s/input0", serio->phys);
spaceorb->dev.name = spaceorb_name; spaceorb->dev.name = spaceorb_name;
spaceorb->dev.phys = spaceorb->phys;
spaceorb->dev.idbus = BUS_RS232; spaceorb->dev.idbus = BUS_RS232;
spaceorb->dev.idvendor = SERIO_SPACEORB; spaceorb->dev.idvendor = SERIO_SPACEORB;
spaceorb->dev.idproduct = 0x0001; spaceorb->dev.idproduct = 0x0001;
...@@ -223,5 +229,3 @@ void __exit spaceorb_exit(void) ...@@ -223,5 +229,3 @@ void __exit spaceorb_exit(void)
module_init(spaceorb_init); module_init(spaceorb_init);
module_exit(spaceorb_exit); module_exit(spaceorb_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: stinger.c,v 1.4 2001/05/23 09:25:02 vojtech Exp $ * $Id: stinger.c,v 1.10 2002/01/22 20:29:31 vojtech Exp $
* *
* Copyright (c) 2000-2001 Vojtech Pavlik * Copyright (c) 2000-2001 Vojtech Pavlik
* Copyright (c) 2000 Mark Fletcher * Copyright (c) 2000 Mark Fletcher
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -28,7 +26,7 @@ ...@@ -28,7 +26,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -38,6 +36,10 @@ ...@@ -38,6 +36,10 @@
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/init.h> #include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Gravis Stinger gamepad driver");
MODULE_LICENSE("GPL");
/* /*
* Constants. * Constants.
*/ */
...@@ -54,6 +56,7 @@ struct stinger { ...@@ -54,6 +56,7 @@ struct stinger {
struct input_dev dev; struct input_dev dev;
int idx; int idx;
unsigned char data[STINGER_MAX_LENGTH]; unsigned char data[STINGER_MAX_LENGTH];
char phys[32];
}; };
/* /*
...@@ -145,7 +148,10 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev) ...@@ -145,7 +148,10 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
BIT(BTN_START) | BIT(BTN_SELECT); BIT(BTN_START) | BIT(BTN_SELECT);
stinger->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); stinger->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
sprintf(stinger->phys, "%s/serio0", serio->phys);
stinger->dev.name = stinger_name; stinger->dev.name = stinger_name;
stinger->dev.phys = stinger->phys;
stinger->dev.idbus = BUS_RS232; stinger->dev.idbus = BUS_RS232;
stinger->dev.idvendor = SERIO_STINGER; stinger->dev.idvendor = SERIO_STINGER;
stinger->dev.idproduct = 0x0001; stinger->dev.idproduct = 0x0001;
...@@ -168,7 +174,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev) ...@@ -168,7 +174,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
input_register_device(&stinger->dev); input_register_device(&stinger->dev);
printk(KERN_INFO "input%d: %s on serio%d\n", stinger->dev.number, stinger_name, serio->number); printk(KERN_INFO "input: %s on %s\n", stinger_name, serio->phys);
} }
/* /*
...@@ -198,5 +204,3 @@ void __exit stinger_exit(void) ...@@ -198,5 +204,3 @@ void __exit stinger_exit(void)
module_init(stinger_init); module_init(stinger_init);
module_exit(stinger_exit); module_exit(stinger_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: tmdc.c,v 1.23 2000/11/29 19:52:24 vojtech Exp $ * $Id: tmdc.c,v 1.31 2002/01/22 20:29:52 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
*
* Sponsored by SuSE
* *
* Based on the work of: * Based on the work of:
* Trystan Larey-Williams * Trystan Larey-Williams
*
*/ */
/* /*
...@@ -30,8 +27,8 @@ ...@@ -30,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -42,6 +39,10 @@ ...@@ -42,6 +39,10 @@
#include <linux/gameport.h> #include <linux/gameport.h>
#include <linux/input.h> #include <linux/input.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("ThrustMaster DirectConnect joystick driver");
MODULE_LICENSE("GPL");
#define TMDC_MAX_START 400 /* 400 us */ #define TMDC_MAX_START 400 /* 400 us */
#define TMDC_MAX_STROBE 45 /* 45 us */ #define TMDC_MAX_STROBE 45 /* 45 us */
#define TMDC_MAX_LENGTH 13 #define TMDC_MAX_LENGTH 13
...@@ -94,6 +95,7 @@ struct tmdc { ...@@ -94,6 +95,7 @@ struct tmdc {
struct timer_list timer; struct timer_list timer;
struct input_dev dev[2]; struct input_dev dev[2];
char name[2][64]; char name[2][64];
char phys[2][32];
int mode[2]; int mode[2];
signed char *abs[2]; signed char *abs[2];
short *btn[2]; short *btn[2];
...@@ -172,6 +174,7 @@ static void tmdc_timer(unsigned long private) ...@@ -172,6 +174,7 @@ static void tmdc_timer(unsigned long private)
if ((r = tmdc_read_packet(tmdc->gameport, data)) != tmdc->exists) if ((r = tmdc_read_packet(tmdc->gameport, data)) != tmdc->exists)
bad = 1; bad = 1;
else
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
if (r & (1 << j) & tmdc->exists) { if (r & (1 << j) & tmdc->exists) {
...@@ -302,11 +305,14 @@ static void tmdc_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -302,11 +305,14 @@ static void tmdc_connect(struct gameport *gameport, struct gameport_dev *dev)
sprintf(tmdc->name[j], models[m].name, models[m].abs, sprintf(tmdc->name[j], models[m].name, models[m].abs,
(data[j][TMDC_BYTE_DEF] & 0xf) << 3, tmdc->mode[j]); (data[j][TMDC_BYTE_DEF] & 0xf) << 3, tmdc->mode[j]);
sprintf(tmdc->phys[j], "%s/input%d", gameport->phys, j);
tmdc->dev[j].private = tmdc; tmdc->dev[j].private = tmdc;
tmdc->dev[j].open = tmdc_open; tmdc->dev[j].open = tmdc_open;
tmdc->dev[j].close = tmdc_close; tmdc->dev[j].close = tmdc_close;
tmdc->dev[j].name = tmdc->name[j]; tmdc->dev[j].name = tmdc->name[j];
tmdc->dev[j].phys = tmdc->phys[j];
tmdc->dev[j].idbus = BUS_GAMEPORT; tmdc->dev[j].idbus = BUS_GAMEPORT;
tmdc->dev[j].idvendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; tmdc->dev[j].idvendor = GAMEPORT_ID_VENDOR_THRUSTMASTER;
tmdc->dev[j].idproduct = models[m].id; tmdc->dev[j].idproduct = models[m].id;
...@@ -336,8 +342,7 @@ static void tmdc_connect(struct gameport *gameport, struct gameport_dev *dev) ...@@ -336,8 +342,7 @@ static void tmdc_connect(struct gameport *gameport, struct gameport_dev *dev)
} }
input_register_device(tmdc->dev + j); input_register_device(tmdc->dev + j);
printk(KERN_INFO "input%d: %s on gameport%d.%d\n", printk(KERN_INFO "input: %s on %s\n", tmdc->name[j], gameport->phys);
tmdc->dev[j].number, tmdc->name[j], gameport->number, j);
} }
return; return;
...@@ -374,5 +379,3 @@ void __exit tmdc_exit(void) ...@@ -374,5 +379,3 @@ void __exit tmdc_exit(void)
module_init(tmdc_init); module_init(tmdc_init);
module_exit(tmdc_exit); module_exit(tmdc_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: turbografx.c,v 1.8 2000/05/29 20:39:38 vojtech Exp $ * $Id: turbografx.c,v 1.14 2002/01/22 20:30:39 vojtech Exp $
* *
* Copyright (c) 1998-2000 Vojtech Pavlik * Copyright (c) 1998-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* Steffen Schwenke * Steffen Schwenke
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -29,8 +27,8 @@ ...@@ -29,8 +27,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 * 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: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -39,8 +37,10 @@ ...@@ -39,8 +37,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("TurboGraFX parallel port interface driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(tgfx, "2-8i"); MODULE_PARM(tgfx, "2-8i");
MODULE_PARM(tgfx_2, "2-8i"); MODULE_PARM(tgfx_2, "2-8i");
MODULE_PARM(tgfx_3, "2-8i"); MODULE_PARM(tgfx_3, "2-8i");
...@@ -69,6 +69,7 @@ struct tgfx { ...@@ -69,6 +69,7 @@ struct tgfx {
struct pardevice *pd; struct pardevice *pd;
struct timer_list timer; struct timer_list timer;
struct input_dev dev[7]; struct input_dev dev[7];
char phys[7][32];
int sticks; int sticks;
int used; int used;
} *tgfx_base[3]; } *tgfx_base[3];
...@@ -174,7 +175,10 @@ static struct tgfx __init *tgfx_probe(int *config) ...@@ -174,7 +175,10 @@ static struct tgfx __init *tgfx_probe(int *config)
tgfx->dev[i].open = tgfx_open; tgfx->dev[i].open = tgfx_open;
tgfx->dev[i].close = tgfx_close; tgfx->dev[i].close = tgfx_close;
sprintf(tgfx->phys[i], "%s/input0", tgfx->pd->port->name);
tgfx->dev[i].name = tgfx_name; tgfx->dev[i].name = tgfx_name;
tgfx->dev[i].phys = tgfx->phys[i];
tgfx->dev[i].idbus = BUS_PARPORT; tgfx->dev[i].idbus = BUS_PARPORT;
tgfx->dev[i].idvendor = 0x0003; tgfx->dev[i].idvendor = 0x0003;
tgfx->dev[i].idproduct = config[i+1]; tgfx->dev[i].idproduct = config[i+1];
...@@ -190,8 +194,8 @@ static struct tgfx __init *tgfx_probe(int *config) ...@@ -190,8 +194,8 @@ static struct tgfx __init *tgfx_probe(int *config)
tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1; tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1;
input_register_device(tgfx->dev + i); input_register_device(tgfx->dev + i);
printk(KERN_INFO "input%d: %d-button Multisystem joystick on %s\n", printk(KERN_INFO "input: %d-button Multisystem joystick on %s\n",
tgfx->dev[i].number, config[i+1], tgfx->pd->port->name); config[i+1], tgfx->pd->port->name);
} }
if (!tgfx->sticks) { if (!tgfx->sticks) {
......
/* /*
* $Id: warrior.c,v 1.8 2000/05/31 13:17:12 vojtech Exp $ * $Id: warrior.c,v 1.14 2002/01/22 20:32:10 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -27,7 +25,7 @@ ...@@ -27,7 +25,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,6 +35,10 @@ ...@@ -37,6 +35,10 @@
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/init.h> #include <linux/init.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Logitech WingMan Warrior joystick driver");
MODULE_LICENSE("GPL");
/* /*
* Constants. * Constants.
*/ */
...@@ -53,6 +55,7 @@ struct warrior { ...@@ -53,6 +55,7 @@ struct warrior {
struct input_dev dev; struct input_dev dev;
int idx, len; int idx, len;
unsigned char data[WARRIOR_MAX_LENGTH]; unsigned char data[WARRIOR_MAX_LENGTH];
char phys[32];
}; };
/* /*
...@@ -149,7 +152,10 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev) ...@@ -149,7 +152,10 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev)
warrior->dev.relbit[0] = BIT(REL_DIAL); warrior->dev.relbit[0] = BIT(REL_DIAL);
warrior->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y); warrior->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y);
sprintf(warrior->phys, "%s/input0", serio->phys);
warrior->dev.name = warrior_name; warrior->dev.name = warrior_name;
warrior->dev.phys = warrior->phys;
warrior->dev.idbus = BUS_RS232; warrior->dev.idbus = BUS_RS232;
warrior->dev.idvendor = SERIO_WARRIOR; warrior->dev.idvendor = SERIO_WARRIOR;
warrior->dev.idproduct = 0x0001; warrior->dev.idproduct = 0x0001;
...@@ -180,7 +186,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev) ...@@ -180,7 +186,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev)
input_register_device(&warrior->dev); input_register_device(&warrior->dev);
printk(KERN_INFO "input%d: Logitech WingMan Warrior on serio%d\n", warrior->dev.number, serio->number); printk(KERN_INFO "input: Logitech WingMan Warrior on %s\n", serio->phys);
} }
/* /*
...@@ -210,5 +216,3 @@ void __exit warrior_exit(void) ...@@ -210,5 +216,3 @@ void __exit warrior_exit(void)
module_init(warrior_init); module_init(warrior_init);
module_exit(warrior_exit); module_exit(warrior_exit);
MODULE_LICENSE("GPL");
/* /*
* $Id: serio.c,v 1.5 2000/06/04 17:44:59 vojtech Exp $ * $Id: serio.c,v 1.15 2002/01/22 21:12:03 vojtech Exp $
* *
* Copyright (c) 1999-2000 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -27,14 +25,16 @@ ...@@ -27,14 +25,16 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/errno.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Serio abstraction core");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(serio_register_port); EXPORT_SYMBOL(serio_register_port);
...@@ -47,7 +47,6 @@ EXPORT_SYMBOL(serio_rescan); ...@@ -47,7 +47,6 @@ EXPORT_SYMBOL(serio_rescan);
static struct serio *serio_list; static struct serio *serio_list;
static struct serio_dev *serio_dev; static struct serio_dev *serio_dev;
static int serio_number;
static void serio_find_dev(struct serio *serio) static void serio_find_dev(struct serio *serio)
{ {
...@@ -69,7 +68,6 @@ void serio_rescan(struct serio *serio) ...@@ -69,7 +68,6 @@ void serio_rescan(struct serio *serio)
void serio_register_port(struct serio *serio) void serio_register_port(struct serio *serio)
{ {
serio->number = serio_number++;
serio->next = serio_list; serio->next = serio_list;
serio_list = serio; serio_list = serio;
serio_find_dev(serio); serio_find_dev(serio);
...@@ -84,8 +82,6 @@ void serio_unregister_port(struct serio *serio) ...@@ -84,8 +82,6 @@ void serio_unregister_port(struct serio *serio)
if (serio->dev && serio->dev->disconnect) if (serio->dev && serio->dev->disconnect)
serio->dev->disconnect(serio); serio->dev->disconnect(serio);
serio_number--;
} }
void serio_register_device(struct serio_dev *dev) void serio_register_device(struct serio_dev *dev)
......
/* /*
* $Id: serport.c,v 1.7 2001/05/25 19:00:27 jdeneux Exp $ * $Id: serport_old.c,v 1.10 2002/01/24 19:52:57 vojtech Exp $
* *
* Copyright (c) 1999-2001 Vojtech Pavlik * Copyright (c) 1999-2001 Vojtech Pavlik
*
* Sponsored by SuSE
*/ */
/* /*
...@@ -28,7 +26,7 @@ ...@@ -28,7 +26,7 @@
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -39,12 +37,19 @@ ...@@ -39,12 +37,19 @@
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/tty.h> #include <linux/tty.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input device TTY line discipline");
MODULE_LICENSE("GPL");
struct serport { struct serport {
struct tty_struct *tty; struct tty_struct *tty;
wait_queue_head_t wait; wait_queue_head_t wait;
struct serio serio; struct serio serio;
char phys[32];
}; };
char serport_name[] = "Serial port";
/* /*
* Callback functions from the serio code. * Callback functions from the serio code.
*/ */
...@@ -75,6 +80,8 @@ static void serport_serio_close(struct serio *serio) ...@@ -75,6 +80,8 @@ static void serport_serio_close(struct serio *serio)
static int serport_ldisc_open(struct tty_struct *tty) static int serport_ldisc_open(struct tty_struct *tty)
{ {
struct serport *serport; struct serport *serport;
char ttyname[64];
int i;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
...@@ -85,9 +92,19 @@ static int serport_ldisc_open(struct tty_struct *tty) ...@@ -85,9 +92,19 @@ static int serport_ldisc_open(struct tty_struct *tty)
memset(serport, 0, sizeof(struct serport)); memset(serport, 0, sizeof(struct serport));
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
serport->tty = tty; serport->tty = tty;
tty->disc_data = serport; tty->disc_data = serport;
strcpy(ttyname, tty->driver.name);
for (i = 0; ttyname[i] != 0 && ttyname[i] != '/'; i++);
ttyname[i] = 0;
sprintf(serport->phys, "%s%d/serio0", ttyname, minor(tty->device) - tty->driver.minor_start);
serport->serio.name = serport_name;
serport->serio.phys = serport->phys;
serport->serio.type = SERIO_RS232; serport->serio.type = SERIO_RS232;
serport->serio.write = serport_serio_write; serport->serio.write = serport_serio_write;
serport->serio.open = serport_serio_open; serport->serio.open = serport_serio_open;
...@@ -156,14 +173,14 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u ...@@ -156,14 +173,14 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u
serio_register_port(&serport->serio); serio_register_port(&serport->serio);
printk(KERN_INFO "serio%d: Serial port %s\n", serport->serio.number, name); printk(KERN_INFO "serio: Serial port %s\n", name);
add_wait_queue(&serport->wait, &wait); add_wait_queue(&serport->wait, &wait);
current->state = TASK_INTERRUPTIBLE; set_current_state(TASK_INTERRUPTIBLE);
while(serport->serio.type && !signal_pending(current)) schedule(); while(serport->serio.type && !signal_pending(current)) schedule();
current->state = TASK_RUNNING; set_current_state(TASK_RUNNING);
remove_wait_queue(&serport->wait, &wait); remove_wait_queue(&serport->wait, &wait);
serio_unregister_port(&serport->serio); serio_unregister_port(&serport->serio);
...@@ -187,6 +204,14 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi ...@@ -187,6 +204,14 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi
return -EINVAL; return -EINVAL;
} }
static void serport_ldisc_write_wakeup(struct tty_struct * tty)
{
struct serport *sp = (struct serport *) tty->disc_data;
serio_dev_write_wakeup(&sp->serio);
}
/* /*
* The line discipline structure. * The line discipline structure.
*/ */
...@@ -199,6 +224,7 @@ static struct tty_ldisc serport_ldisc = { ...@@ -199,6 +224,7 @@ static struct tty_ldisc serport_ldisc = {
ioctl: serport_ldisc_ioctl, ioctl: serport_ldisc_ioctl,
receive_buf: serport_ldisc_receive, receive_buf: serport_ldisc_receive,
receive_room: serport_ldisc_room, receive_room: serport_ldisc_room,
write_wakeup: serport_ldisc_write_wakeup
}; };
/* /*
...@@ -222,5 +248,3 @@ void __exit serport_exit(void) ...@@ -222,5 +248,3 @@ void __exit serport_exit(void)
module_init(serport_init); module_init(serport_init);
module_exit(serport_exit); module_exit(serport_exit);
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment