Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!uflorida!gatech!udel!udccvax1!anand From: anand@vax1.acs.udel.EDU (Anand Iyengar) Newsgroups: comp.society.futures Subject: Re: Keyboards - input devices Message-ID: <2714@udccvax1.acs.udel.EDU> Date: 19 Jan 89 22:36:20 GMT References: <19626@uflorida.cis.ufl.EDU> <315@s1.sys.uea.ac.uk> <292@ultb.UUCP> Reply-To: anand@vax1.acs.udel.EDU (Anand Iyengar) Organization: The Lab Rats Lines: 54 In article <292@ultb.UUCP> jdb9608@ultb.UUCP (J.D. Beutel (713ICS)) writes: >A solution would be to have a tty driver that will map keys. The user could ... >No hardware would be affected, and the solution would allow a uniform and >personal choice of a Dvorak or other such change-the-names-of-the-keys-but- >don't-actually-move-any-around type keyboard. > >I think such a tty driver would need only two changes from ones used now: > 1) enable it to read a key map > 2) any char it recieves is used as an offset into the key map to > determin the char that is passed along--i.e., translate > >A problem would be that reading a key map from disk every key stroke would be >very inefficient, so the key map would need to be kept in memory with the tty >device driver. However, since each user might have a different key map, >the device driver would need an array of key maps (less than or equal to >128*2 bytes per user record), or perhaps a limited number of pre-defined >keyboard types corresponding to a user-modifiable minor device number? > >Are there any Un*x gurus out there that would care to comment on the >feasability of such an improvement to the tty driver? For a number of reasons, the modifications shouldn't really be put in the tty driver, but since we're using unix it doesn't have to be. Some time ago I wrote some code that does what you describe: remaps kb input according to a mapping file (for exactly that reason: I wanted a Dvorak keyboard, and the only terminals in the building that supported s dvorak KB layout got locked up at midnight. I either had to write some simple code to remap keys, or change my work schedule. Not a difficult choice...). At first I tried forking off a shell, and subsituting a pipe for stdin. Fair idea, but the shell (shells, actually, I tried csh and tcsh) was somewhat flakey about reading from non-tty's. No big deal...the source for _script_ (which, by definition does everything a (non-console) tty does) + very minor changes (I had less than an hour to spend on it) met the specs. I've been told that since the script that I used is BSD-code I can give away this source. So: If you would like the code, send me mail (anand@vax1.acs.udel.edu: see below) with your e-mail address, and I'll re-mail the source to you. You'll need a C compiler. Anand. -- {arpa | bit}net: anand@vax1.acs.udel.edu (<- prefer), iyengar@udel.edu csnet: iyengar%udel.edu@relay.cs.net uucp: ->unidot ->!cfg!udel!udccvax1!anand ->uunet -/ ->!harvard ->udel.edu!iyengar ->!allegra!berkeley -/