From owner-freebsd-hackers Wed Jan 5 19:58:11 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 3EBBB153A5 for ; Wed, 5 Jan 2000 19:58:09 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id VAA87098; Wed, 5 Jan 2000 21:57:52 -0600 (CST) (envelope-from dan) Date: Wed, 5 Jan 2000 21:57:52 -0600 From: Dan Nelson To: "Daniel O'Connor" Cc: Jim Shankland , lyndon@orthanc.ab.ca, freebsd-hackers@FreeBSD.ORG Subject: Re: Reading kbd scancodes from userland Message-ID: <20000105215752.A86025@dan.emsphone.com> References: <200001052345.PAA26271@biggusdiskus.flyingfox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from "Daniel O'Connor" on Thu Jan 6 11:37:39 GMT 2000 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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