newcons and beeping X

From: Matthew D. Fuller <fullermd_at_over-yonder.net>
Date: Sun, 27 Apr 2014 09:33:20 -0500
I switched my workstation over to newcons today, and it worked just
fine, so yay.  After using it a while, it slowly dawned on me that I
wasn't making hardly any typing mistakes, nor was there any annoying
email coming in.  After all, if either were happing, I'd be getting
beeps; vt is making my life easier!  ...  wait...

A little investigation showed that the KDMKTONE ioctl handler was a
complete stub, so anything X tried to do to ring the bell was
completely unavailing.  Urg.  That's...  unpleasant.

>From poking around in vt and comparing with syscons, I've come up with
the following patch which makes it work (as the couple beeps I've
spawned just writing this email show).  It's kinda fugly; should
probably be better factored, or less magic-numberized.  Possibly
vtterm_bell() should be able to take pitch/duration like sc_bell()
does.  But it's _much_ better than nothing; the bell should work!



Index: sys/dev/vt/vt_core.c
===================================================================
--- sys/dev/vt/vt_core.c	(revision 264991)
+++ sys/dev/vt/vt_core.c	(working copy)
_at__at_ -1636,7 +1636,11 _at__at_
 #endif
 		return (0);
 	case KDMKTONE:      	/* sound the bell */
-		/* TODO */
+		if(*(int*)data)
+			sysbeep(1193182 / ((*(int*)data)&0xffff),
+			        (((*(int*)data)>>16)&0xffff)*hz/1000);
+		else
+			vtterm_bell(tm);
 		return (0);
 	case KIOCSOUND:     	/* make tone (*data) hz */
 		/* TODO */



-- 
Matthew Fuller     (MF4839)   |  fullermd_at_over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.
Received on Sun Apr 27 2014 - 12:33:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:48 UTC