[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian Linux keyboard mapping files ...



On Thu 01 Jul 2021 at 12:46:01 (-0400), Albretch Mueller wrote:
> $ ls -l /etc/console-setup/boottime.kmap.gz
> ls: cannot access '/etc/console-setup/boottime.kmap.gz': No such file
> or directory
> $
> 
>  Or did you mean in the /etc/console-setup of the installation CD/DVD?
> ~

No idea. That was somebody else's post.

> $ file /etc/console-setup/compose.KOI8-R.inc
> /etc/console-setup/compose.KOI8-R.inc: ASCII text
> 
> $ ls -l /etc/console-setup/compose.KOI8-R.inc &
> -rw-r--r-- 1 root root 31 Apr  6  2017 /etc/console-setup/compose.KOI8-R.inc
> 
> $ wc -l /etc/console-setup/compose.KOI8-R.inc &
> 1 /etc/console-setup/compose.KOI8-R.inc
> 
> $ cat /etc/console-setup/compose.KOI8-R.inc &[2] 8630
> # Compose sequences for KOI8-R
> $
> 
> $ ls -l /etc/console-setup/
> total 144
> -rw-r--r-- 1 root root  819 Mar 10  2018 cached_ISO-8859-15.acm.gz
> -rw-r--r-- 1 root root 4736 Mar 10  2018 cached_ISO-8859-15_del.kmap.gz
> -rw-r--r-- 1 root root 2427 Mar 10  2018 cached_Lat15-Fixed16.psf.gz

Those files look like they might date from the original installation.

> -rwxr-xr-x 1 root root  473 Feb 17 06:49 cached_setup_font.sh
> -rwxr-xr-x 1 root root  199 Feb 17 06:49 cached_setup_keyboard.sh
> -rwxr-xr-x 1 root root   73 Feb 17 06:49 cached_setup_terminal.sh
> -rw-r--r-- 1 root root 4024 Feb 17 06:49 cached_UTF-8_del.kmap.gz

Yes, they look rather like mine. The first part of
cached_UTF-8_del.kmap.gz can look really boring unless you're tracking
down some obscure modifier combination, but then it's followed by the
Compose sequences that get dpkg-reconfigure'd into it from remap.inc.

> -rw-r--r-- 1 root root   34 Apr  6  2017 compose.ARMSCII-8.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.CP1251.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.CP1255.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.CP1256.inc
> -rw-r--r-- 1 root root   41 Apr  6  2017 compose.GEORGIAN-ACADEMY.inc
> -rw-r--r-- 1 root root   36 Apr  6  2017 compose.GEORGIAN-PS.inc
> -rw-r--r-- 1 root root   32 Apr  6  2017 compose.IBM1133.inc
> -rw-r--r-- 1 root root   35 Apr  6  2017 compose.ISIRI-3342.inc
> -rw-r--r-- 1 root root   36 Apr  6  2017 compose.ISO-8859-10.inc
> -rw-r--r-- 1 root root   36 Apr  6  2017 compose.ISO-8859-11.inc
> -rw-r--r-- 1 root root 3737 Apr  6  2017 compose.ISO-8859-13.inc
> -rw-r--r-- 1 root root 3020 Apr  6  2017 compose.ISO-8859-14.inc
> -rw-r--r-- 1 root root 3552 Apr  6  2017 compose.ISO-8859-15.inc
> -rw-r--r-- 1 root root   36 Apr  6  2017 compose.ISO-8859-16.inc
> -rw-r--r-- 1 root root 3596 Apr  6  2017 compose.ISO-8859-1.inc
> -rw-r--r-- 1 root root 2893 Apr  6  2017 compose.ISO-8859-2.inc
> -rw-r--r-- 1 root root 3387 Apr  6  2017 compose.ISO-8859-3.inc
> -rw-r--r-- 1 root root 2805 Apr  6  2017 compose.ISO-8859-4.inc
> -rw-r--r-- 1 root root   35 Apr  6  2017 compose.ISO-8859-5.inc
> -rw-r--r-- 1 root root   35 Apr  6  2017 compose.ISO-8859-6.inc
> -rw-r--r-- 1 root root 1217 Apr  6  2017 compose.ISO-8859-7.inc
> -rw-r--r-- 1 root root   35 Apr  6  2017 compose.ISO-8859-8.inc
> -rw-r--r-- 1 root root 3617 Apr  6  2017 compose.ISO-8859-9.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.KOI8-R.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.KOI8-U.inc
> -rw-r--r-- 1 root root   32 Apr  6  2017 compose.TIS-620.inc
> -rw-r--r-- 1 root root   31 Apr  6  2017 compose.VISCII.inc

I've never worked out whether they do anything for me, as they appear
to be written in different (perhaps their titular) codesets.

> -rw-r--r-- 1 root root 1359 Apr  6  2017 remap.inc

That's the file I replace. The original version consists only of comments.

> $
> 
> > I'm not quite sure I can reconcile your subject line and text.
> 
>  Given the baseline option a user chooses as "language" during
> installation, the codes sent by the keyboard should be interpreted.
> 
>  There should be files with the associations of (unicode) numbers and
> keys on a keyboard. I don't think that information is "secret" in any
> way. Where can I find those files?

There's no such table: it cannot exist. Which unicode number would you
assign to CapsLock, or RightShift. There are several layers of
translation which lie between pressing/releasing a key and assigning
a character to the result. Some of these tables are built up out of
component parts, like the basic letter keys, the "shift"s at their
edges, function keys, keypads, multimedia, etc.

> > The eventual mapping is then placed in /etc/console-setup/, so mine
> > is in /etc/console-setup/cached_UTF-8_del.kmap.gz
> 
> $ ls -l /etc/console-setup/cached_UTF-8_del.kmap.gz
> -rw-r--r-- 1 root root 4024 Feb 17 06:49
> /etc/console-setup/cached_UTF-8_del.kmap.gz
> 
> $ cp -v /etc/console-setup/cached_UTF-8_del.kmap.gz /home/$(whoami)/temp
> '/etc/console-setup/cached_UTF-8_del.km
> ap.gz' -> '/home/debian/temp/cached_UTF-8_del.kmap.gz'
> 
>  and in this file:
> 
> $ ls -l /home/debian/temp/cached_UTF-8_del.kmap/cached_UTF-8_del.kmap
> -rw-r--r-- 1 debian debian 122418 Jul  1 11:51
> /home/debian/temp/cached_UTF-8_del.kmap/cached_UTF-8_del.kmap
> 
> I see no indication whatsoever about the fact that I am using a
> standard dvorak keyboard right now and that I am typing in English.
> 
> I mean something like:
> 
> http://xahlee.info/kbd/russian_keyboard_layout.html
> 
> Most probably I can't get why anyone would spend time doing such
> things, but Xah Lee seems to be interested on the (IMO nonsensical)
> "heat map" produced by typing the first chapter of Dostoevsky's "Crime
> and Punishment".
> 
> I just need, given the language, the unicode keys on regular keyboards
> out there.
> 
> I may be wrong, but I don't think that my English is so bad and/or my
> question so unhinged.
> 
> > the raw information appears to be under /usr/share/X11/xkb/
> 
> $ ls -l "/usr/share/X11/xkb/"
> total 24
> drwxr-xr-x  2 root root 4096 Feb 17 06:30 compat
> drwxr-xr-x  4 root root 4096 Feb 17 06:30 geometry
> drwxr-xr-x  4 root root 4096 Feb 17 06:30 keycodes
> drwxr-xr-x  2 root root 4096 Feb 17 06:30 rules
> drwxr-xr-x 14 root root 4096 Feb 17 06:30 symbols
> drwxr-xr-x  2 root root 4096 Feb 17 06:30 types
> $
> 
> find "/usr/share/X11/xkb" -type f -exec grep -il "iso\|lang" {} \;
> ...
> 
>  bingo!, but as you said those files look worrying complicated and intratextual.
> 
>  "The way I understand reality"; given a language, there should be
> just tables associating unicodes to keys on a keyboard
> 
> >I did just type
> >$ apt-file find keymaps
> >and it looks as though installing "console-data" might yield
> >some interesting files to peruse
> 
> # apt-get install console-data
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following additional packages will be installed:
>   console-common
> Suggested packages:
>   unicode-data
> The following NEW packages will be installed:
>   console-common console-data
> 0 upgraded, 2 newly installed, 0 to remove and 147 not upgraded.
> Need to get 1,270 kB of archives.
> After this operation, 2,996 kB of additional disk space will be used.
> Do you want to continue? [Y/n] Y
> Get:1 http://deb.debian.org/debian stretch/main amd64 console-data all
> 2:1.12-5 [1,150 kB]
> Get:2 http://deb.debian.org/debian stretch/main amd64 console-common
> all 0.7.89 [120 kB]
> Fetched 1,270 kB in 0s (2,998 kB/s)
> Preconfiguring packages ...
> Selecting previously unselected package console-data.
> (Reading database ... 265142 files and directories currently installed.)
> Preparing to unpack .../console-data_2%3a1.12-5_all.deb ...
> Unpacking console-data (2:1.12-5) ...
> Selecting previously unselected package console-common.
> Preparing to unpack .../console-common_0.7.89_all.deb ...
> Unpacking console-common (0.7.89) ...
> Setting up console-data (2:1.12-5) ...
> Looking for keymap to install:
> NONE
> Setting up console-common (0.7.89) ...
> Looking for keymap to install:
> NONE
> Processing triggers for man-db (2.7.6.1-2) ...
> #
> 
> 
> $ ls -l "/usr/share/console-setup/"
> total 44
> -rw-r--r-- 1 root root   272 Apr  6  2017 console-setup
> -rwxr-xr-x 1 root root  1793 Oct  9  2016 kbdnames-maker
> -rw-r--r-- 1 root root   140 Apr  6  2017 keyboard
> -rw-r--r-- 1 root root 31177 Apr  6  2017 KeyboardNames.pl
> 
> $ file "/usr/share/console-setup/KeyboardNames.pl"
> /usr/share/console-setup/KeyboardNames.pl: Perl script text executable
> 
> $
> 
>  KeyboardNames.pl contains associations of keyboard types with ISO
> 639-1 language codes
> 
>  But the kind of lookup tables I need I couldn't find.
> 
> # apt-get install unicode-data
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following NEW packages will be installed:
>   unicode-data
> 0 upgraded, 1 newly installed, 0 to remove and 147 not upgraded.
> Need to get 7,080 kB of archives.
> After this operation, 33.6 MB of additional disk space will be used.
> Get:1 http://deb.debian.org/debian stretch/main amd64 unicode-data all
> 9.0-1 [7,080 kB]
> Fetched 7,080 kB in 1s (4,260 kB/s)
> Selecting previously unselected package unicode-data.
> (Reading database ... 265852 files and directories currently installed.)
> Preparing to unpack .../unicode-data_9.0-1_all.deb ...
> Unpacking unicode-data (9.0-1) ...
> Setting up unicode-data (9.0-1) ...
> #
> 
>  and in "/usr/share/unicode/", I found files which look like what I am
> looking for, but not quite.
> 
>  Again, there files with look up tables determined by:
>  a) user language
>  b) type of keyboard
>  c) input method (at times a sequence of key strokes should be entered)
> 
>  Why is it so hard to find such a thing?

