CVS commit: src/sys/dev/adb

2020-08-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug 29 22:33:53 UTC 2020

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

Log Message:
properly map left Command to Meta_L and left Option to Alt_L
Mostly for correctness, should help non-US layouts


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/dev/adb/adb_keymap.h:1.7
--- src/sys/dev/adb/adb_keymap.h:1.6	Mon Jun 20 00:05:58 2016
+++ src/sys/dev/adb/adb_keymap.h	Sat Aug 29 22:33:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.6 2016/06/20 00:05:58 jakllsch Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.7 2020/08/29 22:33:53 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -90,10 +90,10 @@ static const keysym_t akbd_keydesc_us[] 
 KC(52),			KS_KP_Enter,/* Pretend this is alt-R ? */
 KC(53),			KS_Escape,
 KC(54),			KS_Control_L,
-KC(55),  KS_Cmd,/* Command */
+KC(55),  KS_Cmd,		KS_Meta_L,	/* Command */
 KC(56),			KS_Shift_L,
 KC(57),			KS_Caps_Lock,
-KC(58),  KS_Cmd1,/* Option */
+KC(58),			KS_Alt_L,	/* Option */
 KC(59),			KS_Left,
 KC(60),			KS_Right,
 KC(61), KS_Cmd_ScrollSlowDown, KS_Down,
@@ -120,13 +120,13 @@ static const keysym_t akbd_keydesc_us[] 
 KC(92), KS_Cmd_ScrollFastUp, KS_KP_Prior,	KS_KP_9,
 
 KC(95),			KS_KP_Delete,	KS_KP_Decimal,
-KC(96),	KS_Cmd_Screen4,		KS_f5,
-KC(97),	KS_Cmd_Screen5,		KS_f6,
-KC(98),	KS_Cmd_Screen6,		KS_f7,
-KC(99),	KS_Cmd_Screen2,		KS_f3,
-KC(100),KS_Cmd_Screen7,		KS_f8,
+KC(96), KS_Cmd_Screen4,	KS_f5,
+KC(97), KS_Cmd_Screen5,	KS_f6,
+KC(98), KS_Cmd_Screen6,	KS_f7,
+KC(99), KS_Cmd_Screen2,	KS_f3,
 
-KC(101),KS_Cmd_Screen8,		KS_f9,
+KC(100), KS_Cmd_Screen7,	KS_f8,
+KC(101), KS_Cmd_Screen8,	KS_f9,
 
 KC(103),			KS_f11,
 
@@ -134,7 +134,7 @@ static const keysym_t akbd_keydesc_us[] 
 KC(106),			KS_KP_Enter,
 KC(107),			KS_Hold_Screen,
 
-KC(109),KS_Cmd_Screen9,	KS_f10,
+KC(109), KS_Cmd_Screen9,	KS_f10,
 
 KC(111),			KS_f12,
 
@@ -143,11 +143,11 @@ static const keysym_t akbd_keydesc_us[] 
 KC(115),			KS_Home,
 KC(116), KS_Cmd_ScrollFastUp, KS_Prior,
 KC(117),			KS_Delete,	/* BackSpace */
-KC(118),KS_Cmd_Screen3,	KS_f4,
+KC(118), KS_Cmd_Screen3,	KS_f4,
 KC(119),			KS_End,
-KC(120),KS_Cmd_Screen1,	KS_f2,
-KC(121),KS_Cmd_ScrollFastDown, KS_Next,
-KC(122),KS_Cmd_Screen0,	KS_f1,
+KC(120), KS_Cmd_Screen1,	KS_f2,
+KC(121), KS_Cmd_ScrollFastDown, KS_Next,
+KC(122), KS_Cmd_Screen0,	KS_f1,
 KC(123),			KS_Shift_R,
 KC(124),			KS_Alt_R,
 KC(125),			KS_Control_R,



CVS commit: src/sys/dev/adb

2020-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 31 17:51:56 UTC 2020

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

Log Message:
behave like USB keyboards - KB_US uses ctrl-alt-Fn, KB_APPLE variant uses
Command-Fn


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/dev/adb/adb_keymap.h:1.8
--- src/sys/dev/adb/adb_keymap.h:1.7	Sat Aug 29 22:33:53 2020
+++ src/sys/dev/adb/adb_keymap.h	Mon Aug 31 17:51:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.7 2020/08/29 22:33:53 macallan Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.8 2020/08/31 17:51:56 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -89,11 +89,11 @@ static const keysym_t akbd_keydesc_us[] 
 KC(51),			KS_Delete,
 KC(52),			KS_KP_Enter,/* Pretend this is alt-R ? */
 KC(53),			KS_Escape,
-KC(54),			KS_Control_L,
-KC(55),  KS_Cmd,		KS_Meta_L,	/* Command */
+KC(54),  KS_Cmd1,		KS_Control_L,
+KC(55),			KS_Meta_L,	/* Command */
 KC(56),			KS_Shift_L,
 KC(57),			KS_Caps_Lock,
-KC(58),			KS_Alt_L,	/* Option */
+KC(58),  KS_Cmd2,		KS_Alt_L,	/* Option */
 KC(59),			KS_Left,
 KC(60),			KS_Right,
 KC(61), KS_Cmd_ScrollSlowDown, KS_Down,
@@ -154,6 +154,13 @@ static const keysym_t akbd_keydesc_us[] 
 KC(127),  KS_Cmd_Debugger,
 };
 
+static const keysym_t akbd_keydesc_apple[] = {
+/*  pos  command		normal		shifted */
+KC(54),			KS_Control_L,
+KC(55),  KS_Cmd,		KS_Meta_L,	/* Command */
+KC(58),			KS_Alt_L,	/* Option */
+};
+
 static const keysym_t akbd_keydesc_us_dvorak[] = {
 /*  pos  command		normal		shifted */
 KC(0),			KS_a,
@@ -450,18 +457,35 @@ static const keysym_t akbd_keydesc_pt[] 
 
 static const struct wscons_keydesc akbd_keydesctab[] = {
 	KBD_MAP(KB_US,			0,	akbd_keydesc_us),
+	KBD_MAP(KB_US | KB_APPLE,	KB_US,	akbd_keydesc_apple),
 	KBD_MAP(KB_US | KB_DVORAK,  KB_US,  akbd_keydesc_us_dvorak),
+	KBD_MAP(KB_US | KB_DVORAK | KB_APPLE, KB_US | KB_DVORAK,
+		akbd_keydesc_apple),
 	KBD_MAP(KB_FR,			KB_US,	akbd_keydesc_fr),
-	KBD_MAP(KB_JP,			KB_US,	akbd_keydesc_jp),
 	KBD_MAP(KB_FR | KB_NODEAD,	KB_FR,	akbd_keydesc_fr_nodead),
+	KBD_MAP(KB_FR | KB_APPLE,	KB_FR,	akbd_keydesc_apple),
+	KBD_MAP(KB_FR | KB_NODEAD | KB_APPLE,	KB_FR | KB_DVORAK,
+		akbd_keydesc_apple),
+	KBD_MAP(KB_JP,			KB_US,	akbd_keydesc_jp),
+	KBD_MAP(KB_JP | KB_APPLE,	KB_JP,	akbd_keydesc_apple),
 	KBD_MAP(KB_SF,			KB_US,  akbd_keydesc_sf),
+	KBD_MAP(KB_SF | KB_APPLE,	KB_SF,	akbd_keydesc_apple),
 	KBD_MAP(KB_SV,			KB_US,  akbd_keydesc_sv),
+	KBD_MAP(KB_SV | KB_APPLE,	KB_SV,	akbd_keydesc_apple),
 	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,  akbd_keydesc_sv_nodead),
+	KBD_MAP(KB_SV | KB_NODEAD | KB_APPLE,	KB_SV | KB_NODEAD,
+		akbd_keydesc_apple),
 	KBD_MAP(KB_DE,			KB_US,  akbd_keydesc_de),
+	KBD_MAP(KB_DE | KB_APPLE,	KB_DE,	akbd_keydesc_apple),
 	KBD_MAP(KB_DE | KB_NODEAD,	KB_DE,  akbd_keydesc_de_nodead),
+	KBD_MAP(KB_DE | KB_NODEAD | KB_APPLE,	KB_DE | KB_NODEAD,
+		akbd_keydesc_apple),
 	KBD_MAP(KB_UK,			KB_US,  akbd_keydesc_uk),
+	KBD_MAP(KB_UK | KB_APPLE,	KB_UK,	akbd_keydesc_apple),
 	KBD_MAP(KB_ES,			KB_US,	akbd_keydesc_es),
+	KBD_MAP(KB_ES | KB_APPLE,	KB_ES,	akbd_keydesc_apple),
 	KBD_MAP(KB_PT,  KB_US,  akbd_keydesc_pt),
+	KBD_MAP(KB_PT | KB_APPLE,	KB_PT,	akbd_keydesc_apple),
 	{0, 0, 0, 0}
 };
 



CVS commit: src/sys/dev/adb

2020-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 31 17:54:18 UTC 2020

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

Log Message:
defparam and use ADBKBD_LAYOUT, default to KB_US|KB_APPLE for tradition


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.9 -r1.10 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.29 src/sys/dev/adb/adb_kbd.c:1.30
--- src/sys/dev/adb/adb_kbd.c:1.29	Sun Jun  9 14:18:29 2019
+++ src/sys/dev/adb/adb_kbd.c	Mon Aug 31 17:54:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.29 2019/06/09 14:18:29 christos Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.30 2020/08/31 17:54:18 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.29 2019/06/09 14:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.30 2020/08/31 17:54:18 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -139,10 +139,10 @@ struct wskbd_consops adbkbd_consops = {
 
 struct wskbd_mapdata adbkbd_keymapdata = {
 	akbd_keydesctab,
-#ifdef AKBD_LAYOUT
-	AKBD_LAYOUT,
+#ifdef ADBKBD_LAYOUT
+	ADBKBD_LAYOUT,
 #else
-	KB_US,
+	KB_US | KB_APPLE,
 #endif
 };
 

Index: src/sys/dev/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.9 src/sys/dev/adb/files.adb:1.10
--- src/sys/dev/adb/files.adb:1.9	Sun Sep  8 05:55:15 2019
+++ src/sys/dev/adb/files.adb	Mon Aug 31 17:54:18 2020
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.9 2019/09/08 05:55:15 macallan Exp $
+#	$NetBSD: files.adb,v 1.10 2020/08/31 17:54:18 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -21,6 +21,7 @@ attach adbkbd at nadb
 file dev/adb/adb_kbd.c		adbkbd needs-flag
 file dev/adb/adb_usb_map.c	adbkbd
 defflag	opt_adbkbd.h	ADBKBD_EMUL_USB
+defparam opt_adbkbd.h	ADBKBD_LAYOUT
 
 device adbbt : wskbddev
 attach adbbt at nadb



CVS commit: src/sys/dev/adb

2010-08-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 11 16:54:10 UTC 2010

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

Log Message:
Make the movement-while-tapping threshold smaller so moving the cursor by a
few pixels won't trigger a button event. This should probably become a sysctl
knob.
While there, remove some commented out stuff and fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/dev/adb/adb_ms.c:1.9
--- src/sys/dev/adb/adb_ms.c:1.8	Wed Mar 26 18:04:15 2008
+++ src/sys/dev/adb/adb_ms.c	Wed Aug 11 16:54:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.8 2008/03/26 18:04:15 matt Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.9 2010/08/11 16:54:10 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.8 2008/03/26 18:04:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.9 2010/08/11 16:54:10 macallan Exp $");
 
 #include 
 #include 
@@ -107,7 +107,6 @@
 static int	adbms_match(device_t, cfdata_t, void *);
 static void	adbms_attach(device_t, device_t, void *);
 static void	ems_init(struct adbms_softc *);
-//static void	ms_processevent(adb_event_t *event, struct adbms_softc *);
 static void	init_trackpad(struct adbms_softc *);
 static void	adbms_init_mouse(struct adbms_softc *);
 static void	adbms_init_turbo(struct adbms_softc *);
@@ -614,7 +613,7 @@
 		/* finger up */
 		if (sc->sc_down) {
 			if (((sc->sc_x * sc->sc_x + 
-			sc->sc_y * sc->sc_y) < 20) && 
+			sc->sc_y * sc->sc_y) < 3) && 
 			(sc->sc_wsmousedev)) {
 /* 
  * if there wasn't much movement between
@@ -646,7 +645,7 @@
 		/* finger up */
 		if (sc->sc_down) {
 			if (((sc->sc_x * sc->sc_x + 
-			sc->sc_y * sc->sc_y) < 20) && 
+			sc->sc_y * sc->sc_y) < 3) && 
 			(sc->sc_wsmousedev)) {
 /* 
  * if there wasn't much movement between
@@ -758,7 +757,7 @@
 		}
 	} else {
 		while ((sc->sc_msg_len == -1) && (cnt < timeout)) {
-			tsleep(&sc->sc_event, 0, "adbkbdio", hz);
+			tsleep(&sc->sc_event, 0, "adbmsio", hz);
 			cnt++;
 		}
 	}



CVS commit: src/sys/dev/adb

2010-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  8 04:48:03 UTC 2010

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

Log Message:
make debug code compile again


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/adb/adb_bt.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_bt.c
diff -u src/sys/dev/adb/adb_bt.c:1.5 src/sys/dev/adb/adb_bt.c:1.6
--- src/sys/dev/adb/adb_bt.c:1.5	Thu May 15 19:19:50 2008
+++ src/sys/dev/adb/adb_bt.c	Wed Sep  8 04:48:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_bt.c,v 1.5 2008/05/15 19:19:50 macallan Exp $ */
+/*	$NetBSD: adb_bt.c,v 1.6 2010/09/08 04:48:03 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_bt.c,v 1.5 2008/05/15 19:19:50 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_bt.c,v 1.6 2010/09/08 04:48:03 macallan Exp $");
 
 #include 
 #include 
@@ -117,8 +117,9 @@
 	uint8_t k, scancode;
 
 #ifdef ADBBT_DEBUG
+	struct adbbt_softc *sc = cookie;
 	int i;
-	printf("%s: %02x - ", device_xname(&sc->sc_dev), sc->sc_us);
+	printf("%s: %02x - ", device_xname(sc->sc_dev), sc->sc_us);
 	for (i = 0; i < len; i++) {
 		printf(" %02x", data[i]);
 	}



CVS commit: src/sys/dev/adb

2011-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Nov 16 06:56:50 UTC 2011

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

Log Message:
only require the power button to be pressed twice on keyboards where it's easy
to hit by accident, send an event to sysmon immediately otherwise


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/dev/adb/adb_kbd.c:1.16
--- src/sys/dev/adb/adb_kbd.c:1.15	Thu Aug 18 02:18:40 2011
+++ src/sys/dev/adb/adb_kbd.c	Wed Nov 16 06:56:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.16 2011/11/16 06:56:49 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.16 2011/11/16 06:56:49 macallan Exp $");
 
 #include 
 #include 
@@ -75,6 +75,7 @@ struct adbkbd_softc {
 	struct sysmon_pswitch sc_sm_pbutton;
 	int sc_leds;
 	int sc_have_led_control;
+	int sc_power_button_delay;
 	int sc_msg_len;
 	int sc_event;
 	int sc_poll;
@@ -194,6 +195,19 @@ adbkbd_attach(device_t parent, device_t 
 
 	sc->sc_leds = 0;	/* initially off */
 	sc->sc_have_led_control = 0;
+
+	/*
+	 * If this is != 0 then pushing the power button will not immadiately
+	 * send a shutdown event to sysmon but instead require another key
+	 * press within 5 seconds with a gap of at least two seconds. The 
+	 * reason to do this is the fact that some PowerBook keyboards,
+	 * like the 2400, 3400 and original G3 have their power buttons
+	 * right next to the backspace key and it's extremely easy to hit
+	 * it by accident.
+	 * On most other keyboards the power button is sufficiently far out
+	 * of the way so we don't need this.
+	 */
+	sc->sc_power_button_delay = 0;
 	sc->sc_msg_len = 0;
 	sc->sc_poll = 0;
 	sc->sc_capslock = 0;
@@ -244,10 +258,12 @@ adbkbd_attach(device_t parent, device_t 
 	case ADB_PBKBD:
 		printf("PowerBook keyboard\n");
 		sc->sc_power = 0x7e;
+		sc->sc_power_button_delay = 1;
 		break;
 	case ADB_PBISOKBD:
 		printf("PowerBook keyboard (ISO layout)\n");
 		sc->sc_power = 0x7e;
+		sc->sc_power_button_delay = 1;
 		break;
 	case ADB_ADJKPD:
 		printf("adjustable keypad\n");
@@ -263,10 +279,12 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	case ADB_PBEXTISOKBD:
 		printf("PowerBook extended keyboard (ISO layout)\n");
+		sc->sc_power_button_delay = 1;
 		sc->sc_power = 0x7e;
 		break;
 	case ADB_PBEXTJAPKBD:
 		printf("PowerBook extended keyboard (Japanese layout)\n");
+		sc->sc_power_button_delay = 1;
 		sc->sc_power = 0x7e;
 		break;
 	case ADB_JPKBDII:
@@ -274,6 +292,7 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	case ADB_PBEXTKBD:
 		printf("PowerBook extended keyboard\n");
+		sc->sc_power_button_delay = 1;
 		sc->sc_power = 0x7e;
 		break;
 	case ADB_DESIGNKBD:
@@ -282,6 +301,7 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	case ADB_PBJPKBD:
 		printf("PowerBook keyboard (Japanese layout)\n");
+		sc->sc_power_button_delay = 1;
 		sc->sc_power = 0x7e;
 		break;
 	case ADB_PBG3KBD:
@@ -392,7 +412,8 @@ adbkbd_keys(struct adbkbd_softc *sc, uin
 		uint32_t diff = now - sc->sc_timestamp;
 
 		sc->sc_timestamp = now;
-		if ((diff > 1) && (diff < 5)) {
+		if (((diff > 1) && (diff < 5)) ||
+		 (sc->sc_power_button_delay == 0)) {
 
 			/* power button, report to sysmon */
 			sc->sc_pe = k1;



CVS commit: src/sys/dev/adb

2011-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jul 28 16:28:12 UTC 2011

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

Log Message:
sanitize sysctl interface in order to appease gcc 4.5


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.9 -r1.10 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_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.13 src/sys/dev/adb/adb_kbd.c:1.14
--- src/sys/dev/adb/adb_kbd.c:1.13	Wed Mar 18 10:22:39 2009
+++ src/sys/dev/adb/adb_kbd.c	Thu Jul 28 16:28:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.13 2009/03/18 10:22:39 cegger Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.13 2009/03/18 10:22:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $");
 
 #include 
 #include 
@@ -148,7 +148,8 @@
 	adbkms_disable,
 };
 
-static int  adbkbd_sysctl_button(SYSCTLFN_ARGS);
+static int  adbkbd_sysctl_mid(SYSCTLFN_ARGS);
+static int  adbkbd_sysctl_right(SYSCTLFN_ARGS);
 static void adbkbd_setup_sysctl(struct adbkbd_softc *);
 
 #endif /* NWSMOUSE > 0 */
@@ -655,11 +656,11 @@
 static void
 adbkbd_setup_sysctl(struct adbkbd_softc *sc)
 {
-	struct sysctlnode *node, *me;
+	const struct sysctlnode *me, *node;
 	int ret;
 
 	DPRINTF("%s: sysctl setup\n", device_xname(sc->sc_dev));
-	ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&me,
+	ret = sysctl_createv(NULL, 0, NULL, &me,
 	   CTLFLAG_READWRITE,
 	   CTLTYPE_NODE, device_xname(sc->sc_dev), NULL,
 	   NULL, 0, NULL, 0,
@@ -667,42 +668,66 @@
 
 	ret = sysctl_createv(NULL, 0, NULL,
 	(const struct sysctlnode **)&node, 
-	CTLFLAG_READWRITE | CTLFLAG_OWNDESC | CTLFLAG_IMMEDIATE,
-	CTLTYPE_INT, "middle", "middle mouse button", adbkbd_sysctl_button, 
-		1, NULL, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_INT, "middle", "middle mouse button", adbkbd_sysctl_mid, 
+		1, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
 		CTL_EOL);
-	node->sysctl_data = sc;
 
 	ret = sysctl_createv(NULL, 0, NULL, 
 	(const struct sysctlnode **)&node, 
-	CTLFLAG_READWRITE | CTLFLAG_OWNDESC | CTLFLAG_IMMEDIATE,
-	CTLTYPE_INT, "right", "right mouse button", adbkbd_sysctl_button, 
-		2, NULL, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_INT, "right", "right mouse button", adbkbd_sysctl_right, 
+		2, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
 		CTL_EOL);
-	node->sysctl_data = sc;
 }
 
 static int
-adbkbd_sysctl_button(SYSCTLFN_ARGS)
+adbkbd_sysctl_mid(SYSCTLFN_ARGS)
 {
 	struct sysctlnode node = *rnode;
 	struct adbkbd_softc *sc=(struct adbkbd_softc *)node.sysctl_data;
 	const int *np = newp;
-	int btn = node.sysctl_idata, reg;
+	int reg;
 
-	DPRINTF("adbkbd_sysctl_button %d\n", btn);
-	node.sysctl_idata = sc->sc_trans[btn];
-	reg = sc->sc_trans[btn];
+	DPRINTF("adbkbd_sysctl_mid\n");
+	reg = sc->sc_trans[1];
 	if (np) {
 		/* we're asked to write */	
 		node.sysctl_data = ®
 		if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) {
 			
-			sc->sc_trans[btn] = node.sysctl_idata;
+			sc->sc_trans[1] = *(int *)node.sysctl_data;
 			return 0;
 		}
 		return EINVAL;
 	} else {
+		node.sysctl_data = ®
+		node.sysctl_size = 4;
+		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	}
+}
+
+static int
+adbkbd_sysctl_right(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct adbkbd_softc *sc=(struct adbkbd_softc *)node.sysctl_data;
+	const int *np = newp;
+	int reg;
+
+	DPRINTF("adbkbd_sysctl_right\n");
+	reg = sc->sc_trans[2];
+	if (np) {
+		/* we're asked to write */	
+		node.sysctl_data = ®
+		if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) {
+			
+			sc->sc_trans[2] = *(int *)node.sysctl_data;
+			return 0;
+		}
+		return EINVAL;
+	} else {
+		node.sysctl_data = ®
 		node.sysctl_size = 4;
 		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
 	}

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.9 src/sys/dev/adb/adb_ms.c:1.10
--- src/sys/dev/adb/adb_ms.c:1.9	Wed Aug 11 16:54:10 2010
+++ src/sys/dev/adb/adb_ms.c	Thu Jul 28 16:28:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.9 2010/08/11 16:54:10 macallan Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.10 2011/07/28 16:28:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.9 2010/08/11 16:54:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.10 2011/07/28 16:28:12 macallan Exp $");
 
 #include 
 #include 
@@ -690,7 +690,7 @@
 static void
 init_trackpad(struct adbms_softc *sc)
 {
-	struct sysctlnode *me = NULL, *node = NULL;
+	cons

CVS commit: src/sys/dev/adb

2011-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 18 02:18:41 UTC 2011

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

Log Message:
Fix gcc-4.5 warnings. If you still see them, e-mail them to me.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.11 -r1.12 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_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.14 src/sys/dev/adb/adb_kbd.c:1.15
--- src/sys/dev/adb/adb_kbd.c:1.14	Thu Jul 28 12:28:12 2011
+++ src/sys/dev/adb/adb_kbd.c	Wed Aug 17 22:18:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.14 2011/07/28 16:28:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.15 2011/08/18 02:18:40 christos Exp $");
 
 #include 
 #include 
@@ -667,14 +667,14 @@
 	   CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 
 	ret = sysctl_createv(NULL, 0, NULL,
-	(const struct sysctlnode **)&node, 
+	(void *)&node, 
 	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
 	CTLTYPE_INT, "middle", "middle mouse button", adbkbd_sysctl_mid, 
 		1, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
 		CTL_EOL);
 
 	ret = sysctl_createv(NULL, 0, NULL, 
-	(const struct sysctlnode **)&node, 
+	(void *)&node, 
 	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
 	CTLTYPE_INT, "right", "right mouse button", adbkbd_sysctl_right, 
 		2, sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.11 src/sys/dev/adb/adb_ms.c:1.12
--- src/sys/dev/adb/adb_ms.c:1.11	Mon Aug  1 08:28:53 2011
+++ src/sys/dev/adb/adb_ms.c	Wed Aug 17 22:18:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.11 2011/08/01 12:28:53 mbalmer Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.12 2011/08/18 02:18:40 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.11 2011/08/01 12:28:53 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.12 2011/08/18 02:18:40 christos Exp $");
 
 #include 
 #include 
@@ -179,17 +179,17 @@
 	/* print out the type of mouse we have */
 	switch (sc->sc_adbdev->handler_id) {
 	case ADBMS_100DPI:
-		printf("%d-button, %d dpi mouse\n", sc->sc_buttons,
-		(int)(sc->sc_res));
+		printf("%d-button, %u dpi mouse\n", sc->sc_buttons,
+		sc->sc_res);
 		break;
 	case ADBMS_200DPI:
 		sc->sc_res = 200;
-		printf("%d-button, %d dpi mouse\n", sc->sc_buttons,
-		(int)(sc->sc_res));
+		printf("%d-button, %u dpi mouse\n", sc->sc_buttons,
+		sc->sc_res);
 		break;
 	case ADBMS_MSA3:
-		printf("Mouse Systems A3 mouse, %d-button, %d dpi\n",
-		sc->sc_buttons, (int)(sc->sc_res));
+		printf("Mouse Systems A3 mouse, %d-button, %u dpi\n",
+		sc->sc_buttons, sc->sc_res);
 		break;
 	case ADBMS_USPEED:
 		printf("MicroSpeed mouse, default parameters\n");
@@ -235,8 +235,8 @@
 printf("unknown device");
 break;
 			}
-			printf(" <%s> %d-button, %d dpi\n", sc->sc_devid,
-			sc->sc_buttons, (int)(sc->sc_res));
+			printf(" <%s> %d-button, %u dpi\n", sc->sc_devid,
+			sc->sc_buttons, sc->sc_res);
 		}
 		break;
 	default:
@@ -390,6 +390,7 @@
 		memcpy(buffer, sc->sc_buffer, len);
 
 		if (sc->sc_msg_len == 8) {
+			uint16_t res;
 			/* we have a true EMP device */
 #ifdef ADB_PRINT_EMP
 		
@@ -397,10 +398,11 @@
 			buffer[0], buffer[1], buffer[2], buffer[3],
 			buffer[4], buffer[5], buffer[6], buffer[7]);
 #endif
+			memcpy(sc->sc_devid, &buffer[0], 4);
+			memcpy(&res, &buffer[4], sizeof(res));
+			sc->sc_res = res;
 			sc->sc_class = buffer[6];
 			sc->sc_buttons = buffer[7];
-			sc->sc_res = (int)*(short *)&buffer[4];
-memcpy(sc->sc_devid, &(buffer[0]), 4);
 		} else if (buffer[0] == 0x9a &&
 		((buffer[1] == 0x20) || (buffer[1] == 0x21))) {
 			/*



CVS commit: src/sys/dev/adb

2012-08-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 29 02:44:07 UTC 2012

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

Log Message:
when in event mode, optionally pretend to be a USB keyboard
with this USB and ADB keyboards can coexist at the same mux, with X just
listening to /dev/wskbd instead of having to open each one separately
this can be controlled via sysctl, defaults to off for now
needs testing with non-US keyboards


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/adb/adb_usb_map.c
cvs rdiff -u -r1.5 -r1.6 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.17 src/sys/dev/adb/adb_kbd.c:1.18
--- src/sys/dev/adb/adb_kbd.c:1.17	Sat Jun  2 21:36:43 2012
+++ src/sys/dev/adb/adb_kbd.c	Wed Aug 29 02:44:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.17 2012/06/02 21:36:43 dsl Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.18 2012/08/29 02:44:07 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.17 2012/06/02 21:36:43 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.18 2012/08/29 02:44:07 macallan Exp $");
 
 #include 
 #include 
@@ -86,6 +86,8 @@ struct adbkbd_softc {
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	int sc_rawkbd;
 #endif
+	bool sc_emul_usb;
+
 	uint8_t sc_buffer[16];
 	uint8_t sc_pollbuf[16];
 	uint8_t sc_us;
@@ -151,6 +153,7 @@ const struct wsmouse_accessops adbkms_ac
 
 static int  adbkbd_sysctl_mid(SYSCTLFN_ARGS);
 static int  adbkbd_sysctl_right(SYSCTLFN_ARGS);
+static int  adbkbd_sysctl_usb(SYSCTLFN_ARGS);
 static void adbkbd_setup_sysctl(struct adbkbd_softc *);
 
 #endif /* NWSMOUSE > 0 */
@@ -215,6 +218,7 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_trans[2] = 111;	/* F12 */
 	sc->sc_power = 0x7f;
 	sc->sc_timestamp = 0;
+	sc->sc_emul_usb = FALSE;
 
 	printf(" addr %d: ", sc->sc_adbdev->current_addr);
 
@@ -340,9 +344,8 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_wsmousedev = config_found_ia(self, "wsmousedev", &am, 
 	wsmousedevprint);
 
-	if (sc->sc_wsmousedev != NULL)
-		adbkbd_setup_sysctl(sc);
 #endif
+	adbkbd_setup_sysctl(sc);
 
 	/* finally register the power button */
 	sysmon_task_queue_init();
@@ -573,7 +576,11 @@ adbkbd_ioctl(void *v, u_long cmd, void *
 	switch (cmd) {
 
 	case WSKBDIO_GTYPE:
-		*(int *)data = WSKBD_TYPE_ADB;
+		if (sc->sc_emul_usb) {
+			*(int *)data = WSKBD_TYPE_USB;
+		} else {
+			*(int *)data = WSKBD_TYPE_ADB;
+		}
 		return 0;
 	case WSKBDIO_SETLEDS:
 		adbkbd_set_leds(sc, *(int *)data);
@@ -674,34 +681,6 @@ adbkms_disable(void *v)
 {
 }
 
-static void
-adbkbd_setup_sysctl(struct adbkbd_softc *sc)
-{
-	const struct sysctlnode *me, *node;
-	int ret;
-
-	DPRINTF("%s: sysctl setup\n", device_xname(sc->sc_dev));
-	ret = sysctl_createv(NULL, 0, NULL, &me,
-	   CTLFLAG_READWRITE,
-	   CTLTYPE_NODE, device_xname(sc->sc_dev), NULL,
-	   NULL, 0, NULL, 0,
-	   CTL_MACHDEP, CTL_CREATE, CTL_EOL);
-
-	ret = sysctl_createv(NULL, 0, NULL,
-	(void *)&node, 
-	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
-	CTLTYPE_INT, "middle", "middle mouse button", adbkbd_sysctl_mid, 
-		1, (void *)sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
-		CTL_EOL);
-
-	ret = sysctl_createv(NULL, 0, NULL, 
-	(void *)&node, 
-	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
-	CTLTYPE_INT, "right", "right mouse button", adbkbd_sysctl_right, 
-		2, (void *)sc, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, 
-		CTL_EOL);
-}
-
 static int
 adbkbd_sysctl_mid(SYSCTLFN_ARGS)
 {
@@ -754,6 +733,77 @@ adbkbd_sysctl_right(SYSCTLFN_ARGS)
 	}
 }
 
+#endif /* NWSMOUSE > 0 */
+
+static int
+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;
+
+	DPRINTF("%s\n", __func__);
+	reg = sc->sc_emul_usb;
+	if (np) {
+		/* we're asked to write */	
+		node.sysctl_data = ®
+		if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 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 {
+wskbd_set_evtrans(sc->sc_wskbddev, NULL, 0);
+			}
+			return 0;
+		}
+		return EINVAL;
+	} else {
+		node.sysctl_data = ®
+		node.sysctl_size = sizeof(reg);
+		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	}
+}
+
+static void
+adbkbd_setup_sysctl(struct adbkbd_softc *sc)
+{
+	const struct sysctlnode *me, *node;
+	int ret;
+
+	DPRINTF("%s: sysctl setup\n", device_xname(sc->sc_dev));
+	ret = sysctl_createv(NULL, 0, NULL, &me,
+	   CTLFLAG_READWRITE,
+	   CTLTYPE_NODE, device_xname

CVS commit: src/sys/dev/adb

2012-08-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 30 01:27:45 UTC 2012

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

Log Message:
add options ADBKBD_EMUL_USB to turn USB emulation on by default


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.6 -r1.7 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.18 src/sys/dev/adb/adb_kbd.c:1.19
--- src/sys/dev/adb/adb_kbd.c:1.18	Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_kbd.c	Thu Aug 30 01:27:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.18 2012/08/29 02:44:07 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.19 2012/08/30 01:27:44 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.18 2012/08/29 02:44:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.19 2012/08/30 01:27:44 macallan Exp $");
 
 #include 
 #include 
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 
 #include 
 
 #include "opt_wsdisplay_compat.h"
+#include "opt_adbkbd.h"
 #include "adbdebug.h"
 #include "wsmouse.h"
 
@@ -336,6 +337,10 @@ adbkbd_attach(device_t parent, device_t 
 	a.accesscookie = sc;
 
 	sc->sc_wskbddev = config_found_ia(self, "wskbddev", &a, wskbddevprint);
+#ifdef ADBKBD_EMUL_USB
+	sc->sc_emul_usb = TRUE;
+	wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb, 128);
+#endif /* ADBKBD_EMUL_USB */
 
 #if NWSMOUSE > 0
 	/* attach the mouse device */

Index: src/sys/dev/adb/files.adb
diff -u src/sys/dev/adb/files.adb:1.6 src/sys/dev/adb/files.adb:1.7
--- src/sys/dev/adb/files.adb:1.6	Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/files.adb	Thu Aug 30 01:27:44 2012
@@ -1,5 +1,5 @@
 # 
-#	$NetBSD: files.adb,v 1.6 2012/08/29 02:44:07 macallan Exp $
+#	$NetBSD: files.adb,v 1.7 2012/08/30 01:27:44 macallan Exp $
 #
 # Apple Desktop Bus protocol and drivers
 
@@ -19,6 +19,7 @@ device adbkbd : wskbddev, wsmousedev, sy
 attach adbkbd at nadb
 file dev/adb/adb_kbd.c		adbkbd needs-flag
 file dev/adb/adb_usb_map.c	adbkbd
+defflag	opt_adbkbd.h	ADBKBD_EMUL_USB
 
 device adbbt : wskbddev
 attach adbbt at nadb



CVS commit: src/sys/dev/adb

2012-09-02 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Sep  2 21:06:54 UTC 2012

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

Log Message:
Move adbkbd_setup_sysctl() declaration to outside NWSMOUSE > 0, to
match the rest of the code.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/dev/adb/adb_kbd.c:1.20
--- src/sys/dev/adb/adb_kbd.c:1.19	Thu Aug 30 01:27:44 2012
+++ src/sys/dev/adb/adb_kbd.c	Sun Sep  2 21:06:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.19 2012/08/30 01:27:44 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.19 2012/08/30 01:27:44 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $");
 
 #include 
 #include 
@@ -155,10 +155,11 @@ const struct wsmouse_accessops adbkms_ac
 static int  adbkbd_sysctl_mid(SYSCTLFN_ARGS);
 static int  adbkbd_sysctl_right(SYSCTLFN_ARGS);
 static int  adbkbd_sysctl_usb(SYSCTLFN_ARGS);
-static void adbkbd_setup_sysctl(struct adbkbd_softc *);
 
 #endif /* NWSMOUSE > 0 */
 
+static void adbkbd_setup_sysctl(struct adbkbd_softc *);
+
 #ifdef ADBKBD_DEBUG
 #define DPRINTF printf
 #else



CVS commit: src/sys/dev/adb

2012-09-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 19 04:55:07 UTC 2012

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

Log Message:
some older powerbook keyboards use the same scancode for the power button as
later ones send on Fn-Command - now we look for that 'special' scancode only
on keyboards that actually need it


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sys/dev/adb/adb_kbd.c:1.21
--- src/sys/dev/adb/adb_kbd.c:1.20	Sun Sep  2 21:06:54 2012
+++ src/sys/dev/adb/adb_kbd.c	Wed Sep 19 04:55:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.20 2012/09/02 21:06:54 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $");
 
 #include 
 #include 
@@ -89,10 +89,10 @@ struct adbkbd_softc {
 #endif
 	bool sc_emul_usb;
 
+	uint32_t sc_power;
 	uint8_t sc_buffer[16];
 	uint8_t sc_pollbuf[16];
-	uint8_t sc_us;
-	uint8_t sc_power, sc_pe;
+	uint8_t sc_us, sc_pe;
 };	
 
 /*
@@ -218,7 +218,16 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_capslock = 0;
 	sc->sc_trans[1] = 103;	/* F11 */
 	sc->sc_trans[2] = 111;	/* F12 */
-	sc->sc_power = 0x7f;
+	
+	/*
+	 * Most ADB keyboards send 0x7f 0x7f when the power button is pressed.
+	 * Some older PowerBooks, like the 3400c, will send a single scancode
+	 * 0x7e instead. Unfortunately Fn-Command on some more recent *Books
+	 * sends the same scancode, so by default sc_power is set to a value
+	 * that can't occur as a scancode and only set to 0x7e on hardware that
+	 * needs it
+	 */
+	sc->sc_power = 0x;
 	sc->sc_timestamp = 0;
 	sc->sc_emul_usb = FALSE;
 
@@ -312,11 +321,9 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	case ADB_PBG3KBD:
 		printf("PowerBook G3 keyboard\n");
-		sc->sc_power = 0x7e;
 		break;
 	case ADB_PBG3JPKBD:
 		printf("PowerBook G3 keyboard (Japanese layout)\n");
-		sc->sc_power = 0x7e;
 		break;
 	case ADB_IBOOKKBD:
 		printf("iBook keyboard\n");
@@ -426,7 +433,6 @@ adbkbd_keys(struct adbkbd_softc *sc, uin
 
 			/* power button, report to sysmon */
 			sc->sc_pe = k1;
-		
 			sysmon_task_queue_sched(0, adbkbd_powerbutton, sc);
 		}
 	} else {



CVS commit: src/sys/dev/adb

2015-07-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 27 19:27:04 UTC 2015

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

Log Message:
add a sysctl to optionally ender ddb when pressing the power button


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/dev/adb/adb_kbd.c:1.25
--- src/sys/dev/adb/adb_kbd.c:1.24	Sat Nov  8 17:21:51 2014
+++ src/sys/dev/adb/adb_kbd.c	Mon Jul 27 19:27:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.24 2014/11/08 17:21:51 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.25 2015/07/27 19:27:04 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.24 2014/11/08 17:21:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.25 2015/07/27 19:27:04 macallan Exp $");
 
 #include 
 #include 
@@ -88,6 +88,7 @@ struct adbkbd_softc {
 	int sc_rawkbd;
 #endif
 	bool sc_emul_usb;
+	bool sc_power_dbg;
 
 	uint32_t sc_power;
 	uint8_t sc_buffer[16];
@@ -231,6 +232,7 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_power = 0x;
 	sc->sc_timestamp = 0;
 	sc->sc_emul_usb = FALSE;
+	sc->sc_power_dbg = FALSE;
 
 	aprint_normal(" addr %d: ", sc->sc_adbdev->current_addr);
 
@@ -354,6 +356,14 @@ adbkbd_attach(device_t parent, device_t 
 		aprint_verbose_dev(sc->sc_dev, "extended protocol enabled\n");
 	}
 
+#ifdef ADBKBD_DEBUG
+	cmd = ADBTALK(sc->sc_adbdev->current_addr, 1);
+	sc->sc_msg_len = 0;
+	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 0, NULL);
+	adbkbd_wait(sc, 10);
+	printf("buffer: %02x %02x\n", sc->sc_buffer[0], sc->sc_buffer[1]);
+#endif
+
 	if (adbkbd_is_console && (adbkbd_console_attached == 0)) {
 		wskbd_cnattach(&adbkbd_consops, sc, &adbkbd_keymapdata);
 		adbkbd_console_attached = 1;
@@ -469,9 +479,13 @@ adbkbd_powerbutton(void *cookie)
 {
 	struct adbkbd_softc *sc = cookie;
 
-	sysmon_pswitch_event(&sc->sc_sm_pbutton, 
-	ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
-	PSWITCH_EVENT_RELEASED);
+	if (sc->sc_power_dbg) {
+		Debugger();
+	} else {
+		sysmon_pswitch_event(&sc->sc_sm_pbutton, 
+		ADBK_PRESS(sc->sc_pe) ? PSWITCH_EVENT_PRESSED :
+		PSWITCH_EVENT_RELEASED);
+	}
 }
 
 static inline void
@@ -800,6 +814,32 @@ adbkbd_sysctl_usb(SYSCTLFN_ARGS)
 	}
 }
 
+static int
+adbkbd_sysctl_dbg(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct adbkbd_softc *sc=(struct adbkbd_softc *)node.sysctl_data;
+	const int *np = newp;
+	bool reg;
+
+	DPRINTF("%s\n", __func__);
+	reg = sc->sc_power_dbg;
+	if (np) {
+		/* we're asked to write */	
+		node.sysctl_data = ®
+		if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) {
+			
+			sc->sc_power_dbg = *(bool *)node.sysctl_data;
+			return 0;
+		}
+		return EINVAL;
+	} else {
+		node.sysctl_data = ®
+		node.sysctl_size = sizeof(reg);
+		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	}
+}
+
 static void
 adbkbd_setup_sysctl(struct adbkbd_softc *sc)
 {
@@ -818,6 +858,12 @@ adbkbd_setup_sysctl(struct adbkbd_softc 
 	CTLTYPE_BOOL, "emulate_usb", "USB keyboard emulation", 
 	adbkbd_sysctl_usb, 1, (void *)sc, 0, CTL_MACHDEP, 
 	me->sysctl_num, CTL_CREATE, CTL_EOL);
+	ret = sysctl_createv(NULL, 0, NULL,
+	(void *)&node, 
+	CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+	CTLTYPE_BOOL, "power_ddb", "power button triggers ddb", 
+	adbkbd_sysctl_dbg, 1, (void *)sc, 0, CTL_MACHDEP, 
+	me->sysctl_num, CTL_CREATE, CTL_EOL);
 #if NWSMOUSE > 0
 	if (sc->sc_wsmousedev != NULL) {
 		ret = sysctl_createv(NULL, 0, NULL,



CVS commit: src/sys/dev/adb

2015-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 29 08:45:29 UTC 2015

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

Log Message:
We don't have Debugger if we don't have DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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.25 src/sys/dev/adb/adb_kbd.c:1.26
--- src/sys/dev/adb/adb_kbd.c:1.25	Mon Jul 27 15:27:04 2015
+++ src/sys/dev/adb/adb_kbd.c	Wed Jul 29 04:45:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.25 2015/07/27 19:27:04 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.26 2015/07/29 08:45:28 christos Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.25 2015/07/27 19:27:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.26 2015/07/29 08:45:28 christos Exp $");
 
 #include 
 #include 
@@ -480,7 +480,11 @@ 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 :



CVS commit: src/sys/dev/adb

2016-06-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jun 20 00:05:58 UTC 2016

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

Log Message:
Add us.dvorak keymap variant for ADB keyboards.  Addresses PR 51255.

Tested by sevan@.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/dev/adb/adb_keymap.h:1.6
--- src/sys/dev/adb/adb_keymap.h:1.5	Sat Nov  8 16:52:35 2014
+++ src/sys/dev/adb/adb_keymap.h	Mon Jun 20 00:05:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.5 2014/11/08 16:52:35 macallan Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.6 2016/06/20 00:05:58 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -154,6 +154,50 @@ static const keysym_t akbd_keydesc_us[] 
 KC(127),  KS_Cmd_Debugger,
 };
 
+static const keysym_t akbd_keydesc_us_dvorak[] = {
+/*  pos  command		normal		shifted */
+KC(0),			KS_a,
+KC(1),			KS_o,
+KC(2),			KS_e,
+KC(3),			KS_u,
+KC(4),			KS_d,
+KC(5),			KS_i,
+KC(6),			KS_semicolon,	KS_colon,
+KC(7),			KS_q,
+KC(8),			KS_j,
+KC(9),			KS_k,
+
+KC(11),			KS_x,
+KC(12),			KS_apostrophe,	KS_quotedbl,
+KC(13),			KS_comma,	KS_less,
+KC(14),			KS_period,	KS_greater,
+KC(15),			KS_p,
+KC(16),			KS_f,
+KC(17),			KS_y,
+
+KC(24),			KS_bracketright, KS_braceright,
+KC(27),			KS_bracketleft,	KS_braceleft,
+
+KC(30),			KS_equal,	KS_plus,
+KC(31),			KS_r,
+KC(32),			KS_g,
+KC(33),			KS_slash,	KS_question,
+KC(34),			KS_c,
+KC(35),			KS_l,
+
+KC(37),			KS_n,
+KC(38),			KS_h,
+KC(39),			KS_minus,	KS_underscore,
+KC(40),			KS_t,
+KC(41),			KS_s,
+
+KC(43),			KS_w,
+KC(44),			KS_z,
+KC(45),			KS_b,
+KC(46),			KS_m,
+KC(47),			KS_v,
+};
+
 static const keysym_t akbd_keydesc_fr[] = {
 /*  pos		normal		shifted		altgr		shift-altgr */
 KC(0),	KS_q,
@@ -406,6 +450,7 @@ static const keysym_t akbd_keydesc_pt[] 
 
 static const struct wscons_keydesc akbd_keydesctab[] = {
 	KBD_MAP(KB_US,			0,	akbd_keydesc_us),
+	KBD_MAP(KB_US | KB_DVORAK,  KB_US,  akbd_keydesc_us_dvorak),
 	KBD_MAP(KB_FR,			KB_US,	akbd_keydesc_fr),
 	KBD_MAP(KB_JP,			KB_US,	akbd_keydesc_jp),
 	KBD_MAP(KB_FR | KB_NODEAD,	KB_FR,	akbd_keydesc_fr_nodead),



CVS commit: src/sys/dev/adb

2014-10-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Oct 29 00:48:12 UTC 2014

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

Log Message:
actually support EMP
( as in, look for additional motion info bits, not just buttons )


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/dev/adb/adb_ms.c:1.16
--- src/sys/dev/adb/adb_ms.c:1.15	Mon Nov 18 11:02:34 2013
+++ src/sys/dev/adb/adb_ms.c	Wed Oct 29 00:48:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.15 2013/11/18 11:02:34 nisimura Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.15 2013/11/18 11:02:34 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.16 2014/10/29 00:48:12 macallan Exp $");
 
 #include 
 #include 
@@ -564,8 +564,38 @@ adbms_process_event(struct adbms_softc *
 			break;
 	}
 
-	dx = ((int)(buffer[1] & 0x3f)) - ((buffer[1] & 0x40) ? 64 : 0);
-	dy = ((int)(buffer[0] & 0x3f)) - ((buffer[0] & 0x40) ? 64 : 0);
+	if (sc->sc_adbdev->handler_id != ADBMS_EXTENDED) {
+		dx = ((int)(buffer[1] & 0x3f)) - ((buffer[1] & 0x40) ? 64 : 0);
+		dy = ((int)(buffer[0] & 0x3f)) - ((buffer[0] & 0x40) ? 64 : 0);
+	} else {
+		/* EMP crap, additional motion bits */
+		int shift = 7, ddx, ddy, sign, smask;
+
+#ifdef ADBMS_DEBUG
+		printf("EMP packet:");
+		for (i = 0; i < len; i++)
+			printf(" %02x", buffer[i]);
+		printf("\n");
+#endif
+		dx = (int)buffer[1] & 0x7f;
+		dy = (int)buffer[0] & 0x7f;
+		for (i = 2; i < len; i++) {
+			ddx = (buffer[i] & 0x07);
+			ddy = (buffer[i] & 0x70) >> 4;
+			dx |= (ddx << shift);
+			dy |= (ddy << shift);
+			shift += 3;
+		}
+		sign = 1 << (shift - 1);
+		smask = 0x << shift;
+		if (dx & sign)
+			dx |= smask;
+		if (dy & sign)
+			dy |= smask;
+#ifdef ADBMS_DEBUG
+		printf("%d %d %08x %d\n", dx, dy, smask, shift);
+#endif
+	}
 
 	if (sc->sc_class == MSCLASS_TRACKPAD) {
 



CVS commit: src/sys/dev/adb

2014-11-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov  8 16:52:35 UTC 2014

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

Log Message:
nicely ask the keyboard to distinguish between left and right Control, Alt
and Shift keys.
Welcome to the world of accents and diacritics!


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r1.1 -r1.2 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.22 src/sys/dev/adb/adb_kbd.c:1.23
--- src/sys/dev/adb/adb_kbd.c:1.22	Mon Nov 18 11:02:34 2013
+++ src/sys/dev/adb/adb_kbd.c	Sat Nov  8 16:52:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $");
 
 #include 
 #include 
@@ -190,6 +190,7 @@ adbkbd_attach(device_t parent, device_t 
 #if NWSMOUSE > 0
 	struct wsmousedev_attach_args am;
 #endif
+	uint8_t buffer[2];
 
 	sc->sc_dev = self;
 	sc->sc_ops = aaa->ops;
@@ -333,6 +334,27 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	}
 
+	/*
+	 * try to switch to extended protocol
+	 * as in, tell the keyboard to distinguish between left and right
+	 * Shift, Control and Alt keys
+	 */
+	cmd = ADBLISTEN(sc->sc_adbdev->current_addr, 3);
+	buffer[0] = sc->sc_adbdev->current_addr;
+	buffer[1] = 3;
+	sc->sc_msg_len = 0;
+	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 2, buffer);
+	adbkbd_wait(sc, 10);
+
+	cmd = ADBTALK(sc->sc_adbdev->current_addr, 3);
+	sc->sc_msg_len = 0;
+	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 0, NULL);
+	adbkbd_wait(sc, 10);
+	if ((sc->sc_msg_len == 4) && (sc->sc_buffer[3] == 3)) {
+		printf("%s: extended protocol enabled\n",
+		device_xname(sc->sc_dev));
+	}
+
 	if (adbkbd_is_console && (adbkbd_console_attached == 0)) {
 		wskbd_cnattach(&adbkbd_consops, sc, &adbkbd_keymapdata);
 		adbkbd_console_attached = 1;

Index: src/sys/dev/adb/adb_keymap.h
diff -u src/sys/dev/adb/adb_keymap.h:1.4 src/sys/dev/adb/adb_keymap.h:1.5
--- src/sys/dev/adb/adb_keymap.h:1.4	Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_keymap.h	Sat Nov  8 16:52:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.4 2012/08/29 02:44:07 macallan Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.5 2014/11/08 16:52:35 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -148,7 +148,9 @@ static const keysym_t akbd_keydesc_us[] 
 KC(120),KS_Cmd_Screen1,	KS_f2,
 KC(121),KS_Cmd_ScrollFastDown, KS_Next,
 KC(122),KS_Cmd_Screen0,	KS_f1,
-
+KC(123),			KS_Shift_R,
+KC(124),			KS_Alt_R,
+KC(125),			KS_Control_R,
 KC(127),  KS_Cmd_Debugger,
 };
 

Index: src/sys/dev/adb/adb_usb_map.c
diff -u src/sys/dev/adb/adb_usb_map.c:1.1 src/sys/dev/adb/adb_usb_map.c:1.2
--- src/sys/dev/adb/adb_usb_map.c:1.1	Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_usb_map.c	Sat Nov  8 16:52:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_usb_map.c,v 1.1 2012/08/29 02:44:07 macallan Exp $ */
+/*	$NetBSD: adb_usb_map.c,v 1.2 2014/11/08 16:52:35 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_usb_map.c,v 1.1 2012/08/29 02:44:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_usb_map.c,v 1.2 2014/11/08 16:52:35 macallan Exp $");
 
 #include 
 #include 
@@ -158,9 +158,9 @@ keysym_t adb_to_usb[] = {
 /* 120, KS_f2		*/		59,
 /* 121, KS_Next		*/		78,
 /* 122, KS_f1		*/		58,
-/* 123			*/		0,
-/* 124			*/		0,
-/* 125			*/		0,
+/* 123, KS_Shift_R	*/		229,
+/* 124, KS_Alt_R	*/		230,
+/* 125, KS_Control_R	*/		228,
 /* 126			*/		0,
 /* 127, KS_Cmd_Debugger	*/		102
 };



CVS commit: src/sys/dev/adb

2014-11-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov  8 17:21:51 UTC 2014

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

Log Message:
aprint_*-ize


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/adb/adb_bus.c
cvs rdiff -u -r1.23 -r1.24 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_bus.c
diff -u src/sys/dev/adb/adb_bus.c:1.9 src/sys/dev/adb/adb_bus.c:1.10
--- src/sys/dev/adb/adb_bus.c:1.9	Tue May 12 14:07:01 2009
+++ src/sys/dev/adb/adb_bus.c	Sat Nov  8 17:21:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_bus.c,v 1.9 2009/05/12 14:07:01 cegger Exp $ */
+/*	$NetBSD: adb_bus.c,v 1.10 2014/11/08 17:21:51 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.9 2009/05/12 14:07:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.10 2014/11/08 17:21:51 macallan Exp $");
 
 #include 
 #include 
@@ -171,7 +171,7 @@ nadb_init(device_t dev)
 			if (config_found(sc->sc_dev, &aaa, nadb_devprint)) {
 devmask |= (1 << i);
 			} else {
-printf(" not configured\n");
+aprint_normal(" not configured\n");
 			}
 		}
 	}
@@ -183,7 +183,7 @@ nadb_init(device_t dev)
 int
 nadb_print(void *aux, const char *what)
 {
-	printf(": Apple Desktop Bus\n");
+	aprint_normal(": Apple Desktop Bus\n");
 	return 0;
 }
 
@@ -197,13 +197,13 @@ nadb_devprint(void *aux, const char *wha
 
 	switch(aaa->dev->original_addr) {
 		case 2:
-			printf("%s: ADB Keyboard", what);
+			aprint_normal("%s: ADB Keyboard", what);
 			break;
 		case 3:
-			printf("%s: ADB relative pointing device", what);
+			aprint_normal("%s: ADB relative pointing device", what);
 			break;
 		default:
-			printf("%s: something from address %d:%02x",
+			aprint_normal("%s: something from address %d:%02x",
 			what,
 			aaa->dev->original_addr,
 			aaa->dev->handler_id);

Index: src/sys/dev/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.23 src/sys/dev/adb/adb_kbd.c:1.24
--- src/sys/dev/adb/adb_kbd.c:1.23	Sat Nov  8 16:52:35 2014
+++ src/sys/dev/adb/adb_kbd.c	Sat Nov  8 17:21:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.24 2014/11/08 17:21:51 macallan Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.23 2014/11/08 16:52:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.24 2014/11/08 17:21:51 macallan Exp $");
 
 #include 
 #include 
@@ -232,14 +232,14 @@ adbkbd_attach(device_t parent, device_t 
 	sc->sc_timestamp = 0;
 	sc->sc_emul_usb = FALSE;
 
-	printf(" addr %d: ", sc->sc_adbdev->current_addr);
+	aprint_normal(" addr %d: ", sc->sc_adbdev->current_addr);
 
 	switch (sc->sc_adbdev->handler_id) {
 	case ADB_STDKBD:
-		printf("standard keyboard\n");
+		aprint_normal("standard keyboard\n");
 		break;
 	case ADB_ISOKBD:
-		printf("standard keyboard (ISO layout)\n");
+		aprint_normal("standard keyboard (ISO layout)\n");
 		break;
 	case ADB_EXTKBD:
 		cmd = ADBTALK(sc->sc_adbdev->current_addr, 1);
@@ -250,87 +250,87 @@ adbkbd_attach(device_t parent, device_t 
 		/* Ignore Logitech MouseMan/Trackman pseudo keyboard */
 		/* XXX needs testing */
 		if (sc->sc_buffer[2] == 0x9a && sc->sc_buffer[3] == 0x20) {
-			printf("Mouseman (non-EMP) pseudo keyboard\n");
+			aprint_normal("Mouseman (non-EMP) pseudo keyboard\n");
 			return;
 		} else if (sc->sc_buffer[2] == 0x9a && 
 		sc->sc_buffer[3] == 0x21) {
-			printf("Trackman (non-EMP) pseudo keyboard\n");
+			aprint_normal("Trackman (non-EMP) pseudo keyboard\n");
 			return;
 		} else {
-			printf("extended keyboard\n");
+			aprint_normal("extended keyboard\n");
 			adbkbd_initleds(sc);
 		}
 		break;
 	case ADB_EXTISOKBD:
-		printf("extended keyboard (ISO layout)\n");
+		aprint_normal("extended keyboard (ISO layout)\n");
 		adbkbd_initleds(sc);
 		break;
 	case ADB_KBDII:
-		printf("keyboard II\n");
+		aprint_normal("keyboard II\n");
 		break;
 	case ADB_ISOKBDII:
-		printf("keyboard II (ISO layout)\n");
+		aprint_normal("keyboard II (ISO layout)\n");
 		break;
 	case ADB_PBKBD:
-		printf("PowerBook keyboard\n");
+		aprint_normal("PowerBook keyboard\n");
 		sc->sc_power = 0x7e;
 		sc->sc_power_button_delay = 1;
 		break;
 	case ADB_PBISOKBD:
-		printf("PowerBook keyboard (ISO layout)\n");
+		aprint_normal("PowerBook keyboard (ISO layout)\n");
 		sc->sc_power = 0x7e;
 		sc->sc_power_button_delay = 1;
 		break;
 	case ADB_ADJKPD:
-		printf("adjustable keypad\n");
+		aprint_normal("adjustable keypad\n");
 		break;
 	case ADB_ADJKBD:
-		printf("adjustable keyboard\n");
+		aprint_normal("adjustable keyboard\n");
 		break;
 	case ADB_ADJISOKBD:
-		printf("adjustable keyboard (ISO layout)\n");
+		aprint_normal("adjustable keyboard (ISO layout)\n");
 		break;
 	case AD

CVS commit: src/sys/dev/adb

2013-11-18 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Nov 18 11:02:34 UTC 2013

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

Log Message:
minor tweaks to shut gcc4.8 warning off.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.14 -r1.15 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_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.21 src/sys/dev/adb/adb_kbd.c:1.22
--- src/sys/dev/adb/adb_kbd.c:1.21	Wed Sep 19 04:55:06 2012
+++ src/sys/dev/adb/adb_kbd.c	Mon Nov 18 11:02:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.21 2012/09/19 04:55:06 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $");
 
 #include 
 #include 
@@ -814,6 +814,8 @@ adbkbd_setup_sysctl(struct adbkbd_softc 
 		me->sysctl_num, CTL_CREATE, CTL_EOL);
 	}
 #endif /* NWSMOUSE > 0 */
+
+	(void)ret;
 }
 
 SYSCTL_SETUP(sysctl_adbkbdtrans_setup, "adbkbd translator setup")

Index: src/sys/dev/adb/adb_ms.c
diff -u src/sys/dev/adb/adb_ms.c:1.14 src/sys/dev/adb/adb_ms.c:1.15
--- src/sys/dev/adb/adb_ms.c:1.14	Sat Oct 27 17:18:14 2012
+++ src/sys/dev/adb/adb_ms.c	Mon Nov 18 11:02:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_ms.c,v 1.14 2012/10/27 17:18:14 chs Exp $	*/
+/*	$NetBSD: adb_ms.c,v 1.15 2013/11/18 11:02:34 nisimura Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.14 2012/10/27 17:18:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.15 2013/11/18 11:02:34 nisimura Exp $");
 
 #include 
 #include 
@@ -743,6 +743,8 @@ init_trackpad(struct adbms_softc *sc)
 	CTLTYPE_INT, "tapping", "tapping the pad causes button events",
 	sysctl_adbms_tap, 1, (void *)sc, 0,
 	CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL);
+
+	(void)ret;
 }
 
 static int