Module Name:    src
Committed By:   jakllsch
Date:           Tue Jan 12 16:50:58 UTC 2010

Modified Files:
        src/sys/dev/usb: uhidev.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/usb/uhidev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.46 src/sys/dev/usb/uhidev.c:1.47
--- src/sys/dev/usb/uhidev.c:1.46	Wed Dec 30 23:42:22 2009
+++ src/sys/dev/usb/uhidev.c	Tue Jan 12 16:50:58 2010
@@ -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;
 

Reply via email to