Add support for USB HID devices that report absolute coordinates instead
of relative movement data, i.e. touchpanels. Please note that calibration must be done outside the wsons(4) driver for now.
This commit is contained in:
parent
3f18fe8123
commit
8a44b5e050
@ -1,4 +1,4 @@
|
||||
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1320 $>
|
||||
# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1321 $>
|
||||
#
|
||||
#
|
||||
# [Note: This file does not mention every change made to the NetBSD source tree.
|
||||
@ -485,3 +485,4 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
|
||||
rump: Load rump virtual kernel symbol table at boot. This enables
|
||||
the use of the kernel linker in a rump kernel.
|
||||
[pooka 20091126]
|
||||
ums(4): Added touchpanel support. [mbalmer 20091127]
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ums.4,v 1.8 2008/04/30 13:10:54 martin Exp $
|
||||
.\" $NetBSD: ums.4,v 1.9 2009/11/27 08:35:05 mbalmer Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -27,20 +27,20 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 12, 1998
|
||||
.Dd November 27, 2009
|
||||
.Dt UMS 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ums
|
||||
.Nd USB mouse support
|
||||
.Nd USB mouse and touchpanel support
|
||||
.Sh SYNOPSIS
|
||||
.Cd "ums* at uhidev? reportid ?"
|
||||
.Cd "wsmouse* at ums?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for USB mice.
|
||||
Access to the mouse is through the
|
||||
driver provides support for USB mice and touchpanels.
|
||||
Access to the movement data is through the
|
||||
.Xr wscons 4
|
||||
driver.
|
||||
.Sh SEE ALSO
|
||||
@ -53,3 +53,5 @@ The
|
||||
driver
|
||||
appeared in
|
||||
.Nx 1.4 .
|
||||
Touchpanel support was added in
|
||||
.Nx 5.1 .
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ums.c,v 1.76 2009/11/12 19:58:27 dyoung Exp $ */
|
||||
/* $NetBSD: ums.c,v 1.77 2009/11/27 08:35:05 mbalmer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.76 2009/11/12 19:58:27 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.77 2009/11/27 08:35:05 mbalmer Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -95,6 +95,7 @@ struct ums_softc {
|
||||
#define UMS_SPUR_BUT_UP 0x02 /* spurious button up events */
|
||||
#define UMS_REVZ 0x04 /* Z-axis is reversed */
|
||||
#define UMS_W 0x08 /* w direction/tilt available */
|
||||
#define UMS_ABS 0x10 /* absolute position, touchpanel */
|
||||
|
||||
int nbuttons;
|
||||
|
||||
@ -105,7 +106,6 @@ struct ums_softc {
|
||||
};
|
||||
|
||||
#define MOUSE_FLAGS_MASK (HIO_CONST|HIO_RELATIVE)
|
||||
#define MOUSE_FLAGS (HIO_RELATIVE)
|
||||
|
||||
Static void ums_intr(struct uhidev *addr, void *ibuf, u_int len);
|
||||
|
||||
@ -180,7 +180,13 @@ ums_attach(device_t parent, device_t self, void *aux)
|
||||
USBDEVNAME(sc->sc_hdev.sc_dev));
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
}
|
||||
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
|
||||
switch (flags & MOUSE_FLAGS_MASK) {
|
||||
case 0:
|
||||
sc->flags |= UMS_ABS;
|
||||
break;
|
||||
case HIO_RELATIVE:
|
||||
break;
|
||||
default:
|
||||
aprint_error("\n%s: X report 0x%04x not supported\n",
|
||||
USBDEVNAME(sc->sc_hdev.sc_dev), flags);
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
@ -192,7 +198,13 @@ ums_attach(device_t parent, device_t self, void *aux)
|
||||
USBDEVNAME(sc->sc_hdev.sc_dev));
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
}
|
||||
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
|
||||
switch (flags & MOUSE_FLAGS_MASK) {
|
||||
case 0:
|
||||
sc->flags |= UMS_ABS;
|
||||
break;
|
||||
case HIO_RELATIVE:
|
||||
break;
|
||||
default:
|
||||
aprint_error("\n%s: Y report 0x%04x not supported\n",
|
||||
USBDEVNAME(sc->sc_hdev.sc_dev), flags);
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
@ -209,7 +221,7 @@ ums_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
zloc = &sc->sc_loc_z;
|
||||
if (hl) {
|
||||
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
|
||||
if ((flags & MOUSE_FLAGS_MASK) != HIO_RELATIVE) {
|
||||
aprint_verbose("\n%s: Wheel report 0x%04x not "
|
||||
"supported\n", USBDEVNAME(sc->sc_hdev.sc_dev),
|
||||
flags);
|
||||
@ -247,7 +259,7 @@ ums_attach(device_t parent, device_t self, void *aux)
|
||||
}
|
||||
|
||||
if (hl) {
|
||||
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
|
||||
if ((flags & MOUSE_FLAGS_MASK) != HIO_RELATIVE) {
|
||||
aprint_verbose("\n%s: Z report 0x%04x not supported\n",
|
||||
USBDEVNAME(sc->sc_hdev.sc_dev), flags);
|
||||
zloc->size = 0; /* Bad Z coord, ignore it */
|
||||
@ -362,15 +374,21 @@ ums_intr(struct uhidev *addr, void *ibuf, u_int len)
|
||||
struct ums_softc *sc = (struct ums_softc *)addr;
|
||||
int dx, dy, dz, dw;
|
||||
u_int32_t buttons = 0;
|
||||
int i;
|
||||
int s;
|
||||
int i, flags, s;
|
||||
|
||||
DPRINTFN(5,("ums_intr: len=%d\n", len));
|
||||
|
||||
flags = WSMOUSE_INPUT_DELTA; /* equals 0 */
|
||||
|
||||
dx = hid_get_data(ibuf, &sc->sc_loc_x);
|
||||
dy = -hid_get_data(ibuf, &sc->sc_loc_y);
|
||||
if (sc->flags & UMS_ABS) {
|
||||
flags |= (WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y);
|
||||
dy = hid_get_data(ibuf, &sc->sc_loc_y);
|
||||
} else
|
||||
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++)
|
||||
@ -384,10 +402,8 @@ ums_intr(struct uhidev *addr, void *ibuf, u_int len)
|
||||
sc->sc_buttons = buttons;
|
||||
if (sc->sc_wsmousedev != NULL) {
|
||||
s = spltty();
|
||||
wsmouse_input(sc->sc_wsmousedev,
|
||||
buttons,
|
||||
dx, dy, dz, dw,
|
||||
WSMOUSE_INPUT_DELTA);
|
||||
wsmouse_input(sc->sc_wsmousedev, buttons, dx, dy, dz,
|
||||
dw, flags);
|
||||
splx(s);
|
||||
}
|
||||
}
|
||||
@ -434,9 +450,14 @@ ums_ioctl(void *v, u_long cmd, void *data, int flag,
|
||||
struct lwp * p)
|
||||
|
||||
{
|
||||
struct ums_softc *sc = v;
|
||||
|
||||
switch (cmd) {
|
||||
case WSMOUSEIO_GTYPE:
|
||||
*(u_int *)data = WSMOUSE_TYPE_USB;
|
||||
if (sc->flags & UMS_ABS)
|
||||
*(u_int *)data = WSMOUSE_TYPE_TPANEL;
|
||||
else
|
||||
*(u_int *)data = WSMOUSE_TYPE_USB;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user