dma@stat.Berkeley.EDU (D. Mark Abrahams) (06/05/90)
Is there a program for Sys V/386 3.2 which remaps keys on the keyboard? What I particularly want to do is interchange the meanings of the Control and Caps-Lock keys so that the 386 PC keyboard matches the "usual" UNIX keyboard layout for Control and Caps-Lock. So that I can switch between the two systems without the muscle-memory in my poor left forearm short-circuiting. Many thanks, Mark Abrahams dma@stat.berkeley.edu dma@ucbstat.bitnet ...!ucbvax!stat!dma
rogerk@sco.COM (Roger Knopf 5502) (06/07/90)
In article <36763@ucbvax.BERKELEY.EDU> dma@stat.Berkeley.EDU (D. Mark Abrahams) writes: >Is there a program for Sys V/386 3.2 which remaps keys on the keyboard? For SCO Unix Sys V/386, its mapkey. -- Roger Knopf <standard disclaimer applies> SCO Consulting Services uunet!sco!rogerk or rogerk@sco.com "...and he's got bare feet, too." 408-425-7222 (voice) 408-458-4227 (fax) --Charley Watkins
fish@gemed.com (Mark Fisher) (06/07/90)
Here is something that was posted a little while ago. I am posting it again because there might be someone else interested. It is a very annoying problem. From: km@cs.pitt.edu Newsgroups: comp.unix.i386 Subject: capslock/control keys Date: 2 May 90 19:27:24 GMT Reply-To: km@cs.pitt.edu () Organization: Univ. of Pittsburgh Computer Science As follow up to my own question, one CAN use the keymapping ioctl functions for special keys as well as regular keys. The following tiny program can be used to switch two keys. Note that this works for the console and virtual terminals only: under X windows, one can use xmodmap to accomplish the same thing. Ken Mitchum km@cs.pitt.edu #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: kd.c # Wrapped by km@speedy.cs.pitt.edu on Wed May 2 15:19:32 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'kd.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'kd.c'\" else echo shar: Extracting \"'kd.c'\" \(1663 characters\) sed "s/^X//" >'kd.c' <<'END_OF_FILE' X/* kd.c X Switch two keys by scan code. X Usage: kd key1 key2 X To switch Caps Lock and Left Control Keys: kd 29 58 X To switch accent/tilde and Escape keys: kd 1 41 X Does not work for X windows. X K. Mitchum km@cs.pitt.edu X*/ X#include <sys/types.h> X#include <stdio.h> X#include <fcntl.h> X#include <sys/at_ansi.h> X#include <sys/kd.h> X#include <sys/vt.h> X X Xmain(argc,argv) Xchar *argv[]; X{ X int error,fd, key1, key2; X keymap_t kmap; X struct key_t tmp; X X if(argc != 3) usage(argv[0]); X if(((key1 = atoi(argv[1])) < 0 || key1 >= NUM_KEYS) X || ((key2 = atoi(argv[2])) < 0 || key2 >= NUM_KEYS)) usage(argv[0]); X X if((fd = open("/dev/console",O_RDONLY)) < 0) X perror("Error opening"); X X printf("\nfd = %d",fd); X if((error = ioctl(fd,GIO_KEYMAP,&kmap)) < 0) X perror("Error getting keymap"); X X puten(&tmp,&kmap.key[key1]); X puten(&kmap.key[key1],&kmap.key[key2]); X puten(&kmap.key[key2],&tmp); X X pentry(&(kmap.key[key1]),key1); X pentry(&(kmap.key[key2]),key2); X X if((error = ioctl(fd,PIO_KEYMAP,&kmap)) < 0) X perror("Error setting keymap"); X close(fd); X} X Xputen(dest,src) Xstruct key_t *dest,*src; X{ X int i; X X for(i = 0; i < NUM_STATES; i++) X dest->map[i] = src->map[i]; X dest->spcl = src->spcl; X dest->flgs = src->flgs; X} X Xpentry(en,n) Xstruct key_t *en; X{ X int i; X printf("\nNumber %d %x",n,n); X printf("\nStates: "); X printf("%x ",en->map[0]); X X for(i = 1; i < NUM_STATES; i++) X printf("%x ",en->map[i] ); X printf("\nSpcl %x",en->spcl); X printf("\nFlgs %x", en->flgs); X} X Xusage(pname) Xchar *pname; X{ X fprintf(stderr,"\nUsage: %s key1 key2",pname); X fprintf(stderr,"\nkey1 & key2 are scancodes\n"); X exit(0); X} X END_OF_FILE if test 1663 -ne `wc -c <'kd.c'`; then echo shar: \"'kd.c'\" unpacked with wrong size! fi # end of 'kd.c' fi echo shar: End of shell archive. exit 0 -- // Mark M. Fisher // fish@gemed.ge.com // uunet!crdgw1!gemed!fish // sun!sunbrew!gemed!fish