Keyboard mappings problem on FreeBSD 12

Hi

I have a problem with one cloud console against a new test VM. Usually I can switch from Swedish to US keyboard (if it is vnc that is poorly setup in the backend) and I can at least do the basics in the console.

Now.. I am trying another clould vendor. And even US keyboard settings sucks as I sit on a MAC. I had the same problem om CentOS as on FreeBSD. But doing this on a CentOS host magically made it work to 100%...

yum install kbd
loadkeys se-mac
localectl set-keymap se-mac

Now... How can I accomplish this on FreeBSD as FreeBSD 12 is what I want to run there... I cannot find any swedish MAC keymap.

Thanks in advance

Not a keyboard settings guru..

/Peo
 
You have a physical PC which is running a VM and the VM is connecting to a cloud console?

Which one has the FreeBSD?

I have no knowledge of Swedish, but if you are using a virtual terminal (not X.org) try this:

In the file /etc/rc.conf

Code:
keymap="se"
In the file /home/you/.login_conf

Code:
me:\
:charset=iso-8859-1:\
:lang=sv_SE.ISO8859-1:
 
Hi

I have keymap="se.kbd" in rc.conf already. I am maybe looking for something that very well could have been named se-mac.kbd if it existed. See the linux conf above.


And regarding the stuff in login.conf, I have something similar. I have added:
Code:
        :charset=UTF-8:\
        :lang=en_US.UTF-8:  -----> do not want swedish error messages in console :)
there...

The keyboard now works as it should for a Swedish std keyboard that is NOT Mac. I know where all keys are on a US, Swedish and a Mac Swedish keyboard. So I can handle it. But I would prefer the keyboard to be 100% ok. It is 100% ok if using
Code:
loadkeys se-mac
localectl set-keymap se-mac

in linux. But I guess FreeBSD lacks this.. Note that the swedish MAC keyboard works 100% ok if using an SSH terminal against the FreeBSD server, but not in the cloud console. I can live with this as I do not use the console that much. But I also try to understand why it behaves like this...

Tnx
Peo
 
Yes. Used cap_mkdb when I changed the global login.conf file. But it ended up I instead used the local config in my home directory instead. And for that I only modified the text config file, which worked... (changes made in config file seen when I log in).

/Peo
 
Anyone that know anything about where I should start looking for info about how to create my own keymap file for MAC? This as it seems no se-mac.kbd exist for FreeBSD. If I have to spare and manage to create a complete one, I will later on publish it.
 
It's quite easy to create a keymap file, start at the /usr/share/vt/keymaps directory. Take the se.kbd keymap file as draft, copy it besides, ex se.mac.kbd, inspect it, after that read kbdmap(5).

Then have a UTF-8 character table at hand, ex https://www.utf8-chartable.de/. You can modify the keymap by setting the symbol the key should produce, or the decimal number or hexadecimal number.

Having misc/kbdscan installed is helpfull to determine the scancodes of the pressed keys.

Have also a look at the ch.macbook.acc, dk..., fr.., us.macbook keymap files, how the Mac specific keys are asigned there.

You can load the modified keymap with kbdmap(1).

I'm not sure where to submit the keymap, as a bug-report or at the freebsd-current mailing list.
 
Note that the swedish MAC keyboard works 100% ok if using an SSH terminal against the FreeBSD server, but not in the cloud console

For me, this mean that you do not have problems with your keyboard configuration, the problem it's with your terminal configuration

What it's the output of echo $TERM in the cloud console?

How do you connect to the cloud console (ssh, telnet, ...)?

Inside of Xorg or in a vt?
 
Hi

The cloud console in built in into the cloud provider gui as a web pop-up. Cannot do anyting about that.


If I SSH from my MAC to the cloud server where were everything works as expected (English language with Swedish MAC keyboard) it looks like this:
13:26:22 wolverine:~ $ grep kbd /etc/rc.conf
keymap="se.kbd"

13:26:30 wolverine:~ $ more .login_conf |grep UTF
:charset=UTF-8:\
:lang=en_US.UTF-8:

13:26:45 wolverine:~ $ echo $TERM
xterm-256color

Using the providers console, the only thing that differs is that it says just "xterm".

Note that it with the above settings works for a *standard* non Mac swedish keyboard in the console. This is how they map differently for a few important keys..

Example:
On a swedish MAC kbd
shift+7 -> /
option+7 -> |
option+shift+7 -> \

shift+8 -> (
option-8-> [
shift+option+8 -> {

shift+9 -> )
option-9-> ]
shift+option+9 -> }


On a swedish std kbd
shift+7 -> /
altgr++ -> \
altgr+< -> |

shift+8 -> (
shift+9 -> )

altgr+8 -> [
altgr+9 -> ]

altgr+7 -> {
altgr+0 -> }


So, using SSH I can for example correctly use shift+option+8 for a left curly bracket. But using the cloud console I have to use altgr+7 as it is placed on a non mac swedish keyboard.

If going back to the original problem. This problem exist in FreeBSD only as on Linux I can load a swedish mac keyboard layout that doesn't exist in FreeBSD.

The problem is not that big as I do not work in the console, just set stuff up of fix problems. But It would be great if it worked. I will probably take a look in to the hint I got regarding create such a keyboard layout for FreeBSD.

/Peo
 
I don't want to remap my keys om my mac. I want to make sure the server console matches my mac. I have an .Xmodmap om my mac for some special stuff. But that is not applicable here.
 
FWIW, ssh connections "reads" some of your local environment variables (example: TERM), and sets the on the target machine. This means that if the problem can be fixed by changing TERM on the target machine after ssh'ing in, you can also do TERM=xxx ssh ... as one way to fix the issue.
 
I have tried so change the TERM in the console. Still the key mappings are not on FreeBSD. I guess I have to build my own /usr/share/vt/keymap/se-mac.kbd in the server.

I can see there exist both a us.macbook.kbd and a us.kbd. For most languages there are no mac version.
 
Tried a little test.

cp /usr/share/vt/keymaps/se.kbd /usr/share/vt/keymaps/se.mac.kbd

Changed in the se.mac.kbd...
FROM:
008 '7' '/' nop nop '{' nop nop nop O
009 '8' '(' nop nop '[' nop nop nop O
010 '9' ')' nop nop ']' nop gs nop O

TO:
008 '7' '/' nop nop '|' '\' nop nop O
009 '8' '(' nop nop '[' '{' nop nop O
010 '9' ')' nop nop ']' '}' gs nop O

Changed in rc.conf to reflect the new keymap.

Now all these characters works on the keyboard. Not just remotely, but also in the console. Like linux that had a mac swedish keymap version.

Will do some more digging around this and if I have the energy, try to do a complete swedish MAC keymap for FreeBSD.
 
Back
Top