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
        [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to