maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   xmodmap not working on n900 (https://talk.maemo.org/showthread.php?t=35101)

白い熊 2009-11-25 19:16

xmodmap not working on n900
 
Hmmm, so the fun starts.

I've compiled xmodmap on board the N900. It's not functional. If I try a simple key remap, the key gets probably captured, since it doesn't type anymore, but the replacement key doesn't get echoed...

BTW, I was surprised to find out that xmodmap doesn't exist even in the SDK repository for the N900.

Anyone know what's up?

debernardis 2009-11-25 19:34

Re: xmodmap not working on n900
 
Though I can't help since I've no device yet, I'm curious: did you also compile xev? Does it work?

白い熊 2009-11-25 19:40

Re: xmodmap not working on n900
 
I used qole's xev from here: http://talk.maemo.org/showpost.php?p...5&postcount=21

It works. It's a little clumsy, since every window is full screen on the N900, so you have to click back and forth, but you can determine key codes this way.

This xmodmap is a bugger though, I've never met a problem with it of this kind on any device, so am thinking what could be causing it, especially since I compiled it natively, not even in scratchbox...

I'm kinda surprised negativelly a little by the N900's non-readiness to be used by a GNU/Linux poweruser, seems it's gonna take a lotta effort to get it into a useable state...

白い熊 2009-11-25 20:34

Re: xmodmap not working on n900
 
I mean there is that damned busybox, which doesn't enable onboard development, since it has non-required grep etc. But the busybox cannot be easily replaced by GNU utilities, since it conflicts with grep sed bison and so on and on, so when you try and install GNU utilities you would render your system unuseable, as it'd install half of Nokia proprietary stuff and the phone would stop working...

So, surprisingly though this should be a GNU power phone, it might not be that way until some serious hacking...

qole 2009-11-25 22:13

Re: xmodmap not working on n900
 
Getting the keys remapped on the N900 is the bane of my existence right now.

I can get a temporary remap using the technique described here.

Quote:

Originally Posted by Marius Gedminas

I've had partial success by doing this:

$ xkbcomp :0 default.xkb
$ vi default.xkb

comment out the two rules that cause syntax errors:

// interpret AccessX_Enable+AnyOfOrNone(all) {
// action= LockControls(controls=);
// };

// interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) {
// action= LockControls(controls=);
// };

Now you can restore the settings back by running

$ xkbcmp default.xkb :0

if you screw up and end up with a nonfunctional keyboard.

Next

$ cp default.xkb mg.xkb
$ vi mg.xkb

key <RGHT> {
type= "PC_FN_LEVEL2",
symbols[Group1]= [ Right, Tab ]
};

$ xkbcomp mg.xkb :0

and now Fn+Right arrow is a Tab key.

Sadly I don't know enough about xkbcomp to see if it's possible to make it load incomplete maps on top of the current configuration, just to update a few symbols without replicating the full configuration.


EDIT: That xev is not mine, it is qwerty12's. And the problem that is exposed with xev (and my LXDE on Xephyr project) is that every window has to explicitly call XSetInputFocus() to grab the keyboard, otherwise the keystrokes don't go to that window.

白い熊 2009-11-25 22:58

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 392504)
the problem that is exposed with xev (and my LXDE on Xephyr project) is that every window has to explicitly call XSetInputFocus() to grab the keyboard, otherwise the keystrokes don't go to that window.

Damn it! I suspected something of this sort, after I stumbled upon your post with the xev, and experienced some related strange keyboard happenings.

This is the crux of my efforts since getting the phone today...

twoboxen 2009-11-25 23:01

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 392504)
Getting the keys remapped on the N900 is the bane of my existence right now.

I responded to you in another thread... I had SOME success editing the rx-51 file. What keys are you trying to map?

qole 2009-11-25 23:43

Re: xmodmap not working on n900
 
I remap several keys:
sterling -> bar
euro -> asciitilde
Fn-Right -> tab

Nothing works if I change the /usr/share/X11/xkb/symbols/nokia_vndr/rx-51 file. If I make the same changes to a custom qole.xkb file and then

sudo xkbcomp qole.xkb :0

I'm good to go until my next reboot.

白い熊 2009-11-25 23:45

Re: xmodmap not working on n900
 
