<SOLVED> xsetwacom Script for Cycling Ring-Modes

Forum rules
Before you post please read this

<SOLVED> xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Sun Mar 03, 2013 2:34 am

Hello!
I have a Wacom Intuos5 touch tablet on my Linux Mint 14 machine. It works very well, and I'm quite pleased, however I need to configure it through command-line and scripts, as there isn't a working gui that I know of at the moment.

This is fine, and I have learned how to use it more or less, but still there is one thing I would like to do: make the button in the middle of the touch ring cycle through different ring modes, e.g. zoom, rotate, brush size, etc.

As it is now, I have configured three other buttons to change ring modes, since I wasn't able to get the ring button to cycle at all.

Any help is appreciated.

Thanks in advance!
-Amir
Last edited by zorbama on Thu Mar 07, 2013 1:32 pm, edited 1 time in total.
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Linux Mint is funded by ads and donations.
 

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Sun Mar 03, 2013 11:34 am

Hi Amir,

Welcome to Mint forums!

The Mint dev.s hid the Gnome Wacom tablet applet in Mint 14 for some reason. We found out how to get it back on this thread: viewtopic.php?f=208&t=117690

I think the applet handles the touch ring settings but I am not sure. I haven't gotten direct confirmation of that, more like implied confirmation. Also it may depend on what version of the Gnome Wacom tablet applet you are dealing with. Presumably with touch ring support in more recent versions.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Sun Mar 03, 2013 11:41 am

Favux wrote:Hi Amir,

Welcome to Mint forums!

The Mint dev.s hid the Gnome Wacom tablet applet in Mint 14 for some reason. We found out how to get it back on this thread: viewtopic.php?f=208&t=117690

I think the applet handles the touch ring settings but I am not sure. I haven't gotten direct confirmation of that, more like implied confirmation. Also it may depend on what version of the Gnome Wacom tablet applet you are dealing with. Presumably with touch ring support in more recent versions.


Hi Favux, thanks for the reply. :)

I did see that thread (apologies for not mentioning that earlier), and configured the Gnome Wacom tablet applet. Most of the settings work, but I can't use it to assign buttons; it just doesn't work. Maybe it does not yet have full support to Intuos5 (which is unlikely, since it does recognize my tablet). That is why I'm using xsetwacom scripts to configure my tablet's settings, but I don't really know how to make a button cycle through options.
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Sun Mar 03, 2013 12:54 pm

The Wacom applet is fairly new so it wouldn't surprise me if touch ring support just hasn't been added to it yet. At least in the Mint 14 version, which is what, Gnome 3.4? It recognizes your Intuous5 because Jason added Intuos5 entries to libwacom shortly after he added the Intuous5 code to the drivers.

So the question becomes does the driver code support touch ring mode selection? And if it does is the mode toggling signal available to user land so it could be used in a script?

Libwacom seems to indicate there is touch ring mode code because the data file for a Intuos5 has:
Code: Select all
Ring=A
RingNumModes=4

While RingNumModes may be anticipatory it sure is suggestive.

Where would the code be, in the kernel driver or the X driver? The kernel driver sets the button defaults so I guess that's the place to start.

Of course we could cheat and ask the dev.s on linuxwacom-discuss. :)
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Sun Mar 03, 2013 1:38 pm

Well wacom_wac.c (around line #591) in the kernel appears to have code to detect the mode.
Code: Select all
      } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
         int i;

         /* Touch ring mode switch has no capacitive sensor */
         input_report_key(input, BTN_0, (data[3] & 0x01));

         /*
          * ExpressKeys on Intuos5 have a capacitive sensor in
          * addition to the mechanical switch. Switch data is
          * stored in data[4], capacitive data in data[5].
          */
         for (i = 0; i < 8; i++)
            input_report_key(input, BTN_1 + i, data[4] & (1 << i));

         if (data[2] & 0x80) {
            input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f));
         } else {
            /* Out of proximity, clear wheel value. */
            input_report_abs(input, ABS_WHEEL, 0);
         }

         if (data[2] | (data[3] & 0x01) | data[4] | data[5]) {
            input_report_key(input, wacom->tool[1], 1);
            input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
         } else {
            input_report_key(input, wacom->tool[1], 0);
            input_report_abs(input, ABS_MISC, 0);
         }
      } else {

Since it is contained the usb data[4] packet that doesn't do us much good in user land. So onto the X driver and see if we can find something there.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Sun Mar 03, 2013 4:11 pm

It looks like the Wacom applet does have code for the touch rings now. Here's the beginning of the code:
Code: Select all
static int
flags_to_group (WacomButtonFlags flags)
{
   if (flags & WACOM_BUTTON_RING_MODESWITCH)
      return 1;
   if (flags & WACOM_BUTTON_RING2_MODESWITCH)
      return 2;
   if (flags & WACOM_BUTTON_TOUCHSTRIP_MODESWITCH)
      return 3;
   if (flags & WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH)
      return 4;

   return 0;
}

static GList *
gsd_wacom_device_add_ring_modes (WacomDevice      *wacom_device,

That's in gsd-wacom-device.c in the Gnome 3.7 Control Center: http://git.gnome.org/browse/gnome-contr ... nels/wacom Don't know about Gnome 3.6 etc. And Gnome 3.8 is due out shortly.

But more relevant to where we are now I don't see anything in xf86-input-wacom, specifically xsetwacom.c. What we'd want is to be able to use a xsetwacom get command to query the touch ring mode. Something like:
Code: Select all
xsetwacom get "Wacom Intuos5 medium pad" Ring
or
xsetwacom get "Wacom Cintiq pad" Ring2

And have it return 0 or 1 or 2 or 3. That way we could have a script that would assign an action with xsetwacom set to the central button (Button 1) for each of the 4 states. If I'm correct then we need to make a feature request to the dev.s.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Sun Mar 03, 2013 4:28 pm

Well, what I do now to change the ring's behavior is modify AbsWheelUp and AbsWheelDown. I am thus able to use three different buttons to make the ring act in three different ways. I tried writing a script for the middle button that looks like this:
Code: Select all
#!/bin/bash

## Get the "Device name" or ID number
## for touch from 'xsetwacom list dev'

DEVICE="Wacom Intuos5 touch M Pen pad"
RING_STATE=`xsetwacom get "$DEVICE" AbsWheelUp`
if [ "$RING_STATE" == "button +4" ]
  then
    notify-send -t 1500 "Success!"
    xsetwacom set "$DEVICE" AbsWheelUp key d
  else
    notify-send -t 1500 "Woops..."
fi


When I run this script in the terminal, I get the following error:
Code: Select all
/home/amir/bin/wacom/ringmodes.sh: 8: [: button +4 : unexpected operator


Which is odd, considering that this is exactly the operator I wrote the script to expect.

I have to apologize again for adding details so slowly... Also, I have to admit that I didn't completely understand your last three posts, so I apologize for that as well. :oops:
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Sun Mar 03, 2013 9:06 pm

Interesting. From what I see in the code the touch ring state LED's are suppose to work. Can you identify mode 0,1,2,3 from them? Or do you even need them to determine what mode the touch ring is switched to?

If so what does:
Code: Select all
xsetwacom get "Wacom Intuos5 touch M Pen pad" AbsWheelUp

and
Code: Select all
xsetwacom get "Wacom Intuos5 touch M Pen pad" AbsWheelDown

return for each mode?

Also I'm not clear what "button +4" is about. One of the mode return values?
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Mon Mar 04, 2013 3:23 am

The LEDs worked for me... once. When I clicked the middle button, the LEDs cycled. Other than that, it had no effect. It was strange, and it never happened again. I don't know how to identify the modes.

So I suppose that what I'm doing right now is changing the settings of a single mode to suit my needs, but what I could technically do is switch between the modes using the middle button, once it's configured to do so. I just need to know how to configure it.

I've looked at the wiki pages of linuxwacom. I can't seem to find anything about it.

I believe "button +4" is an X button. What it does is scroll up. AbsWheelDown is configured to "button +5", which scrolls down.
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Mon Mar 04, 2013 11:19 am

Alright, maybe I've got myself confused.

I thought the touch ring was to select the mode and the mode then determined which of 4 actions the central button, the one inside the touch ring, would take when pressed. So the script should have something like:
Code: Select all
xsetwacom set "Wacom Intuos5 touch M Pen pad" Button 1 key (action 1)

With one set command determined by mode for each of the 4 actions. You're saying it is the other way around? The central button toggles the modes and you touch the appropriate quadrant of the touch ring corresponding to mode 1,2,3, or 4 to get the desired action/button press? Does xsetwacom get "Wacom Intuos5 touch M Pen pad" Button 1 return mode then?

The "button +4" is an X button. 4 and 5 are reserved by X for vertical scroll while 6 and 7 are reserved for horizontal scroll. I guess if I squint I can sort of see how the driver conflates an Absolute Wheel with the touch ring. But I don't think it is suppose to do that. And we don't seem to be querying mode.

Let's see what output you get when you run in a terminal:
Code: Select all
xsetwacom get "Wacom Intuos5 touch M Pen pad" all

When I do it on a BambooPT I get the following spurious parameters:
Code: Select all
Option "RelWheelUp" "button +5 "
Option "RelWheelDown" "+4 "
Option "AbsWheelUp" "+4 "
Option "AbsWheelDown" "+5 "
Option "AbsWheel2Up" "+4 "
Option "AbsWheel2Down" "+5 "
Option "StripLeftUp" "+4 "
Option "StripLeftDown" "+5 "
Option "StripRightUp" "+4 "
Option "StripRightDown" "+5 "

Not sure why, but that's what I think you are looking at.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Mon Mar 04, 2013 11:44 am

Yes, the idea is to cycle the ring's behavior between several states, which will allow me switch between, say, zooming in/out, increasing/decreasing brush size, etc.

The middle button is currently configured to open a terminal (I wasn't sure what else to do with it...), and by default it acts like a left mouse button. On the Gnome applet it's mapped to "Switch Modes", but that actually doesn't do anything.
At any rate, as far as I know, "mode" is a parameter which switches between relative and absolute mode, for the cursor. I don't know of a parameter or command to assign to a button to switch ring modes.

When I run the command you mentioned in the terminal, I get the same parameters. I believe that these are useful in other tablets, which have more than one touch rings or touch strips, like what we can see here: http://www.wacom.com/~/media/WTC/Images/Carousel/Products/Cintiq/710x440_DTK2400HD_01.jpg?mw=780
I don't think it's relevant to our case. Unless you can assign different parameters to the same buttons?
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Mon Mar 04, 2013 12:24 pm

zorbama wrote:Yes, the idea is to cycle the ring's behavior between several states, which will allow me switch between, say, zooming in/out, increasing/decreasing brush size, etc.

Well that helps clear things up. So the central button selects mode. Then how do you use the touch ring? Just touch it anywhere? Do you have to do some circular motion in one direction or the other? Sounds like it for zoom and brush size at least. And that explains the wheel conflation. I just need to get an idea of how it is suppose to work physically.

So if mode is selected by Button 1 then maybe you don't want it assigned to anything?
Code: Select all
xsetwacom set "Wacom Intuos5 touch M Pen pad" Button 1 0

Does it now select through modes again, and as a bonus the LEDs cycle again? And you can also do that in a custom .conf file with an Option.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Mon Mar 04, 2013 12:43 pm

I'm sorry for not clarifying earlier... Yes, the middle button changes modes, and the ring is used with a circular motion in two directions to do several functions, such as scroll up and down, etc.

I tried the command you suggested, and unfortunately it doesn't work. The button doesn't do anything at all when I make this command.

I also tried:
Code: Select all
xsetwacom set "Wacom Intuos5 touch M Pen pad" Button 1


With nothing following "Button 1", and that seems to restore the left mouse button behavior.
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Mon Mar 04, 2013 1:12 pm

As the implications sink in, now that I understand things, we may actually be able to do a script. Basically we just need to augment your original script with mode.

Bind Button 1 to a script. Example see part VII.: viewtopic.php?f=42&t=110408 May want to use keyboard shortcuts or something else.

I'm assuming the touch ring is actually handled by the AbsWheelUp and AbsWheelDown parameter. So then your script would ultimately have 4 pairs of xsetwacom set commands.
Code: Select all
1.
xsetwacom set  "Wacom Intuos5 touch M Pen pad" AbsWheelUp zoom in
xsetwacom set  "Wacom Intuos5 touch M Pen pad" AbsWheelDown zoom out
2.
xsetwacom set  "Wacom Intuos5 touch M Pen pad" AbsWheelUp increase brush size
xsetwacom set  "Wacom Intuos5 touch M Pen pad" AbsWheelDown decrease brush size
3. etc.

Using if and elif for the branching I suppose. Using the Win 7 defaults would be a good place to start I'd think.

Then what you'd need is to set the mode state to 0 initially in a tmp file:
Code: Select all
echo 0 > /tmp/mode_state

And then increment 1 to the mode_state each time the script runs, up to 3. Assuming you want to use 0 to 3 for the 4 states. Then of course to read it at each conditional.
Code: Select all
cat /tmp/mode_state

It would be more elegant to query the mode state directly from the command line using xsetwacom. So we could talk to the dev.s about adding that feature. The other thing is why is Button 1 getting confused and stopping setting mode state? Since apparently that is what it is suppose to do.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Mon Mar 04, 2013 5:09 pm

Yes! Following what you said, I managed to write a script to change the ring modes using the middle button and it works fantastically well!
The only thing missing is the changing of the LEDs, to indicate what mode I'm on right now (I added notifications, so I have sort of an indication, only it doesn't stay).
I suppose the next step would be to indeed ask the dev.s about what you said. Where can that be done?
Thank you very much for your help! :)
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Mon Mar 04, 2013 5:52 pm

Great! :)

Nice work. When you get a chance maybe you could share the script and describe how you bound it to Button 1.

Also it may be possible you could write to sysfs in the script to control the LEDs.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Tue Mar 05, 2013 3:05 am

This is the script I use:
Code: Select all
#!/bin/bash

CHECK=`cat /tmp/mode_state`

if [ "$CHECK" == 1 ]
then
echo 2 > /tmp/mode_state
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelUp "key d"
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelDown "key f"
notify-send -t 1500 "Brush Size"
elif [ "$CHECK" == 2 ]
then
echo 3 > /tmp/mode_state
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelUp "key comma"
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelDown "key period"
notify-send -t 1500 "Zoom"
elif [ "$CHECK" == 3 ]
then
echo 4 > /tmp/mode_state
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelUp "key PgUp"
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelDown "key PgDn"
notify-send -t 1500 "Browse Layers"
else
echo 1 > /tmp/mode_state
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelUp 4
xsetwacom set "Wacom Intuos5 touch M Pen pad" AbsWheelDown 5
notify-send -t 1500 "Scroll"
fi


If it seems messy, it's because I don't know how to organize such things. This is actually the first time I do something like that, so I'm just glad it works...
To bind it to Button 1, I assigned the script to a keyboard shortcut (which is problematic to configure in the GUI in Linux Mint 14 Cinnamon, so I'm using xbindkeys as a workaround), and added to my startup settings script to assign that shortcut to Button 1.
I also added to my startup script the "echo 1 >/tmp/mode_state" command, so that it will reset the setting every time.

I'll look into sysfs.
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Tue Mar 05, 2013 10:50 am

Hi zorbama,

Great, thanks for sharing! And nice work on the script. :)

I'll have to look your script over. While watching SyFy's Powerful Mondays I doodled together a script. The only difference I see right off the bat from yours is I put in a counter. Disclaimer: unlike your script this one isn't tested or debugged so it probably has syntax and maybe logic errors.
Code: Select all
#!/bin/bash

## Intuos touch ring mode toggle script
##
## Bind Button 1 (center of touch ring) to the script.
## For mode state notification use:
##   sudo apt-get install libnotify-bin
## Otherwise comment (#) out the notify-send lines.
## If installed see 'man notify-send'.

if [ ! -f /tmp/mode_state ]; then
        echo 0 > /tmp/mode_state
fi

## For DEVICE use "device name" from 'xinput list'.
DEVICE = "Wacom Intuos5 touch M Pen pad"
MODE = `cat /tmp/mode_state`

if [ "$MODE" == 0 ]; then
        xsetwacom set  "$DEVICE" AbsWheelUp key shift plus  # zoom in
        xsetwacom set  "$DEVICE" AbsWheelDown key minus  # zoom out
#        echo 0 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select
        notify-send -t 1500 "Mode 1:  Zoom in or out in Gimp."
elif [ "$MODE" == 1 ]; then
        xsetwacom set  "$DEVICE" AbsWheelUp key alt up  # Increase brush radius (must be mapped in GIMP)
        xsetwacom set  "$DEVICE" AbsWheelDown key alt down  # Decrease brush radius (must be mapped in GIMP)
#        echo 1 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select
        notify-send -t 1500 "Mode 2:  Increase or decrease brush size in Gimp"
elif [ "$MODE" == 2 ]; then
#        xsetwacom set  "$DEVICE" AbsWheelUp key ?  # scroll up
#        xsetwacom set  "$DEVICE" AbsWheelDown key ?  # scroll down
#        echo 2 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select
#        notify-send -t 1500 "Mode 3:  Scroll up or down in Gimp."
elif [ "$MODE" == 3 ]; then
#        xsetwacom set  "$DEVICE" AbsWheelUp key ?  # rotate ccw
#        xsetwacom set  "$DEVICE" AbsWheelDown key ?  # rotate cw
#        echo 3 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select
#        notify-send -t 1500 "Mode 4:  Rotate cw or ccw in Gimp"
fi

if [ $[MODE + 1] > 3 ]; then
        echo 0 > /tmp/mode_state
else
        echo $[MODE + 1] > /tmp/mode_state
fi

As you can see I was concentrating on sysfs/LEDs. I'm pretty sure status_led0_select is the file we want. And I'm reasonably sure the values are 0 to 3. But we'll need to test. First we'll have to figure out the bus number etc., so you'll need to do a locate with the tablet plugged in:
Code: Select all
locate status_led0_select

Once you find the path then cat the file and see what value is in there. Is it an integer?
Code: Select all
cat /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select

Hopefully it is with a value of 0 to 3. It's unfortunate you can't cycle through the mode states with Button 1 anymore to check on the values of the 4 states but we should be able to survive.

Or another way to find the file is to look in /dev/input/by-path. There I see for my BambooPT pci-0000:00:12.0-usb-0:2:1.1-wacom. Then in /sys/bus/usb/devices I see bus 3 is the only one with 2:1.1 so I know to look in /sys/bus/usb/devices/3-2:1.1 for BambooPT stuff. In other words for the BamboPT <busnum>-<devnum>:<cfg>.<intf> = 3-2:1.1. And I can confirm that by reading the /sys/bus/usb/devices/3-2:1.1/uevent file.

I realized I don't know if the path (bus number etc.) changes with a hot plug or reboot. If it does that will make a big difference on how we have to handle things. The other thing I don't know is if you'll need to be root to write to sysfs. I hope not. So in a terminal you'll need to test if you can change the LEDs with:
Code: Select all
echo 2 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select

etc. Or does it require?
Code: Select all
sudo echo 2 > /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select


If we do have to use sudo the only practical approach I see on first thought is to somehow write a udev rule to change permissions on status_led0_select, because entering your root password each time just doesn't seem workable.
Last edited by Favux on Tue Mar 05, 2013 3:54 pm, edited 2 times in total.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Re: xsetwacom Script for Cycling Ring-Modes

Postby zorbama on Tue Mar 05, 2013 2:13 pm

I got it to work almost perfectly!
Before I tried your advice with sysfs, I ran into this site: http://braindump.kargulus.de/?p=321.
While it mostly talks about Intuos4, which has LEDs which you can send images to and isn't really relevant to our case, it also mentions two commands:
Code: Select all
sudo rmmod wacom
sudo modprobe wacom


This unloads and reloads the wacom module, and that changes the way xsetwacom behaves. Now, if I write:
Code: Select all
xsetwacom set "Wacom Intuos5 touch M Pen pad" Button 1 button 5 key ctrl alt r


it makes the middle button cycle through the LEDs and runs the mode switching script. "Button 5" here isn't an X button, but rather, it's the middle button, if you count the buttons of the tablet from top to bottom (confusing, since you assign it to "button 1").

There are two problems with this, however:
  • I can't get it to work with my startup script, since rmmod and modprobe require root permissions.
  • It messes up the scrolling, since Button 5 stands for cycling through LEDs and not for vertical scroll down. I can use keys up/down, but it's problematic.

Still, we're very close to solving this puzzle! :D
"Inspiring quote" -Inspiring Person
User avatar
zorbama
Level 1
Level 1
 
Posts: 21
Joined: Tue Nov 20, 2012 5:20 pm

Re: xsetwacom Script for Cycling Ring-Modes

Postby Favux on Tue Mar 05, 2013 3:39 pm

zorbama wrote:I got it to work almost perfectly!
Before I tried your advice with sysfs, I ran into this site: http://braindump.kargulus.de/?p=321.
While it mostly talks about Intuos4, which has LEDs which you can send images to and isn't really relevant to our case, it also mentions two commands:
Code: Select all
sudo rmmod wacom
sudo modprobe wacom


This unloads and reloads the wacom module,

Right. And sanette did some refinements to Karg's user land OLED app. All that's on the Intuos4 OLED thread: http://ubuntuforums.org/showthread.php?t=1380744 But having to remove the wacom.ko (usb kernel driver) module and restore it is why Eduardo Hasenleithner came up with the sysfs approach in the kernel. Actually he started with something different and the kernel maintainer suggested using sysfs instead.
zorbama wrote:that changes the way xsetwacom behaves. Now, if I write:
Code: Select all
xsetwacom set "Wacom Intuos5 touch M Pen pad" Button 1 button 5 key ctrl alt r


it makes the middle button cycle through the LEDs and runs the mode switching script. "Button 5" here isn't an X button, but rather, it's the middle button, if you count the buttons of the tablet from top to bottom (confusing, since you assign it to "button 1").

This totally mystifies me. Sounds like something is being reset and I don't understand the button 5. According to my BambooPT HOW TO notes I guess that would be vertical scroll down wih 4 scroll up. Why can't you just use 5? But the key thing is you've shown the Wacom drivers are disabling the indended mode selection action of Button 1, i.e. the button in the center of the touch ring. To me that appears to be a bug the dev.s need to address. Of course there may be some way to handle it already and I am ignorant of it. You know, the kind of thing if you can just read through the C code is obvious.
zorbama wrote:There are two problems with this, however:
  • I can't get it to work with my startup script, since rmmod and modprobe require root permissions.
  • It messes up the scrolling, since Button 5 stands for cycling through LEDs and not for vertical scroll down. I can use keys up/down, but it's problematic.

If scroll down makes Button 1 go through modes I don't see why that would mess with assigning vertical scroll to other buttons. Strange.
zorbama wrote:Still, we're very close to solving this puzzle! :D

I think so too. This is fun. You're the first who's really been interested in exploring this so I'm learning a lot.
Favux
Level 3
Level 3
 
Posts: 199
Joined: Fri Jul 01, 2011 1:20 am

Linux Mint is funded by ads and donations.
 
Next

Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests

cron