Can't remap keys

Asked by kimsyv

Hi,

I've followed this guide: http://ubuntuforums.org/showthread.php?t=948833 , but I must have missed something. I can't get my buttons remapped.

Unit: n52te
OS: Ubuntu 8.04

Read the Answers posts and checked if there were any faulty rights on the devices, but I can't see any:
drwxr-xr-x 2 root root 200 2008-12-20 22:56 by-id
drwxr-xr-x 2 root root 240 2008-12-20 22:56 by-path
crw-rw---- 1 root plugdev 13, 64 2008-12-20 22:27 event0
crw-rw---- 1 root plugdev 13, 65 2008-12-20 22:27 event1
crw-rw---- 1 root plugdev 13, 66 2008-12-20 22:27 event2
crw-rw---- 1 root plugdev 13, 67 2008-12-20 22:27 event3
crw-rw---- 1 root plugdev 13, 68 2008-12-20 22:56 event4
crw-rw---- 1 root plugdev 13, 69 2008-12-20 22:27 event5
crw-rw---- 1 root plugdev 13, 70 2008-12-20 22:27 event6
crw-rw---- 1 root plugdev 13, 71 2008-12-20 22:27 event7
crw-rw---- 1 root plugdev 13, 72 2008-12-20 22:56 event8
crw-rw---- 1 root plugdev 13, 73 2008-12-20 22:56 event9
crw-rw---- 1 root root 13, 63 2008-12-20 23:27 mice
crw-rw---- 1 root root 13, 32 2008-12-20 23:27 mouse0
crw-rw---- 1 root root 13, 33 2008-12-20 23:27 mouse1
crw-rw---- 1 root root 13, 34 2008-12-20 22:56 mouse2
crw-rw---- 1 root root 13, 35 2008-12-20 22:56 mouse3
crw-rw----+ 1 root plugdev 10, 223 2008-12-20 22:27 uinput

lsusb:
Bus 004 Device 004: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
Bus 004 Device 002: ID 0424:2504 Standard Microsystems Corp. USB 2.0 Hub
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 003: ID 0d7d:1440 Phison Electronics Corp.
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 050d:0200 Belkin Components
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 005: ID 045e:0039 Microsoft Corp. IntelliMouse Optical
Bus 001 Device 003: ID 045e:006a Microsoft Corp.
Bus 001 Device 001: ID 0000:0000

Here's my default.map file:
[Device:n52]
vendor=0x050d
product=0x0200

[Map:n52]
KEY_TAB:KEY_1
KEY_Q:KEY_2
KEY_W:KEY_3
KEY_E:KEY_4
KEY_R:KEY_5
KEY_CAPSLOCK:KEY_6

Output when I run: .config/pystromo/./pystromo-remap.py –m -v .config/pystromo/default.map
Using output: <lib.devices.OutputDevice object at 0xb7d2fa8c>
Loading mappings

No errors that I can see, and when I press "01" key on the unit (default:TAB), it does a TAB.

Any ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Pystromo Edit question
Assignee:
No assignee Edit question
Solved by:
kimsyv
Solved:
Last query:
Last reply:
Revision history for this message
Raumkraut (raumkraut) said :
#1

The main clue I'm seeing from this is that pystromo-remap with the -v flag should output one or more lines like this, after the "Loading mappings" line:

Using device: <InputDevice "n52" on 2 device nodes>

That it doesn't in your case indicates that whatever mapping file you're supplying to it doesn't actually contain any device sections. I can replicate the behaviour you see by handing it an empty mapping file, for example.
At this point I can only suggest double or triple-checking that the .config/pystromo/default.map file you specify does indeed contain what you think it contains.
Can you get it to output lines like the above when you use one of the example mapping files included with pystromo (found in config/)?

Revision history for this message
kimsyv (minslaskmail) said :
#2

I get exactly the same output with the *.map files found in config/.

