Pystromo with Cintiq12WX

Asked by Jeremy Ray

I'm attempting to remap the buttons on the 12WX with Pystromo since the remapping tool in System Settings doesn't work.

lsusb returns -

#Bus 004 Device 003: ID 056a:00c6 Wacom Co., Ltd Cintiq 12WX

So in my .map file (gimp.map) I have added -

# Cintiq 12WX
[Device:12WX]
vendor=0x056a
product=0x00c6

Is that correct?

I'm also using the n52, so the first part of gimp.map looks like this -

# Nostromo n52
[Device:n52]
vendor=0x050d
product=0x0815

# Cintiq 12WX
[Device:12WX]
vendor=0x056a
product=0x00c6

[Map:]

Is it o.k.?

I've been attempting to follow these instructions -

http://ubuntuforums.org/archive/index.php/t-948833.html

specifically this section:

"If you want to know *precisely* what value to use (even for keys with non-visible output), do the following.

Open a terminal window and put in these commands.

gedit /home/username/.config/pystromo/output.map

In this file put the following text and save and close it.

# Nostromo N52 Speedpad
[Device:n52]
vendor=0x050d
product=0x0815

[Map:n52]

Now open a terminal window and put in the following commands.

cd /home/username/.config/pystromo
./pystromo-remap.py -m output.map -vv

You can now press any button on the Nostromo and it will output data in this terminal window telling you what exactly is bound to that key."

I have created output.map per the instructions, and cd'd into /home/myusername/.config/pystromo. Running ./pystromo-remap.py -m output.map -vv however gives an error -

/.config/pystromo$ ./pystromo-remap.py -m output.map -vv
bash: ./pystromo-remap.py: No such file or directory

ls shows the file is there. What has happened?

Thanks.

Question information

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

The "Device" sections look correct, from what I can remember.

I'm not sure why you're seeing the error you are, when running pystromo-remap. I would expect a "permission denied", but not the message you're seeing. Are you sure you spelled it correctly - does bash's tab-completion correctly pick up pystromo-remap.py? What does an `ls -l` on the Pystromo directory produce?

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

I've retyped the command, and copied and pasted from above, and still get the same error message -

/.config/pystromo$ ./pystromo-remap.py -m output.map -vv
bash: ./pystromo-remap.py: No such file or directory

Bash does not tab-complete ./pystromo-remap.py from within .config/pystromo

It does from within Documents/pystromo

ls -l produces -

/Documents/pystromo$ ls -l
total 56
drwxrwxr-x 2 jeremy jeremy 4096 May 20 13:50 config
-rw-r--r-- 1 jeremy jeremy 18013 Apr 27 2008 GPL.txt
drwxrwxr-x 2 jeremy jeremy 4096 May 18 22:00 lib
-rwxr-xr-x 1 jeremy jeremy 5281 Oct 14 2008 pystromo-mon.py
-rwxr-xr-x 1 jeremy jeremy 5642 Oct 13 2008 pystromo-remap.py
-rw-r--r-- 1 jeremy jeremy 5726 Oct 3 2008 README
drwxrwxr-x 3 jeremy jeremy 4096 Feb 23 17:41 transfer

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

> It does from within Documents/pystromo

Aha, well that's probably it then.

The instructions you're using assume that you've put the Pystromo program in ~/.config/pystromo (which is the wrong place to put it, actually). Since you've put Pystromo in ~/Documents/pystromo (a better location), you need to execute pystromo-remap.py at that location:

~/.config/pystromo$ ~/Documents/pystromo/pystromo-remap.py -m output.map -vv

or

~/Documents/pystromo$ ./pystromo-remap.py -m ~/.config/pystromo/output.map -vv

In case you didn't know: A "./" path prefix means "the current directory", "~/" means "my home directory", and just "/" means "the file-system root".

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

I got a result executing -

./pystromo-remap.py -m ~/.config/pystromo/output.map -vv

after cd'ing into Documents/pystromo

The result was an error message, but it's kinda progress -

Using output: <lib.devices.OutputDevice object at 0x1416a90>
Loading mappings
/home/jeremy/.config/pystromo/output.map
Traceback (most recent call last):
  File "./pystromo-remap.py", line 170, in <module>
    inputs = getInputs(keymap, output)
  File "./pystromo-remap.py", line 98, in getInputs
    dev = devices.InputDevice(id=device, keymap=keymap, output=output, **params)
  File "/home/jeremy/Documents/pystromo/lib/devices.py", line 99, in __init__
    node.grab()
  File "/home/jeremy/Documents/pystromo/lib/ioctl.py", line 211, in grab
    fcntl.ioctl(self.fd, const.EVIOCGRAB, grab)
IOError: [Errno 16] Device or resource busy

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

That means that another application has "grabbed" the input, so nothing else can do so. Are you running any other instances of Pystromo automatically, or anything else which controls the devices?

To find out what process has grabbed the device node/s:

$ fuser /dev/input/event*

Which should output something like:

