linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* need more events
@ 2006-11-25  1:09 juanslayton
  2006-11-27 18:56 ` [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more Linas Vepstas
  0 siblings, 1 reply; 4+ messages in thread
From: juanslayton @ 2006-11-25  1:09 UTC (permalink / raw)
  To: linux-hotplug


     The object is to poll 20 usb keyboards in an elementary school
classroom, each of which generates 2
events (one keyboard and one mouse).  The stock kernel maxes out at event
31, leaving me 4
keyboards short.
     I thought to fix this by changing the definition of EVDEV_MINORS
(line 12, evdev.c) from 32 to 64.  It almost worked.  The extra
events showed up in /dev/input/* and /proc/bus/input/devices.
However, attempting to access the new events in the application
program only yields a segmentation fault.  Obviously I've got to change
something else.
     Since the student workstations do not use mice, it would be just as
effective for my purposes to get rid of the mouse events.  Is there
any way that either of these approaches can be implemented with udev?

John




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more
  2006-11-25  1:09 need more events juanslayton
@ 2006-11-27 18:56 ` Linas Vepstas
  2006-11-28  3:45   ` Dmitry Torokhov
  2006-11-30 13:25   ` [RFC/PATCH] Uncap max number of evdev devices juanslayton
  0 siblings, 2 replies; 4+ messages in thread
From: Linas Vepstas @ 2006-11-27 18:56 UTC (permalink / raw)
  To: juanslayton; +Cc: linux-hotplug-devel, Vojtech Pavlik, linux-kernel, Alan Cox

