Subject: port-pmax/4519: pmax console bell
To: None <gnats-bugs@gnats.netbsd.org>
From: maximum entropy <entropy@ubik.bernstein.com>
List: netbsd-bugs
Date: 11/17/1997 07:44:37
>Number:         4519
>Category:       port-pmax
>Synopsis:       rcons console bell doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 17 04:50:04 1997
>Last-Modified:
>Originator:     maximum entropy
>Organization:
	
>Release:        <NetBSD-current source date>19971117
>Environment:
	
System: NetBSD ubik.bernstein.com 1.3_ALPHA NetBSD 1.3_ALPHA (GENERIC) #4: Mon Nov 17 07:14:10 EST 1997 entropy@ubik.bernstein.com:/usr/src/sys/arch/pmax/compile/GENERIC pmax


>Description:
	
The rcons driver used on the pmax port doesn't currently support ringing
the console bell.

Along the way, I fixed a (sort of) related problem:  on TC machines,
the keyboard is not initialized, so keyclick doesn't work.

>How-To-Repeat:
	
Log in on console.
echo ^G
>Fix:
	

The key to getting KBDReset() to work on TC machines is the added DELAY() after
sending each character in the reset string.  Everything else is more or
less self-explanatory.

Tested on both a 5000/120@33MHz and a 2100.  Tested with both LK201 and
LK401 keyboards.

diff -ur /import/tardis/usr/src/sys/arch/pmax/dev/lk201.c /sys/arch/pmax/dev/lk201.c
--- /import/tardis/usr/src/sys/arch/pmax/dev/lk201.c	Sun May 25 07:21:12 1997
+++ /sys/arch/pmax/dev/lk201.c	Mon Nov 17 07:05:45 1997
@@ -190,6 +190,8 @@
 	LK_LED_DISABLE, LED_ALL,	/* clear keyboard leds */
 };
 
+static void (*raw_kbd_putc) __P((dev_t dev, int c)) = NULL;
+static dev_t lk_out_dev = NODEV;
 
 /*
  * Initialize the Keyboard.
@@ -205,9 +207,23 @@
 	if (inKBDReset)
 		return;
 	inKBDReset = 1;
-	for (i = 0; i < sizeof(kbdInitString); i++)
+	for (i = 0; i < sizeof(kbdInitString); i++) {
 		(*putc)(kbddev, (int)kbdInitString[i]);
+		DELAY(20000);
+	}
 	inKBDReset = 0;
+	raw_kbd_putc = putc;
+	lk_out_dev = kbddev;
+}
+
+void
+lk_bell(ring)
+	int ring;
+{
+	if ((!ring) || (lk_out_dev == NODEV) || (raw_kbd_putc == NULL))
+		return;
+	(*raw_kbd_putc)(lk_out_dev, LK_RING_BELL);
+	DELAY(20000);
 }
 
 /*
diff -ur /import/tardis/usr/src/sys/arch/pmax/dev/lk201.h /sys/arch/pmax/dev/lk201.h
--- /import/tardis/usr/src/sys/arch/pmax/dev/lk201.h	Fri Oct 13 22:15:52 1995
+++ /sys/arch/pmax/dev/lk201.h	Mon Nov 17 07:05:00 1997
@@ -139,4 +139,5 @@
 #ifdef _KERNEL
 extern int LKgetc __P((dev_t dev));
 extern void lkdivert __P (( int (*getc_fn) __P ((dev_t dev)), dev_t dev));
+extern void lk_bell __P ((int ring));
 #endif
diff -ur /import/tardis/usr/src/sys/arch/pmax/dev/rcons.c /sys/arch/pmax/dev/rcons.c
--- /import/tardis/usr/src/sys/arch/pmax/dev/rcons.c	Mon Oct 14 12:19:09 1996
+++ /sys/arch/pmax/dev/rcons.c	Mon Nov 17 07:12:53 1997
@@ -75,6 +75,7 @@
 
 #include <machine/pmioctl.h>
 #include <pmax/dev/fbreg.h>
+#include <pmax/dev/lk201.h>
 
 
 
@@ -104,8 +105,6 @@
 
 void rconsstart		__P((struct tty *));
 
-void nobell __P ((int));
-
 
 /*
  * rcons_connect is called by fbconnect when the first frame buffer is
@@ -142,7 +141,7 @@
 #define HW_FONT_HEIGHT 15
 	rc.rc_maxrow = rc.rc_height / HW_FONT_HEIGHT;
 	rc.rc_maxcol = 80;
-	rc.rc_bell = nobell;
+	rc.rc_bell = lk_bell;
 
 	/* Initialize the state information. */
 	rc.rc_bits = 0;
@@ -168,14 +167,6 @@
 
 	rc.rc_xorigin = 0;
 	rc.rc_yorigin = 0;
-}
-
-/* We don't support ringing the keyboard bell yet */
-void
-nobell(arg)
-	int arg;
-{
-	return;
 }
 
 /* 
diff -ur /import/tardis/usr/src/sys/arch/pmax/tc/scc.c /sys/arch/pmax/tc/scc.c
--- /import/tardis/usr/src/sys/arch/pmax/tc/scc.c	Sat Nov 15 08:25:55 1997
+++ /sys/arch/pmax/tc/scc.c	Mon Nov 17 04:59:24 1997
@@ -616,14 +616,7 @@
 				cterm.c_ospeed = cterm.c_ispeed = 4800;
 				(void) sccparam(&ctty, &cterm);
 				DELAY(10000);
-#ifdef notyet
-				/*
-				 * For some reason doing this hangs the 3min
-				 * during booting. Fortunately the keyboard
-				 * works ok without it.
-				 */
 				KBDReset(ctty.t_dev, sccPutc);
-#endif /* notyet */
 				DELAY(10000);
 				splx(s);
 			} else if (unit == 0) {
>Audit-Trail:
>Unformatted: