summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorEdd Barrett <edd@cvs.openbsd.org>2013-08-09 22:10:18 +0000
committerEdd Barrett <edd@cvs.openbsd.org>2013-08-09 22:10:18 +0000
commit8a73a5c467fef90078daf5cac88475a85872a7ca (patch)
treebbe6ffc9b29ed833a1a8eb6810d32eeb77835df9 /sys/dev/usb
parentc358398c43731d7fcd7f61ec97253678e50243ed (diff)
Merge uhts(1) into ums(1). The code is amost the same, so no need to duplicate.
A part of ongoing work to improve touchscreen/digitiser support. A diff will follow shortly to remove uhts(1). OK matthieu@, with input from mpi@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/hidms.c36
-rw-r--r--sys/dev/usb/hidmsvar.h21
-rw-r--r--sys/dev/usb/ums.c25
3 files changed, 67 insertions, 15 deletions
diff --git a/sys/dev/usb/hidms.c b/sys/dev/usb/hidms.c
index 1a17cfa7a2d..6636d805631 100644
--- a/sys/dev/usb/hidms.c
+++ b/sys/dev/usb/hidms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidms.c,v 1.4 2011/08/19 18:46:22 matthieu Exp $ */
+/* $OpenBSD: hidms.c,v 1.5 2013/08/09 22:10:17 edd Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -194,6 +194,27 @@ hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks,
break;
ms->sc_num_buttons = i - 1;
+ if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS,
+ HUD_TIP_SWITCH), id, hid_input,
+ &ms->sc_loc_btn[ms->sc_num_buttons], NULL)){
+ ms->sc_flags |= HIDMS_TIP;
+ ms->sc_num_buttons++;
+ }
+
+ if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS,
+ HUD_ERASER), id, hid_input,
+ &ms->sc_loc_btn[ms->sc_num_buttons], NULL)){
+ ms->sc_flags |= HIDMS_ERASER;
+ ms->sc_num_buttons++;
+ }
+
+ if (hid_locate(desc, dlen, HID_USAGE2(HUP_DIGITIZERS,
+ HUD_BARREL_SWITCH), id, hid_input,
+ &ms->sc_loc_btn[ms->sc_num_buttons], NULL)){
+ ms->sc_flags |= HIDMS_BARREL;
+ ms->sc_num_buttons++;
+ }
+
/*
* The Microsoft Wireless Notebook Optical Mouse seems to be in worse
* shape than the Wireless Intellimouse 2.0, as its X, Y, wheel, and
@@ -216,6 +237,11 @@ hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks,
/* Parse descriptors to get touch panel bounds */
d = hid_start_parse(desc, dlen, hid_input);
while (hid_get_item(d, &h)) {
+ if (h.kind != hid_input ||
+ HID_GET_USAGE_PAGE(h.usage) != HUP_GENERIC_DESKTOP)
+ continue;
+ DPRINTF(("hidms: usage=0x%x range %d..%d\n",
+ h.usage, h.logical_minimum, h.logical_maximum));
switch (HID_GET_USAGE(h.usage)) {
case HUG_X:
if (ms->sc_flags & HIDMS_ABSX) {
@@ -255,6 +281,14 @@ hidms_attach(struct hidms *ms, const struct wsmouse_accessops *ops)
printf(", Z and W dir");
break;
}
+
+ if (ms->sc_flags & HIDMS_TIP)
+ printf(", tip");
+ if (ms->sc_flags & HIDMS_BARREL)
+ printf(", barrel");
+ if (ms->sc_flags & HIDMS_ERASER)
+ printf(", eraser");
+
printf("\n");
#ifdef HIDMS_DEBUG
diff --git a/sys/dev/usb/hidmsvar.h b/sys/dev/usb/hidmsvar.h
index 807ce5cf32f..d4a14149bf2 100644
--- a/sys/dev/usb/hidmsvar.h
+++ b/sys/dev/usb/hidmsvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidmsvar.h,v 1.2 2011/03/04 23:57:52 kettenis Exp $ */
+/* $OpenBSD: hidmsvar.h,v 1.3 2013/08/09 22:10:17 edd Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -43,14 +43,17 @@ struct tsscale {
struct hidms {
int sc_enabled;
int sc_flags; /* device configuration */
-#define HIDMS_SPUR_BUT_UP 0x01 /* spurious button up events */
-#define HIDMS_Z 0x02 /* Z direction available */
-#define HIDMS_REVZ 0x04 /* Z-axis is reversed */
-#define HIDMS_W 0x08 /* W direction available */
-#define HIDMS_REVW 0x10 /* W-axis is reversed */
-#define HIDMS_LEADINGBYTE 0x20 /* Unknown leading byte */
-#define HIDMS_ABSX 0x40 /* X-axis is absolute */
-#define HIDMS_ABSY 0x80 /* Y-axis is absolute */
+#define HIDMS_SPUR_BUT_UP 0x001 /* spurious button up events */
+#define HIDMS_Z 0x002 /* Z direction available */
+#define HIDMS_REVZ 0x004 /* Z-axis is reversed */
+#define HIDMS_W 0x008 /* W direction available */
+#define HIDMS_REVW 0x010 /* W-axis is reversed */
+#define HIDMS_LEADINGBYTE 0x020 /* Unknown leading byte */
+#define HIDMS_ABSX 0x040 /* X-axis is absolute */
+#define HIDMS_ABSY 0x080 /* Y-axis is absolute */
+#define HIDMS_TIP 0x100 /* Tip switch on a digitiser pen */
+#define HIDMS_BARREL 0x200 /* Barrel switch on a digitiser pen */
+#define HIDMS_ERASER 0x400 /* Eraser switch on a digitiser pen */
int sc_num_buttons;
u_int32_t sc_buttons; /* mouse button status */
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index 3bb0b545863..bf6dc46c1c9 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ums.c,v 1.35 2011/07/03 15:47:17 matthew Exp $ */
+/* $OpenBSD: ums.c,v 1.36 2013/08/09 22:10:17 edd Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -100,11 +100,26 @@ ums_match(struct device *parent, void *match, void *aux)
void *desc;
uhidev_get_report_desc(uha->parent, &desc, &size);
- if (!hid_is_collection(desc, size, uha->reportid,
- HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
- return (UMATCH_NONE);
- return (UMATCH_IFACECLASS);
+ if (hid_is_collection(desc, size, uha->reportid,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
+ return (UMATCH_IFACECLASS);
+
+ /*
+ * For now return a value higher than UMATCH_IFACECLASS to make sure
+ * touchscreens and digitizers no longer attach to uhts(4).
+ */
+ if (hid_is_collection(desc, size, uha->reportid,
+ HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)))
+ return (UMATCH_IFACECLASS_IFACESUBCLASS); /* XXX */
+ /* return (UMATCH_IFACECLASS); */
+
+ if (hid_is_collection(desc, size, uha->reportid,
+ HID_USAGE2(HUP_DIGITIZERS, HUD_PEN)))
+ return (UMATCH_IFACECLASS_IFACESUBCLASS); /* XXX */
+ /* return (UMATCH_IFACECLASS); */
+
+ return (UMATCH_NONE);
}
void