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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/device.h>
@@ -232,7 +232,11 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_power = 0xffff;
 	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->sc_sm_pbutton, 
-		    ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
-		    PSWITCH_EVENT_RELEASED);
-	}
+	sysmon_pswitch_event(&sc->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 {}
 

Reply via email to