Hi all,
The ring buffer in hiddev.c does not seem to deal correctly with large
reports, such as those generated by the P.I. Engineering "X-keys"
keyboards (www.xkeys.com/xkeys.php). It uses a fixed ring buffer of size
64.
Unfortunately, for devices with more than 64 elements in their reports
(such as the X-keys Jog & Shuttle Editor, which has a wDescriptorLength of
91, and the X-keys Joystick Controller, with wDescriptorLength = 78), this
makes the ring buffer writer (in hiddev_send_event()) write over itself
before the reader (in hiddev_read()) can even get a change to read the
beginning of the report. The result is incorrect output -- keys that never
get reported to user space.
I'm sure there's a more elegant way to fix this, but the attached patch
just increases the size of the ring buffer from 64 to 1024 elements and
does solve the problem, at least for the X-keys keyboards. I wasn't able
to figure out the actual USB maximum (if there is one) from a cursory look
at their documents.
Please let me know if I should send this patch somewhere else instead.
Best,
Keith Winstein
MIT
[EMAIL PROTECTED]
--- linux-2.6.13/drivers/usb/input/hiddev.c.orig 2005-08-28
19:41:01.000000000 -0400
+++ linux-2.6.13/drivers/usb/input/hiddev.c 2005-10-07 03:56:42.000000000
-0400
@@ -44,7 +44,7 @@
#define HIDDEV_MINOR_BASE 96
#define HIDDEV_MINORS 16
#endif
-#define HIDDEV_BUFFER_SIZE 64
+#define HIDDEV_BUFFER_SIZE 1024
struct hiddev {
int exist;