How do I prevent Bochs translation of keycodes?

0

My native keyboard layout is "dk" (Danish).

I am running Tiny Core Linux in a virtual machine (Bochs). The virtual machine is booting the bootloader where I have the possibility of giving the keyboard map as a argument to the kernel. An example is "kmap=qwerty/dk". If I change the keyboard layout to "us" on the host, I can input the "=" in Bochs' X11 GUI. But then I can't input the "/". If I change keyboard layout after inputting anything, Bochs won't let me input more.

I have to keep using the X11 GUI because using i.e. the SDL GUI, CPU utilization is always 100%.

After booting TCL with the default keymap (as I can't change it in the bootloader), I can change keymap with "loadkmap". It reads from STDIN. The keymap is located in /usr/share/kmaps/qwerty/dk. I figured out I can go to the directory using "cd .." without having to use the key "/". But how do I load it into "loadkmap" without using "|" or "<"?

Janus Troelsen

Posted 2012-07-27T19:01:41.217

Reputation: 1 958

How about figuring out where those keys are in the other layout? – DevSolar – 2012-07-27T19:05:15.730

if you mean dk by other layout, that doesnt work because the linux kernel running inside thinks im using a us layout. if you mean us by other layout, that doesnt work because then im stuck with us layout outside the vm too because bochs crashes if i change it while running – Janus Troelsen – 2012-07-27T19:10:11.077

How about a script someplace: Can you make modifications to the filesystem to write a script to do what you want? Possibly on bootup? – Rich Homolka – 2012-07-27T19:10:21.987

What happens if you press / on the US layout (right next to .)? I don't know Bochs, but wouldn't copy & paste work? – Dennis – 2012-07-27T19:11:36.580

@RichHomolka: good idea, Ill try that if theres no other way to do this. this would mean id have to patch every single tcl image i used... – Janus Troelsen – 2012-07-27T19:11:38.220

@Dennis: I don't really think copy-pasting works with Bochs. The VMs input should be keycodes, not text. How would the X server doing the pasting know what keycodes to convert the text to? There's nowhere to paste anyway. – Janus Troelsen – 2012-07-27T19:14:23.990

@Dennis: Strangely enough, with dk as the host layout, that gives me a minus (which is what it would be on a dk layout), even if I didn't change the layout in the VM! Which means Bochs is doing some kind of conversion I guess? I'm glad you asked that question, maybe there's a way to turn this off in Bochs. Then I'd be able to do anything a US layout could do. – Janus Troelsen – 2012-07-27T19:18:48.793

@ysangkok: What happens if you change the host layout to US? Then you should have a fully functional US keyboard, right? – Dennis – 2012-07-27T19:20:21.040

@Dennis: then I'm stuck with the US layout since Bochs dies if I change the keymap while it's running. – Janus Troelsen – 2012-07-27T19:23:35.170

@Dennis: But there's not much sense in changing the keymap at all since Bochs apparently does some kind of translation. For example, the Danish layout's equal sign on Shift-0 doesn't work, even after changing the guest kbd layout to dk and keeping us on the host. I need to find out how to disable the translation. – Janus Troelsen – 2012-07-27T19:35:59.480

You've completely lost me. – DevSolar – 2012-07-28T07:07:43.123

Thanks everyone, I'm thankful for your ideas and suggestions. As noted in my answer, I had a small revelation and worked around the issue. – Janus Troelsen – 2012-07-28T08:16:24.010

Answers

0

I found out that using the US as host layout and booting with the default layout would get me a machine that worked well unless I pressed arrow left. If I pressed arrow left, backspace would delete whole words at a time. It was very hard for me to configure the network interfaces in this state. To get out of the mode I found out that I only needed to press L_ALT. This situation is not the "crash" I talked about, the crash was related to Bochs I believe, as it happened in the bootloader too. The arrow problem only occurred in the guest Linux.

After figuring out that L_ALT would get me out of this mode, I successfully configured the network interfaces. Now then I saved the VM's state, changed host keyboard to DK, restored state and connected over SSH. I now have access to the VM over SSH with my native layout configured on the host and the native layout being "used" (no layout actually used since it's over SSH and SSH does not send key codes AFAIK), which is pretty much what I wanted.

Janus Troelsen

Posted 2012-07-27T19:01:41.217

Reputation: 1 958