LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2015, 08:04 AM   #1
ZXSpectrum48
LQ Newbie
 
Registered: Apr 2015
Location: England
Distribution: Raspbian
Posts: 2

Rep: Reputation: Disabled
Desperately seeking help with XMODMAP...


Hi Guys, genuine noob here. I need some help with my first 'puter project -

I have a PI2 running Raspbian, a vintage ZX Spectrum computer & hacked USB keyboard chip.

I've used the USB keyboard chip to interface the keys from the Spectrum into my PI2.

Unfortunately, I'm having problems re-mapping the keys using XMODMAP...

Now this where it gets weird, let me explain -

Firstly, I've managed to successfully map the basic numbers & letters, so that the Spectrum keys trigger the appropriate KeySymbol.
However, I'm having serious problems with the modifier keys...

SHIFT_L is mapping perfectly, and will trigger CAPITALIZED letters.
BUT... I can't seem to get accurate results from my re-mapped ALTGR button -

It works fine for SOME keys, but for others it will behave like SHIFT_L or not work at all

So as you can see below, I've (attempted) to re-map the Spectrum's SYMBOL SHIFT key to 'MOD5' (altgr), so that the 'number' keys will trigger !,@,#,$,%,&,',(,) and _.

so for 12345767890, I SHOULD be getting !@#$&%'()_
But - instead I'm getting 12345&78)_
It's working fine for keys '6', '9' and '0' but NOT for the other keys....

GGGrrrrrr... I don't understand what's happening here

Anyway, this is my xmodmap code. Please help me!

# first, sort out CAPS SHIFT and SYMBOL SHIFT as a shift and AltGr key..
xmodmap -e "keycode 85 = Shift_L"
xmodmap -e "keycode 97 = Control_R"
xset -r 85 # prevent new shift from autorepeating
xset -r 97 # prevent new AlrGr from autorepeating
xmodmap -e "add shift = Shift_L"
xmodmap -e "remove control = Control_R"
xmodmap -e "add mod5 = Control_R"

# one key maps to 'Caps Lock', need to remove this function to get it working
xmodmap -e "remove lock = Caps_Lock"

# Right, standard keys now... top row first, left to right...
xmodmap -e "keycode 89 = 1 1 exclam exclam exclam"
xmodmap -e "keycode 88 = 2 2 at at at"
xmodmap -e "keycode 112 = 3 3 numbersign numbersign numbersign"
xmodmap -e "keycode 34 = 4 4 dollar dollar dollar"
xmodmap -e "keycode 33 = 5 5 percent percent percent"
xmodmap -e "keycode 60 = 6 6 ampersand ampersand ampersand"
xmodmap -e "keycode 173 = 7 7 apostrophe apostrophe apostrophe"
xmodmap -e "keycode 114 = 8 8 parenleft parenleft parenleft parenleft"
xmodmap -e "keycode 106 = 9 9 parenright parenright parenright"
xmodmap -e "keycode 86 = 0 BackSpace underscore underscore underscore"

I should also mention that I've asked this same question on the PI forum, and no one's replied -

https://www.raspberrypi.org/forums/v...8&t=108434&e=0

Hopefully I can get some help here, as this project is currently useless without being able to re-map the keys.

Many thanks
 
Old 04-27-2015, 11:57 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 14,885

Rep: Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060
I remember the Sinclair Spectrum - the worst Basic interpreter of all time, cassette tape loading programs, etc. Non maskable interrupt rewriting the screen every 20 milliseconds. All for £120. It seemed like Sinclair could do no wrong - but that didn't last forever.

The keyboard is horribly non standard.I very much doubt if you can separate left & right Alt keys. It's also likely to map things to a Basic keyword - remember all those crazy modes?

I advise: Remove the keyboard chip and Sinclair Spectrum. Insert a usb keyboard into the Raspberry Pi, and go from there. You are reinventing the wheel there. And without wishing to pour scorn on your considerable efforts, the original is a little better than the one you have going.
 
Old 04-27-2015, 03:51 PM   #3
ZXSpectrum48
LQ Newbie
 
Registered: Apr 2015
Location: England
Distribution: Raspbian
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hey, don't knock the Speccy - it's still going strong after 35 years. Probably will be long after you and I are dead & buried

OK, perhaps I wasn't clear - the internal workings of the Spectrum have been removed. Now it's just a box containing a PI2, USB keyboard chip and a brand new membrane (working perfectly) along with the lovely rubber keys.

I've used XEV to confirm that the keys are all functioning correctly (no double triggers, etc.), so there's no problem with the hardware side of things.

Therefor it's likely that the problem is with XMODMAP / my XMODMAP programming - can I please get some helpful advice in resolving this problem?


Many thanks.
 
Old 04-28-2015, 04:08 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 14,885

Rep: Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060Reputation: 2060
You do need to set up your modifiers somewhere. Then there is the basic format

keycode = 1 2 3 4

1 = Code shown when you press the key
2 = Code shown when you press the key and Shift
3 = Code shown when you press the key and Modifier
4 = Code shown when you press the key and Modifier and Shift

The code is something like 'pound sign' for £ and do forth. I found a file where the standard keycodes were all listed. That was invaluable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Desperately Seeking Xen LXer Syndicated Linux News 1 06-29-2007 11:53 PM
Desperately seeking Linux compatible printer nappy501 Linux - Hardware 10 01-15-2007 09:24 AM
Desperately seeking drivers!!! navarre9 Linux - Networking 2 11-25-2003 06:01 PM
Desperately seeking drivers!!! navarre9 Linux - Software 2 11-25-2003 01:29 PM
Desperately seeking a ~real~ SATA driver: DrEntropy Linux - Hardware 6 11-03-2003 05:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration