On Sat, 2002-01-26 at 14:05, Martin Pirker wrote:
> I have a
>  074e  Digital Stream Corp.
>     0002  PS/2 Adapter

SHORT STORY

Apply the attached patch and recompile the kernel (or just hid.o).  I
just tested that it works with 2.4.18-pre7, but I've used it since
2.4.13.


LONG STORY

If you only plug in a keyboard, the device claims to be a keyboard; if
you plug in a mouse or a mouse and a keyboard, the device claims to be a
keyboard and a mouse.  In the latter case, when you plug it in, it
connects as a keyboard, disconnects, and re-connects as a
keyboard-and-mouse.  Seems a rather roundabout way of doing things,
doesn't it?

The keyboard part of the report descriptor is different in each case
(the reason behind this escapes me).  When just the keyboard is plugged
in, everything works (for me).  When a mouse is plugged in, the HID
driver parses the keyboard part of the report descriptor incorrectly
(presumably because the HID spec is awfully ambiguous), fails, and the
device goes unclaimed.

The real mystery is what the little black button on the adaptor does;
I've tried pressing it at various times with no effect -- perhaps it's a
placebo?  ;)


PATCH NOTES

The report descriptor parser fails when the device tries to send a
logical maximum of 255 as a single byte (the parser treats it as
signed).  The patch treats a logical maximum as unsigned unless the
logical minimum, treated as signed, was negative; this works as long as
the logical minimum comes before the logical maximum in the report
descriptor.  The RightThing(tm) is probably keeping track of extra
information (e.g. original length) of both, and comparing them to see
whether they should be treated as signed or unsigned, but I decided to
aim for minimal changes instead.

I believe I sent the patch to the HID maintainer a few months ago, but
it must have gotten lost somewhere.  It would be nice if it were
included in the kernel.


-- Mieszko

--- drivers/usb/hid-core.c.orig Sun Nov  4 00:43:42 2001
+++ drivers/usb/hid-core.c      Sun Nov  4 00:44:10 2001
@@ -310,7 +310,10 @@
                        return 0;
 
                case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM:
-                       parser->global.logical_maximum = item_sdata(item);
+                       if (parser->global.logical_minimum < 0)
+                               parser->global.logical_maximum = item_sdata(item);
+                       else
+                               parser->global.logical_maximum = item_udata(item);
                        return 0;
 
                case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM:

Reply via email to