Can you post your working qole.xkb as I see I'm thinking of similar keys, so I don't have to reinvent the wheel?

qole 2009-11-26 00:17

Re: xmodmap not working on n900
 
1 Attachment(s)
Sure, here it is. Sorry, I had to gzip it to attach it here.

Alan_Peery 2009-11-26 11:17

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 392643)
I remap several keys:
sterling -> bar
euro -> asciitilde
Fn-Right -> tab


I'm good to go until my next reboot.

Those are a very good match to what I want as well. When you figure out how to make it permanent, I'd love to see this as an installable package. Then we'd have something to hold us until generalized mapping became possible. ;-)

白い熊 2009-11-27 03:10

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 392698)
Sure, here it is. Sorry, I had to gzip it to attach it here.

Thanks for this. I'm not familiar with xkb mappings and on the road now, so quick question: can you, or did you already - didn't notice - map the Meta/Alt key somewhere. I sorely need it for Emacs, succeeded in ompiling it before borking the N900 with all the dev stuff.

If you didn't map it, can you propose a coded map, since you're somewhat more familiar with it than me?

Oh, and how about ESC?

白い熊 2009-11-27 03:19

Re: xmodmap not working on n900
 
BTW, I've found this: http://upir.cz/maemo/keyboards/

It's in the extras-devel repository as ukeyboard, and it's got some hardware keyboards, but they're borked on the N900, for instancee the Slovak keyboard has some redefines, but the RET key acts funny, but perhaps just some source modification needed and this will give us a power hardware keyboard, also between reboots...

twoboxen 2009-11-27 05:01

Re: xmodmap not working on n900
 
1 Attachment(s)
I have the following keys working with only modifying the rx-51 file and rebooting:
fn+z=>tilde
fn+c=>pipe
fn+left=>escape
fn+right=>tab

The only two keys that don't seem to work are:
fn+up=>page up
fn+down=>page down

The lines that don't seem to work for those entries are:

key <UP> { type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [ Up, PageUp ] };
key <DOWN> { type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [ Down, PageDown ] };

Anyone have any suggestions? I also tried PgDown/PgUp, but that didn't work either.

twoboxen 2009-11-27 18:13

Re: xmodmap not working on n900
 
On a 4-level key, does anyone know how to get the item in the 4th column?
1st: no modifiers
2nd: shift
3rd: fn
4th: ?

I tried fn+shift, but that didn't work. It would be great if we could get that 4th column working to have other keys like {, }, <, >, [, ], `, etc. Otherwise, I won't be able to program on the device after all :(

qole 2009-11-27 18:19

Re: xmodmap not working on n900
 
What level is Ctrl?

twoboxen 2009-11-27 19:01

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 396489)
What level is Ctrl?

I'm not sure... one of the few places I saw the 4th level differ from the 3rd is on the french keyboard. Maybe someone who's used a french n900 can tell us how they get to the 4th symbol for a particular key.

kalikiana 2009-11-27 20:04

Re: xmodmap not working on n900
 
ukeyboard seems to work nicely here. I imagine it would be fairly easy to use it and adapt the available keyboards. However, this would mean to replicate "advanced" layouts for any thinkable language, assuming non-English users are interested in this. I would hope there is a way that works "on top of" the normal keyboard layout.

白い熊 2009-11-27 20:16

Re: xmodmap not working on n900
 
Wait a sec, were you able to use at least one of the hardware keyboards in ukeyboard? I think it only adds two, slovak and czech, but I seemed to have probs with enter stopping working then and so.

You had no probs? I really would like to derive a dvorak keyboard, hardware that is, ukeyboard already has a dvorak virtual one, is OK.

I checked the sources, but am not completely sure how to setup the hardware dvorak keyboard there, did you take a look at them and do you have an idea how to set up one hardware keyboard there?

twoboxen 2009-11-28 03:14

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 396489)
What level is Ctrl?

I don't think control works with the keys (at least it didn't in any combination i could think to try).

IcyAirs 2009-12-03 18:57

Re: xmodmap not working on n900
 
While trying to find what could be the 4th level could be, i found this weird behavior when you use fn+ctrl to put down two consecutive symbols, where the keyboard becomes unresponsive except for return, which still adds lines. It happens in both nokia Conversation and also Leafpad, so its not the program capturing the keypresses for something else, not sure what's up with that. Some sort of ctrl-lock? not sure how to test it

