Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Jul 1997 16:09:22 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        Donn Miller <dmm125@bellatlantic.net>
Cc:        freebsd-questions@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   Re: mapping <alt> to meta key in syscons 
Message-ID:  <199707070709.QAA02496@zodiac.mech.utsunomiya-u.ac.jp>
In-Reply-To: Your message of "Sat, 05 Jul 1997 08:34:57 GMT." <Pine.BSF.3.96.970705082044.17884A-100000@myname.my.domain> 
References:  <Pine.BSF.3.96.970705082044.17884A-100000@myname.my.domain> 

next in thread | previous in thread | raw e-mail | index | archive | help
>I've been reading past news articles in *.freebsd.misc about the problems
>with syscons and using the <alt> 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 <alt> 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 <alt> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707070709.QAA02496>