Subject: kern/23965: Patch to make Wacom Graphire3 behave as a standard tablet
To: None <gnats-bugs@gnats.NetBSD.org>
From: Dave Huang <khym@azeotrope.org>
List: netbsd-bugs
Date: 01/03/2004 18:36:59
>Number: 23965
>Category: kern
>Synopsis: Patch to make Wacom Graphire3 behave as a standard tablet
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Jan 04 00:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Dave Huang
>Release: NetBSD 1.6ZG
>Organization:
>Environment:
System: NetBSD fluff.azeotrope.org 1.6ZG NetBSD 1.6ZG (FLUFF) #47: Sat Jan 3 03:52:35 CST 2004 khym@fluff.azeotrope.org:/usr/src.local/sys/arch/i386/compile/obj.i386/FLUFF i386
Architecture: i386
Machine: i386
>Description:
The Wacom Graphire3 4x5 (and probably the 6x8 too) have a
vendor-specific report descriptor. However, the data returned is
fairly standard, and can be easily represented with a USB Digitizer
descriptor. The report descriptor is already being overridden for the
original Wacom Graphire; this patch does the same for the Graphire3
4x5.
It also writes 0x0202 to feature report ID 2, which is needed
to enable the tablet data.
>How-To-Repeat:
Plug in a Graphire3 tablet, and see:
uhidev0 at uhub0 port 2 configuration 1 interface 0
uhidev0: WACOM CTE-430-UV3.1-4, rev 1.10/3.14, addr 2, iclass 3/1
uhidev0: 3 report ids
ums0 at uhidev0 reportid 1: 3 buttons and Z dir.
wsmouse1 at ums0 mux 0
uhid0 at uhidev0 reportid 2: input=7, output=0, feature=1
uhid1 at uhidev0 reportid 3: input=0, output=0, feature=1
Then run usbhidctl and see all the vendor-specific pages:
% usbhidctl -f /dev/uhid0 -r
Report descriptor:
Collection page=Digitizer usage=Digitizer
Collection page=0x0000 usage=0x0000
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
End collection
Feature size=0 count=1 page=Microsoft usage=0x0001, logical range 0..255
Total input size 7 bytes
Total output size 0 bytes
Total feature size 1 bytes
And finally, dd if=/dev/uhid0 bs=7 and notice that no data is being sent.
>Fix:
diff -ur /usr/src/sys/dev/usb/ugraphire_rdesc.h src/sys/dev/usb/ugraphire_rdesc.h
--- /usr/src/sys/dev/usb/ugraphire_rdesc.h 2000-12-28 19:47:49.000000000 -0600
+++ src/sys/dev/usb/ugraphire_rdesc.h 2004-01-03 03:45:55.000000000 -0600
@@ -89,3 +89,87 @@
0xb1, 0x02, /* FEATURE (Data,Var,Abs) */
0xc0, /* END_COLLECTION */
};
+
+static uByte uhid_graphire3_4x5_report_descr[] = {
+ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
+ 0x09, 0x02, /* USAGE (Mouse) */
+ 0xa1, 0x01, /* COLLECTION (Application) */
+ 0x85, 0x01, /* REPORT_ID (1) */
+ 0x09, 0x01, /* USAGE (Pointer) */
+ 0xa1, 0x00, /* COLLECTION (Physical) */
+ 0x05, 0x09, /* USAGE_PAGE (Button) */
+ 0x19, 0x01, /* USAGE_MINIMUM (Button 1) */
+ 0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */
+ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
+ 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
+ 0x95, 0x03, /* REPORT_COUNT (3) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x75, 0x05, /* REPORT_SIZE (5) */
+ 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */
+ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
+ 0x09, 0x30, /* USAGE (X) */
+ 0x09, 0x31, /* USAGE (Y) */
+ 0x09, 0x38, /* USAGE (Wheel) */
+ 0x15, 0x81, /* LOGICAL_MINIMUM (-127) */
+ 0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */
+ 0x75, 0x08, /* REPORT_SIZE (8) */
+ 0x95, 0x03, /* REPORT_COUNT (3) */
+ 0x81, 0x06, /* INPUT (Data,Var,Rel) */
+ 0xc0, /* END_COLLECTION */
+ 0xc0, /* END_COLLECTION */
+ 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
+ 0x09, 0x01, /* USAGE (Pointer) */
+ 0xa1, 0x01, /* COLLECTION (Applicaption) */
+ 0x85, 0x02, /* REPORT_ID (2) */
+ 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
+ 0x09, 0x01, /* USAGE (Digitizer) */
+ 0xa1, 0x00, /* COLLECTION (Physical) */
+ 0x09, 0x33, /* USAGE (Touch) */
+ 0x09, 0x44, /* USAGE (Barrel Switch) */
+ 0x09, 0x44, /* USAGE (Barrel Switch) */
+ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
+ 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x95, 0x03, /* REPORT_COUNT (3) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x95, 0x02, /* REPORT_COUNT (2) */
+ 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */
+ 0x09, 0x3c, /* USAGE (Invert) */
+ 0x09, 0x38, /* USAGE (Transducer Index) */
+ 0x09, 0x32, /* USAGE (In Range) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x95, 0x03, /* REPORT_COUNT (3) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
+ 0x09, 0x30, /* USAGE (X) */
+ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
+ 0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */
+ 0x75, 0x10, /* REPORT_SIZE (16) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x09, 0x31, /* USAGE (Y) */
+ 0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */
+ 0x75, 0x10, /* REPORT_SIZE (16) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
+ 0x09, 0x30, /* USAGE (Tip Pressure) */
+ 0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */
+ 0x75, 0x10, /* REPORT_SIZE (16) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0xc0, /* END_COLLECTION */
+ 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
+ 0x09, 0x00, /* USAGE (Undefined) */
+ 0x85, 0x02, /* REPORT_ID (2) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */
+ 0x09, 0x00, /* USAGE (Undefined) */
+ 0x85, 0x03, /* REPORT_ID (3) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */
+ 0xc0 /* END_COLLECTION */
+};
diff -ur /usr/src/sys/dev/usb/uhidev.c src/sys/dev/usb/uhidev.c
--- /usr/src/sys/dev/usb/uhidev.c 2003-10-26 01:57:46.000000000 -0500
+++ src/sys/dev/usb/uhidev.c 2004-01-03 18:07:51.000000000 -0600
@@ -109,7 +109,7 @@
struct uhidev *dev;
int size, nrepid, repid, repsz;
int repsizes[256];
- void *desc;
+ void *desc, *descptr = NULL;
usbd_status err;
char devinfo[1024];
@@ -157,21 +157,45 @@
sc->sc_ep_addr = ed->bEndpointAddress;
/* XXX need to extend this */
- if (uaa->vendor == USB_VENDOR_WACOM &&
- uaa->product == USB_PRODUCT_WACOM_GRAPHIRE /* &&
+ if (uaa->vendor == USB_VENDOR_WACOM /* &&
uaa->revision == 0x???? */) { /* XXX should use revision */
+ char reportbuf[] = {2, 2, 2};
+
/* The report descriptor for the Wacom Graphire is broken. */
- size = sizeof uhid_graphire_report_descr;
+ switch (uaa->product) {
+ case USB_PRODUCT_WACOM_GRAPHIRE:
+ size = sizeof uhid_graphire_report_descr;
+ descptr = uhid_graphire_report_descr;
+ break;
+
+ case USB_PRODUCT_WACOM_GAPHIRE3_4X5: /* The 6x8 too? */
+ /*
+ * The Graphire3 needs 0x0202 to be written to
+ * feature report ID 2 before it'll start
+ * returning digitizer data.
+ */
+ usbd_set_report(uaa->iface, UHID_FEATURE_REPORT, 2,
+ &reportbuf, sizeof(reportbuf));
+
+ size = sizeof uhid_graphire3_4x5_report_descr;
+ descptr = uhid_graphire3_4x5_report_descr;
+ break;
+ }
+
+ }
+
+ if (descptr) {
desc = malloc(size, M_USBDEV, M_NOWAIT);
if (desc == NULL)
err = USBD_NOMEM;
else {
err = USBD_NORMAL_COMPLETION;
- memcpy(desc, uhid_graphire_report_descr, size);
+ memcpy(desc, descptr, size);
}
} else {
desc = NULL;
- err = usbd_read_report_desc(uaa->iface, &desc, &size, M_USBDEV);
+ err = usbd_read_report_desc(uaa->iface, &desc, &size,
+ M_USBDEV);
}
if (err) {
printf("%s: no report descriptor\n", USBDEVNAME(sc->sc_dev));
diff -ur /usr/src/sys/dev/usb/usbdevs src/sys/dev/usb/usbdevs
--- /usr/src/sys/dev/usb/usbdevs 2004-01-01 06:52:04.000000000 -0600
+++ src/sys/dev/usb/usbdevs 2004-01-03 02:02:30.000000000 -0600
@@ -1532,6 +1532,7 @@
/* Wacom products */
product WACOM CT0405U 0x0000 CT-0405-U Tablet
product WACOM GRAPHIRE 0x0010 Graphire
+product WACOM GRAPHIRE3_4X5 0x0013 Graphire3 4x5
product WACOM INTUOSA5 0x0021 Intuos A5
/* Xirlink products */
>Release-Note:
>Audit-Trail:
>Unformatted: