hairydalek
Posts: 13
Joined: Mon May 28, 2012 7:50 pm

Remapping the Keyboard

Tue May 29, 2012 6:35 pm

Still getting my Pi up and running. My new problem is with the keyboard I have. I have an Apple extended keyboard which I am using with my Pi (I also have one of those keyboards from the first generation of iMacs).

The problem is this: I have a UK keyboard, so the @ is above the 2 , and the " is two keys to the right of the L key. However, on the Debian Squeeze I am using the keys are transposed.

So, I followed some instructions on getting the keyboard to map properly here:
http://elinux.org/R-Pi_Troubleshooting# ... an_Squeeze

All good. In command line mode, the keys seem to work. The problem starts when I type in starts and launch the GUI. If I start the LXTerminal application, I cannot type anything - nothing appears.

It's mapped to a Macintosh International layout. Any pointers or help here?

The contents of sudo nano /etc/default/keyboard are (and I am typing this on my Mac):

Code: Select all

XKBMODEL="macintosh"
XKBLAYOUT="gb"
XKBVARIANT="intl"
XKBOPTIONS="lv3:ralt_switch,compose:rctrl,terminate:ctrl_alt_bksp"
Thanks.
All the best,
Paul.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remapping the Keyboard

Tue May 29, 2012 8:14 pm

Weird. This is a complete guess, but I wonder if your Pi's power supply isn't coping with running your keyboard AND running X11 at the same time?!

hairydalek
Posts: 13
Joined: Mon May 28, 2012 7:50 pm

Re: Remapping the Keyboard

Wed May 30, 2012 8:25 am

That would be an interesting supposition. My keyboard has been showing some of the signs of being under powered - it repeats keys sometimes when it’s running in the console. However, before I made those keyboard changes, it was working in the GUI environment, which is why I’m suspecting it’s more a configuration problem.

Anyway, I’ll rummage around for a better power supply. I’m using a USB camera charger at the moment - I suspect that it may put out slightly less power than is needed (it’s a very small camera that you clip onto things like radio controlled cars). I have a couple of other USB based phone chargers around which I can try.
All the best,
Paul.

chipmonger
Posts: 14
Joined: Thu Mar 08, 2012 8:44 pm

Re: Remapping the Keyboard

Wed May 30, 2012 7:06 pm

Try this...

- Switch to root user.
- Run 'dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8 (or whatever country setting you need).
- Run 'dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC104 (again, change as needed).
- Reboot.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remapping the Keyboard

Wed May 30, 2012 9:37 pm

If that works, maybe the instructions on the wiki should be updated?

hairydalek
Posts: 13
Joined: Mon May 28, 2012 7:50 pm

Re: Remapping the Keyboard

Wed May 30, 2012 9:43 pm

chipmonger wrote:Try this...

- Switch to root user.
- Run 'dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8 (or whatever country setting you need).
- Run 'dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC104 (again, change as needed).
- Reboot.
Thanks :D That seems to have done that job. Further to this, the Raspberry Pi seems to prefer the old iMac keyboard (http://www.macwebguru.com/wp-content/up ... yboard.jpg) to the newer “crumb catcher” (http://www.instructables.com/image/FWXU ... -Clean.jpg) one. Must be a power thing.

I am also using my iPad power brick to power the Pi, and it’s much more lively. The charger I was originally using was clearly not getting enough juice to it.

Looks like I can start using the Pi instead of setting it up. Hooray!

AndrewS - it may also be worth compiling a list of keyboards that work and their settings? A lot of people will be using their existing keyboards from a variety of manufacturers. By the time schools get hold of these, such a list will be invaluable.
All the best,
Paul.

LGman
Posts: 1
Joined: Sat Jun 02, 2012 7:12 pm

Re: Remapping the Keyboard

Sat Jun 02, 2012 7:18 pm

Excuse the ignorance, but when you say "switch to root user", what do you mean? And how do I do that. I'm using Debian on my RPi.

Nburnes
Posts: 23
Joined: Fri May 25, 2012 7:00 am

Re: Remapping the Keyboard

Sat Jun 02, 2012 8:24 pm

LGman wrote:Excuse the ignorance, but when you say "switch to root user", what do you mean? And how do I do that. I'm using Debian on my RPi.

Code: Select all

sudo su

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: Remapping the Keyboard

Sun Jun 03, 2012 8:27 am

Nburnes wrote:
LGman wrote:Excuse the ignorance, but when you say "switch to root user", what do you mean? And how do I do that. I'm using Debian on my RPi.

Code: Select all

sudo su

Code: Select all

sudo bash.
surely - but a lot of people don't like doing that. I would add a sudo in front of each of the dpkg commands chipmonger lists.

User avatar
mumblefuzz
Posts: 7
Joined: Sun Jun 10, 2012 3:33 pm
Location: Richmond Hill, Canada

Re: Remapping the Keyboard

Sun Jun 10, 2012 3:38 pm

chipmonger wrote: - Run 'dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8 (or whatever country setting you need).
Worked. Thank you.
chipmonger wrote: - Run 'dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC104 (again, change as needed).
It thought about it for as while then came back to the command prompt having, apparently, done nothing. Is 'keyboard-configuration' a package that needs to be installed first?

User avatar
jojopi
Posts: 3037
Joined: Tue Oct 11, 2011 8:38 pm

Re: Remapping the Keyboard

Sun Jun 10, 2012 5:18 pm

mumblefuzz wrote:
chipmonger wrote:- Run 'dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC104 (again, change as needed).
It thought about it for as while then came back to the command prompt having, apparently, done nothing. Is 'keyboard-configuration' a package that needs to be installed first?
You need to reboot or run the following commands to activate the change:

Code: Select all

sudo setupcon
sudo udevadm trigger --subsystem-match=input --action=change
If you do not reboot, even if you run those commands, you may still need to restart the GUI. I consider all this a bug; does it apply to debian generally ?

User avatar
mumblefuzz
Posts: 7
Joined: Sun Jun 10, 2012 3:33 pm
Location: Richmond Hill, Canada

Re: Remapping the Keyboard

Sun Jun 10, 2012 6:52 pm

jojopi wrote:
mumblefuzz wrote:
chipmonger wrote:- Run 'dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC104 (again, change as needed).
It thought about it for as while then came back to the command prompt having, apparently, done nothing. Is 'keyboard-configuration' a package that needs to be installed first?
You need to reboot or run the following commands to activate the change:

Code: Select all

sudo setupcon
sudo udevadm trigger --subsystem-match=input --action=change
. . .
Thanks jojopi. It seems I have to do this from the 'Linux console'. All a moot point for now as I'm running the Pi headless (putty, ultraVNC). Will try this next time I attach it to a real screen and keyboard. Maybe this was the problem all along.

washe
Posts: 5
Joined: Mon Jun 11, 2012 1:47 am

Re: Remapping the Keyboard

Mon Jun 11, 2012 3:08 am

hairydalek, can you tell me what character comes up when you press the "\" key on your mac keyboard?

My Pi has not arrived yet, but I'm experimenting with debian under the QEMU emulation and finding it impossible to get a decent keyboard mapping using a Macintosh Extended keyboard.

With Debian running in virtualBox the best I can achieve transposes a number of keys including:
# -> nothing
| -> ~
\ -> #
~ -> |

But running the rip Debian distro through QEMU emulation gives me a '3' under the '\' key and no way to access the '#' character at all.

Trying the most 'correct' choices in dpkg-configure keyboard-setup
gives the following error:

"WARNING: Can not find "mac" in "macintosh_vndr/us"
or its counterpart
"WARNING: Can not find "mac" in "macintosh_vndr/gb"
and trawling google for this, it seems that macintosh keyboard support has been logged as a bug in Debian for a number of years.

So I'd really like to know ... are mac keyboards a lost cause in Debian .. and more so in Debian on the Pi? Or should I persevere? Or just wait for the real thing to arrive and stop messing with emulation?

washe
Posts: 5
Joined: Mon Jun 11, 2012 1:47 am

Re: Remapping the Keyboard

Mon Jun 11, 2012 9:38 am

I've found a temporary fix for my problem that works for Pi QEMU emulation (as guest on Debian Squeeze which is running in VirtualBox hosted on OSX). The trick is to change keyboard settings in the host (Deb Squeeze). QEMU is accessed via a VNC viewer which is having some effect on the keyboard mappings.

Changing the Debian keyboard layout using
setxkbmap -layout us

gives me a workable layout.

I would prefer gb but can live without the pound sign. Oddly, if I set it to gb:
setxkbmap -layout gb

the shift-2 symbol becomes double-quote instead of @

this is correct for various european keyboards, but not for gb which has the @ symbol at shift-2.

This workaround gets me the console in QEMU but if I go into X I lose keyboard use entirely.

It would be good to know more about where these keyboard mappings are stored so I could edit them if necessary. The man page for setxbmap doesn't spell it out... "An XKB keymap is constructed from a number of components which are compiled only as needed."

Presumably on the Pi I could tweak them in /usr/share/X11/xkb/ or does that apply only to X and not to the console?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Remapping the Keyboard

Mon Jun 11, 2012 3:27 pm

I'm afraid I can't help out with the rest of your queries, but just to point out:
washe wrote:I would prefer gb but can live without the pound sign. Oddly, if I set it to gb:
setxkbmap -layout gb
the shift-2 symbol becomes double-quote instead of @
this is correct for various european keyboards, but not for gb which has the @ symbol at shift-2.
On a "proper" GB/UK keyboard, shift-2 is indeed double-quote (and on US keyboards, shift-2 is @). Maybe the Macs (I don't have any Apple hardware) have a quirk in that their UK keyboards still have a US 2 key? ;)

washe
Posts: 5
Joined: Mon Jun 11, 2012 1:47 am

Re: Remapping the Keyboard

Mon Jun 18, 2012 5:27 pm

AndrewS wrote: On a "proper" GB/UK keyboard, shift-2 is indeed double-quote (and on US keyboards, shift-2 is @). Maybe the Macs (I don't have any Apple hardware) have a quirk in that their UK keyboards still have a US 2 key? ;)
Yes i realised that after I posted: Macs are different - the UK follows the US layout for @ and "... it's on Continental European keyboards that the quote ends up at shift-2. Clearly I exist in a very Mac-centric world!

Since my posts my Pi has arrived so I no longer need to worry about the idiosyncrasies of Qemu running on a Debian virtual machine running on a Mac. I have educated myself by acquiring a small Windows keyboard for the Pi. In fact Debian on the Pi works seamlessly with both the Windows and Mac keyboards, no configuring required. Not with the Mac mice I have tried though - I suspect they might need proprietary drivers, or perhaps it's a USB power issue.

GrahamC
Posts: 27
Joined: Wed Dec 28, 2011 1:03 am

Re: Remapping the Keyboard

Mon Jun 18, 2012 11:40 pm

For anyone trying to use a keyboard that doesn't exactly match one of the standard keyboard layouts I suggest looking at the xmodmap command which allows individual keys to be reassigned. You can use xev to find the keycode that the X subsystem receives (this appears to be 8 greater than the keycodes used by loadkeys maps) and then put redefinitions for those keys into a file in your home directory that you load using xmodmap, e.g. in a .xsessionrc or similar file.

DancingMan
Posts: 3
Joined: Tue Jun 26, 2012 3:26 am

Re: Remapping the Keyboard

Wed Jul 04, 2012 4:09 am

I found that after running

Code: Select all

dpkg-reconfigure keyboard-configuration
I had to delete /etc/console-setup/cached.kmap.gz then reboot.
It took a little while longer to boot the next time, while it regenerated the cache, but it worked.

jdmech
Posts: 1
Joined: Mon Apr 14, 2014 8:45 pm
Location: West Hills, CA.

Re: Remapping the Keyboard

Sun May 04, 2014 9:41 am

:D :D Thanks guys!!! Totally helps me out :D :D

waterlovinguy
Posts: 1
Joined: Sun Jan 08, 2017 5:40 am

Re: Remapping the Keyboard

Sun Jan 08, 2017 4:37 pm

My first reply got dinged as spam because they thought my 'thank you' was spam. Sigh...
This thread was a 'life saver' for me because I was pulling my hair out trying to figure why my backslashes were hash marks.
Thanks for this thread and everyone who's posted tips in it. It saved the day for me.

Return to “Beginners”

Who is online

Users browsing this forum: boyoh and 64 guests