CVS commit: src/sys/dev/adb

2022-05-13 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sat May 14 01:16:55 UTC 2022

Modified Files:
src/sys/dev/adb: adb_kbd.c adb_keymap.h adb_usb_map.c

Log Message:
Add ISO and JIS keyboard layouts for ADB to USB emulation

The layout is configurable using sysctl machdep.adbkbdX.emulate_usb:
0 = no emulation
1 = ANSI
2 = ISO (new with this change)
3 = JIS (new with this change)

Default value is detected using the ADB keyboard handler id. JIS
default is disabled until it is tested.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/adb/adb_usb_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.32 src/sys/dev/adb/adb_kbd.c:1.33
--- src/sys/dev/adb/adb_kbd.c:1.32	Sat Aug  7 16:19:09 2021
+++ src/sys/dev/adb/adb_kbd.c	Sat May 14 01:16:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.32 2021/08/07 16:19:09 thorpej Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.33 2022/05/14 01:16:55 manu Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.32 2021/08/07 16:19:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.33 2022/05/14 01:16:55 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -93,7 +93,7 @@ struct adbkbd_softc {
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	int sc_rawkbd;
 #endif
-	bool sc_emul_usb;
+	int sc_emul_usb;
 	bool sc_power_dbg;
 
 	uint32_t sc_power;
@@ -235,7 +235,7 @@ adbkbd_attach(device_t parent, device_t 
 	 */
 	sc->sc_power = 0x;
 	sc->sc_timestamp = 0;
-	sc->sc_emul_usb = FALSE;
+	sc->sc_emul_usb = ADB_EMUL_USB_NONE;
 #ifdef ADBKBD_POWER_DDB
 	sc->sc_power_dbg = TRUE;
 #else
@@ -386,8 +386,56 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_wskbddev = config_found(self, , wskbddevprint,
 	CFARGS(.iattr = "wskbddev"));
 #ifdef ADBKBD_EMUL_USB
-	sc->sc_emul_usb = TRUE;
-	wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb, 128);
+	/* Values from Linux's drivers/macintosh/adbhud.c */
+switch (sc->sc_adbdev->handler_id) {
+	case ADB_ISOKBD:	/* FALLTHROUGH */
+	case ADB_EXTISOKBD:	/* FALLTHROUGH */
+	case 0x07:		/* FALLTHROUGH */
+	case ADB_ISOKBDII:	/* FALLTHROUGH */
+	case ADB_PBISOKBD:	/* FALLTHROUGH */
+	case ADB_ADJISOKBD:	/* FALLTHROUGH */
+	case ADB_PBEXTISOKBD:	/* FALLTHROUGH */
+	case 0x19:		/* FALLTHROUGH */
+	case 0x1d:		/* FALLTHROUGH */
+	case 0xc1:		/* FALLTHROUGH */
+	case ADB_IBOOKKBD:	/* FALLTHROUGH */
+	case 0xc7:
+		sc->sc_emul_usb = ADB_EMUL_USB_ISO;
+		wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_iso, 128);
+		break;
+#ifdef notyet
+	case ADB_ADJJAPKBD:	/* FALLTHROUGH */
+	case ADB_PBEXTJAPKBD:	/* FALLTHROUGH */
+	case ADB_JPKBDII:	/* FALLTHROUGH */
+	case 0x17:		/* FALLTHROUGH */
+	case 0x1a:		/* FALLTHROUGH */
+	case ADB_PBJPKBD:	/* FALLTHROUGH */
+	case 0xc2:		/* FALLTHROUGH */
+	case 0xc5:		/* FALLTHROUGH */
+	case 0xc8:		/* FALLTHROUGH */
+	case 0xc9:
+		sc->sc_emul_usb = ADB_EMUL_USB_JIS;
+		wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_jis, 128);
+		break;
+#endif
+	case ADB_STDKBD:	/* FALLTHROUGH */
+	case ADB_EXTKBD:	/* FALLTHROUGH */
+	case 0x03:		/* FALLTHROUGH */
+	case 0x06:		/* FALLTHROUGH */
+	case ADB_KBDII:		/* FALLTHROUGH */
+	case ADB_PBKBD:		/* FALLTHROUGH */
+	case ADB_ADJKBD:	/* FALLTHROUGH */
+	case ADB_PBEXTKBD:	/* FALLTHROUGH */
+	case ADB_DESIGNKBD:	/* FALLTHROUGH */
+	case 0x1c:		/* FALLTHROUGH */
+	case 0xc0:		/* FALLTHROUGH */
+	case ADB_PBG3KBD:	/* FALLTHROUGH */
+	case 0xc6:		/* FALLTHROUGH */
+	default:	/* default to ANSI for unknown values */
+		sc->sc_emul_usb = ADB_EMUL_USB_ANSI;
+		wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_ansi, 128);
+		break;
+	}
 #endif /* ADBKBD_EMUL_USB */
 
 #if NWSMOUSE > 0
@@ -633,7 +681,7 @@ adbkbd_ioctl(void *v, u_long cmd, void *
 	switch (cmd) {
 
 	case WSKBDIO_GTYPE:
-		if (sc->sc_emul_usb) {
+		if (sc->sc_emul_usb != ADB_EMUL_USB_NONE) {
 			*(int *)data = WSKBD_TYPE_USB;
 		} else {
 			*(int *)data = WSKBD_TYPE_ADB;
@@ -798,7 +846,7 @@ adbkbd_sysctl_usb(SYSCTLFN_ARGS)
 	struct sysctlnode node = *rnode;
 	struct adbkbd_softc *sc=(struct adbkbd_softc *)node.sysctl_data;
 	const int *np = newp;
-	bool reg;
+	int reg;
 
 	DPRINTF("%s\n", __func__);
 	reg = sc->sc_emul_usb;
@@ -807,12 +855,26 @@ adbkbd_sysctl_usb(SYSCTLFN_ARGS)
 		node.sysctl_data = 
 		if (sysctl_lookup(SYSCTLFN_CALL()) == 0) {
 			
-			sc->sc_emul_usb = *(bool *)node.sysctl_data;
-			if (sc->sc_emul_usb) {
-wskbd_set_evtrans(sc->sc_wskbddev,
-adb_to_usb, 128);
-			} else {
+			sc->sc_emul_usb = *(int *)node.sysctl_data;
+			switch (sc->sc_emul_usb) {
+			case ADB_EMUL_USB_NONE:
 wskbd_set_evtrans(sc->sc_wskbddev, NULL, 0);
+break;
+			case ADB_EMUL_USB_ANSI:
+wskbd_set_evtrans(sc->sc_wskbddev,
+adb_to_usb_ansi, 128);
+	

CVS commit: src/sys/dev/adb

2022-05-13 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sat May 14 01:16:55 UTC 2022

Modified Files:
src/sys/dev/adb: adb_kbd.c adb_keymap.h adb_usb_map.c

Log Message:
Add ISO and JIS keyboard layouts for ADB to USB emulation

The layout is configurable using sysctl machdep.adbkbdX.emulate_usb:
0 = no emulation
1 = ANSI
2 = ISO (new with this change)
3 = JIS (new with this change)

Default value is detected using the ADB keyboard handler id. JIS
default is disabled until it is tested.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/adb/adb_usb_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2022-04-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr  6 17:37:31 UTC 2022

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
KNF nits, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/adb/adb_ktm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_ktm.c
diff -u src/sys/dev/adb/adb_ktm.c:1.4 src/sys/dev/adb/adb_ktm.c:1.5
--- src/sys/dev/adb/adb_ktm.c:1.4	Sat Aug  7 16:19:09 2021
+++ src/sys/dev/adb/adb_ktm.c	Wed Apr  6 17:37:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ktm.c,v 1.4 2021/08/07 16:19:09 thorpej Exp $	*/
+/*	$NetBSD: adb_ktm.c,v 1.5 2022/04/06 17:37:31 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.4 2021/08/07 16:19:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.5 2022/04/06 17:37:31 macallan Exp $");
 
 #include 
 #include 
@@ -363,9 +363,9 @@ ktm_ioctl(void *v, u_long cmd, void *dat
 		break;
 
 	default:
-		return (EPASSTHROUGH);
+		return EPASSTHROUGH;
 	}
-	return (0);
+	return 0;
 }
 
 static void



CVS commit: src/sys/dev/adb

2022-04-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr  6 17:37:31 UTC 2022

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
KNF nits, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/adb/adb_ktm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2022-04-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr  6 17:14:43 UTC 2022

Modified Files:
src/sys/dev/adb: adb_keymap.h

Log Message:
we've been using the power key for its intended purpose for yesrs, which
makes breaking into DDB awkward, so let's do what everyone else does and
use Ctrl-Alt-Escape / Cmd-Escape depending on the layout variant


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/adb_keymap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_keymap.h
diff -u src/sys/dev/adb/adb_keymap.h:1.8 src/sys/dev/adb/adb_keymap.h:1.9
--- src/sys/dev/adb/adb_keymap.h:1.8	Mon Aug 31 17:51:56 2020
+++ src/sys/dev/adb/adb_keymap.h	Wed Apr  6 17:14:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.8 2020/08/31 17:51:56 macallan Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.9 2022/04/06 17:14:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@ static const keysym_t akbd_keydesc_us[] 
 KC(50),			KS_grave,	KS_asciitilde,
 KC(51),			KS_Delete,
 KC(52),			KS_KP_Enter,/* Pretend this is alt-R ? */
-KC(53),			KS_Escape,
+KC(53), KS_Cmd_Debugger,	KS_Escape,
 KC(54),  KS_Cmd1,		KS_Control_L,
 KC(55),			KS_Meta_L,	/* Command */
 KC(56),			KS_Shift_L,



CVS commit: src/sys/dev/adb

2022-04-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr  6 17:14:43 UTC 2022

Modified Files:
src/sys/dev/adb: adb_keymap.h

Log Message:
we've been using the power key for its intended purpose for yesrs, which
makes breaking into DDB awkward, so let's do what everyone else does and
use Ctrl-Alt-Escape / Cmd-Escape depending on the layout variant


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/adb_keymap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 15 16:16:36 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
fix non-debug build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/adb/adb_ktm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 15 16:16:36 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
fix non-debug build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/adb/adb_ktm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_ktm.c
diff -u src/sys/dev/adb/adb_ktm.c:1.1 src/sys/dev/adb/adb_ktm.c:1.2
--- src/sys/dev/adb/adb_ktm.c:1.1	Sun Sep  8 05:55:15 2019
+++ src/sys/dev/adb/adb_ktm.c	Sun Sep 15 16:16:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $	*/
+/*	$NetBSD: adb_ktm.c,v 1.2 2019/09/15 16:16:36 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2019 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.2 2019/09/15 16:16:36 macallan Exp $");
 
 #include 
 #include 
@@ -175,7 +175,6 @@ ktm_init(struct ktm_softc *sc)
 {
 	const struct sysctlnode *me = NULL, *node = NULL;
 	int ret;
-	uint8_t addr;
 
 	/* Found Kensington Turbo Mouse */
 
@@ -212,7 +211,6 @@ ktm_init(struct ktm_softc *sc)
 	/* this seems to be the most reasonable default */
 	uint8_t data[8] = { 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0 };
 
-	addr = sc->sc_adbdev->current_addr;
 	memcpy(sc->sc_config, data, sizeof(data));
 
 	sc->sc_left = 1;
@@ -221,6 +219,7 @@ ktm_init(struct ktm_softc *sc)
 	ktm_buttons(sc);
 
 #ifdef KTM_DEBUG
+	int addr = sc->sc_adbdev->current_addr;
 	{
 		int i;
 		ktm_send_sync(sc, ADBTALK(addr, 2), 0, NULL);



CVS commit: src/sys/dev/adb

2019-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep  8 05:55:15 UTC 2019

Modified Files:
src/sys/dev/adb: files.adb
Added Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
add driver for Kensington Turbo Mouse ( actually a trackball )
the adbms driver contains basic support, this driver lets you program the
buttons, I'll add other features once I figure out how they work


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/files.adb

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep  8 05:55:15 UTC 2019

Modified Files:
src/sys/dev/adb: files.adb
Added Files:
src/sys/dev/adb: adb_ktm.c

Log Message:
add driver for Kensington Turbo Mouse ( actually a trackball )
the adbms driver contains basic support, this driver lets you program the
buttons, I'll add other features once I figure out how they work


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/adb/adb_ktm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/adb/files.adb

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.8 src/sys/dev/adb/files.adb:1.9
--- src/sys/dev/adb/files.adb:1.8	Thu Jun  6 20:59:58 2019
+++ src/sys/dev/adb/files.adb	Sun Sep  8 05:55:15 2019
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.8 2019/06/06 20:59:58 macallan Exp $
+#	$NetBSD: files.adb,v 1.9 2019/09/08 05:55:15 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -8,6 +8,7 @@ defflag	adbdebug.h	ADBKBD_DEBUG
 defflag	adbdebug.h	ADBMS_DEBUG
 defflag	adbdebug.h	ADBBT_DEBUG
 defflag adbdebug.h	ADBKBD_POWER_DDB
+defflag	adbdebug.h	KTM_DEBUG
 
 define adb_bus {}
 
@@ -28,3 +29,7 @@ file dev/adb/adb_bt.c		adbbt
 device adbms : wsmousedev
 attach adbms at nadb
 file dev/adb/adb_ms.c		adbms needs-flag
+
+device ktm : wsmousedev
+attach ktm at nadb
+file dev/adb/adb_ktm.c		ktm needs-flag

Added files:

Index: src/sys/dev/adb/adb_ktm.c
diff -u /dev/null src/sys/dev/adb/adb_ktm.c:1.1
--- /dev/null	Sun Sep  8 05:55:15 2019
+++ src/sys/dev/adb/adb_ktm.c	Sun Sep  8 05:55:15 2019
@@ -0,0 +1,486 @@
+/*	$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $	*/
+
+/*-
+ * Copyright (c) 2019 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: adb_ktm.c,v 1.1 2019/09/08 05:55:15 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "adbdebug.h"
+
+#ifdef KTM_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF while (0) printf
+#endif
+
+/*
+ * State info, per mouse instance.
+ */
+struct ktm_softc {
+	device_t	sc_dev;
+	struct adb_device *sc_adbdev;
+	struct adb_bus_accessops *sc_ops;
+
+	uint8_t		sc_us;		/* cmd to watch for */
+	device_t	sc_wsmousedev;
+	/* buffers */
+	uint8_t		sc_config[8];
+	int		sc_left;
+	int		sc_right;
+	int		sc_poll;
+	int		sc_msg_len;
+	int		sc_event;
+	uint8_t		sc_buffer[16];
+};
+
+/*
+ * Function declarations.
+ */
+static int	ktm_match(device_t, cfdata_t, void *);
+static void	ktm_attach(device_t, device_t, void *);
+static void	ktm_init(struct ktm_softc *);
+static void	ktm_write_config(struct ktm_softc *);
+static void	ktm_buttons(struct ktm_softc *);
+static void	ktm_process_event(struct ktm_softc *, int, uint8_t *);
+static int	ktm_send_sync(struct ktm_softc *, uint8_t, int, uint8_t *);
+
+/* Driver definition. */
+CFATTACH_DECL_NEW(ktm, sizeof(struct ktm_softc),
+ktm_match, ktm_attach, NULL, NULL);
+
+static int ktm_enable(void *);
+static int ktm_ioctl(void *, u_long, void *, int, struct lwp *);
+static void ktm_disable(void *);
+
+static void ktm_handler(void *, int, uint8_t *);
+static int  ktm_wait(struct ktm_softc *, int);
+static int  sysctl_ktm_left(SYSCTLFN_ARGS);
+static int  sysctl_ktm_right(SYSCTLFN_ARGS);
+
+const struct wsmouse_accessops ktm_accessops = {
+	ktm_enable,
+	ktm_ioctl,
+	ktm_disable,
+};
+
+static int
+ktm_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct adb_attach_args *aaa = aux;
+	if 

CVS commit: src/sys/dev/adb

2019-09-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  5 21:29:22 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
now that I figured out how the checksum for the Kensington Turbo Mouse's
init command works:
- document it
- calculate the checksum instead of hardcoding it, so the init command can be
  easily changed
- drop the first init string - it's entirely overwritten by the 2nd
- remove some debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-09-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  5 21:29:22 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
now that I figured out how the checksum for the Kensington Turbo Mouse's
init command works:
- document it
- calculate the checksum instead of hardcoding it, so the init command can be
  easily changed
- drop the first init string - it's entirely overwritten by the 2nd
- remove some debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.18 src/sys/dev/adb/adb_ms.c:1.19
--- src/sys/dev/adb/adb_ms.c:1.18	Sat Aug 31 02:14:51 2019
+++ src/sys/dev/adb/adb_ms.c	Thu Sep  5 21:29:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.19 2019/09/05 21:29:22 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.19 2019/09/05 21:29:22 macallan Exp $");
 
 #include 
 #include 
@@ -320,6 +320,16 @@ adbms_init_uspeed(struct adbms_softc *sc
 	sc->sc_res = 200;
 }
 
+static int
+adbms_turbo_csum(uint8_t *d)
+{
+	int i = 0, sum = 0;
+
+	for (i = 0; i < 7; i++)
+		sum ^= d[i];
+	return (sum ^ 0xff);
+}
+
 static void
 adbms_init_turbo(struct adbms_softc *sc)
 {
@@ -343,22 +353,13 @@ adbms_init_turbo(struct adbms_softc *sc)
  - 0x21 - button 1 - 2, button 2 - 1
  - 0x31 - button 1 - 3, button 2 - 1
  * byte 4 programs a delay for button presses, apparently in 1/100 seconds
- * byte 7 is some sort of checksum, writes will only stick if it's valid
-  no idea how exactly it works yet, can't be too complicated considering
-  the device's age
+ * byte 7 is a simple XOR checksum, writes will only stick if it's valid
+  as in, b[7] = (b[0] ^ b[1] ^ ... ^ b[6]) ^ 0xff
  */
  
-/*
- * XXX
- * I doubt the first command is actually necessary. Leave in for now since it 
- * doesn't do any harm either
- */
-	static u_char data1[] =
-		{ 0xe7, 0x8c, 0, 0, 0, 0xff, 0xff, 0x94 };
-
 	/* this seems to be the most reasonable default */
-	static u_char data2[] =
-		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0x55 };
+	static u_char data[] =
+		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0/*0x55*/ };
 
 	addr = sc->sc_adbdev->current_addr;
 
@@ -374,23 +375,9 @@ adbms_init_turbo(struct adbms_softc *sc)
 #endif
 
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
-	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+	data[7] = adbms_turbo_csum(data);
+	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data);
 
-#ifdef ADBMS_BRUTEFORCE
-	sc->sc_buffer[1] = 0;
-	int y = 0;
-	while ((sc->sc_buffer[1] != data2[1]) && (y < 0x100)) {
-		data2[7] = y;
-		y++;
-		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-		adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
-		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
-		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
-	}
-	printf("y %02x\n", data2[7]);	
-#endif
 
 #ifdef ADBMS_DEBUG
 	int i, reg;



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 31 02:14:51 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
fix Kensington Turbo Mouse support properly
- program the buttons sanely ( as left & right mouse buttons, no toggles and
  no ridiculous debounce delay either ) - apparently the init values were
  cargo culted from cthulhu knows where
- don't fudge buttons anymore, now that they behave sanely
- add comments on what I could figure out the init command actually does
- leave in code to find checksum values for init commands, at least until I
  can figure out what exactly the checksum is
Todo: deal with models that have more than 2 buttons, figure out what the rest
  of the init command does


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.17 src/sys/dev/adb/adb_ms.c:1.18
--- src/sys/dev/adb/adb_ms.c:1.17	Fri Aug 30 19:24:03 2019
+++ src/sys/dev/adb/adb_ms.c	Sat Aug 31 02:14:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.18 2019/08/31 02:14:51 macallan Exp $");
 
 #include 
 #include 
@@ -326,18 +326,72 @@ adbms_init_turbo(struct adbms_softc *sc)
 	uint8_t addr;
 
 	/* Found Kensington Turbo Mouse */
+
+/*
+ * byte 1 assigns what which button does
+ - 0x08 - button 1 - 1, button 2 - nothing
+ - 0x09 - both buttons - 1
+ - 0x0a - butoon 1 - 1, button 2 - toggle 1
+ - 0x0b - button 1 - 1, button 2 - nothing
+ - 0x0c - button 1 - 1, button 2 - 2
+ - 0x0e - button 1 - 1, button 2 - 3
+ - 0x0f - button 1 - 1, button 2 - toggle 3
+ - 0x10 - button 1 toggle 1, button 2 nothing
+ - 0x11 - button 1 - toggle 1, button 2 - 1
+ - 0x12 - both toggle 1
+ - 0x14 - button 1 toggle 1, button 2 - 2
+ - 0x21 - button 1 - 2, button 2 - 1
+ - 0x31 - button 1 - 3, button 2 - 1
+ * byte 4 programs a delay for button presses, apparently in 1/100 seconds
+ * byte 7 is some sort of checksum, writes will only stick if it's valid
+  no idea how exactly it works yet, can't be too complicated considering
+  the device's age
+ */
+ 
+/*
+ * XXX
+ * I doubt the first command is actually necessary. Leave in for now since it 
+ * doesn't do any harm either
+ */
 	static u_char data1[] =
 		{ 0xe7, 0x8c, 0, 0, 0, 0xff, 0xff, 0x94 };
+
+	/* this seems to be the most reasonable default */
 	static u_char data2[] =
-		{ 0xa5, 0x14, 0, 0, 0x69, 0xff, 0xff, 0x27 };
+		{ 0xa5, 0x0e, 0, 0, 1, 0xff, 0xff, 0x55 };
 
 	addr = sc->sc_adbdev->current_addr;
 
+#ifdef ADBMS_DEBUG
+	{
+		int i;
+		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
+		printf("reg *");
+		for (i = 0; i < sc->sc_msg_len; i++)
+			printf(" %02x", sc->sc_buffer[i]);
+		printf("\n");
+	}
+#endif
+
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
 
+#ifdef ADBMS_BRUTEFORCE
+	sc->sc_buffer[1] = 0;
+	int y = 0;
+	while ((sc->sc_buffer[1] != data2[1]) && (y < 0x100)) {
+		data2[7] = y;
+		y++;
+		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
+		adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+		adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
+		adbms_send_sync(sc, ADBTALK(addr, 2), 0, NULL);
+	}
+	printf("y %02x\n", data2[7]);	
+#endif
+
 #ifdef ADBMS_DEBUG
 	int i, reg;
 	for (reg = 1; reg < 4; reg++) {
@@ -607,9 +661,6 @@ adbms_process_event(struct adbms_softc *
 #ifdef ADBMS_DEBUG
 		printf("%d %d %08x %d\n", dx, dy, smask, shift);
 #endif
-		if (sc->sc_adbdev->handler_id == ADBMS_TURBO) {
-			buttons = (buttons != 0) ? 1 : 0;
-		}
 	}
 
 	if (sc->sc_class == MSCLASS_TRACKPAD) {



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 31 02:14:51 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
fix Kensington Turbo Mouse support properly
- program the buttons sanely ( as left & right mouse buttons, no toggles and
  no ridiculous debounce delay either ) - apparently the init values were
  cargo culted from cthulhu knows where
- don't fudge buttons anymore, now that they behave sanely
- add comments on what I could figure out the init command actually does
- leave in code to find checksum values for init commands, at least until I
  can figure out what exactly the checksum is
Todo: deal with models that have more than 2 buttons, figure out what the rest
  of the init command does


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 30 19:24:03 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
make Kensington Turbo Mouse ( actually a trackball ) work:
- this thing speaks EMP, act like it
- adjust the *way* excessive timeout for trying to enable EMP mode on mice -
  for some reason this trackball shows up as two devices - the trackball and a
  non-functional non-EMP mouse
- map both buttons to button 0 - one is an on/off switch for button 0, the
  other shows up as regular button 1


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.16 src/sys/dev/adb/adb_ms.c:1.17
--- src/sys/dev/adb/adb_ms.c:1.16	Wed Oct 29 00:48:12 2014
+++ src/sys/dev/adb/adb_ms.c	Fri Aug 30 19:24:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.17 2019/08/30 19:24:03 macallan Exp $");
 
 #include 
 #include 
@@ -337,6 +337,17 @@ adbms_init_turbo(struct adbms_softc *sc)
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data1);
 	adbms_send_sync(sc, ADBFLUSH(addr), 0, NULL);
 	adbms_send_sync(sc, ADBLISTEN(addr, 2), 8, data2);
+
+#ifdef ADBMS_DEBUG
+	int i, reg;
+	for (reg = 1; reg < 4; reg++) {
+		adbms_send_sync(sc, ADBTALK(addr, reg), 0, NULL);
+		printf("reg %d", reg);
+		for (i = 0; i < sc->sc_msg_len; i++)
+			printf(" %02x", sc->sc_buffer[i]);
+		printf("\n");
+	}
+#endif
 }
 
 static void
@@ -564,7 +575,8 @@ adbms_process_event(struct adbms_softc *
 			break;
 	}
 
-	if (sc->sc_adbdev->handler_id != ADBMS_EXTENDED) {
+	if ((sc->sc_adbdev->handler_id != ADBMS_EXTENDED) &&
+	(sc->sc_adbdev->handler_id != ADBMS_TURBO)) {
 		dx = ((int)(buffer[1] & 0x3f)) - ((buffer[1] & 0x40) ? 64 : 0);
 		dy = ((int)(buffer[0] & 0x3f)) - ((buffer[0] & 0x40) ? 64 : 0);
 	} else {
@@ -595,6 +607,9 @@ adbms_process_event(struct adbms_softc *
 #ifdef ADBMS_DEBUG
 		printf("%d %d %08x %d\n", dx, dy, smask, shift);
 #endif
+		if (sc->sc_adbdev->handler_id == ADBMS_TURBO) {
+			buttons = (buttons != 0) ? 1 : 0;
+		}
 	}
 
 	if (sc->sc_class == MSCLASS_TRACKPAD) {
@@ -806,7 +821,7 @@ adbms_send_sync(struct adbms_softc *sc, 
 		DPRINTF(" %02x", msg[i]);
 	DPRINTF("\n");
 	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, len, msg);
-	adbms_wait(sc, 1000);
+	adbms_wait(sc, 3);
 	return (sc->sc_msg_len != -1);
 }
 



CVS commit: src/sys/dev/adb

2019-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug 30 19:24:03 UTC 2019

Modified Files:
src/sys/dev/adb: adb_ms.c

Log Message:
make Kensington Turbo Mouse ( actually a trackball ) work:
- this thing speaks EMP, act like it
- adjust the *way* excessive timeout for trying to enable EMP mode on mice -
  for some reason this trackball shows up as two devices - the trackball and a
  non-functional non-EMP mouse
- map both buttons to button 0 - one is an on/off switch for button 0, the
  other shows up as regular button 1


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/adb/adb_ms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  9 14:18:30 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c

Log Message:
make this compile again without ddb


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/adb/adb_kbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-06-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  9 14:18:30 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c

Log Message:
make this compile again without ddb


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/adb/adb_kbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.28 src/sys/dev/adb/adb_kbd.c:1.29
--- src/sys/dev/adb/adb_kbd.c:1.28	Thu Jun  6 16:59:58 2019
+++ src/sys/dev/adb/adb_kbd.c	Sun Jun  9 10:18:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.29 2019/06/09 14:18:29 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.29 2019/06/09 14:18:29 christos Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ddb.h"
+#endif
 
 #include 
 #include 
@@ -465,14 +469,15 @@ adbkbd_keys(struct adbkbd_softc *sc, uin
 		sc->sc_timestamp = now;
 		if (((diff > 1) && (diff < 5)) ||
 		 (sc->sc_power_button_delay == 0)) {
-
-			/* power button, report to sysmon */
+#ifdef DDB
 			if (sc->sc_power_dbg) {
 Debugger();
-			} else {
-sc->sc_pe = k1;
-sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
+return;
 			}
+#endif
+			/* power button, report to sysmon */
+			sc->sc_pe = k1;
+			sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
 		}
 	} else {
 



CVS commit: src/sys/dev/adb

2019-06-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  6 20:59:58 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c files.adb

Log Message:
- call Debugger() from adbkbd_keys() instead of the task queue
- add options ADBKBD_POWER_DDB to enable DDB-on-Power by default


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/adb/files.adb

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/adb

2019-06-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  6 20:59:58 UTC 2019

Modified Files:
src/sys/dev/adb: adb_kbd.c files.adb

Log Message:
- call Debugger() from adbkbd_keys() instead of the task queue
- add options ADBKBD_POWER_DDB to enable DDB-on-Power by default


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/adb/files.adb

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.27 src/sys/dev/adb/adb_kbd.c:1.28
--- src/sys/dev/adb/adb_kbd.c:1.27	Sat Oct 28 04:53:55 2017
+++ src/sys/dev/adb/adb_kbd.c	Thu Jun  6 20:59:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.27 2017/10/28 04:53:55 riastradh Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.27 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.28 2019/06/06 20:59:58 macallan Exp $");
 
 #include 
 #include 
@@ -232,7 +232,11 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_power = 0x;
 	sc->sc_timestamp = 0;
 	sc->sc_emul_usb = FALSE;
+#ifdef ADBKBD_POWER_DDB
+	sc->sc_power_dbg = TRUE;
+#else
 	sc->sc_power_dbg = FALSE;
+#endif
 
 	aprint_normal(" addr %d: ", sc->sc_adbdev->current_addr);
 
@@ -463,8 +467,12 @@ adbkbd_keys(struct adbkbd_softc *sc, uin
 		 (sc->sc_power_button_delay == 0)) {
 
 			/* power button, report to sysmon */
-			sc->sc_pe = k1;
-			sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
+			if (sc->sc_power_dbg) {
+Debugger();
+			} else {
+sc->sc_pe = k1;
+sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
+			}
 		}
 	} else {
 
@@ -479,17 +487,10 @@ adbkbd_powerbutton(void *cookie)
 {
 	struct adbkbd_softc *sc = cookie;
 
-	if (sc->sc_power_dbg) {
-#ifdef DDB
-		Debugger();
-#else
-		printf("kernel is not compiled with DDB support\n");
-#endif
-	} else {
-		sysmon_pswitch_event(>sc_sm_pbutton, 
-		ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
-		PSWITCH_EVENT_RELEASED);
-	}
+	sysmon_pswitch_event(>sc_sm_pbutton, 
+	ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
+	PSWITCH_EVENT_RELEASED);
+
 }
 
 static inline void

Index: src/sys/dev/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.7 src/sys/dev/adb/files.adb:1.8
--- src/sys/dev/adb/files.adb:1.7	Thu Aug 30 01:27:44 2012
+++ src/sys/dev/adb/files.adb	Thu Jun  6 20:59:58 2019
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.7 2012/08/30 01:27:44 macallan Exp $
+#	$NetBSD: files.adb,v 1.8 2019/06/06 20:59:58 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -7,7 +7,7 @@ defflag	adbdebug.h	ADB_DEBUG
 defflag	adbdebug.h	ADBKBD_DEBUG
 defflag	adbdebug.h	ADBMS_DEBUG
 defflag	adbdebug.h	ADBBT_DEBUG
-defflag adbdebug.h	ADBKBD_POWER_PANIC
+defflag adbdebug.h	ADBKBD_POWER_DDB
 
 define adb_bus {}