[PATCHES] USB input layer improvements

From: Ben Collins (bcollins@debian.org)
Date: Mon May 05 2003 - 19:22:33 EST


Ok, now I'm sending this here since linux-usb-devel and Pavel seem to be
ignoring my emails. Note, this is against 2.4.21-rc1, but I am prepared
to finish this off for 2.5 aswell. I just need someone who knows USB to
look this over and give me some freaking feedback. The multi-input patch
seems to be of significant importance.

---------------------------------------------------------------------

I've been working on getting my recently purchased Happ Controls UGCI
Fighting interface working.

Aside from getting it working with the standard input layer (it
implements a mouse, 2 joysticks and a keyboard), it also has some
specialized inputs/outputs that I am programming from userspace
using the event layer.

The first problem I had with the initial HID was that the hid-input
layer only has per-interface granularity with the input layer. This
device has only two interfaces. The second is the mouse, the first is
7 other inputs including the 2 joysticks and the keyboard.

The hid-input layer would lump all the fields in the first interface (7
axis and 13 buttons in all) to one input. So I got one joystick device
and that was it.

I did up a patch that created an input for each input in the interfaces
listing. IMO, this is the correct way since each input descibes the
fields available in it, and is a logical grouping.

Now, the second problem is that my joysticks look like this:

    Field(0)
      Physical(GenericDesktop.Pointer)
      Usage(2)
        GenericDesktop.X
        GenericDesktop.Y
      Logical Minimum(-128)
      Logical Maximum(127)
      Physical Minimum(0)
      Physical Maximum(255)
      Report Size(8)
      Report Count(2)
      Report Offset(0)
      Flags( Variable Absolute )

Notice the logical/physical min/max are different, even though they are
the same range. As far as I can tell this is within HID specs. Windows
uses the joystick just fine. However Linux's HID and HID-input layer
both use the logic min/max in this case, while the device is sending
values in the physical min/max range. This is digital, so we get
0,128,255 from the device, but HID interprets that as 0,-128,-1.

Obviously that doesn't work right. I'm not sure what the correct thing
to do is, so my patch for this is only RFC status. With this patch my
mouse and keyboard still work, and the joysticks work correctly. Maybe
the correct thing is to map the physical values read from the device to
the logical values.

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
Deqo       - http://www.deqo.com/



- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 07 2003 - 22:00:24 EST