I'm also trying to find how to adjust the keyboard, notably fn + directions for ^<>, but unsure how to skip the shift+direction designation to keep text selection.

Seeing how you guys are having trouble i'll probably back down for now (i somehow managed to get it to fail to boot, stuck on the .... booting screen from messing with rx-51, forced to flash), wait for someone to figure out exactly what's going on

I'm not thrilled with the symbols vkb being inconsistant for entry for signs that could be used for accents (tilde and whatnot, where you need to hit space after tapping it to enter the symbol, whereas stuff like copyright are entered on tap)

qole 2009-12-03 20:43

Re: xmodmap not working on n900
 
Quote:

Originally Posted by IcyAirs (Post 408168)
I'm also trying to find how to adjust the keyboard, notably fn + directions for ^<>, but unsure how to skip the shift+direction designation to keep text selection.

Please see my post above where I actually show how to do this (using only two levels instead of four). You need to use "PC_FN_LEVEL2" on the arrow keys.

IcyAirs 2009-12-04 01:20

Re: xmodmap not working on n900
 
Complete reading failure there, thanks for pointing it out... I somehow only managed to notice the issues you guys were having getting keymaps to stick, nothing about what you guys were actually succeeding at doing.

Any ideas why editing /usr/share/X11/xkb/symbols/nokia_vndr/rx-51 with vi might cause my device to fail to boot? I would imagine that worst case would just get me a nonfunctional keyboard, and needing to revert to the older version to fix it, but this is the second time I've edited rx-51 and caused the device to stall at the loading dots. Just trying to get an idea what could be system critical elements in a keyboard configuration file.

Edit: nevermind, I tried editing the file bit by bit this time and nothing blew up in my face, no idea what I could have done that caused system failure, though.

kwotski 2009-12-04 23:48

Re: xmodmap not working on n900
 
1 Attachment(s)
Quote:

Originally Posted by twoboxen (Post 395142)
I have the following keys working with only modifying the rx-51 file and rebooting:
fn+z=>tilde
fn+c=>pipe
fn+left=>escape
fn+right=>tab

The only two keys that don't seem to work are:
fn+up=>page up
fn+down=>page down

The lines that don't seem to work for those entries are:

key <UP> { type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [ Up, PageUp ] };
key <DOWN> { type[Group1] = "PC_FN_LEVEL2", symbols[Group1] = [ Down, PageDown ] };

Anyone have any suggestions? I also tried PgDown/PgUp, but that didn't work either.

Thanks very much for your work here! I've used it to set my keys up with the following mappings:

sterling -> | (bar)
euro -> ` (grave)
fn+backspace -> delete
fn+right -> > (greater)
fn+left -> < (less)
fn+up-> ^ (asciicircum)
fn+down-> % (percent)

which together with tab, esc, [, ], {, }, and ~ in the xterm key bar gives me more or less everything I need, I think.

After editing the rx-51 file, I found the command setxkbmap with no params was enough to get the keys loaded.

By way of return, I think you want Page_Up and Page_Down (with underscores) for your mappings on the fn+up and fn+down. I did try Page_Up in the fn+up slot and it seemed to work for me.

One curiosity of my own: I tried to map shift+space to Tab in the second column for SPCE in the english_base section (tried "tab" as well as "Tab") but with no luck. Pressing the shifted space did nothing (didn't even get a space out of it). However when I put (randomly) "colon" in the place of "Tab", shifted space got me a colon no problems... Something odd about tab in that position? I don't know.

If anyone wants to replicate or investigate this setup, the xterm bar commands (run as user) are

Code:

gconftool-2 -s /apps/osso/xterm/keys -t list --list-type=string "[Tab,Escape,bracketleft,bracketright,braceleft,braceright,asciitilde]"

 gconftool-2 -s /apps/osso/xterm/key_labels -t list --list-type=string "[Tab,Esc,\[,\],\{,\},~]"

and my /usr/share/X11/xkb/symbols/nokia_vndr/rx-51 file is attached.

Edit: if you try using the rx-51 file, results may depend on the regional settings of your n900, judging by the file itself!

Further Edit: Of course, you can get tab in the kb with ctrl-i in any case.. but still!

白い熊 2009-12-05 18:18

Re: xmodmap not working on n900
 
1 Attachment(s)
So, here is my layout for the brave few! DVORAK

The layout of the keys is:

| Ctr/Sym | :;1 | w 2 | v 3 | p 4 | y 5 | f 6 | g 7 | c 8 | r 9 | l 0 | .,= ....| DEL ..|
| FN......| a * | o + | e # | u - | i _ | d ! | h ? | t & | n < | s > | UP ` ...| RET ..|
| Shift...| z ~ | q $ | j / | k ( | x ) | b " | m ' | SPC/@.... | LEFT| DOWN bar| RIGHT |