/dev/input/event0: 1988
/dev/input/event2: 1997

With the trailing number/s, you can run:

$ ps ax | grep 1988

Which should display which process is preventing Pystromo from getting a monopoly on that particular device's input, so you can hopefully work out how to get around it.

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

Sorry for the late reply - I didn't get the usual update email, Yahoo is funny about what it considers spam.

fuser /dev/input/event* needed to be sudo fuser /dev/input/event*, fwiw.

There were seven outputs, but all events ended in 1052 -

 1052 tty7 Rs+ 1:04 /usr/bin/X :0 vt7 -br -nolisten tcp -auth /var/run/xauth/A:0-2lFn9a
 2547 pts/1 S+ 0:00 grep --color=auto 1052

Naturally I have not a clue what any of that means.

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

Okay, so it seems to be the X server itself which is grabbing the input devices.
Check your /etc/X11/xorg.conf for "InputDevice" sections, which contain:

Option "GrabDevice" "True"

If you find any, try changing that value to "False" (or just comment the line out). Then you'll have to restart your X server (which usually just means logging out and back in again, but may require a ctrl+alt+backspace at the login screen, or a restart at worst).

If you don't find any GrabDevice lines... then I'm not sure what else to try.

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

I don't seem to have an xorg.conf - didn't it get phased out in Ubuntu 12.04? I may be thinking of something else - but there's no xorg.conf.

You may be interested in this thread -

http://tinyurl.com/7tkzft8

We've determined that the rub strips are outputting 3 and 4.

I haven't had any luck getting Pystromo to remap the output though. Worse, having the lines -

KEY_3:KEY_ALT

KEY_4:KEY_ALT

knocks out all other remapping of the n52. I've tried it with "[map:]" and with seperate sections for the n52 and 12WX ("[map:n52]" and "[map:12WX]")

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

Still need help.

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

Sorry, been busy.

The thread linked to mentions the directory /etc/X11/xorg.conf.d/ (the more friendly alternative to a single xorg.conf) - do you have one of those, and a file in there which uses "GrabDevice"?
Beyond that, I've no idea what could be going wrong. :(

And I don't know why those two KEY_3/KEY_4 lines would knock everything else out, either. Is there any error which gets output by Pystromo, or whatever else? :s

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

In /etc/X11/xorg.conf.d/ there is only the file 52-wacom.conf, which contains the lines -

Section "InputClass"
 Identifier "Wacom pad options"
 MatchDriver "wacom"
 MatchProduct "pad"
 # Apply custom Options to this device below.
 Option "StripRightDown" "0"
 Option "StripRightUp" "0"
EndSection

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

I took out all the n52 code from gimp.map and ran pystromo with only the Cintiq code, which generated the error -

Traceback (most recent call last):
  File "/home/jeremy/Documents/pystromo/pystromo-remap.py", line 169, in <module>
    keymap = loadMappings()
  File "/home/jeremy/Documents/pystromo/pystromo-remap.py", line 68, in loadMappings
    return mapping.Mapper(*options.maps)
  File "/home/jeremy/Documents/pystromo/lib/config.py", line 21, in __init__
    self.load(args)
  File "/home/jeremy/Documents/pystromo/lib/mapping.py", line 122, in load
    self._loadMapSection(section)
  File "/home/jeremy/Documents/pystromo/lib/mapping.py", line 184, in _loadMapSection
    remap = ReMapping (singleInput, output)
  File "/home/jeremy/Documents/pystromo/lib/mapping.py", line 261, in __init__
    self.output = self.decode(output)
  File "/home/jeremy/Documents/pystromo/lib/mapping.py", line 314, in decode
    note = self.stringToKey(note)
  File "/home/jeremy/Documents/pystromo/lib/mapping.py", line 362, in stringToKey
    raise ValueError ('"%s" is an invalid code' % string)
ValueError: "KEY_ALT" is an invalid code

I don't necessarily want 3 and 4 mapped to the alt key, if there is a way to get null output that would be better. I don't want anything to happen when I hit the rub strips.

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

A-haha! Good detective work.

Pystromo works with the physical keys on the keyboard (the scan-codes, actually), not the expected output. Since there are two Alt keys, there are both KEY_LEFTALT and KEY_RIGHTALT mappings. I'd forgotten about that. XD

Besides which, to completely neutralise a key, it should work to set it to nothing, or "none", eg.:
KEY_3:
KEY_4: none

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

Changing the key assignment to "none" sort of worked, but also revealed a different problem. GIMP was seeing the pad as another tool, like the stylus or map. So the input from the rub strips was disabled, but every time I would touch them GIMP still wanted to switch to the tool settings for the pad. Disabling the pad in GIMP's "configure input drivers" section solved the problem.

Incidentally the Cintiq section in gimp.map was still knocking out the n52 section, but I don't need the Cintiq section anymore so it's not a problem. If it comes up again in the future I'll start a new thread.

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

oops, meant to say "like the stylus or mouse."