Skip to contentSkip to conversation

Hotplugging for the input subsystem

PATCH Vojtech Pavlik 2 participants 3 messages Sep 28, 2001

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi!

For a long time there was the problem that while upon inserting an USB keyboard the HID driver was auto-loaded OK, the mousedev, joydev, etc drivers were not.

This patch implements (among other things) hotplugging for the input subsystem.

I can provide some docs if it isn't obvious how it works.

It'd be nice if someone could add support for this to the hotplug tools.

Patch attached, you can try it out, it's against 2.4.10.

Hotplug for gameport and serio subsystems will follow sometime later ...

Signature · 2 lines
Vojtech Pavlik
SuSE Labs
drivers/char/joystick/a3d.c +22 -12
diff -urN linux-2.4.10/drivers/char/joystick/a3d.c linux/drivers/char/joystick/a3d.c
@@ -1,9 +1,7 @@
 /*
- * $Id: a3d.c,v 1.14 2001/04/26 10:24:46 vojtech Exp $
+ * $Id: a3d.c,v 1.19 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 1998-2001 Vojtech Pavlik
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -37,6 +35,10 @@
 #include <linux/gameport.h>
 #include <linux/input.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver");
+MODULE_LICENSE("GPL");
+
 #define A3D_MAX_START		400	/* 400 us */ 
 #define A3D_MAX_STROBE		60	/* 40 us */ 
 #define A3D_DELAY_READ		3	/* 3 ms */
@@ -63,6 +65,8 @@
 	int used;
 	int reads;
 	int bads;
+	char phys[32];
+	char adcphys[32];
 };
 
 /*
@@ -280,10 +284,12 @@
 
 	if (!a3d->mode || a3d->mode > 5) {
 		printk(KERN_WARNING "a3d.c: Unknown A3D device detected "
-			"(gameport%d, id=%d), contact <[email protected]>\n", gameport->number, a3d->mode);
+			"(%s, id=%d), contact <[email protected]>\n", gameport->phys, a3d->mode);
 		goto fail2;
 	}
 
+	sprintf(a3d->phys, "%s/input0", gameport->phys);
+	sprintf(a3d->adcphys, "%s/gameport0", gameport->phys);
 
 	if (a3d->mode == A3D_MODE_PXL) {
 
@@ -329,11 +335,17 @@
 		a3d->adc.cooked_read = a3d_adc_cooked_read;
 		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);
 
 		gameport_register_port(&a3d->adc);
-		printk(KERN_INFO "gameport%d: %s on gameport%d.0\n",
-			a3d->adc.number, a3d_names[a3d->mode], gameport->number);
+		printk(KERN_INFO "gameport: %s on %s\n", a3d_names[a3d->mode], gameport->phys);
 	}
 
 	a3d->dev.private = a3d;
@@ -341,14 +353,14 @@
 	a3d->dev.close = a3d_close;
 
 	a3d->dev.name = a3d_names[a3d->mode];
+	a3d->dev.phys = a3d->phys;
 	a3d->dev.idbus = BUS_GAMEPORT;
 	a3d->dev.idvendor = GAMEPORT_ID_VENDOR_MADCATZ;
 	a3d->dev.idproduct = a3d->mode;
 	a3d->dev.idversion = 0x0100;
 
 	input_register_device(&a3d->dev);
-	printk(KERN_INFO "input%d: %s on gameport%d.0\n",
-		a3d->dev.number, a3d_names[a3d->mode], gameport->number);
+	printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys);
 
 	return;
 fail2:	gameport_close(gameport);
@@ -384,5 +396,3 @@
 
 module_init(a3d_init);
 module_exit(a3d_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/adi.c +16 -12
diff -urN linux-2.4.10/drivers/char/joystick/adi.c linux/drivers/char/joystick/adi.c
@@ -1,9 +1,7 @@
 /*
- * $Id: adi.c,v 1.15 2001/01/09 13:32:39 vojtech Exp $
+ * $Id: adi.c,v 1.21 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1998-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1998-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/delay.h>
@@ -39,6 +37,10 @@
 #include <linux/gameport.h>
 #include <linux/init.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Logitech ADI joystick family driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Times, array sizes, flags, ids.
  */
@@ -55,6 +57,7 @@
 #define ADI_MIN_ID_LENGTH	66
 #define ADI_MAX_NAME_LENGTH	48
 #define ADI_MAX_CNAME_LENGTH	16
+#define ADI_MAX_PHYS_LENGTH	32
 
 #define ADI_FLAG_HAT		0x04
 #define ADI_FLAG_10BIT		0x08
@@ -118,6 +121,7 @@
 	short *key;
 	char name[ADI_MAX_NAME_LENGTH];
 	char cname[ADI_MAX_CNAME_LENGTH];
+	char phys[ADI_MAX_PHYS_LENGTH];
 	unsigned char data[ADI_MAX_LENGTH];
 };
 
@@ -392,7 +396,7 @@
 	}
 }
 
-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;
 	char buf[ADI_MAX_NAME_LENGTH];
@@ -403,6 +407,7 @@
 
 	sprintf(buf, adi_names[t], adi->id);
 	sprintf(adi->name, "Logitech %s", buf);
+	sprintf(adi->phys, "%s/input%d", port->gameport->phys, half);
 
 	adi->abs = adi_abs[t];
 	adi->key = adi_key[t];
@@ -411,6 +416,7 @@
 	adi->dev.close = adi_close;
 
 	adi->dev.name = adi->name;
+	adi->dev.phys = adi->phys;
 	adi->dev.idbus = BUS_GAMEPORT;
 	adi->dev.idvendor = GAMEPORT_ID_VENDOR_LOGITECH;
 	adi->dev.idproduct = adi->id;
@@ -495,7 +501,7 @@
 
 	for (i = 0; i < 2; i++) {
 		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) {
@@ -514,8 +520,8 @@
 		if (port->adi[i].length > 0) {
 			adi_init_center(port->adi + i);
 			input_register_device(&port->adi[i].dev);
-			printk(KERN_INFO "input%d: %s [%s] on gameport%d.%d\n",
-				port->adi[i].dev.number, port->adi[i].name, port->adi[i].cname, gameport->number, i);
+			printk(KERN_INFO "input: %s [%s] on %s\n",
+				port->adi[i].name, port->adi[i].cname, gameport->phys);
 		}
 }
 
@@ -553,5 +559,3 @@
 
 module_init(adi_init);
 module_exit(adi_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/amijoy.c +11 -10
diff -urN linux-2.4.10/drivers/char/joystick/amijoy.c linux/drivers/char/joystick/amijoy.c
@@ -1,9 +1,7 @@
 /*
- * $Id: amijoy.c,v 1.5 2000/07/21 22:52:24 vojtech Exp $
+ * $Id: amijoy.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1998-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1998-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/types.h>
@@ -40,13 +38,15 @@
 #include <asm/system.h>
 #include <asm/amigahw.h>
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Driver for Amiga joysticks");
 MODULE_PARM(amijoy, "1-2i");
 MODULE_LICENSE("GPL");
 
 static int amijoy[2] = { 0, 1 };
 static int amijoy_used[2] = { 0, 0 };
 static struct input_dev amijoy_dev[2];
+static char *amijoy_phys[2] = { "amijoy/input0", "amijoy/input1" };
 
 static char *amijoy_name = "Amiga joystick";
 
@@ -64,9 +64,9 @@
 
 			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));
-			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 @@
 			}
 
 			amijoy->dev[i].name = amijoy_name;
+			amijoy->dev[i].phys = amijoy_phys[i];
 			amijoy->dev[i].idbus = BUS_AMIGA;
 			amijoy->dev[i].idvendor = 0x0001;
 			amijoy->dev[i].idproduct = 0x0003;
@@ -141,7 +142,7 @@
 			amijoy_dev[i].private = amijoy_used + 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;
 }
drivers/char/joystick/analog.c +20 -18
diff -urN linux-2.4.10/drivers/char/joystick/analog.c linux/drivers/char/joystick/analog.c
@@ -1,9 +1,7 @@
 /*
- * $Id: analog.c,v 1.52 2000/06/07 13:07:06 vojtech Exp $
+ * $Id: analog.c,v 1.65 2001/09/25 10:15:22 vojtech Exp $
  *
- *  Copyright (c) 1996-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1996-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/config.h>
@@ -41,8 +39,8 @@
 #include <linux/gameport.h>
 #include <asm/timex.h>
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
-MODULE_DESCRIPTION("Analog joystick and gamepad driver for Linux");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Analog joystick and gamepad driver");
 MODULE_LICENSE("GPL");
 
 /*
@@ -95,6 +93,7 @@
 #define ANALOG_FUZZ_MAGIC	36	/* 36 u*ms/loop */
 
 #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_hats[] = { ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y };
@@ -111,6 +110,7 @@
 	int mask;
 	short *buttons;
 	char name[ANALOG_MAX_NAME_LENGTH];
+	char phys[ANALOG_MAX_PHYS_LENGTH];
 };
 
 struct analog_port {
@@ -138,7 +138,7 @@
 
 #ifdef __i386__
 #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 { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } } while (0)
 #define DELTA(x,y)	(TSC_PRESENT?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
 #define TIME_NAME	(TSC_PRESENT?"TSC":"PIT")
 #elif __x86_64__
@@ -418,10 +418,12 @@
 	int i, j, t, v, w, x, y, z;
 
 	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->dev.name = analog->name;
+	analog->dev.phys = analog->phys;
 	analog->dev.idbus = BUS_GAMEPORT;
 	analog->dev.idvendor = GAMEPORT_ID_VENDOR_ANALOG;
 	analog->dev.idproduct = analog->mask >> 4;
@@ -491,8 +493,7 @@
 
 	input_register_device(&analog->dev);
 
-	printk(KERN_INFO "input%d: %s at gameport%d.%d",
-		analog->dev.number, analog->name, port->gameport->number, index);
+	printk(KERN_INFO "input: %s at %s", analog->name, port->gameport->phys);
 
 	if (port->cooked)
 		printk(" [ADC port]\n");
@@ -517,12 +518,13 @@
 
 	if ((port->mask & 3) != 3 && port->mask != 0xc) {
 		printk(KERN_WARNING "analog.c: Unknown joystick device found  "
-			"(data=%#x, gameport%d), probably not analog joystick.\n",
-			port->mask, port->gameport->number);
+			"(data=%#x, %s), probably not analog joystick.\n",
+			port->mask, port->gameport->phys);
 		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;
 
@@ -602,8 +604,8 @@
 		gameport_trigger(gameport);
 		while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; 
 
-		if (v < (u >> 1) && port->gameport->number < ANALOG_PORTS) {
-			analog_options[port->gameport->number] |=
+		if (v < (u >> 1)) { /* FIXME - more than one port */
+			analog_options[0] |= /* FIXME - more than one port */
 				ANALOG_SAITEK | ANALOG_BTNS_CHF | ANALOG_HBTN_CHF | ANALOG_HAT1_CHF;
 			return 0;
 		}
@@ -664,9 +666,9 @@
 		if (port->analog[i].mask)
 			input_unregister_device(&port->analog[i].dev);
 	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->gameport->number);
+		port->gameport->phys);
 	kfree(port);
 }
 