Still a WIP with maybe minor changes to come.

Thanks everyone, especially qole, da man, for help...

IcyAirs 2009-12-08 19:53

Re: xmodmap not working on n900
 
Just a quick note here,

I was also using shift+space for tab and found it works everywhere else other than xterm... but the important thing for me was that changing shift+space breaks the page up functionality in browser. I currently have tab set to fn+backspace (shift for delete) and it works fine for me, reverted shift space to allow for pageup.

Thanks for the setxkbmap trick! I was using kill hildon-input-method for it to reload the maps, this way is much more reliable and safer

mikeos 2009-12-09 20:37

Re: xmodmap not working on n900
 
Quote:

Originally Posted by 白い熊 (Post 392146)
I used qole's xev from here: http://talk.maemo.org/showpost.php?p...5&postcount=21

It works. It's a little clumsy, since every window is full screen on the N900, so you have to click back and forth, but you can determine key codes this way.

This xmodmap is a bugger though, I've never met a problem with it of this kind on any device, so am thinking what could be causing it, especially since I compiled it natively, not even in scratchbox...

I'm kinda surprised negativelly a little by the N900's non-readiness to be used by a GNU/Linux poweruser, seems it's gonna take a lotta effort to get it into a useable state...

Seems like a broken XFree86 in the current version of Fremantle. Command xmodmap uses XChangeKeyboardMapping API which seems to be broken; keeps setting the keymap to random values (mostly zeros). These zeros are the reason why the key becomes "dead".
I have tried running xmodmap (and another simple C prog using above mentioned API) on a Ubuntu box against the $DISPLAY of the N900. And the result? Broken, Broken :-/

Someone can confirm this? Any developer understanding the issue is reading us?

twoboxen 2009-12-10 01:16

Re: xmodmap not working on n900
 
Quote:

Originally Posted by kwotski (Post 410864)
By way of return, I think you want Page_Up and Page_Down (with underscores) for your mappings on the fn+up and fn+down. I did try Page_Up in the fn+up slot and it seemed to work for me.

Worked great! Thanks!

delaroca 2010-01-30 14:33

Re: xmodmap not working on n900
 
Quote:

Originally Posted by mikeos (Post 419566)
Seems like a broken XFree86 in the current version of Fremantle. Command xmodmap uses XChangeKeyboardMapping API which seems to be broken;

I filed a bug report,

https://bugs.maemo.org/show_bug.cgi?id=8695

Could you add your test case to it?

--denis

mikeos 2010-02-01 13:25

Re: xmodmap not working on n900
 
thanks delaroca for filing the bug report, your test case enough represents the issue for being fully reproduced

delaroca 2010-02-02 03:17

Re: xmodmap not working on n900
 
Quote:

Originally Posted by 白い熊 (Post 411818)
So, here is my layout for the brave few! DVORAK

I notice that in your layout you have defined some FOUR_LEVEL mappings. I am curious since for me, the only FOUR_LEVEL mappings that work are those of 3rd level chars who have an uppercase counterpart. But your layout, as well as another I have seen from a French user show that functional FOUR_LEVEL layouts are possible... but I fail to find what is the "magic" is to make them work on my N900.

By the way, I think you could have implemented your layout say within the US section... instead of modifying the "english-base" which affects all other layouts that do a default include of that base.

--denis

白い熊 2010-02-02 05:38

Re: xmodmap not working on n900
 
Quote:

