summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/adb/ams.c4
-rw-r--r--sys/dev/hil/hilms.c4
-rw-r--r--sys/dev/pckbc/psm.c4
-rw-r--r--sys/dev/pckbc/psm_intelli.c4
-rw-r--r--sys/dev/usb/ums.c61
-rw-r--r--sys/dev/usb/uts.c4
-rw-r--r--sys/dev/wscons/wsconsio.h8
-rw-r--r--sys/dev/wscons/wsdisplay.c4
-rw-r--r--sys/dev/wscons/wsmouse.c31
-rw-r--r--sys/dev/wscons/wsmousevar.h5
10 files changed, 91 insertions, 38 deletions
diff --git a/sys/dev/adb/ams.c b/sys/dev/adb/ams.c
index d1fd1925aa3..332772d7660 100644
--- a/sys/dev/adb/ams.c
+++ b/sys/dev/adb/ams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ams.c,v 1.4 2007/03/13 20:56:56 miod Exp $ */
+/* $OpenBSD: ams.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */
/*
@@ -498,7 +498,7 @@ ms_processevent(adb_event_t *event, struct ams_softc *sc)
((event->bytes[0] & 0x40) ? 64 : 0);
if (sc->sc_wsmousedev)
- wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, 0,
+ wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, 0, 0,
WSMOUSE_INPUT_DELTA);
}
diff --git a/sys/dev/hil/hilms.c b/sys/dev/hil/hilms.c
index 8c752bf6d56..4251ae419c2 100644
--- a/sys/dev/hil/hilms.c
+++ b/sys/dev/hil/hilms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hilms.c,v 1.4 2006/12/16 20:08:44 miod Exp $ */
+/* $OpenBSD: hilms.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -334,5 +334,5 @@ hilms_callback(struct hildev_softc *dev, u_int buflen, u_int8_t *buf)
if (sc->sc_wsmousedev != NULL)
wsmouse_input(sc->sc_wsmousedev,
- sc->sc_buttonstate, dx, dy, dz, flags);
+ sc->sc_buttonstate, dx, dy, dz, 0, flags);
}
diff --git a/sys/dev/pckbc/psm.c b/sys/dev/pckbc/psm.c
index 8882f1e1b9b..e8708820eb2 100644
--- a/sys/dev/pckbc/psm.c
+++ b/sys/dev/pckbc/psm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: psm.c,v 1.4 2002/03/14 01:27:00 millert Exp $ */
+/* $OpenBSD: psm.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -319,7 +319,7 @@ int data;
if (sc->dx || dy || changed)
wsmouse_input(sc->sc_wsmousedev,
- sc->buttons, sc->dx, dy, 0,
+ sc->buttons, sc->dx, dy, 0, 0,
WSMOUSE_INPUT_DELTA);
break;
}
diff --git a/sys/dev/pckbc/psm_intelli.c b/sys/dev/pckbc/psm_intelli.c
index be98095a06d..edcc3eb61bb 100644
--- a/sys/dev/pckbc/psm_intelli.c
+++ b/sys/dev/pckbc/psm_intelli.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: psm_intelli.c,v 1.4 2002/03/14 01:27:00 millert Exp $ */
+/* $OpenBSD: psm_intelli.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: psm_intelli.c,v 1.8 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -344,7 +344,7 @@ int data;
if (sc->dx || sc->dy || dz || changed)
wsmouse_input(sc->sc_wsmousedev,
- sc->buttons, sc->dx, sc->dy, dz,
+ sc->buttons, sc->dx, sc->dy, dz, 0,
WSMOUSE_INPUT_DELTA);
break;
}
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index decb27e40a8..6aa9525250f 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ums.c,v 1.17 2006/06/23 06:27:12 miod Exp $ */
+/* $OpenBSD: ums.c,v 1.18 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -91,7 +91,7 @@ int umsdebug = 0;
struct ums_softc {
struct uhidev sc_hdev;
- struct hid_location sc_loc_x, sc_loc_y, sc_loc_z;
+ struct hid_location sc_loc_x, sc_loc_y, sc_loc_z, sc_loc_w;
struct hid_location sc_loc_btn[MAX_BUTTONS];
int sc_enabled;
@@ -149,7 +149,7 @@ USB_ATTACH(ums)
int size;
void *desc;
u_int32_t flags, quirks;
- int i, wheel;
+ int i;
struct hid_location loc_btn;
sc->sc_hdev.sc_intr = ums_intr;
@@ -188,20 +188,41 @@ USB_ATTACH(ums)
USB_ATTACH_ERROR_RETURN;
}
- /* Try to guess the Z activator: first check Z, then WHEEL. */
- wheel = 0;
- if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z),
- uha->reportid, hid_input, &sc->sc_loc_z, &flags) ||
- (wheel = hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
- HUG_WHEEL),
- uha->reportid, hid_input, &sc->sc_loc_z, &flags))) {
+ /* Try the wheel as Z activator first */
+ if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
+ uha->reportid, hid_input, &sc->sc_loc_z, &flags)) {
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
- sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */
+ DPRINTF(("\n%s: Wheel report 0x%04x not supported\n",
+ USBDEVNAME(sc->sc_hdev.sc_dev), flags));
+ sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */
} else {
sc->flags |= UMS_Z;
/* Wheels need the Z axis reversed. */
- if (wheel)
- sc->flags ^= UMS_REVZ;
+ sc->flags ^= UMS_REVZ;
+ }
+ /*
+ * We might have both a wheel and Z direction; in this case,
+ * report the Z direction on the W axis.
+ */
+ if (hid_locate(desc, size,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z),
+ uha->reportid, hid_input, &sc->sc_loc_w, &flags)) {
+ if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
+ DPRINTF(("\n%s: Z report 0x%04x not supported\n",
+ USBDEVNAME(sc->sc_hdev.sc_dev), flags));
+ /* Bad Z coord, ignore it */
+ sc->sc_loc_w.size = 0;
+ }
+ }
+ } else if (hid_locate(desc, size,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z),
+ uha->reportid, hid_input, &sc->sc_loc_z, &flags)) {
+ if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
+ DPRINTF(("\n%s: Z report 0x%04x not supported\n",
+ USBDEVNAME(sc->sc_hdev.sc_dev), flags));
+ sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */
+ } else {
+ sc->flags |= UMS_Z;
}
}
@@ -281,7 +302,7 @@ void
ums_intr(struct uhidev *addr, void *ibuf, u_int len)
{
struct ums_softc *sc = (struct ums_softc *)addr;
- int dx, dy, dz;
+ int dx, dy, dz, dw;
u_int32_t buttons = 0;
int i;
int s;
@@ -291,20 +312,22 @@ ums_intr(struct uhidev *addr, void *ibuf, u_int len)
dx = hid_get_data(ibuf, &sc->sc_loc_x);
dy = -hid_get_data(ibuf, &sc->sc_loc_y);
dz = hid_get_data(ibuf, &sc->sc_loc_z);
+ dw = hid_get_data(ibuf, &sc->sc_loc_w);
if (sc->flags & UMS_REVZ)
dz = -dz;
for (i = 0; i < sc->nbuttons; i++)
if (hid_get_data(ibuf, &sc->sc_loc_btn[i]))
buttons |= (1 << UMS_BUT(i));
- if (dx != 0 || dy != 0 || dz != 0 || buttons != sc->sc_buttons) {
- DPRINTFN(10, ("ums_intr: x:%d y:%d z:%d buttons:0x%x\n",
- dx, dy, dz, buttons));
+ if (dx != 0 || dy != 0 || dz != 0 || dw != 0 ||
+ buttons != sc->sc_buttons) {
+ DPRINTFN(10, ("ums_intr: x:%d y:%d z:%d w:%d buttons:0x%x\n",
+ dx, dy, dz, dw, buttons));
sc->sc_buttons = buttons;
if (sc->sc_wsmousedev != NULL) {
s = spltty();
- wsmouse_input(sc->sc_wsmousedev, buttons, dx, dy, dz,
- WSMOUSE_INPUT_DELTA);
+ wsmouse_input(sc->sc_wsmousedev, buttons,
+ dx, dy, dz, dw, WSMOUSE_INPUT_DELTA);
splx(s);
}
}
diff --git a/sys/dev/usb/uts.c b/sys/dev/usb/uts.c
index 7de16ae042a..2831725411c 100644
--- a/sys/dev/usb/uts.c
+++ b/sys/dev/usb/uts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uts.c,v 1.2 2007/03/23 14:35:19 robert Exp $ */
+/* $OpenBSD: uts.c,v 1.3 2007/04/10 22:37:17 miod Exp $ */
/*
* Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
@@ -395,7 +395,7 @@ uts_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
return;
}
- wsmouse_input(sc->sc_wsmousedev, tp.z, tp.x, tp.y, 0,
+ wsmouse_input(sc->sc_wsmousedev, tp.z, tp.x, tp.y, 0, 0,
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
WSMOUSE_INPUT_ABSOLUTE_Z);
sc->sc_oldy = tp.y;
diff --git a/sys/dev/wscons/wsconsio.h b/sys/dev/wscons/wsconsio.h
index 73ffb75dc3b..1bf7ad94f7b 100644
--- a/sys/dev/wscons/wsconsio.h
+++ b/sys/dev/wscons/wsconsio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsio.h,v 1.43 2006/11/27 18:04:28 gwk Exp $ */
+/* $OpenBSD: wsconsio.h,v 1.44 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */
/*
@@ -76,6 +76,9 @@ struct wscons_event {
#define WSCONS_EVENT_MOUSE_ABSOLUTE_Y 9 /* Y location */
#define WSCONS_EVENT_MOUSE_DELTA_Z 10 /* Z delta amount */
#define WSCONS_EVENT_MOUSE_ABSOLUTE_Z 11 /* Z location */
+ /* 12-15, see below */
+#define WSCONS_EVENT_MOUSE_DELTA_W 16 /* W delta amount */
+#define WSCONS_EVENT_MOUSE_ABSOLUTE_W 17 /* W location */
/*
* Following events are not real wscons_event but are used as parameters of the
* WSDISPLAYIO_WSMOUSED ioctl
@@ -88,7 +91,8 @@ struct wscons_event {
#define IS_MOTION_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_DELTA_X) || \
((type) == WSCONS_EVENT_MOUSE_DELTA_Y) || \
- ((type) == WSCONS_EVENT_MOUSE_DELTA_Z))
+ ((type) == WSCONS_EVENT_MOUSE_DELTA_Z) || \
+ ((type) == WSCONS_EVENT_MOUSE_DELTA_W))
#define IS_BUTTON_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_UP) || \
((type) == WSCONS_EVENT_MOUSE_DOWN))
#define IS_CTRL_EVENT(type) ((type == WSCONS_EVENT_WSMOUSED_ON) || \
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index c2d8fcf81bb..f8a8fff7d2c 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.79 2007/04/10 17:47:55 miod Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.80 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -3283,7 +3283,7 @@ wsmoused_release(struct wsdisplay_softc *sc)
/* inject event to notify wsmoused(8) to close mouse device */
if (wsms_dev != NULL)
- wsmouse_input(wsms_dev, 0, 0, 0, 0,
+ wsmouse_input(wsms_dev, 0, 0, 0, 0, 0,
WSMOUSE_INPUT_WSMOUSED_CLOSE);
}
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index 14c7a321dcb..bf3c483e71e 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmouse.c,v 1.18 2006/11/01 03:37:24 tedu Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.19 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -117,6 +117,7 @@ extern int wsmuxdebug;
#define INVALID_X INT_MAX
#define INVALID_Y INT_MAX
#define INVALID_Z INT_MAX
+#define INVALID_W INT_MAX
struct wsmouse_softc {
struct wsevsrc sc_base;
@@ -129,9 +130,11 @@ struct wsmouse_softc {
int sc_dx; /* delta-x */
int sc_dy; /* delta-y */
int sc_dz; /* delta-z */
+ int sc_dw; /* delta-w */
int sc_x; /* absolute-x */
int sc_y; /* absolute-y */
int sc_z; /* absolute-z */
+ int sc_w; /* absolute-w */
int sc_refcnt;
u_char sc_dying; /* device is being detached */
@@ -285,14 +288,14 @@ wsmouse_detach(struct device *self, int flags)
void
wsmouse_input(struct device *wsmousedev, u_int btns, /* 0 is up */
- int x, int y, int z, u_int flags)
+ int x, int y, int z, int w, u_int flags)
{
struct wsmouse_softc *sc = (struct wsmouse_softc *)wsmousedev;
struct wscons_event *ev;
struct wseventvar *evar;
int mb, ub, d, get, put, any;
- add_mouse_randomness(x ^ y ^ z ^ btns);
+ add_mouse_randomness(x ^ y ^ z ^ w ^ btns);
/*
* Discard input if not ready.
@@ -320,6 +323,8 @@ wsmouse_input(struct device *wsmousedev, u_int btns, /* 0 is up */
sc->sc_dy += y;
if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Z))
sc->sc_dz += z;
+ if (!(flags & WSMOUSE_INPUT_ABSOLUTE_W))
+ sc->sc_dw += w;
/*
* We have at least one event (mouse button, delta-X, or
@@ -411,6 +416,25 @@ wsmouse_input(struct device *wsmousedev, u_int btns, /* 0 is up */
sc->sc_dz = 0;
}
}
+ if (flags & WSMOUSE_INPUT_ABSOLUTE_W) {
+ if (sc->sc_w != w) {
+ NEXT;
+ ev->type = WSCONS_EVENT_MOUSE_ABSOLUTE_W;
+ ev->value = w;
+ TIMESTAMP;
+ ADVANCE;
+ sc->sc_w = w;
+ }
+ } else {
+ if (sc->sc_dw) {
+ NEXT;
+ ev->type = WSCONS_EVENT_MOUSE_DELTA_W;
+ ev->value = sc->sc_dw;
+ TIMESTAMP;
+ ADVANCE;
+ sc->sc_dw = 0;
+ }
+ }
mb = sc->sc_mb;
while ((d = mb ^ ub) != 0) {
@@ -527,6 +551,7 @@ wsmousedoopen(struct wsmouse_softc *sc, struct wseventvar *evp)
sc->sc_x = INVALID_X;
sc->sc_y = INVALID_Y;
sc->sc_z = INVALID_Z;
+ sc->sc_w = INVALID_W;
/* enable the device, and punt if that's not possible */
return (*sc->sc_accessops->enable)(sc->sc_accesscookie);
diff --git a/sys/dev/wscons/wsmousevar.h b/sys/dev/wscons/wsmousevar.h
index cc20831bb11..99e83e9db20 100644
--- a/sys/dev/wscons/wsmousevar.h
+++ b/sys/dev/wscons/wsmousevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmousevar.h,v 1.4 2002/03/27 18:54:09 jbm Exp $ */
+/* $OpenBSD: wsmousevar.h,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/* $NetBSD: wsmousevar.h,v 1.4 2000/01/08 02:57:24 takemura Exp $ */
/*
@@ -71,8 +71,9 @@ int wsmousedevprint(void *, const char *);
#define WSMOUSE_INPUT_ABSOLUTE_X (1<<0)
#define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1)
#define WSMOUSE_INPUT_ABSOLUTE_Z (1<<2)
+#define WSMOUSE_INPUT_ABSOLUTE_W (1<<4)
#define WSMOUSE_INPUT_WSMOUSED_CLOSE (1<<3) /* notify wsmoused(8) to close
mouse device */
void wsmouse_input(struct device *kbddev, u_int btns,
- int x, int y, int z, u_int flags);
+ int x, int y, int z, int w, u_int flags);