I did try to install this software before I found yours: http://sourceforge.net/project/showfiles.php?group_id=61608.
Only the editor part, not the driver.

Could this be the reason why I can't remap?

Revision history for this message
kimsyv (minslaskmail) said :
#3

Hello again,

I've not given up yet. Now I have tried it with another box.
OS: Ubuntu 7.10

#> locale (don't know if this has anything to do with anything)
LANG=sv_SE.UTF-8
LANGUAGE=sv_SE:sv:en_GB:en
LC_CTYPE="sv_SE.UTF-8"
...

Followed the guide (http://ubuntuforums.org/showthread.php?t=948833) and edited all files.

Time for the first attempt .... Here are the results:
.config/pystromo$ ./pystromo-remap.py –m -v default.map
Traceback (most recent call last):
  File "./pystromo-remap.py", line 51, in <module>
    output = devices.OutputDevice()
  File "/home/mulle/.config/pystromo/lib/devices.py", line 665, in __init__
    self.node = ioctl.OutputNode()
  File "/home/mulle/.config/pystromo/lib/ioctl.py", line 237, in __init__
    raise LookupError ('no uinput device-nodes found')
LookupError: no uinput device-nodes found

I remembered seeing something similar in the other Answers, so I went ahead and did the following:
#> sudo chmod a+rw /dev/input/uinput
#> sudo chmod a+rw /dev/input/event*

Now the second attempt
.config/pystromo$ ./pystromo-remap.py –m -v default.map
Using output: <lib.devices.OutputDevice object at 0xb7c7d64c>
Loading mappings

And nothing ..... Pressing the keys will result in the standard letters and functions.

Next I will try with an Ubuntu with default language. I'm planing to use VirtualBox for this. Any does and don'ts?

Revision history for this message
Raumkraut (raumkraut) said :
#4

It's possible that your locale is having some effect on proceedings, but I'm not sure how it would bring about what you're seeing. I tried installing and setting my locale to Swedish but, despite taking over KDE for a time, there wasn't any effect on pystromo I could discern.
I've had pretty good results with VirtualBox so far. The closed-source version is needed for USB support, but in your case that probably isn't /needed/ anyway - you only need to get config-loading working AFAICT.

I notice that you keep quoting the command line "./pystromo-remap.py –m -v default.map", which isn't going to work as intended because of the ordering of the -m and -v (the -m needs to immediately precede the mapping-file name). For the sake of accuracy, could you make sure to paste the exact command you use in future! :o

I can only think of one more diagnostic tool for you to try for the moment, and that is to test the config-loading parts of the program directly:
- cd to the pystromo/lib directory, where various .py and .pyc files live
- Start the python interpreter: ie. `python`
- Replicate the following:
>>> import mapping
>>> m = mapping.Mapper("/path/to/default.map")
>>> print m.devices

- Let me know what gets outputted from those commands.

You /should/ see something like:
{'mx510': {'product': 49181, 'vendor': 1133}}
However, if your situation continues true to form, you may well see just "{}". If so, then at this point all I can think is that the file/s which are being loaded by pystromo are in fact empty! If they were invalid, there would be a warning or traceback...

Most perplexing.

Revision history for this message
kimsyv (minslaskmail) said :
#5

I am very happy and confused at the same time.

After reading your answer I plugged out the n52 from the Ubuntu 7.10 box and plugged it in my 8.04 and decided to give your tips a go. Just to be sure, I opened a terminal an ran the command: ./pystromo-remap.py -m default.map

And it WORKED! I have no clue to why it worked this time and not the several other times.

And now when I paste my badly formatted command (I am sorry for that by the way) : ./pystromo-remap.py –m -v default.map

I get a warning that I didn't get before.
./pystromo-remap.py -m -v default.map
WARNING: Unable to load "-v"

The funny part is that I haven't done any changes to any files or rights. I have unplugged the device during my testing.

I am very grateful for your software and your help Raumkraut, thank you!

Marry Christmas! (I know it will be for me now ;))