diff options
-rw-r--r-- | sys/arch/hp300/dev/dnkbd.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/lms.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/mms.c | 4 | ||||
-rw-r--r-- | sys/arch/luna88k/dev/lunaws.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/dev/tpms.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/dec/vsms_ws.c | 4 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zts.c | 5 | ||||
-rw-r--r-- | sys/dev/adb/ams.c | 4 | ||||
-rw-r--r-- | sys/dev/hil/hilms.c | 4 | ||||
-rw-r--r-- | sys/dev/pckbc/psm.c | 4 | ||||
-rw-r--r-- | sys/dev/pckbc/psm_intelli.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/ums.c | 61 | ||||
-rw-r--r-- | sys/dev/usb/uts.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsconsio.h | 8 | ||||
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsmouse.c | 31 | ||||
-rw-r--r-- | sys/dev/wscons/wsmousevar.h | 5 | ||||
-rw-r--r-- | usr.sbin/wsmoused/mouse_protocols.c | 13 | ||||
-rw-r--r-- | usr.sbin/wsmoused/mouse_protocols.h | 3 | ||||
-rw-r--r-- | usr.sbin/wsmoused/wsmoused.c | 7 |
20 files changed, 122 insertions, 60 deletions
diff --git a/sys/arch/hp300/dev/dnkbd.c b/sys/arch/hp300/dev/dnkbd.c index 28902ad8220..f5931ac1529 100644 --- a/sys/arch/hp300/dev/dnkbd.c +++ b/sys/arch/hp300/dev/dnkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dnkbd.c,v 1.14 2007/01/07 15:12:50 miod Exp $ */ +/* $OpenBSD: dnkbd.c,v 1.15 2007/04/10 22:37:14 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -734,7 +734,7 @@ dnevent_mouse(struct dnkbd_softc *sc, u_int8_t *dat) wsmouse_input(sc->sc_wsmousedev, (~dat[0] & (DNBUTTON_L | DNBUTTON_M | DNBUTTON_R)) >> 4, - (int8_t)dat[1], (int8_t)dat[2], 0, WSMOUSE_INPUT_DELTA); + (int8_t)dat[1], (int8_t)dat[2], 0, 0, WSMOUSE_INPUT_DELTA); } #endif diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index 4930a51a641..eb2dc1f3259 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lms.c,v 1.19 2006/09/19 11:06:34 jsg Exp $ */ +/* $OpenBSD: lms.c,v 1.20 2007/04/10 22:37:17 miod Exp $ */ /* $NetBSD: lms.c,v 1.38 2000/01/08 02:57:25 takemura Exp $ */ /*- @@ -236,7 +236,7 @@ lmsintr(void *arg) if (dx || dy || changed) wsmouse_input(sc->sc_wsmousedev, - buttons, dx, dy, 0, WSMOUSE_INPUT_DELTA); + buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA); return -1; } diff --git a/sys/arch/i386/isa/mms.c b/sys/arch/i386/isa/mms.c index 0e517cb0745..977978a3ae3 100644 --- a/sys/arch/i386/isa/mms.c +++ b/sys/arch/i386/isa/mms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mms.c,v 1.18 2006/09/19 11:06:34 jsg Exp $ */ +/* $OpenBSD: mms.c,v 1.19 2007/04/10 22:37:17 miod Exp $ */ /* $NetBSD: mms.c,v 1.35 2000/01/08 02:57:25 takemura Exp $ */ /*- @@ -230,7 +230,7 @@ mmsintr(void *arg) if (dx || dy || changed) wsmouse_input(sc->sc_wsmousedev, - buttons, dx, dy, 0, WSMOUSE_INPUT_DELTA); + buttons, dx, dy, 0, 0, WSMOUSE_INPUT_DELTA); return -1; } diff --git a/sys/arch/luna88k/dev/lunaws.c b/sys/arch/luna88k/dev/lunaws.c index 1b657542e15..af0e644fcc2 100644 --- a/sys/arch/luna88k/dev/lunaws.c +++ b/sys/arch/luna88k/dev/lunaws.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lunaws.c,v 1.4 2006/08/12 21:10:03 miod Exp $ */ +/* $OpenBSD: lunaws.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */ /* $NetBSD: lunaws.c,v 1.6 2002/03/17 19:40:42 atatat Exp $ */ /*- @@ -271,7 +271,8 @@ wsintr(chan) sc->dy = (signed char)code; if (sc->sc_wsmousedev != NULL) wsmouse_input(sc->sc_wsmousedev, - sc->buttons, sc->dx, sc->dy, 0, 0); + sc->buttons, sc->dx, sc->dy, 0, 0, + WSMOUSE_INPUT_DELTA); sc->sc_msreport = 0; } #else diff --git a/sys/arch/macppc/dev/tpms.c b/sys/arch/macppc/dev/tpms.c index fd115c6789a..e67d7a397e0 100644 --- a/sys/arch/macppc/dev/tpms.c +++ b/sys/arch/macppc/dev/tpms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tpms.c,v 1.4 2006/03/16 06:57:23 miod Exp $ */ +/* $OpenBSD: tpms.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */ /* * Copyright (c) 2005, Johan Wallén @@ -503,7 +503,7 @@ tpms_intr(struct uhidev *addr, void *ibuf, unsigned int len) if ((dx != 0 || dy != 0 || dz != 0 || buttons != sc->sc_buttons) && sc->sc_wsmousedev != NULL) { s = spltty(); - wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, dz, + wsmouse_input(sc->sc_wsmousedev, buttons, dx, -dy, dz, 0, WSMOUSE_INPUT_DELTA); splx(s); } diff --git a/sys/arch/vax/dec/vsms_ws.c b/sys/arch/vax/dec/vsms_ws.c index bb9464a456e..ea26e938a08 100644 --- a/sys/arch/vax/dec/vsms_ws.c +++ b/sys/arch/vax/dec/vsms_ws.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsms_ws.c,v 1.1 2006/08/27 16:52:15 miod Exp $ */ +/* $OpenBSD: vsms_ws.c,v 1.2 2007/04/10 22:37:17 miod Exp $ */ /* $NetBSD: dzms.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */ /* @@ -127,7 +127,7 @@ lkms_input(void *vsc, int data) else sc->dy = data; wsmouse_input(sc->sc_wsmousedev, sc->buttons, - sc->dx, sc->dy, 0, WSMOUSE_INPUT_DELTA); + sc->dx, sc->dy, 0, 0, WSMOUSE_INPUT_DELTA); } return (1); diff --git a/sys/arch/zaurus/dev/zts.c b/sys/arch/zaurus/dev/zts.c index d816fcb11bb..60b96acef80 100644 --- a/sys/arch/zaurus/dev/zts.c +++ b/sys/arch/zaurus/dev/zts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zts.c,v 1.9 2005/04/24 18:55:49 uwe Exp $ */ +/* $OpenBSD: zts.c,v 1.10 2007/04/10 22:37:17 miod Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -542,7 +542,8 @@ zts_irq(void *v) } if (down || sc->sc_buttons != down) { - wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y, 0 /* z */, + wsmouse_input(sc->sc_wsmousedev, down, tp.x, tp.y, + 0 /* z */, 0 /* w */, WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | WSMOUSE_INPUT_ABSOLUTE_Z); sc->sc_buttons = down; 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); diff --git a/usr.sbin/wsmoused/mouse_protocols.c b/usr.sbin/wsmoused/mouse_protocols.c index ca0a3061afb..b0da3878070 100644 --- a/usr.sbin/wsmoused/mouse_protocols.c +++ b/usr.sbin/wsmoused/mouse_protocols.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mouse_protocols.c,v 1.11 2006/04/17 08:42:41 deraadt Exp $ */ +/* $OpenBSD: mouse_protocols.c,v 1.12 2007/04/10 22:37:17 miod Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -985,15 +985,15 @@ mouse_protocol(u_char rBuf, mousestatus_t * act) break; default: - act->dx = act->dy = act->dz = 0; + act->dx = act->dy = act->dz = act->dw = 0; act->obutton = act->button; act->button = butmapmss2[(rBuf & MOUSE_MSS_BUTTONS) >> 4] | (act->obutton & (MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN)); break; } - act->flags = ((act->dx || act->dy || act->dz) ? MOUSE_POSCHANGED : 0) - | (act->obutton ^ act->button); + act->flags = ((act->dx || act->dy || act->dz || act->dw) ? + MOUSE_POSCHANGED : 0) | (act->obutton ^ act->button); pBufP = 0; return act->flags; } @@ -1013,6 +1013,7 @@ mouse_protocol(u_char rBuf, mousestatus_t * act) pBuf[4], pBuf[5], pBuf[6], pBuf[7]); act->dz = 0; + act->dw = 0; act->obutton = act->button; switch (mouse.proto) { case P_MS: /* Microsoft */ @@ -1060,7 +1061,7 @@ mouse_protocol(u_char rBuf, mousestatus_t * act) * byte in some protocols. See above. */ /* has something changed? */ - act->flags = ((act->dx || act->dy || act->dz) ? MOUSE_POSCHANGED : 0) | - (act->obutton ^ act->button); + act->flags = ((act->dx || act->dy || act->dz || act->dw) ? + MOUSE_POSCHANGED : 0) | (act->obutton ^ act->button); return act->flags; } diff --git a/usr.sbin/wsmoused/mouse_protocols.h b/usr.sbin/wsmoused/mouse_protocols.h index f14f55bee20..14a2ab64451 100644 --- a/usr.sbin/wsmoused/mouse_protocols.h +++ b/usr.sbin/wsmoused/mouse_protocols.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mouse_protocols.h,v 1.4 2003/11/08 19:17:30 jmc Exp $ */ +/* $OpenBSD: mouse_protocols.h,v 1.5 2007/04/10 22:37:17 miod Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -193,6 +193,7 @@ typedef struct mousestatus { int dx; /* x movement */ int dy; /* y movement */ int dz; /* z movement */ + int dw; /* w movement */ } mousestatus_t; /* Prototypes */ diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c index 760c64b282b..a468b986ce4 100644 --- a/usr.sbin/wsmoused/wsmoused.c +++ b/usr.sbin/wsmoused/wsmoused.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.c,v 1.20 2006/04/17 08:42:41 deraadt Exp $ */ +/* $OpenBSD: wsmoused.c,v 1.21 2007/04/10 22:37:17 miod Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -357,6 +357,11 @@ split_event(mousestatus_t *act) event.value = act->dz; treat_event(&event); } + if (act->dw != 0) { + event.type = WSCONS_EVENT_MOUSE_DELTA_W; + event.value = act->dw; + treat_event(&event); + } /* buttons state */ mask = act->flags & MOUSE_BUTTONS; |