Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2000 21:57:52 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        Jim Shankland <jas@flyingfox.com>, lyndon@orthanc.ab.ca, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Reading kbd scancodes from userland
Message-ID:  <20000105215752.A86025@dan.emsphone.com>
In-Reply-To: <XFMail.000106113739.doconnor@gsoft.com.au>; from "Daniel O'Connor" on Thu Jan  6 11:37:39 GMT 2000
References:  <200001052345.PAA26271@biggusdiskus.flyingfox.com> <XFMail.000106113739.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 06), Daniel O'Connor said:
> 
> On 05-Jan-00 Jim Shankland wrote:
> >    (void) tcsetattr(fd, 0, &old_t);
> >    if (ioctl(fd, KDSKBMODE, oldmode) < 0) {
> >      (void) fprintf(stderr,
> >                     "Danger, Will Robinson! Can't restore keyboard:
> >  %s\n",
> 
> You know I *really* wish there was a way to make sure that when your
> app closed the keyboard was unborked again..

Three ideas:

1) #! /bin/sh
   ./myprogram
   kbd_mode -a

   or a similar C routine that runs as the parent process, and resets
   the keyboard mode when the child exits

2) Is there a termios flag that could be used to indicate "raw keyboard
   mode"?  That way you can have your shell reset the mode via
   tcgetattr/tcsetattr (in zsh "ttyctl -f" does this).

3) Another alternative is to write a "keyboardd" that resets the mode;
   your program would (say) flock /dev/console and go into raw mode. 
   keyboardd would check every 10 seconds or so to see if the keyboard
   is in raw mode.  If it is, it does a flock on /dev/console (whick
   will block until your program exits), and resets the mode back.
 
-- 
	Dan Nelson
	dnelson@emsphone.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000105215752.A86025>