Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pckbport Modify driver to use bits(3) to extract cap...
details: https://anonhg.NetBSD.org/src/rev/3ac1ca6d5fd6
branches: trunk
changeset: 450666:3ac1ca6d5fd6
user: blymn <blymn%NetBSD.org@localhost>
date: Mon Apr 22 00:53:59 2019 +0000
description:
Modify driver to use bits(3) to extract capabilities. Thanks to
Anon Ymous for the fix.
diffstat:
sys/dev/pckbport/synaptics.c | 19 +++++++++++--------
sys/dev/pckbport/synapticsreg.h | 27 +++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 10 deletions(-)
diffs (114 lines):
diff -r 6393d6d0ea7e -r 3ac1ca6d5fd6 sys/dev/pckbport/synaptics.c
--- a/sys/dev/pckbport/synaptics.c Sun Apr 21 22:32:12 2019 +0000
+++ b/sys/dev/pckbport/synaptics.c Mon Apr 22 00:53:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: synaptics.c,v 1.47 2019/04/21 02:40:35 blymn Exp $ */
+/* $NetBSD: synaptics.c,v 1.48 2019/04/22 00:53:59 blymn Exp $ */
/*
* Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
#include "opt_pms.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.47 2019/04/21 02:40:35 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.48 2019/04/22 00:53:59 blymn Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -302,20 +302,23 @@
* 1 0x20 report min query 0x0f gives min coord reported
*/
if (res == 0) {
- u_char clickpad_type = (resp[0] & 0x10);
- clickpad_type |= (resp[1] & 0x01);
+ uint val = SYN_CCAP_VALUE(resp);
aprint_debug_dev(psc->sc_dev, "%s: Continued "
"Capabilities 0x%02x 0x%02x 0x%02x.\n", __func__,
resp[0], resp[1], resp[2]);
- switch (clickpad_type) {
- case 0x10:
+ switch (SYN_CCAP_CLICKPAD_TYPE(val)) {
+ case 0: /* not a clickpad */
+ break;
+ case 1:
sc->flags |= SYN_FLAG_HAS_ONE_BUTTON_CLICKPAD;
break;
- case 0x01:
+ case 2:
sc->flags |= SYN_FLAG_HAS_TWO_BUTTON_CLICKPAD;
break;
+ case 3: /* reserved */
default:
+ /* unreached */
break;
}
}
@@ -395,7 +398,7 @@
goto doreset;
}
- sc->caps = (resp[0] << 8) | resp[2];
+ sc->caps = SYNAPTICS_CAP_VALUE(resp);
if (sc->caps & SYNAPTICS_CAP_MBUTTON)
sc->flags |= SYN_FLAG_HAS_MIDDLE_BUTTON;
diff -r 6393d6d0ea7e -r 3ac1ca6d5fd6 sys/dev/pckbport/synapticsreg.h
--- a/sys/dev/pckbport/synapticsreg.h Sun Apr 21 22:32:12 2019 +0000
+++ b/sys/dev/pckbport/synapticsreg.h Mon Apr 22 00:53:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: synapticsreg.h,v 1.10 2018/07/14 00:47:33 maya Exp $ */
+/* $NetBSD: synapticsreg.h,v 1.11 2019/04/22 00:53:59 blymn Exp $ */
/*
* Copyright (c) 2005, Steve C. Woodford
@@ -56,16 +56,39 @@
#define SYNAPTICS_MAGIC_BYTE 0x47
/* Capability bits. */
+/* (byte[0] << 8) | byte[2] */
+#define SYNAPTICS_CAP_VALUE(b) (((b)[0] << 8) | (b)[2])
#define SYNAPTICS_CAP_EXTENDED (1 << 15)
#define SYNAPTICS_CAP_EXTNUM (1 << 14 | 1 << 13 | 1 << 12)
#define SYNAPTICS_CAP_MBUTTON (1 << 10)
#define SYNAPTICS_CAP_PASSTHROUGH (1 << 7)
+#define SYNAPTICS_CAP_LOWPOWER (1 << 6)
#define SYNAPTICS_CAP_MULTIFINGERREPORT (1 << 5)
#define SYNAPTICS_CAP_SLEEP (1 << 4)
#define SYNAPTICS_CAP_4BUTTON (1 << 3)
#define SYNAPTICS_CAP_MULTIDETECT (1 << 1)
#define SYNAPTICS_CAP_PALMDETECT (1 << 0)
+/* Continued Capability bits */
+/* (byte[0] << 8) | byte[1] */
+#define SYN_CCAP_VALUE(b) (((b)[0] << 8) | (b)[1])
+#define SYN_CCAP_COVERED_PAD __BIT(15)
+#define SYN_CCAP_MULTIFINGER_MODE __BITS(13,14)
+#define SYN_CCAP_CLICKPAD_BIT_0 __BIT(12) /* one-button clickpad */
+#define SYN_CCAP_HAS_ADV_GESTURE_MODE __BIT(11)
+#define SYN_CCAP_CLEARPAD __BIT(10)
+#define SYN_CCAP_REPORT_MAX __BIT(9)
+#define SYN_CCAP_ADJ_THRESHOLD __BIT(8)
+#define SYN_CCAP_REPORT_MIN __BIT(5)
+#define SYN_CCAP_UNIFORM_CLICKPAD __BIT(4)
+#define SYN_CCAP_IMAGE_SENSOR __BIT(3) /* reports V */
+#define SYN_CCAP_REDUCED_FILTERING __BIT(2)
+#define SYN_CCAP_DELUX_LED_CONTROLS __BIT(1)
+#define SYN_CCAP_CLICKPAD_BIT_1 __BIT(0) /* two-button clickpad */
+#define SYN_CCAP_CLICKPAD_TYPE(v) \
+ ((__SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_1) << 1) | \
+ __SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_0))
+
/* Mode bits. */
#define SYNAPTICS_MODE_ABSOLUTE (1 << 7)
#define SYNAPTICS_MODE_RATE (1 << 6)
@@ -73,7 +96,7 @@
#define SYNAPTICS_MODE_EXTENDED_W (1 << 2) /* double meaning */
#define SYNAPTICS_MODE_GEST (1 << 2)
#define SYNAPTICS_MODE_4BYTE_CLIENT (1 << 1)
-#define SYNAPTICS_MODE_W (1)
+#define SYNAPTICS_MODE_W (1 << 0)
/* Extended mode button masks. */
#define SYN_1BUTMASK 0x1
Home |
Main Index |
Thread Index |
Old Index