diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-01-06 03:36:33 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-01-06 03:36:33 +0000 |
commit | 3cbb91164727466e046db9beabec8bf4280b20ec (patch) | |
tree | 4812dd28ded579ec60ba72c1902475a7be293c3b /sys | |
parent | f6ed9fef0aec51fb89b8c548b9abbacb03889a4a (diff) |
add Wacom Graphire3 and Graphire4 support.
From NetBSD via Michael Knudsen
ok dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/ugraphire_rdesc.h | 87 | ||||
-rw-r--r-- | sys/dev/usb/uhidev.c | 32 |
2 files changed, 112 insertions, 7 deletions
diff --git a/sys/dev/usb/ugraphire_rdesc.h b/sys/dev/usb/ugraphire_rdesc.h index a5611410995..0daa50c4380 100644 --- a/sys/dev/usb/ugraphire_rdesc.h +++ b/sys/dev/usb/ugraphire_rdesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ugraphire_rdesc.h,v 1.2 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: ugraphire_rdesc.h,v 1.3 2006/01/06 03:36:32 brad Exp $ */ /* $NetBSD: ugraphire_rdesc.h,v 1.1 2000/12/29 01:47:49 augustss Exp $ */ /* * Copyright (c) 2000 Nick Hibma <n_hibma@freebsd.org> @@ -90,3 +90,88 @@ static uByte uhid_graphire_report_descr[] = { 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 (Application) */ + 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 --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 370adb84dbc..fd4f252e86a 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.11 2005/08/01 05:36:48 brad Exp $ */ +/* $OpenBSD: uhidev.c,v 1.12 2006/01/06 03:36:32 brad Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -112,6 +112,7 @@ USB_ATTACH(uhidev) int size, nrepid, repid, repsz; int repsizes[256]; void *desc; + const void *descptr; usbd_status err; char *devinfop; @@ -161,17 +162,36 @@ USB_ATTACH(uhidev) sc->sc_ep_addr = ed->bEndpointAddress; /* XXX need to extend this */ - if (uaa->vendor == USB_VENDOR_WACOM && - uaa->product == USB_PRODUCT_WACOM_GRAPHIRE /* && - uaa->revision == 0x???? */) { /* XXX should use revision */ + descptr = NULL; + if (uaa->vendor == USB_VENDOR_WACOM) { + static uByte 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_GRAPHIRE3_4X5: + case USB_PRODUCT_WACOM_GRAPHIRE4_4X5: + 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; + default: + /* Keep descriptor */ + 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; |