summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredd <edd@openbsd.org>2013-08-09 22:10:17 +0000
committeredd <edd@openbsd.org>2013-08-09 22:10:17 +0000
commit5a046de6a2011dced5a95aba354660c2bb7964a2 (patch)
tree39f3545591fad2d76030571aa1ce43c702416f37
parentAdd RCS id and ISC license. (diff)
downloadwireguard-openbsd-5a046de6a2011dced5a95aba354660c2bb7964a2.tar.xz
wireguard-openbsd-5a046de6a2011dced5a95aba354660c2bb7964a2.zip
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@
-rw-r--r--share/man/man4/ums.429
-rw-r--r--share/man/man4/usb.46
-rw-r--r--sys/dev/usb/hidms.c36
-rw-r--r--sys/dev/usb/hidmsvar.h21
-rw-r--r--sys/dev/usb/ums.c25
5 files changed, 94 insertions, 23 deletions
diff --git a/share/man/man4/ums.4 b/share/man/man4/ums.4
index 69d93620e5c..69953618abe 100644
--- a/share/man/man4/ums.4
+++ b/share/man/man4/ums.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ums.4,v 1.10 2008/06/26 05:42:07 ray Exp $
+.\" $OpenBSD: ums.4,v 1.11 2013/08/09 22:10:17 edd Exp $
.\" $NetBSD: ums.4,v 1.7 2001/12/28 17:38:00 augustss Exp $
.\"
.\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -28,23 +28,30 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 26 2008 $
+.Dd $Mdocdate: August 9 2013 $
.Dt UMS 4
.Os
.Sh NAME
.Nm ums
-.Nd USB mouse support
+.Nd USB HID mouse, touchscreen and digitiser devices
.Sh SYNOPSIS
.Cd "ums* at uhidev?"
.Cd "wsmouse* at ums? mux 0"
.Sh DESCRIPTION
The
.Nm
-driver provides support for USB mice.
-Access to the mouse is through the
+driver provides support for USB HID mice, touchscreens and digitisers.
+Access to these devices is through the
.Xr wscons 4
driver.
+.Pp
+If the touchscreen sensor is poorly aligned, then
+.Xr xtsscale 1
+should be used to provide calibration results to the
+.Nm
+driver.
.Sh SEE ALSO
+.Xr xtsscale 1 ,
.Xr uhidev 4 ,
.Xr usb 4 ,
.Xr wsmouse 4
@@ -54,3 +61,15 @@ The
driver
first appeared in
.Ox 2.8 .
+.Sh AUTHORS
+.An -nosplit
+HID touchscreen and digitiser support was written by
+.An Robert Nagy
+and
+.An Matthieu Herrb
+then later merged into the generic
+.Xr ums 4
+driver by
+.An Edd Barrett .
+.Sh CAVEATS
+Touchscreen and digitiser pressure sensitivity is not yet implemented.
diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4
index f41eca221e9..9430f4b67ac 100644
--- a/share/man/man4/usb.4
+++ b/share/man/man4/usb.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: usb.4,v 1.140 2013/06/01 17:04:57 jmc Exp $
+.\" $OpenBSD: usb.4,v 1.141 2013/08/09 22:10:17 edd Exp $
.\" $NetBSD: usb.4,v 1.15 1999/07/29 14:20:32 augustss Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 1 2013 $
+.Dd $Mdocdate: August 9 2013 $
.Dt USB 4
.Os
.Sh NAME
@@ -252,7 +252,7 @@ HID touchscreen support
keyboards that follow the boot protocol
.It Xr ums 4
.Tn USB
-mouse devices
+HID mouse, touchscreen and digitiser devices
.It Xr uoaklux 4
Toradex OAK USB illuminance sensor
.It Xr uoakrh 4
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