On Fri, Nov 24, 2006 at 05:09:52PM -0800, juanslayton@dslextreme.com wrote:
> 
>      The object is to poll 20 usb keyboards in an elementary school
> classroom, each of which generates 2
> events (one keyboard and one mouse).  The stock kernel maxes out at event
> 31, leaving me 4
> keyboards short.
>      I thought to fix this by changing the definition of EVDEV_MINORS
> (line 12, evdev.c) from 32 to 64.  It almost worked.  The extra
> events showed up in /dev/input/* and /proc/bus/input/devices.
> However, attempting to access the new events in the application
> program only yields a segmentation fault.  Obviously I've got to change
> something else.

The problem is in input_register_handler() in drivers/input/input.c
which does things like 
if (input_table[handler->minor >> 5])
 and 
input_table[handler->minor >> 5] = handler;

which implicitly makes 32 the max. 

The kernel path below removes this limitation. Does it fix your problem?

--linas


The evdev code is limited to 32 input devices max, because
the generic input layer puts a 32-device cap on the number
of minor device numbers that a device driver can register.

This patch hacks around the 32-device limitation for 
the number of evdev drivers. Not clear to me if this
this is the best solution. 

Not-even-compile-tested.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 drivers/input/input.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Index: linux-2.6.19-rc4-git3/drivers/input/input.c
=================================--- linux-2.6.19-rc4-git3.orig/drivers/input/input.c	2006-11-01 16:15:19.000000000 -0600
+++ linux-2.6.19-rc4-git3/drivers/input/input.c	2006-11-27 12:50:12.000000000 -0600
@@ -28,12 +28,16 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@s
 MODULE_DESCRIPTION("Input core");
 MODULE_LICENSE("GPL");
 
-#define INPUT_DEVICES	256
+#define INPUT_MINOR_BITS   8
+#define INPUT_DEVICES      (1<<INPUT_MINOR_BITS)
+#define MINOR_RANGE_BITS   6
+#define MINOR_RANGES       (1<<(INPUT_MINOR_BITS-MINOR_RANGE_BITS))
+#define TABLE_OFFSET(minor) ((minor)>>MINOR_RANGE_BITS)
 
 static LIST_HEAD(input_dev_list);
 static LIST_HEAD(input_handler_list);
 
-static struct input_handler *input_table[8];
+static struct input_handler *input_table[MINOR_RANGES];
 
 /**
  * input_event() - report new input event
@@ -1046,10 +1050,10 @@ int input_register_handler(struct input_
 	INIT_LIST_HEAD(&handler->h_list);
 
 	if (handler->fops != NULL) {
-		if (input_table[handler->minor >> 5])
+		if (input_table[TABLE_OFFSET(handler->minor)])
 			return -EBUSY;
 
-		input_table[handler->minor >> 5] = handler;
+		input_table[TABLE_OFFSET(handler->minor)] = handler;
 	}
 
 	list_add_tail(&handler->node, &input_handler_list);
@@ -1082,7 +1086,7 @@ void input_unregister_handler(struct inp
 	list_del_init(&handler->node);
 
 	if (handler->fops != NULL)
-		input_table[handler->minor >> 5] = NULL;
+		input_table[TABLE_OFFSET(handler->minor)] = NULL;
 
 	input_wakeup_procfs_readers();
 }
@@ -1090,7 +1094,7 @@ EXPORT_SYMBOL(input_unregister_handler);
 
 static int input_open_file(struct inode *inode, struct file *file)
 {
-	struct input_handler *handler = input_table[iminor(inode) >> 5];
+	struct input_handler *handler = input_table[TABLE_OFFSET(iminor(inode))];
 	const struct file_operations *old_fops, *new_fops = NULL;
 	int err;
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more
  2006-11-27 18:56 ` [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more Linas Vepstas
@ 2006-11-28  3:45   ` Dmitry Torokhov
  2006-11-30 13:25   ` [RFC/PATCH] Uncap max number of evdev devices juanslayton
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2006-11-28  3:45 UTC (permalink / raw)
  To: Linas Vepstas
  Cc: juanslayton, linux-hotplug-devel, Vojtech Pavlik, linux-kernel,
	Alan Cox

On Monday 27 November 2006 13:56, Linas Vepstas wrote:
> On Fri, Nov 24, 2006 at 05:09:52PM -0800, juanslayton@dslextreme.com wrote:
> > 
> >      The object is to poll 20 usb keyboards in an elementary school
> > classroom, each of which generates 2
> > events (one keyboard and one mouse).  The stock kernel maxes out at event
> > 31, leaving me 4
> > keyboards short.
> >      I thought to fix this by changing the definition of EVDEV_MINORS
> > (line 12, evdev.c) from 32 to 64.  It almost worked.  The extra
> > events showed up in /dev/input/* and /proc/bus/input/devices.
> > However, attempting to access the new events in the application
> > program only yields a segmentation fault.  Obviously I've got to change
> > something else.
> 
> The problem is in input_register_handler() in drivers/input/input.c
> which does things like 
> if (input_table[handler->minor >> 5])
>  and 
> input_table[handler->minor >> 5] = handler;
> 
> which implicitly makes 32 the max. 
> 
> The kernel path below removes this limitation. Does it fix your problem?
> 

This makes /dev/input/js32-63 take over /dev/input/mouse0-31 which is
contrary to what Documentation/devices.txt says and therefore not a good
idea for the mainline.

I am planning to convert input core to cdevs and that table will go away
completely and then it can be discussed how to extend range of input
devices (probably by going beyond 256 minors?).

-- 
Dmitry

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC/PATCH] Uncap max number of evdev devices
  2006-11-27 18:56 ` [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more Linas Vepstas
  2006-11-28  3:45   ` Dmitry Torokhov
@ 2006-11-30 13:25   ` juanslayton
  1 sibling, 0 replies; 4+ messages in thread
From: juanslayton @ 2006-11-30 13:25 UTC (permalink / raw)
  To: linux-hotplug




  Success!  Although it the compiler complained loudly with a fistful of
warnings, it did compile and works beautifully.

  Dimitri, I am (I hope) a much better schoolteacher than programmer, but
I assume that your points are valid.  I'll be looking for your
principled approach.  In the meantime, I am delighted to have a working
'field expedient.'  Thanks again to both of you for your time and
attention.

John






-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-30 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-25  1:09 need more events juanslayton
2006-11-27 18:56 ` [RFC/PATCH] Uncap max number of evdev devices [was: Re: need more Linas Vepstas
2006-11-28  3:45   ` Dmitry Torokhov
2006-11-30 13:25   ` [RFC/PATCH] Uncap max number of evdev devices juanslayton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).