From owner-freebsd-questions Mon Jul 7 00:16:56 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA29766 for questions-outgoing; Mon, 7 Jul 1997 00:16:56 -0700 (PDT) Received: from agora.rdrop.com (root@agora.rdrop.com [199.2.210.241]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA29751 for ; Mon, 7 Jul 1997 00:16:51 -0700 (PDT) Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by agora.rdrop.com (8.8.5/8.8.5) with ESMTP id AAA27171 for ; Mon, 7 Jul 1997 00:13:53 -0700 (PDT) Received: from outmail.utsunomiya-u.ac.jp (outmail.utsunomiya-u.ac.jp [160.12.196.3]) by nasu.utsunomiya-u.ac.jp (8.8.4+2.7Wbeta4/3.5Wpl3) with ESMTP id QAA28862; Mon, 7 Jul 1997 16:03:45 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (fRB8JGaQU8oAqdAvNUN4nJqld8I5hixj@zodiac.mech.utsunomiya-u.ac.jp [160.12.33.1]) by outmail.utsunomiya-u.ac.jp (8.8.4+2.7Wbeta4/3.5Wpl3) with ESMTP id QAA26551; Mon, 7 Jul 1997 16:03:45 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (zenith.mech.utsunomiya-u.ac.jp [160.12.33.60]) by zodiac.mech.utsunomiya-u.ac.jp (8.7.6+2.6Wbeta7/3.4W/zodiac-May96) with ESMTP id QAA02496; Mon, 7 Jul 1997 16:09:23 +0900 (JST) Message-Id: <199707070709.QAA02496@zodiac.mech.utsunomiya-u.ac.jp> To: Donn Miller cc: freebsd-questions@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: mapping to meta key in syscons In-reply-to: Your message of "Sat, 05 Jul 1997 08:34:57 GMT." References: Date: Mon, 07 Jul 1997 16:09:22 +0900 From: Kazutaka YOKOTA Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >I've been reading past news articles in *.freebsd.misc about the problems >with syscons and using the key as meta (ESC) in emacs. Some >postings suggested adding lines to .emacs and/or loading/modifying the >right keyboard map with syscons - something about needing an 8th bit to >get the syscons to recognize alt as meta. > >I basically need to know what to modify, and where. There are many >possibilities; one is to modify the syscons.c, another is loading a >different key map (I use the default configuration - US). Another posting >suggested using kbdcontrol to change this. > >How is the key mapped by default in syscons? Also, what is the best >way to fix it so that alt is mapped to meta in emacs? Actually, I was >thinking that the "lowest level" solution was best, i.e., changing the >syscons or kbdcontrol behavior instead of just simply remapping the keys >under emacs. Presumably, I would think that a good solution would be to >make the behave the same way as pcvt allows. > > Donn Key maps are stored in /usr/share/syscons/keymaps. Have a look at them. They are in plain text format and can be easily edited. If you want to set the 8th bit of the character code when ALT is hold down, you modify 7th and 8th fields of the key definition. For example, us.iso.kbd has the following lines for 'a' and 's' keys. As you can see, the state of the alt key does not affect character codes for the US keyboard. scan cntrl alt alt cntrl lock code base shift cntrl shift alt shift cntrl shift state ------------------------------------------------------------------ 030 'a' 'A' soh soh 'a' 'A' soh soh C 031 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C The character codes for 'a', 'A', 's' and 'S' are 0x61, 0x41, 0x73 and 0x53 respectively. Make a copy of a key map file you like and add 0x80 to the 7th and 8th fields: 030 'a' 'A' soh soh 0xe1 0xc1 soh soh C 031 's' 'S' dc3 dc3 0xf3 0xd3 dc3 dc3 C Then you load the modified key map by running 'kbdcontrol -l my_new_map.kbd'. Remember syscons does not care whether the 8th bit of a character code is set or not. It just sends the code as is to the user land programs. (Of course I am too simplifying. If syscons is in raw mode, scan codes rather than character codes are sent to the programs. But this is irrelevant in your case :-) Kazu