I guess the answer is "what useful use would it have?"

For a start, mapping key depressions to unicode text is a many-to-one
mapping. There are keystrokes that I never use—sensible combinations
like ø and ¶, where I find it easier to Compose them by pressing
CapsLock (= Compose) and a sequence of keys¹. No shifting, and the
key sequences make logical sense to me. There's no way of telling
which method was used, or which Shift key I use with which other keys.

Then there are tools to find out "what does this key do?", like
showkey and xev. One approach might be to build you own table by
capturing the output from xev and just striking all the keys in turn.
That gives you the coordinates of the keystrokes to form any
character. Use a character-counter to ascertain the "vocabulary" of
the text, so that you only have to determine the sequence of
keystrokes for characters that exist in the text when you build your
table.

¹ AltGr o yields ø, fair enough,
 but
  CapsLock /o yields ø
  CapsLock 'o yields ó
  CapsLock `o yields ò
  CapsLock ^o yields ô
  CapsLock ~o yields õ
  CapsLock -o yields ō
  CapsLock "o yields ö
  CapsLock !o yields ọ
  CapsLock .o yields ȯ
  CapsLock #o yields º
  CapsLock oo yields °
 and there's really no limit, so long as I can recall them:
  CapsLock co yields ©
  CapsLock ro yields ®
  CapsLock so yields §
  CapsLock %o yields ‰
 and you don't need an AltGr key, and you can configure it
 to seamlessly work on both VC and in X.

Cheers,
David.


Reply to: