Wacom CPL Config in Karmic

Posted in Guides, Linux, Ubuntu by aliencam | No Comments »

to stylus > tool buttons > then set “button 2” to “right” and “button 3” to middle.

The wacom control panel setup in Ubuntu 9.10 is, of course, different from what it was in 9.04, moving closer to what it was in 8.10…

anyway, wacomcpl is a very useful tool for changing settings and recalibrating your wacom tablet, and the “touch” is miscalibrated by default with a karmic install, so this is necessary to get much use of “touch”.

start by installing wacomcpl:
sudo apt-get install wacom-tool

now, create the wacom configuration file:

sudo gedit /etc/hal/fdi/policy/wacom.fdi

and paste in the following content:

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="input.x11_driver" contains="wacom">
<match key="input.x11_options.Type" contains="stylus">
<merge key="info.product" type="string">stylus</merge>
</match>
<match key="input.x11_options.Type" contains="eraser">
<merge key="info.product" type="string">eraser</merge>
</match>
<match key="input.x11_options.Type" contains="touch">
<merge key="info.product" type="string">touch</merge>
</match>
</match>
</device>
</deviceinfo>

save and close, reboot your computer, and run wacomcpl by hitting alt-f2 and entering “wacomcpl”. From here you can change settings or calibrate as you wish.

Now, I like the button on the side of the stylus to be right-click, so go to stylus > tool buttons > then set “button 2” to “right” and “button 3” to middle.

sorry if this isn’t as coherent, wrote this entry really quick as a response to a comment. let me know if anything needs clarification, or if it doesn’t work.

Ubuntu Setup Guide VIII. Wacom Tablet Config & Rotation

Posted in Linux by aliencam | 7 Comments »

The tablet on the X61t is amazing. Unfortunately, not everything works out of the box. This guide goes through setting up most of the tablet-related things on the x61t.

what doesn’t work:  wacom cpl and all of it’s configurations, screen rotation, touch (kind of works, but it needs the wacomcpl configurations that don’t work), the “eraser” button, the rotation hotkey,

First thing you need to do is make sure you have wacom-tools and xserver-xorg-input-wacom installed:

sudo apt-get install wacom-tools xserver-xorg-input-wacom

Now, we run into a roadblock.  Ubuntu 9.04 does something strange with the names of each device, so if you go and try to use any of the utilities that were just installed (wacomcpl and xset wacom being just a few of what is included in the above), it can’t find the actual input devices.  In order to remedy this, we need to install a short script from the Ubuntu forums.

Open a root text editor (alt-f2 then enter “gksu gedit”, or type that into a terminal) and paste in the following content:

# wacom-names script by Roger E. Critchlow, Jr. (4-12-09)
# modified by gali98/Favux (4-14-09)
#
# Obtained/shortened by aliencam (aliencam.net) from:
# http://ubuntuforums.org/showthread.php?p=7068115#post7068115
#
#! /bin/sh
## find any wacom devices
for udi in `hal-find-by-property --key input.x11_driver --string wacom`
do
type=`hal-get-property --udi $udi --key input.x11_options.Type`
## rewrite the names that the Xserver will use
hal-set-property --udi $udi --key info.product --string $type
done

Now save it in /etc/init.d/ as “wacom-names”

Close gedit, and in a terminal, enter:

sudo chmod +x /etc/init.d/wacom-names

now you must make sure the file is at /etc/init.d/wacom-names before you do the next step, otherwise you’ll have problems booting, and could run into some other fun issues. Do this by actually going to the file explorer  (Places > Computer > Filesystem)  and looking for the file “wacom-names” in /etc/init.d.   (or type find /etc/init.d/wacom-names into a terminal and make sure it returns “/etc/init.d/wacom-tools” )

One more check, and “ls -l /etc/init.d/wacom-names” in a terminal should return “-rwxr-xr-x 1 root root 508 2009-06-27 00:50 /etc/init.d/wacom-names”    (with a different date and time of course)

Now, back in the terminal, the following line sets the script to run after HAL, but before X, meaning that before X even sees the devices, they are correctly named:
sudo update-rc.d wacom-names start 27 2 3 4 5 .

then it should return something similar to:

update-rc.d: warning: /etc/init.d/wacom-names missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/wacom-names ...
/etc/rc2.d/S27wacom-names -> ../init.d/wacom-names
/etc/rc3.d/S27wacom-names -> ../init.d/wacom-names
/etc/rc4.d/S27wacom-names -> ../init.d/wacom-names
/etc/rc5.d/S27wacom-names -> ../init.d/wacom-names

the “Missing LSB information” line is nothing to worry about for these purposes.  LSB Information is a line in the file that is supposed to say what the dependencies for the file are, making sure that it is executed in the correct order. We added it to run in S27 in levels 2, 3, 4, and 5, so it should be fine. I wonder though if this will slow down boot time (this will be analyzed and addressed if necessary in one of the next sections) (UPDATE: it does not seem to adversely affect boot times.)

After restarting the computer, test this by entering “xsetwacom list” into a terminal, it should list the available wacom devices now. You can then use the “wacomcpl” (wacom control panel) to configure the tablet devices.

One thing I noticed was that after enabling the script, kerneloops reports a kernel bug every reboot and every time I resume from suspend/hibernate. It doesn’t seem to cause any real problems, but I would like to find out what is going wrong and how to fix it.

REMOVAL:
if you need to remove this script from startup, simply enter this command into the terminal:
sudo update-rc.d -f wacom-names remove

then delete the actual file with this command:
sudo rm /etc/init.d/wacom-names

SOURCES for wacom-names guide:
http://ubuntuforums.org/showthread.php?p=7068115#post7068115
https://help.ubuntu.com/community/X61T

Once you have the devices renamed properly configure touch by pressing alt-F2, and entering “wacomcpl”. You then need to click the “touch” device in the list, and select “Calibrate”. Then press the center of the pink selected box (first in the top left corner, then the bottom right) and it will recalibrate the touch device.

You also probably want to set the button on the stylus to be right-click, and the back button to be middle. To do this, in wacomcpl go to the “stylus” device, click “tool buttons”, and change “Button 2” to “right”. Then hit “Okay” and close wacomcpl.


Keeping Configuration After Reboot

Now, if you have a problem loosing the calibration every time you restart the computer (I do), the following steps will save your configuration between reboots.

first, you need to edit the .xinitrc file in your home directory. Open a terminal and enter:
gedit ~/.xinitrc

Now, put a # before the line “. /etc/X11/xinit/xinitrc” Save, and close. Now, you need to set this file to run on startup. Open System > Preferences > Startup Applications, and create a “New” entry.

Name it something you will remember, I chose “Wacom Config”
The command should be:
sh /home/$USERNAME/.xinitrc
and for a comment, I put “Sets wacom tablet configuration on boot.”

Now, just configure your wacom tablet settings as normal with wacomcpl (see above) and the settings will be saved.

UPDATE: (July 26, 2009) A recent update fixed the problem that was making this necessary.  If you did this fix and all of the sudden your configuration stopped working, just go into the System> Preferences > Startup Applications  and disable or delete the .xinitrc launcher that was created (the wacom configuration setting).


Screen Rotation Script

Screen rotation is one of the things I am most asked about with the X61t. Unfortunately, you can’t use the standard display control panel to rotate the screen because then the tablet input will not be rotated. Fortunately, this is a very easy fix once you have applied the wacom-names script (detailed above in this guide.)

This particular script rotates the screen clockwise 90 degrees every time you run it, so if you want the screen to be facing the right, you will have to run it three times, left is just once, inverted is twice, and four times to get it back to normal. I chose not to do an automatic rotation script because those use CPU cycles, and significantly decrease battery life. If you want automatic screen rotation see https://help.ubuntu.com/community/X61T#Setup%20Automatic%20Screen%20Rotation

First, create a new file for the rotate script in your home directory:
gedit ~/.rotate

Now, paste the following content into the empty rotate file, then save and close gedit:

#Screen Rotation Script by aliencam (http://aliencam.net)
#This script will only work if your Xserver has the correct tablet device names
#follow the guide on http://blog.aliencam.net/articles/ubuntu-9-04-setup-guide/
#! /bin/sh

orientation=`xrandr -q | grep “LVDS”| awk ‘{print $4}’ | sed ‘s/[^A-Za-z]//g’`
if [ “$orientation” = “normal” ]; then
/usr/bin/X11/xrandr –orientation right
xsetwacom set stylus rotate CW

else
if [ “$orientation” = “right” ]; then
/usr/bin/X11/xrandr –orientation inverted
xsetwacom set stylus rotate 3
else
if [ “$orientation” = “inverted” ]; then
/usr/bin/X11/xrandr –orientation left
xsetwacom set stylus rotate CCW
else
if [ “$orientation” = “left” ]; then
/usr/bin/X11/xrandr –orientation normal
xsetwacom set stylus rotate

else
/usr/bin/X11/xrandr –orientation normal
xsetwacom set stylus rotate
fi
fi
fi

fi

If you want the code formatted correctly (wordpress removes all my tabs and whitespace!) download the file here: http://cameronkopas.com/blog/wp-content/uploads/2009/06/rotate.txt into your home directory, and rename it from “rotate.txt” to “.rotate” (the “.” before the filename makes it a hidden file)

Now, we have to  make the file executable:

chmod +x ~/.rotate

At this point, you are ready to run the script. You can execute it by clicking on it in your home folder, but since we made it hidden it is more likely that you want to set a shortcut to execute the file. In the past, I have had a button on the panel at the top that I could click to rotate the screen, but now I realize that it would be much better (and space-conserving) to simply use the rotate screen button on the tablet itself.

If you still want to have a button on the panel, right click on an empty space, select “Add to panel” (you might have to move something to get empty space) then add a “Custom Application Launcher”, making the command “/home/$USERNAME/.rotate”