Originally Posted by delaroca (Post 506209)
I notice that in your layout you have defined some FOUR_LEVEL mappings. I am curious since for me, the only FOUR_LEVEL mappings that work are those of 3rd level chars who have an uppercase counterpart. But your layout, as well as another I have seen from a French user show that functional FOUR_LEVEL layouts are possible...

Dunno, I just put them in and they work...

Quote:

By the way, I think you could have implemented your layout say within the US section... instead of modifying the "english-base" which affects all other layouts that do a default include of that base.
Let's see, hmmmm... You're probably right, I didn't bother with it, actually as I didn't realize that this would change this at the time. Not worth going back to, as I wonder how many people really use the Dvorak keyboard, and how many out of these actually switch to other language input via the N900's rx maps.

I mean, after updates, my Dvorak layout is almost perfect, within the crappy keyboard confines of the N900 and other languages I use in GNU Emacs, where the Dvorak is the base and every other language is on top of it, works really well for instance for Russian, Japanese, Polish, etc.

But, yeah, the clean version should probably be within en-us.

delaroca 2010-02-02 11:25

Re: xmodmap not working on n900
 
Quote:

Originally Posted by 白い熊 (Post 506274)
Dunno, I just put them in and they work...

But trying to duplicate some of your FOUR_LEVEL mapping somehow doesn't work on my device. What "language / region" is your N900 configured for? In "Text Input" settings, what primary and secondary languages you have configured?

What flash image do you have on your device, the "Second Maemo 5 USA variant for Nokia N900" or the so-called "Second Maemo 5 Global release for Nokia N900"? I never understood the difference.

--denis

Edit 2/3/10: Matan pointed out bugs in the hildon-input-methoid framework that prevent FOUR_LEVEL mapping from working reliably. He has a patched version of that module that fixes the problem!!!

Viqsi 2010-02-08 02:43

Re: xmodmap not working on n900
 
From what I understand, PageUp and PageDown symbols are represented with "Next" and "Prior" respectively.


What I've been trying to do is significantly more evil - on my n810, I had the zoom in/zoom out keys remapped to PageUp/PageDown for browser reading purposes. I can get it to work just fine by editing rx-51 (scrolling isn't smooth, but it works)... unless the browser is in portrait mode.

My presumption is that this has to do with the fact that maemo-statusbar-volume messes with those keys for handling the phone (as seen in the comments in the rx-51 file), and since the device was released with the assumption that portrait was phone-only, it's still grabbing the keys and thus my modifications can't get through. Oops!

Anyone else care to confirm this, or perhaps show me a better way? :)

radiochickenwax 2010-07-15 07:07

Re: xmodmap not working on n900
 
Although resurrecting an old thread is very unlikely to get results, I have to try.

This bug is still open. Why?
https://bugs.maemo.org/show_bug.cgi?id=8695

Can't we just rebuild xserver-xorg-core and be done with this? (Trying that now).

Also, it's nice that there is an alternative to remapping the keyboard, but what about the pointer? Yes, I would like to use the middle mouse button, and am having a hard time finding a way to do so without xmodmap.

dnastase 2011-02-20 15:18

Re: xmodmap not working on n900
 
Is xmodmap supposed to work w/ PR 1.3 ?

I find that not even xev is showing the KeyPress/KeyRelease like on my PC ...

dnastase 2011-02-22 18:16

Re: xmodmap not working on n900
 
Quote:

Originally Posted by dnastase (Post 951079)
Is xmodmap supposed to work w/ PR 1.3 ?

I find that not even xev is showing the KeyPress/KeyRelease like on my PC ...

Yep, still not working.
There is a custom xev that works though ...
Had to change the xkb/symbols/* to achieve what I needed :(

jj0 2011-03-16 14:56

Re: xmodmap not working on n900
 
Quote:

Originally Posted by radiochickenwax (Post 752433)
Can't we just rebuild xserver-xorg-core and be done with this? (Trying that now).

Did you have success with this?

int_ua 2014-01-11 12:41

Re: xmodmap not working on n900
 
Quote:

Originally Posted by qole (Post 392504)
I can get a temporary remap using the technique described here.

I've just file a bug about xkbcomp producing syntax errors: https://bugs.maemo.org/show_bug.cgi?id=12721


All times are GMT. The time now is 08:43.

vBulletin® Version 3.8.8