drivers/char/joystick/cobra.c +17 -14
diff -urN linux-2.4.10/drivers/char/joystick/cobra.c linux/drivers/char/joystick/cobra.c
@@ -1,13 +1,11 @@
 /*
- * $Id: cobra.c,v 1.10 2000/06/08 10:23:45 vojtech Exp $
+ * $Id: cobra.c,v 1.18 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1999-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  */
 
 /*
- * Creative Labd Blaster GamePad Cobra driver for Linux
+ * Creative Labs Blaster GamePad Cobra driver for Linux
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -37,6 +35,10 @@
 #include <linux/gameport.h>
 #include <linux/input.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+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_REFRESH_TIME	HZ/50	/* 20 ms between reads */
 #define COBRA_LENGTH		36
@@ -53,6 +55,7 @@
 	int reads;
 	int bads;
 	unsigned char exists;
+	char phys[2][32];
 };
 
 static unsigned char cobra_read_packet(struct gameport *gameport, unsigned int *data)
@@ -121,6 +124,7 @@
 
 	if ((r = cobra_read_packet(cobra->gameport, data)) != cobra->exists)
 		cobra->bads++;
+	else
 
 	for (i = 0; i < 2; i++)
 		if (cobra->exists & r & (1 << i)) {
@@ -177,8 +181,8 @@
 
 	for (i = 0; i < 2; i++) 
 		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"
-				" Contact [email protected]\n", gameport->number, i, (data[i] >> 2) & 7);
+			printk(KERN_WARNING "cobra.c: Device %d on %s has the Ext bit set. ID is: %d"
+				" Contact [email protected]\n", i, gameport->phys, (data[i] >> 2) & 7);
 			cobra->exists &= ~(1 << i);
 		}
 
@@ -188,11 +192,14 @@
 	for (i = 0; i < 2; i++)
 		if ((cobra->exists >> i) & 1) {
 
+			sprintf(cobra->phys[i], "%s/input%d", gameport->phys, i);
+
 			cobra->dev[i].private = cobra;
 			cobra->dev[i].open = cobra_open;
 			cobra->dev[i].close = cobra_close;
 
 			cobra->dev[i].name = cobra_name;
+			cobra->dev[i].phys = cobra->phys[i];
 			cobra->dev[i].idbus = BUS_GAMEPORT;
 			cobra->dev[i].idvendor = GAMEPORT_ID_VENDOR_CREATIVE;
 			cobra->dev[i].idproduct = 0x0008;
@@ -208,11 +215,9 @@
 			cobra->dev[i].absmin[ABS_Y] = -1; cobra->dev[i].absmax[ABS_Y] = 1;
 
 			input_register_device(cobra->dev + i);
-			printk(KERN_INFO "input%d: %s on gameport%d.%d\n",
-				cobra->dev[i].number, cobra_name, gameport->number, i);
+			printk(KERN_INFO "input: %s on %s\n", cobra_name, gameport->phys);
 		}
 
-
 	return;
 fail2:	gameport_close(gameport);
 fail1:	kfree(cobra);
@@ -248,5 +253,3 @@
 
 module_init(cobra_init);
 module_exit(cobra_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/cs461x.c +25 -23

103 lines not on this page · raw message

drivers/char/joystick/db9.c +12 -9
diff -urN linux-2.4.10/drivers/char/joystick/db9.c linux/drivers/char/joystick/db9.c
@@ -1,12 +1,10 @@
 /*
- * $Id: db9.c,v 1.6 2000/06/25 10:57:50 vojtech Exp $
+ * $Id: db9.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1999 Vojtech Pavlik
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  *
  *  Based on the work of:
  *	Andree Borrmann		Mats Sjövall
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -29,8 +27,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -40,8 +38,10 @@
 #include <linux/parport.h>
 #include <linux/input.h>
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Atari, Amstrad, Commodore, Amiga, Sega, etc. joystick driver");
 MODULE_LICENSE("GPL");
+
 MODULE_PARM(db9, "2i");
 MODULE_PARM(db9_2, "2i");
 MODULE_PARM(db9_3, "2i");
@@ -87,6 +87,7 @@
 	struct pardevice *pd;	
 	int mode;
 	int used;
+	char phys[2][32];
 };
 
 static struct db9 *db9_base[3];
@@ -342,11 +343,14 @@
 
 	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].open = db9_open;
 		db9->dev[i].close = db9_close;
 
 		db9->dev[i].name = db9_name[db9->mode];
+		db9->dev[i].phys = db9->phys[i];
 		db9->dev[i].idbus = BUS_PARPORT;
 		db9->dev[i].idvendor = 0x0002;
 		db9->dev[i].idproduct = config[1];
@@ -362,8 +366,7 @@
 		db9->dev[i].absmin[ABS_Y] = -1; db9->dev[i].absmax[ABS_Y] = 1;
 
 		input_register_device(db9->dev + i);
-		printk(KERN_INFO "input%d: %s on %s\n",
-			db9->dev[i].number, db9_name[db9->mode], db9->pd->port->name);
+		printk(KERN_INFO "input: %s on %s\n", db9->dev[i].name, db9->pd->port->name);
 	}
 
 	return db9;
drivers/char/joystick/emu10k1-gp.c +33 -29

110 lines not on this page · raw message

drivers/char/joystick/gamecon.c +13 -9
diff -urN linux-2.4.10/drivers/char/joystick/gamecon.c linux/drivers/char/joystick/gamecon.c
@@ -1,17 +1,15 @@
 /*
- * $Id: gamecon.c,v 1.14 2001/04/29 22:42:14 vojtech Exp $
+ * $Id: gamecon.c,v 1.20 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
  *
  *  Based on the work of:
  *  	Andree Borrmann		John Dahlstrom
  *  	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 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -41,8 +39,10 @@
 #include <linux/parport.h>
 #include <linux/input.h>
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("NES, SNES, N64, MultiSystem, PSX gamepad driver");
 MODULE_LICENSE("GPL");
+
 MODULE_PARM(gc, "2-6i");
 MODULE_PARM(gc_2,"2-6i");
 MODULE_PARM(gc_3,"2-6i");
@@ -65,6 +65,7 @@
 	struct timer_list timer;
 	unsigned char pads[GC_MAX + 1];
 	int used;
+	char phys[5][32];
 };
 
 static struct gc *gc_base[3];
@@ -585,12 +586,15 @@
 					default:
 						gc->pads[GC_PSX] &= ~gc_status_bit[i];
 						printk(KERN_WARNING "gamecon.c: Unsupported PSX controller %#x,"
-							" please report to <[email protected]>.\n", psx);
+							" please report to <[email protected]>.\n", psx);
 				}
 				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].phys = gc->phys[i];
                 gc->dev[i].idbus = BUS_PARPORT;
                 gc->dev[i].idvendor = 0x0001;
                 gc->dev[i].idproduct = config[i + 1];
@@ -608,7 +612,7 @@
 	for (i = 0; i < 5; i++) 
 		if (gc->pads[0] & gc_status_bit[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;
drivers/char/joystick/gameport.c +6 -11
diff -urN linux-2.4.10/drivers/char/joystick/gameport.c linux/drivers/char/joystick/gameport.c
@@ -1,9 +1,7 @@
 /*
- * $Id: gameport.c,v 1.5 2000/05/29 10:54:53 vojtech Exp $
+ * $Id: gameport.c,v 1.17 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1999-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <asm/io.h>
@@ -40,7 +38,8 @@
 #include <linux/stddef.h>
 #include <linux/delay.h>
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Generic gameport layer");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(gameport_register_port);
@@ -54,7 +53,6 @@
 
 static struct gameport *gameport_list;
 static struct gameport_dev *gameport_dev;
-static int gameport_number;
 
 /*
  * gameport_measure_speed() measures the gameport i/o speed.
@@ -122,7 +120,6 @@
 
 void gameport_register_port(struct gameport *gameport)
 {
-	gameport->number = gameport_number++;
 	gameport->next = gameport_list;	
 	gameport_list = gameport;
 
@@ -140,8 +137,6 @@
 
 	if (gameport->dev && gameport->dev->disconnect)
 		gameport->dev->disconnect(gameport);
-
-	gameport_number--;
 }
 
 void gameport_register_device(struct gameport_dev *dev)
drivers/char/joystick/gf2k.c +15 -12
diff -urN linux-2.4.10/drivers/char/joystick/gf2k.c linux/drivers/char/joystick/gf2k.c
@@ -1,9 +1,7 @@
 /*
- * $Id: gf2k.c,v 1.12 2000/06/04 14:53:44 vojtech Exp $
+ * $Id: gf2k.c,v 1.18 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1998-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1998-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/delay.h>
@@ -38,6 +36,10 @@
 #include <linux/input.h>
 #include <linux/gameport.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+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_STROBE		40	/* The time we wait for the first bit [40 us] */
 #define GF2K_TIMEOUT		4	/* Wait for everything to settle [4 ms] */
@@ -85,6 +87,7 @@
 	int used;
 	unsigned char id;
 	unsigned char length;
+	char phys[32];
 };
 
 /*
@@ -278,11 +281,13 @@
 #endif
 
 	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",
-			gameport->number, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]);
+		printk(KERN_WARNING "gf2k.c: Not yet supported joystick on %s. [id: %d type:%s]\n",
+			gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]);
 		goto fail2;
 	}
 
+	sprintf(gf2k->phys, "%s/input0", gameport->phys);
+
 	gf2k->length = gf2k_lens[gf2k->id];
 
 	gf2k->dev.private = gf2k;
@@ -291,6 +296,7 @@
 	gf2k->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
 	gf2k->dev.name = gf2k_names[gf2k->id];
+	gf2k->dev.phys = gf2k->phys;
 	gf2k->dev.idbus = BUS_GAMEPORT;
 	gf2k->dev.idvendor = GAMEPORT_ID_VENDOR_GENIUS;
 	gf2k->dev.idproduct = gf2k->id;
@@ -323,8 +329,7 @@
 	}
 
 	input_register_device(&gf2k->dev);
-	printk(KERN_INFO "input%d: %s on gameport%d.0\n",
-		gf2k->dev.number, gf2k_names[gf2k->id], gameport->number);
+	printk(KERN_INFO "input: %s on %s\n", gf2k_names[gf2k->id], gameport->phys);
 
 	return;
 fail2:	gameport_close(gameport);
@@ -357,5 +362,3 @@
 
 module_init(gf2k_init);
 module_exit(gf2k_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/grip.c +14 -10
diff -urN linux-2.4.10/drivers/char/joystick/grip.c linux/drivers/char/joystick/grip.c
@@ -1,9 +1,7 @@
 /*
- * $Id: grip.c,v 1.14 2000/06/06 21:13:36 vojtech Exp $
+ * $Id: grip.c,v 1.20 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1998-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1998-2001 Vojtech Pavlik
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -37,6 +35,10 @@
 #include <linux/gameport.h>
 #include <linux/input.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Gravis GrIP protocol joystick driver");
+MODULE_LICENSE("GPL");
+
 #define GRIP_MODE_GPP		1
 #define GRIP_MODE_BD		2
 #define GRIP_MODE_XT		3
@@ -59,6 +61,7 @@
 	int used;
 	int reads;
 	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 };
@@ -340,12 +343,15 @@
 	for (i = 0; i < 2; i++)
 		if (grip->mode[i]) {
 
+			sprintf(grip->phys[i], "%s/input%d", gameport->phys, i);
+
 			grip->dev[i].private = grip;
 
 			grip->dev[i].open = grip_open;
 			grip->dev[i].close = grip_close;
 
 			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].idvendor = GAMEPORT_ID_VENDOR_GRAVIS;
 			grip->dev[i].idproduct = grip->mode[i];
@@ -382,8 +388,8 @@
 
 			input_register_device(grip->dev + i);
 
-			printk(KERN_INFO "input%d: %s on gameport%d.%d\n",
-				grip->dev[i].number, grip_name[grip->mode[i]], gameport->number, i);
+			printk(KERN_INFO "input: %s on %s\n",
+				grip_name[grip->mode[i]], gameport->phys);
 		}
 
 	return;
@@ -421,5 +427,3 @@
 
 module_init(grip_init);
 module_exit(grip_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/iforce.c +412 -99

827 lines not on this page · raw message

drivers/char/joystick/interact.c +39 -34

141 lines not on this page · raw message

drivers/char/joystick/lightning.c +15 -9
diff -urN linux-2.4.10/drivers/char/joystick/lightning.c linux/drivers/char/joystick/lightning.c
@@ -1,9 +1,7 @@
 /*
- * $Id: lightning.c,v 1.13 2001/04/26 10:24:46 vojtech Exp $
+ * $Id: lightning.c,v 1.18 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 1998-2001 Vojtech Pavlik
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -26,8 +24,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <asm/io.h>
@@ -51,14 +49,18 @@
 #define L4_BUSY			0x01
 #define L4_TIMEOUT		80	/* 80 us */
 
-MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("PDPI Lightning 4 gamecard driver");
 MODULE_LICENSE("GPL");
 
 struct l4 {
 	struct gameport gameport;
 	unsigned char port;
+	char phys[32];
 } *l4_port[8];
 
+char l4_name[] = "PDPI Lightning 4";
+
 /*
  * l4_wait_ready() waits for the L4 to become ready.
  */
@@ -247,12 +249,18 @@
 			l4 = 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->private = l4;
 			gameport->open = l4_open;
 			gameport->cooked_read = l4_cooked_read;
 			gameport->calibrate = l4_calibrate;
 
+			gameport->name = l4_name;
+			gameport->phys = l4->phys;
+			gameport->idbus = BUS_ISA;
+
 			if (!i && !j)
 				gameport->io = L4_PORT;
 
@@ -262,9 +270,7 @@
 			gameport_register_port(gameport);
 		}
 
-		printk(KERN_INFO "gameport%d,%d,%d,%d: 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, 
+		printk(KERN_INFO "gameport: PDPI Lightning 4 %s card v%d.%d at %#x\n",
 			i ? "secondary" : "primary", rev >> 4, rev, L4_PORT);
 
 		cards++;
drivers/char/joystick/magellan.c +15 -11
diff -urN linux-2.4.10/drivers/char/joystick/magellan.c linux/drivers/char/joystick/magellan.c
@@ -1,9 +1,7 @@
 /*
- * $Id: magellan.c,v 1.8 2000/05/31 13:17:12 vojtech Exp $
+ * $Id: magellan.c,v 1.15 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1999-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  */
 
 /*
@@ -27,7 +25,7 @@
  * 
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <[email protected]>, 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>
@@ -37,15 +35,19 @@
 #include <linux/serio.h>
 #include <linux/init.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Magellan and SpaceMouse 6dof controller driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Definitions & global arrays.
  */
 
 #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_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ};
-static char *magellan_name = "LogiCad3D Magellan";
+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 char *magellan_name = "LogiCad3D Magellan / SpaceMouse";
 
 /*
  * Per-Magellan data.
@@ -55,6 +57,7 @@
 	struct input_dev dev;
 	int idx;
 	unsigned char data[MAGELLAN_MAX_LENGTH];
+	char phys[32];
 };
 
 /*
@@ -162,8 +165,11 @@
 		magellan->dev.absmax[t] =  360;
 	}
 
+	sprintf(magellan->phys, "%s/input0", serio->phys);
+
 	magellan->dev.private = magellan;
 	magellan->dev.name = magellan_name;
+	magellan->dev.phys = magellan->phys;
 	magellan->dev.idbus = BUS_RS232;
 	magellan->dev.idvendor = SERIO_MAGELLAN;
 	magellan->dev.idproduct = 0x0001;
@@ -178,7 +184,7 @@
 
 	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 @@
 
 module_init(magellan_init);
 module_exit(magellan_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/ns558.c +54 -17

125 lines not on this page · raw message

drivers/char/joystick/pcigame.c +18 -11
diff -urN linux-2.4.10/drivers/char/joystick/pcigame.c linux/drivers/char/joystick/pcigame.c
@@ -1,12 +1,10 @@
 /*
- * $Id: pcigame.c,v 1.10 2001/04/26 10:24:46 vojtech Exp $
+ * $Id: pcigame.c,v 1.16 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 2000-2001 Vojtech Pavlik
  *
  *  Based on the work of:
  *	Raymond Ingles
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -29,8 +27,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <asm/io.h>
@@ -44,6 +42,10 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Trident 4DWave and Aureal Vortex gameport driver");
+MODULE_LICENSE("GPL");
+
 #define PCI_VENDOR_ID_AUREAL	0x12eb
 
 #define PCIGAME_DATA_WAIT	20	/* 20 ms */
@@ -72,6 +74,7 @@
 	struct pci_dev *dev;
         unsigned char *base;
 	struct pcigame_data *data;
+	char phys[32];
 };
 
 static unsigned char pcigame_read(struct gameport *gameport)
@@ -131,8 +134,9 @@
 
 
 	pcigame->data = pcigame_data + id->driver_data;
-
 	pcigame->dev = dev;
+	sprintf(pcigame->phys, "pci%s/gameport0", dev->slot_name);
+
 	dev->driver_data = pcigame;
 
 	pcigame->gameport.private = pcigame;
@@ -143,6 +147,12 @@
 	pcigame->gameport.cooked_read = pcigame_cooked_read;
 	pcigame->gameport.open = pcigame_open;
 
+	pcigame->gameport.name = dev->name;
+	pcigame->gameport.phys = pcigame->phys;
+	pcigame->gameport.idbus = BUS_PCI;
+	pcigame->gameport.idvendor = dev->vendor;
+	pcigame->gameport.idproduct = dev->device;
+
 	for (i = 0; i < 6; i++)
 		if (~pci_resource_flags(dev, i) & IORESOURCE_IO)
 			break;