To set one of the tablet hardware buttons to be a shortcut key, you first have to find out it’s keycode. To do this, open a terminal and launch the program “xev”

Then move your mouse over to close the window that it spawns, but don’t close it yet. When your mouse is in position, press the tablet rotate button and you should get something like the following:
KeyPress event, serial 32, synthetic NO, window 0x4a00001,
root 0xaa, subw 0x0, time 1510919, (164,-20), root:(611,29),
state 0x0, keycode 199 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

In there you can see “keycode 199” remember this or write it down, then you can close the box that xev spawned. (if yours does not show a keycode, type the command “setkeycodes 6c 199”. see Here for the rest of the tablet buttons, and Here for other keys entirely.

At this point, you need to create an xmodmap file in your home directory, and set your computer to use that xmodmap file:
touch ~/.Xmodmap
xmodmap ~/.Xmodmap

Now, edit the file by entering “gedit ~/.Xmodmap” into a terminal to include the keys you want to map in the following format:
keycode < keycode> = < keysym>

So in my case, I want to map keycode 199 to the keysum XF86LaunchB (I’m saving LaunchA for later)
keycode 199 = XF86LaunchB

then save and close the file. You will have to restart X (haven’t gotten to setting that hotkey yet) so for now, logout and log back in, or restart the computer. You will then be asked which Xmodmap file you want to load, select the one you just created, press “load”, “do not ask me this again”, and then “okay”.

xmodmap

Now to actually set that key to launch the rotate script, you should already have compiz config settings manager installed (sudo apt-get install compizconfig-settings-manager if you don’t already). Open that in System > Preferences > (Display >) Compiz Config Settings Manager.

Within CompizConfig, click on “Commands” (should be top left) then go to the “Key Bindings” tab. Click on the word “Disabled” next to “Run Command 1” (I’m saving command 0 for later) then check the “Enabled” box. Now you need to click on “Grab Key Combination” and press the rotate screen button (it should then read XF86LaunchB). Now you can hit okay and go to the “Commands” tab.

In “Command Line 1” enter the command for the rotate script:
/home/$USERNAME/.rotate

Now check the “enable commands” box over in the left column, hit back, close compizconfig, and have fun with your new calibrated tablet with ondemand screen rotation!!!

SOURCES for rotation and hotkeys:
rotation script framework: http://wiki.control-d.com/index.php?title=Ubuntu_Intrepid_Ibex_(8.10)_on_a_Toshiba_Protege_M400#Rotating_the_screen
Tablet Hardware Buttons: http://www.thinkwiki.org/wiki/Tablet_Hardware_Buttons
Thinkpad Special Keys: http://www.thinkwiki.org/wiki/How_to_get_special_keys_to_work#Gnome.2Fmetacity

Updating Linuxwacom (drivers and utilities) in Ubnutu Intrepid

Posted in Life in General by aliencam | 15 Comments »

If you have a tablet with a multitouch capable screen in Ubuntu Intrepid 8.10, then you have probably noticed some problems with the touch function.  Of course, if you don’t have the tablet set up at all yet, you’ll want to follow my guide to setting up the tablet in Ubuntu Intrepid first.  I had pretty much given up on well-calibrated touch support in this version, but yesterday “Drew” commented on my middle mouse scrolling setup guide and I followed his intensedebate profile over to his blog, http://geedew.com/blog.  Over there he has a guide on updating wacom-tools to the newest version.  You can read his post at this link or just continue reading here.

If you want to see which version of wacom-tools came with your instalation, or which version youmost recently installed with a package.  In a terminal run:

dpkg -p wacom-tools  | grep Version

and it should return:

Version: 1:0.8.1.4-0ubuntu3

However, if you have tried updating linuxwacom on your instalation of linux previously, that command is essentially useless as it just says what version the package manager most recently installed. (even after updating linuxwacom using this guide, that command will still give the same output).  The new version has much better touch support, allows you to calibrate the touch driver, and allows you to disable touch from the wacom control pannel.  (command is wacomcpl)

First step is to download the newest version of the software here (should be the one at the top of the list) and unzip it.  Open a terminal and change the directory to the new unzipped file. Uou can type “cd” and then drag the file into the terminal window and press enter to do this, or if it is on your desktop, use the command:

cd ~/Desktop/linuxwacom-0.8.2

changing the version number if you have to. Now run the uninstall and install scripts as sudo to update your linuxwacom utilities.

sudo ./prebuilt/uninstall

sudo ./prebuilt/install

save and close your work, and restart X with ctrl-alt-backspace, or restart the computer.

and that should be all to update those. If you get any errors on the uninstall or install commands, try re-downloading the file (that happened to me the first time).

Now, to recalibrate or disable/enable touch, hit alt-f2 (or go into a terminal) and enter “wacomcpl”
This will let you change options related to the tablet’s drivers. To recalibrate, go to “touch” on the left, then “calibrate” and poke the middle of the pink box with your finger.

works great now! Thanks for the heads up Drew.

-aliencam

Creative Commons License