bugs in remapper maybe?

Asked by Jeremy Ray

I think I solved the problem mentioned in message 42387 (needed to change a path in monitor.conf). I believe pystromo is finding n52_inkscape.map now but is not using it. I get this error message -

jeremy@r1e:~/Documents/pystromo/trunk$ ./monitor.py -v
/home/jeremy/Documents/pystromo/trunk/remapper.py -m config/test.map
/home/jeremy/Documents/pystromo/trunk/remapper.py -m config/test.map -m /home/.pystromo/n52_inkscape.map
Traceback (most recent call last):
  File "/home/jeremy/Documents/pystromo/trunk/remapper.py", line 48, in <module>
    keymap = mapping.Mapper(*options.maps)
  File "/home/jeremy/Documents/pystromo/trunk/lib/config.py", line 21, in __init__
    self.load(args)
  File "/home/jeremy/Documents/pystromo/trunk/lib/mapping.py", line 122, in load
    self._loadMapSection(section)
  File "/home/jeremy/Documents/pystromo/trunk/lib/mapping.py", line 184, in _loadMapSection
    remap = ReMapping (singleInput, output)
  File "/home/jeremy/Documents/pystromo/trunk/lib/mapping.py", line 261, in __init__
    self.output = self.decode(output)
  File "/home/jeremy/Documents/pystromo/trunk/lib/mapping.py", line 314, in decode
    note = self.stringToKey(note)
  File "/home/jeremy/Documents/pystromo/trunk/lib/mapping.py", line 362, in stringToKey
    raise ValueError ('"%s" is an invalid code' % string)
ValueError: "KEY_" is an invalid code

In Inkscape, the n52 seems to be using test.map instead of the inkscape map file.

It may not be related, but the n52 doesn't seem to behave well with Ubuntu as a qwerty keyboard, without pystromo running. It seems to interfere with the system, or at least the regular keyboard. Instead of typing "this" I might get something like "thhhhhhhhhhs" (typing on the regular keyboard). It worked fine in Vista on the same system, so I'm inclined to believe the problem is on Ubuntu's end.

Question information

Language:
English Edit question
Status:
Solved
For:
Pystromo Edit question
Assignee:
No assignee Edit question
Solved by:
Raumkraut
Solved:
Last query:
Last reply:

This question was reopened

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

I noticed in your previous question that you had the lines:
# For GIMP, ink size, increase/decrease, scroll wheel
#KEY_SCROLLUP:KEY_
#KEY_SCROLLDOWN:KEY_

Are you absolutely sure that these lines, or lines similar to them, are not uncommented in the version you're trying to use?
I was able to replicate the traceback you give by adding in an uncommented mapping to KEY_ (which is indeed invalid).

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

Oh, and I'm not sure about the second part of your question, that does seem very odd (and if you're not running pystromo at that point, not my fault! ;).
Do they share a USB hub maybe? Okay, so I'm completely guessing on this part. :/

Revision history for this message
Jeremy Ray (jeremyray01) said :
#3

Very good guessing!

It looks like I overwrote the new n52_inkscape.map with an old one that didn't have the GIMP lines commented out. That problem has been fixed.

The n52 was on a usb hub with a keyboard. I've unplugged the usb hub and plugged the n52 directly into my tablet. Now it works fine as a qwerty keyboard without pystromo running, and fine with pystromo :)

What's the key code for the orange button above the d-pad?

I've made a graphic for the n52 showing the unmapped output, which you can have as soon as I get the orange button correctly labelled.

I can also help with gui graphics.

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

Woohoo! *hi-fives his intuition*
If the hub's repeating-key behaviour doesn't happen on other computers/OSes/distros, it may be worth posting a general Ubuntu bug.

The orange button is KEY_LEFTALT (test.map remaps this at: "## Red button causes a lightshow!")
If you want to see what code a key/button/etc. outputs, run the remapper with the -vv option.

And I will get round to writing a GUI at some point, I swear. :x

Revision history for this message
Jeremy Ray (jeremyray01) said :
#5

I posted my n52 graphic to the ubuntu forums thread, feel free to bundle it with Pystromo if you feel it is useful.

Do you know what the output for the mouse scroll wheel is? I see a couple possibilities in constant.py.

Other than that I think I'm well set up now. If I could suggest a little extra functionality, it would be great to be able to alter the map files on the fly as it were, instead of needing to hunt down the pystromo processes, kill them and re-execute. I'm always trying to tweak my settings for more efficiency (maybe I should run a Nostromo and a Saitek. I can now!).

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

There does need to be some way for people to easily see what buttons need remapping, but I'd rather have something more generic. This is intended for the eternally pending GUI. :)

Mouse wheel is REL_WHEEL (confirmed by -vv), search for it in test.map for examples of it's use. A quick google suggests that ABS_WHEEL is for things like steering-wheel peripherals.

I have considered having the remapper and monitor reload configuration files when they receive a SIGHUP (the usual use for such a signal IME). It just hasn't been that important a feature as of yet.

Feel free to create new blueprints for features you'd like to see (though I'm still unsure how exactly they're supposed to work!). :)

Revision history for this message
Jeremy Ray (jeremyray01) said :
#7

Reload config files is important to me ;)

Revision history for this message
Jeremy Ray (jeremyray01) said :
#8

Oops, I thought of another question. How would you correctly code -

#KEY_SPACE+REL_WHEEL<=:KEY_LEFTSHIFT+KEY_LEFTCTRL+REL_WHEEL<=

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

Took me a while there, before I remembered how the config lines are actually parsed!

The "=" is always an assignment; an alias for ":". It only sees the first "=" or ":" as the divisor between the input and output. Hence the "=:" confuses it into thinking the first output code is ":KEY_LEFTSHIFT", rather than just "KEY_LEFTSHIFT".

So what you want is:
KEY_SPACE+REL_WHEEL<:KEY_LEFTSHIFT+KEY_LEFTCTRL+REL_WHEEL<
(note lack of "="s.)

Revision history for this message
Jeremy Ray (jeremyray01) said :
#10

Thanks, I was wondering about the lack of :