summaryrefslogtreecommitdiff
path: root/sys/dev/bluetooth
diff options
context:
space:
mode:
authorplunky <plunky@NetBSD.org>2006-10-31 19:17:04 +0000
committerplunky <plunky@NetBSD.org>2006-10-31 19:17:04 +0000
commite500250b1782ffcb89a4d7db07ce2d542ade39f0 (patch)
tree1ee2c455e15917d32b0956b26e707e4e51b187e3 /sys/dev/bluetooth
parent162befcdae80b1824b0f621c3d561c865534c0fc (diff)
enable 'Application Control Pan' in Consumer usage group as an equivalent
to the Z direction since some mice (Apple Mighty Mouse) provide horizontal scrolling direction with that report.
Diffstat (limited to 'sys/dev/bluetooth')
-rw-r--r--sys/dev/bluetooth/btms.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/sys/dev/bluetooth/btms.c b/sys/dev/bluetooth/btms.c
index 563d8235470..ae9213daf49 100644
--- a/sys/dev/bluetooth/btms.c
+++ b/sys/dev/bluetooth/btms.c
@@ -1,4 +1,4 @@
-/* $NetBSD: btms.c,v 1.2 2006/10/12 01:30:55 christos Exp $ */
+/* $NetBSD: btms.c,v 1.3 2006/10/31 19:17:04 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btms.c,v 1.2 2006/10/12 01:30:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btms.c,v 1.3 2006/10/31 19:17:04 plunky Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -81,6 +81,7 @@ struct btms_softc {
/* sc_flags */
#define BTMS_REVZ (1 << 0) /* reverse Z direction */
#define BTMS_HASZ (1 << 1) /* has Z direction */
+#define BTMS_HASW (1 << 2) /* has W direction */
/* autoconf(9) methods */
static int btms_match(struct device *, struct cfdata *, void *);
@@ -200,11 +201,30 @@ btms_attach(struct device *parent __unused, struct device *self, void *aux)
zloc,
&flags);
+ /*
+ * The horizontal component of the scrollball can also be given by
+ * Application Control Pan in the Consumer page, so if we didnt see
+ * any Z then check that.
+ */
+ if (!hl) {
+ hl = hid_locate(ba->ba_desc,
+ ba->ba_dlen,
+ HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN),
+ ba->ba_id,
+ hid_input,
+ zloc,
+ &flags);
+ }
+
if (hl) {
if (NOTMOUSE(flags))
zloc->size = 0; /* ignore Z */
- else
- sc->sc_flags |= BTMS_HASZ;
+ else {
+ if (sc->sc_flags & BTMS_HASZ)
+ sc->sc_flags |= BTMS_HASW;
+ else
+ sc->sc_flags |= BTMS_HASZ;
+ }
}
for (i = 1 ; i <= MAX_BUTTONS ; i++) {
@@ -221,10 +241,12 @@ btms_attach(struct device *parent __unused, struct device *self, void *aux)
}
sc->sc_num_buttons = i - 1;
- aprint_normal(": %d button%s%s.\n",
+ aprint_normal(": %d button%s%s%s%s.\n",
sc->sc_num_buttons,
sc->sc_num_buttons == 1 ? "" : "s",
- sc->sc_flags & BTMS_HASZ ? " and Z dir" : "");
+ sc->sc_flags & BTMS_HASW ? ", W" : "",
+ sc->sc_flags & BTMS_HASZ ? " and Z dir" : "",
+ sc->sc_flags & BTMS_HASW ? "s" : "");
wsma.accessops = &btms_wsmouse_accessops;
wsma.accesscookie = sc;