summaryrefslogtreecommitdiff
path: root/sys/dev/i2c
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2017-08-31 19:55:43 +0000
committerjmcneill <jmcneill@NetBSD.org>2017-08-31 19:55:43 +0000
commitd501ef6503e1011756d696fe003d37eff154ef55 (patch)
tree223c0be7cfd3915680ddda4b4a0ba976f338f832 /sys/dev/i2c
parent13936b019825eadd3e6ba29ab632b7f20164f2df (diff)
Instead of a Linux keymap, convert Linux event codes to USB scan codes and
use the ukbd keymaps instead.
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r--sys/dev/i2c/files.i2c4
-rw-r--r--sys/dev/i2c/tcakp.c19
2 files changed, 8 insertions, 15 deletions
diff --git a/sys/dev/i2c/files.i2c b/sys/dev/i2c/files.i2c
index 52ba1178ffb..00dd5fb6ecd 100644
--- a/sys/dev/i2c/files.i2c
+++ b/sys/dev/i2c/files.i2c
@@ -1,4 +1,4 @@
-# $NetBSD: files.i2c,v 1.74 2017/08/26 21:02:35 jmcneill Exp $
+# $NetBSD: files.i2c,v 1.75 2017/08/31 19:55:43 jmcneill Exp $
obsolete defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
@@ -264,6 +264,6 @@ attach as3722reg at as3722pmic
file dev/i2c/as3722.c as3722pmic needs-flag
# Texas Instruments TCA8418 Keypad Scan IC
-device tcakp: wskbddev
+device tcakp: wskbddev, linux_keymap
attach tcakp at iic
file dev/i2c/tcakp.c tcakp
diff --git a/sys/dev/i2c/tcakp.c b/sys/dev/i2c/tcakp.c
index e9bebe17848..b2da262f229 100644
--- a/sys/dev/i2c/tcakp.c
+++ b/sys/dev/i2c/tcakp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcakp.c,v 1.3 2017/08/30 00:40:09 jmcneill Exp $ */
+/* $NetBSD: tcakp.c,v 1.4 2017/08/31 19:55:43 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@@ -29,7 +29,7 @@
#include "opt_fdt.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcakp.c,v 1.3 2017/08/30 00:40:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcakp.c,v 1.4 2017/08/31 19:55:43 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,14 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcakp.c,v 1.3 2017/08/30 00:40:09 jmcneill Exp $");
#define TCA_DEBOUNCE_DIS2 0x2a
#define TCA_DEBOUNCE_DIS3 0x2b
-#ifdef FDT
-#define KC(n) KS_KEYCODE(n)
-static const keysym_t tcakp_linux_event_keydesc[] = {
- KC(1),
-};
-#undef KC
-#endif
-
struct tcakp_softc {
device_t sc_dev;
i2c_tag_t sc_i2c;
@@ -160,7 +152,7 @@ tcakp_intr(void *priv)
u_int type = pressed ? WSCONS_EVENT_KEY_DOWN :
WSCONS_EVENT_KEY_UP;
- int key = sc->sc_keymap[index];
+ int key = linux_key_to_usb(sc->sc_keymap[index]);
if (sc->sc_wskbddev)
wskbd_input(sc->sc_wskbddev, type, key);
@@ -264,7 +256,7 @@ tcakp_ioctl(void *v, u_long cmd, void *data, int flag, lwp_t *l)
{
switch (cmd) {
case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_TCAKP;
+ *(int *)data = WSKBD_TYPE_USB;
return 0;
}
@@ -314,8 +306,9 @@ static const struct wskbd_consops tcakp_consops = {
};
#endif
+extern const struct wscons_keydesc ukbd_keydesctab[];
static const struct wskbd_mapdata tcakp_keymapdata = {
- linux_keymap_keydesctab,
+ ukbd_keydesctab,
KB_US,
};