Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Adjust report descriptor for Logitech USB Receiv...



details:   https://anonhg.NetBSD.org/src/rev/a5cc62071e36
branches:  trunk
changeset: 750735:a5cc62071e36
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Tue Jan 12 16:50:58 2010 +0000

description:
Adjust report descriptor for Logitech USB Receiver M/N C-BT44 to
more closely match what is in the report.  (This corrects the
off-by-one usages of most of the gray multimedia keys on a EX110
wireless keyboard so they can sensibly be used with libusbhid(3),
usbhidctl(1) and usbhidaction(1).)

This device also uses officially reserved usages (in the approximate
range of 0x1000 to 0x1100) in the Consumer usage page, but these
are out of the logical range the device reports as being valid.

diffstat:

 sys/dev/usb/uhidev.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r c818080e2446 -r a5cc62071e36 sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Tue Jan 12 16:18:58 2010 +0000
+++ b/sys/dev/usb/uhidev.c      Tue Jan 12 16:50:58 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.46 2009/12/30 23:42:22 jakllsch Exp $     */
+/*     $NetBSD: uhidev.c,v 1.47 2010/01/12 16:50:58 jakllsch Exp $     */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.46 2009/12/30 23:42:22 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.47 2010/01/12 16:50:58 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -246,6 +246,20 @@
                    &reportbuf, sizeof reportbuf);
        }
 
+       if (uaa->vendor == USB_VENDOR_LOGITECH &&
+           uaa->product == USB_PRODUCT_LOGITECH_CBT44 && size == 0xb1) {
+               uint8_t *data = desc;
+               /*
+                * This device has a odd USAGE_MINIMUM value that would
+                * cause the multimedia keys to have their usage number
+                * shifted up one usage.  Adjust so the usages are sane.
+                */
+
+               if (data[0x56] == 0x19 && data[0x57] == 0x01 &&
+                   data[0x58] == 0x2a && data[0x59] == 0x8c)
+                       data[0x57] = 0x00;
+       }
+
        sc->sc_repdesc = desc;
        sc->sc_repdesc_size = size;
 



Home | Main Index | Thread Index | Old Index