@@ -154,9 +164,8 @@
 
 	gameport_register_port(&pcigame->gameport);
 	
-	printk(KERN_INFO "gameport%d: %s at pci%02x:%02x.%x speed %d kHz\n",
-		pcigame->gameport.number, dev->name, dev->bus->number,
-			PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pcigame->gameport.speed);
+	printk(KERN_INFO "gameport: %s at pci%s speed %d kHz\n",
+		dev->name, dev->slot_name, pcigame->gameport.speed);
 
 	return 0;
 }
@@ -195,5 +204,3 @@
 
 module_init(pcigame_init);
 module_exit(pcigame_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/serio.c +5 -9
diff -urN linux-2.4.10/drivers/char/joystick/serio.c linux/drivers/char/joystick/serio.c
@@ -1,9 +1,7 @@
 /*
- * $Id: serio.c,v 1.5 2000/06/04 17:44:59 vojtech Exp $
+ * $Id: serio.c,v 1.14 2001/09/25 10:44:37 vojtech Exp $
  *
- *  Copyright (c) 1999-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  */
 
 /*
@@ -27,14 +25,16 @@
  * 
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <[email protected]>, 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/module.h>
 #include <linux/serio.h>
+#include <linux/errno.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Serio abstraction core");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(serio_register_port);
@@ -47,7 +47,6 @@
 
 static struct serio *serio_list;
 static struct serio_dev *serio_dev;
-static int serio_number;
 
 static void serio_find_dev(struct serio *serio)
 {
@@ -69,7 +68,6 @@
 
 void serio_register_port(struct serio *serio)
 {
-	serio->number = serio_number++;
 	serio->next = serio_list;	
 	serio_list = serio;
 	serio_find_dev(serio);
@@ -84,8 +82,6 @@
 
 	if (serio->dev && serio->dev->disconnect)
 		serio->dev->disconnect(serio);
-
-	serio_number--;
 }
 
 void serio_register_device(struct serio_dev *dev)
drivers/char/joystick/serport.c +31 -7
diff -urN linux-2.4.10/drivers/char/joystick/serport.c linux/drivers/char/joystick/serport.c
@@ -1,9 +1,7 @@
 /*
- * $Id: serport.c,v 1.7 2001/05/25 19:00:27 jdeneux Exp $
+ * $Id: serport_old.c,v 1.7 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -28,7 +26,7 @@
  * 
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <[email protected]>, 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>
@@ -39,12 +37,19 @@
 #include <linux/serio.h>
 #include <linux/tty.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Input device TTY line discipline");
+MODULE_LICENSE("GPL");
+
 struct serport {
 	struct tty_struct *tty;
 	wait_queue_head_t wait;
 	struct serio serio;
+	char phys[32];
 };
 
+char serport_name[] = "Serial port";
+
 /*
  * Callback functions from the serio code.
  */
@@ -75,6 +80,8 @@
 static int serport_ldisc_open(struct tty_struct *tty)
 {
 	struct serport *serport;
+	char ttyname[64];
+	int i;
 
 	MOD_INC_USE_COUNT;
 
@@ -85,9 +92,19 @@
 
 	memset(serport, 0, sizeof(struct serport));
 
+	set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
 	serport->tty = tty;
 	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.write = serport_serio_write;
 	serport->serio.open = serport_serio_open;
@@ -156,7 +173,7 @@
 
 	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);
 	current->state = TASK_INTERRUPTIBLE;
@@ -187,6 +204,14 @@
 	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.
  */
@@ -199,6 +224,7 @@
 	ioctl:		serport_ldisc_ioctl,
 	receive_buf:	serport_ldisc_receive,
 	receive_room:	serport_ldisc_room,
+	write_wakeup:	serport_ldisc_write_wakeup
 };
 
 /*
@@ -222,5 +248,3 @@
 
 module_init(serport_init);
 module_exit(serport_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/sidewinder.c +24 -21

130 lines not on this page · raw message

drivers/char/joystick/spaceball.c +85 -36

213 lines not on this page · raw message

drivers/char/joystick/spaceorb.c +20 -16
diff -urN linux-2.4.10/drivers/char/joystick/spaceorb.c linux/drivers/char/joystick/spaceorb.c
@@ -1,12 +1,10 @@
 /*
- * $Id: spaceorb.c,v 1.7 2000/05/29 11:19:51 vojtech Exp $
+ * $Id: spaceorb.c,v 1.14 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1999-2000 Vojtech Pavlik
+ *  Copyright (c) 1999-2001 Vojtech Pavlik
  * 
  *  Based on the work of:
  *  	David Thompson
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -29,8 +27,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  *  Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/kernel.h>
@@ -40,15 +38,19 @@
 #include <linux/input.h>
 #include <linux/serio.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("SpaceTec SpaceOrb 360 and Avenger 6dof controller driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Constants.
  */
 
 #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_axes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ};
-static char *spaceorb_name = "SpaceTec SpaceOrb 360";
+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 char *spaceorb_name = "SpaceTec SpaceOrb 360 / Avenger";
 
 /*
  * Per-Orb data.
@@ -59,6 +61,7 @@
 	struct serio *serio;
 	int idx;
 	unsigned char data[SPACEORB_MAX_LENGTH];
+	char phys[32];
 };
 
 static unsigned char spaceorb_xor[] = "SpaceWare";
@@ -88,8 +91,8 @@
 		case 'R':				/* Reset packet */
 			spaceorb->data[spaceorb->idx - 1] = 0;
 			for (i = 1; i < spaceorb->idx && spaceorb->data[i] == ' '; i++);
-			printk(KERN_INFO "input%d: %s [%s] on serio%d\n",
-				 spaceorb->dev.number, spaceorb_name, spaceorb->data + i, spaceorb->serio->number);
+			printk(KERN_INFO "input: %s [%s] on %s\n",
+				 spaceorb_name, spaceorb->data + i, spaceorb->serio->phys);
 			break;
 
 		case 'D':				/* Ball + button data */
@@ -103,7 +106,7 @@
 			axes[5] = ((data[9] & 0x3f) << 4) | (data[10] >> 3);
 			for (i = 0; i < 6; i++)
 				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);
 			break;
 
@@ -167,8 +170,8 @@
 
 	spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
 
-	for (i = 0; i < 7; i++)
-		set_bit(spaceorb_buttons[i], &spaceorb->dev.keybit);
+	for (i = 0; i < 6; i++)
+		set_bit(spaceorb_buttons[i], spaceorb->dev.keybit);
 
 	for (i = 0; i < 6; i++) {
 		t = spaceorb_axes[i];
@@ -180,7 +183,10 @@
 	spaceorb->serio = serio;
 	spaceorb->dev.private = spaceorb;
 
+	sprintf(spaceorb->phys, "%s/input0", serio->phys);
+
 	spaceorb->dev.name = spaceorb_name;
+	spaceorb->dev.phys = spaceorb->phys;
 	spaceorb->dev.idbus = BUS_RS232;
 	spaceorb->dev.idvendor = SERIO_SPACEORB;
 	spaceorb->dev.idproduct = 0x0001;
@@ -223,5 +229,3 @@
 
 module_init(spaceorb_init);
 module_exit(spaceorb_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/stinger.c +11 -7
diff -urN linux-2.4.10/drivers/char/joystick/stinger.c linux/drivers/char/joystick/stinger.c
@@ -1,10 +1,8 @@
 /*
- * $Id: stinger.c,v 1.4 2001/05/23 09:25:02 vojtech Exp $
+ * $Id: stinger.c,v 1.9 2001/09/25 10:12:07 vojtech Exp $
  *
  *  Copyright (c) 2000-2001 Vojtech Pavlik
  *  Copyright (c) 2000 Mark Fletcher
- *
- *  Sponsored by SuSE
  */
 
 /*
@@ -28,7 +26,7 @@
  *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <[email protected]>, 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>
@@ -38,6 +36,10 @@
 #include <linux/serio.h>
 #include <linux/init.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Gravis Stinger gamepad driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Constants.
  */
@@ -54,6 +56,7 @@
 	struct input_dev dev;
 	int idx;
 	unsigned char data[STINGER_MAX_LENGTH];
+	char phys[32];
 };
 
 /*
@@ -145,7 +148,10 @@
 					   BIT(BTN_START) | BIT(BTN_SELECT);
 	stinger->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
 
+	sprintf(stinger->phys, "%s/serio0", serio->phys);
+
 	stinger->dev.name = stinger_name;
+	stinger->dev.phys = stinger->phys;
 	stinger->dev.idbus = BUS_RS232;
 	stinger->dev.idvendor = SERIO_STINGER;
 	stinger->dev.idproduct = 0x0001;
@@ -168,7 +174,7 @@
 
 	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 @@
 
 module_init(stinger_init);
 module_exit(stinger_exit);
-
-MODULE_LICENSE("GPL");
drivers/char/joystick/tmdc.c +14 -11
diff -urN linux-2.4.10/drivers/char/joystick/tmdc.c linux/drivers/char/joystick/tmdc.c
@@ -1,13 +1,10 @@
 /*
- * $Id: tmdc.c,v 1.23 2000/11/29 19:52:24 vojtech Exp $
+ * $Id: tmdc.c,v 1.30 2001/09/25 10:12:07 vojtech Exp $
  *
- *  Copyright (c) 1998-2000 Vojtech Pavlik
- *
- *  Sponsored by SuSE
+ *  Copyright (c) 1998-2001 Vojtech Pavlik
  *
  *   Based on the work of:
  *	Trystan Larey-Williams 
- *
  */
 
 /*
@@ -30,8 +27,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  * 
  * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <[email protected]>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ * e-mail - mail your message to <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
 #include <linux/delay.h>
@@ -42,6 +39,10 @@
 #include <linux/gameport.h>
 #include <linux/input.h>
 
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("ThrustMaster DirectConnect joystick driver");
+MODULE_LICENSE("GPL");
+
 #define TMDC_MAX_START		400	/* 400 us */
 #define TMDC_MAX_STROBE		45	/* 45 us */
 #define TMDC_MAX_LENGTH		13
@@ -94,6 +95,7 @@
 	struct timer_list timer;
 	struct input_dev dev[2];
 	char name[2][64];
+	char phys[2][32];
 	int mode[2];
 	signed char *abs[2];
 	short *btn[2];
@@ -172,6 +174,7 @@
 
 	if ((r = tmdc_read_packet(tmdc->gameport, data)) != tmdc->exists)
 		bad = 1;
+	else
 
 	for (j = 0; j < 2; j++) 
 		if (r & (1 << j) & tmdc->exists) {
@@ -302,11 +305,14 @@
 			sprintf(tmdc->name[j], models[m].name, models[m].abs,
 				(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;
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/char/joystick/turbografx.c +13 -9
diff -urN linux-2.4.10/drivers/char/joystick/turbografx.c linux/drivers/char/joystick/turbografx.c

Lines of this file are not shown. View the raw message.

drivers/char/joystick/usbpath.h +35 -0
diff -urN linux-2.4.10/drivers/char/joystick/usbpath.h linux/drivers/char/joystick/usbpath.h

Lines of this file are not shown. View the raw message.

drivers/char/joystick/warrior.c +12 -8
diff -urN linux-2.4.10/drivers/char/joystick/warrior.c linux/drivers/char/joystick/warrior.c

Lines of this file are not shown. View the raw message.

drivers/input/evdev.c +36 -10

46 lines not on this page · raw message

drivers/input/input.c +447 -49

496 lines not on this page · raw message

drivers/input/joydev.c +46 -22

68 lines not on this page · raw message

drivers/input/keybdev.c +31 -31

62 lines not on this page · raw message

drivers/input/mousedev.c +51 -25

76 lines not on this page · raw message

drivers/usb/hid-core.c +169 -175

344 lines not on this page · raw message

drivers/usb/hid-debug.h +4 -6
diff -urN linux-2.4.10/drivers/usb/hid-debug.h linux/drivers/usb/hid-debug.h

Lines of this file are not shown. View the raw message.

drivers/usb/hid-input.c +45 -10

55 lines not on this page · raw message

drivers/usb/hid.h +20 -16
diff -urN linux-2.4.10/drivers/usb/hid.h linux/drivers/usb/hid.h

Lines of this file are not shown. View the raw message.

drivers/usb/hiddev.c +2 -2
diff -urN linux-2.4.10/drivers/usb/hiddev.c linux/drivers/usb/hiddev.c

Lines of this file are not shown. View the raw message.

drivers/usb/usbkbd.c +16 -11
diff -urN linux-2.4.10/drivers/usb/usbkbd.c linux/drivers/usb/usbkbd.c

Lines of this file are not shown. View the raw message.

drivers/usb/usbmouse.c +17 -12
diff -urN linux-2.4.10/drivers/usb/usbmouse.c linux/drivers/usb/usbmouse.c

Lines of this file are not shown. View the raw message.

drivers/usb/usbpath.h +35 -0
diff -urN linux-2.4.10/drivers/usb/usbpath.h linux/drivers/usb/usbpath.h

Lines of this file are not shown. View the raw message.

drivers/usb/wacom.c +17 -12
diff -urN linux-2.4.10/drivers/usb/wacom.c linux/drivers/usb/wacom.c

Lines of this file are not shown. View the raw message.

include/linux/gameport.h +13 -9
diff -urN linux-2.4.10/include/linux/gameport.h linux/include/linux/gameport.h

Lines of this file are not shown. View the raw message.

include/linux/input.h +105 -22

127 lines not on this page · raw message

include/linux/serio.h +25 -11
diff -urN linux-2.4.10/include/linux/serio.h linux/include/linux/serio.h

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 6 lines

For a long time there was the problem that while upon inserting an USB keyboard the HID driver was auto-loaded OK, the mousedev, joydev, etc drivers were not.

This patch implements (among other things) hotplugging for the input subsystem.

Great to see this patch! Did you submit this to Linus, or are you waiting for feedback first? And what version of modutils knows how to emit records for "struct input_device_id" (or is there one?) via MODULE_DEVICE_TABLE?

Quoted 1 line

I can provide some docs if it isn't obvious how it works.

I provided skeletal docs on the website, mostly just grubbed from the invocation of the hotplug agent.

http://linux-hotplug.sourceforge.net/?selected=input

Real explanations of all those bit parameters would be good to have, from anyone who knows the input subsystem. There's too much "see the kernel source" there for my taste ... :)

Quoted 1 line

It'd be nice if someone could add support for this to the hotplug tools.

Yes indeed ... volunteers?

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Vojtech Pavlik
Quoted 9 lines · David Brownell
Quoted 6 lines

For a long time there was the problem that while upon inserting an USB keyboard the HID driver was auto-loaded OK, the mousedev, joydev, etc drivers were not.

This patch implements (among other things) hotplugging for the input subsystem.

Great to see this patch! Did you submit this to Linus, or are you waiting for feedback first?

I'd like feedback first, yes.

Quoted 3 lines

And what version of modutils knows
how to emit records for "struct input_device_id" (or is there one?) via MODULE_DEVICE_TABLE?

None at all yet. I just started with the kernelside part of the whole puzzle. This has to be implemented.

Quoted 10 lines
Quoted 1 line

I can provide some docs if it isn't obvious how it works.

I provided skeletal docs on the website, mostly just grubbed from the invocation of the hotplug agent.

http://linux-hotplug.sourceforge.net/?selected=input

Real explanations of all those bit parameters would be good to have, from anyone who knows the input subsystem. There's too much "see the kernel source" there for my taste ... :)

Ok.:

ACTION: "add" or "remove", adding or removing the device

PRODUCT: idbus/idvendor/idproduct/idversion. Idbus is defined in
input.h, the rest is in bus specific includes, ie for PCI idvendor and idproduct are from pci_ids.h.

NAME: The name of the device, as a string. Can be anything.

PHYS: Physical path of the device. This is defined to be constant if the
device is plugged to the same port in the system and unique for all connected devices. It has the form: busX.X/busX.X/busX.X ..., where bus is bus type, X.X is bus address, typically slot or port, entries are slash delimited. Examples:

pci00:07.2/usb0:2.3/input0
USB device (mouse, keyboard ...) connected to port #3 of an USB hub connected to port #2, USB bus 0 of USB controller located in PCI slot 7 function 2.

isa0201/gameport0/input0
Joystick connected to a gameport on an ISA card at i/o address 0x201

amimouse/input0
Mouse of the Amiga

UNIQ: Unique device ID. If non-empty, and present, then this is a string that
is unique for each device with the idbus/idvendor/idproduct/idversion combination. Typically a serial number. Not all devices have this.

EV, KEY, REL, ABS, MSC, LED, FF: Bitfields describing the device
features, buttons, axes, etc. Encoded as arrays of hex longs without any leading zeros.

Quoted 3 lines
Quoted 1 line

It'd be nice if someone could add support for this to the hotplug tools.

Yes indeed ... volunteers?

I can do it myself, if noone will take it, but I'd prefer on working on hotplug support for gameport and serio ...

Signature · 7 lines
Vojtech Pavlik
SuSE Labs

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel