SDB:Wacom tablet installer
Version: 11.3,11.4 This script has been tested only on openSUSE 11.3 and 11.4.
Introduction
The purpose of this script is to automate and simplify the installation of Wacom tablets. This script has been tested on a Wacom Bamboo Pen & Touch(CTH-460) and a Hanwang (Hanvon) Artmaster III tablet. However, the script should work for other Wacom (and some Wacom compatible) tablets as well. The script has been modified to take into account openSUSE 11.4's current version of xorg. The linuxwacom drivers will only be installed if necessary. Thanks to Frankstappers for pointing this out.
Acquiring
Simply copy and paste the script from below into your favorite editor and save it as "linuxwacom_installer.sh" to a location you will remember (your home directory is recommended).
#!/bin/sh
set -e
set -u
outfile="`pwd`/linuxwacom_error.log"
xorg_ver=$(X -version 2>&1 | grep X.Org | cut -d' ' -f4)
# Make sure the script is run as root.
if [ "`whoami`" != "root" ]
then
echo "Please run this script as root."
exit
fi
ans_valid=false
while ! $ans_valid; do
clear
echo "------------------------------------------------------------------------------"
echo " Disclamer of Warranty: "
echo
echo " No liability for this script can be accepted. Use the script at your own "
echo " risk. There may be errors and inaccuracies in this script that could lead "
echo " to damage to your system. Proceed with caution, and although damage to "
echo " your system is highly unlikely, the author(s) do not take any "
echo " responsibility for damage or loss caused by errors in this script. "
echo "------------------------------------------------------------------------------"
echo
echo "Please choose items to install:"
echo "1) xf86-input-wacom"
echo "2) linuxwacom"
echo "3) all - Choose all if you are not sure."
echo "q) quit"
echo
read -p "Option: " ans
xf86_input_wacom_install=false
linuxwacom_install=false
case "$ans" in
1)
xf86_input_wacom_install=true
ans_valid=true;;
2)
linuxwacom_install=true
ans_valid=true;;
3)
xf86_input_wacom_install=true
linuxwacom_install=true
ans_valid=true;;
q)
exit 0;;
esac
done
srcPath="/usr/src"
xf86_input_wacom="xf86-input-wacom"
linuxwacom="linuxwacom"
xorg_macros="xorg-macros"
echo
echo ------------------------------------------------------------------------------
echo Please make sure that your tablet is not connected!
echo ------------------------------------------------------------------------------
read -s -n 1 -p "Press any key to begin installation..."
echo
echo -n "checking for /usr/src directory... "
if [ ! -d $srcPath ]
then
echo no
mkdir -p $srcPath
else
echo yes
fi
cd $srcPath
workdir="`pwd`"
echo
echo ------------------------------------------------------------------------------
echo Installing Dependencies...
echo ------------------------------------------------------------------------------
kernel_flavor=$(uname -r | cut -d- -f3)
kernel_number=$(uname -r | cut -d- -f1,2)
kernel_version=$(zypper se -s kernel-${kernel_flavor} | grep -m 1 $kernel_number | cut -d\| -f4 | sed "s/[ ]*//g")
kernel_version=${kernel_version}
# List of dependencies
deplist="gcc make automake git-core cvs gettext-runtime gettext-tools libtool tcl tk tcl-devel tk-devel ncurses ncurses-devel libudev-devel xorg-x11-server-sdk kernel-source=$kernel_version kernel-syms=$kernel_version"
OLDIFS=$IFS
IFS=" "
for dep in $deplist
do
short_dep=$(echo $dep | cut -d= -f1)
echo -n "checking for $short_dep... "
if [ -n "`zypper se -i --match-word $short_dep | grep -e "^i."`" ]
then
echo yes
else
echo no
echo -n "Installing $dep... "
zypper --non-interactive --quiet in $dep &>$outfile || {
read -p "The package $dep failed to install would you like to attempt to resolve this issue automatically? (y/n): " ans
case "$ans" in
y|Y|yes) zypper --non-interactive in --force-resolution $dep &>>$outfile;; #|| zypper --non-interactive in --force-resolution $short_dep;;
n|N|no)
echo "Please install $dep and launch the script again."
exit;;
esac
}
echo [done]
fi
done
IFS=$OLDIFS
echo
echo ------------------------------------------------------------------------------
echo Prepare sources for building firmware module...
echo ------------------------------------------------------------------------------
cd /usr/src/linux-`uname -r | cut -d- -f 1,2`
make oldconfig && make modules_prepare
#Restore original directory
cd $workdir
echo
echo ------------------------------------------------------------------------------
echo Creating symbolic link for Modules...
echo ------------------------------------------------------------------------------
echo -n "checking for /usr/src/linux-`uname -r | cut -d- -f1,2` directory... "
if [ -d /usr/src/linux-`uname -r | cut -d- -f1,2` ]
then
echo yes
cd /usr/src/linux-`uname -r | cut -d- -f1,2`
else
echo no
exit 1
fi
if [ ! -e /usr/src/linux-`uname -r | cut -d- -f1,2`/Module.symvers ]
then
ln -s /lib/modules/`uname -r`/build/Module.symvers /usr/src/linux-`uname -r | cut -d- -f1,2`/Module.symvers
fi
#Restore original directory
cd $workdir
if $xf86_input_wacom_install; then
echo
echo ------------------------------------------------------------------------------
echo Downloading and installing xorg-macros...
echo ------------------------------------------------------------------------------
# Get xorg-macros
PREFIX=/usr
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
PATH=$PREFIX/bin:$PATH
ACLOCAL="aclocal -I $PREFIX/share/aclocal"
LD_LIBRARY_PATH=$PREFIX/lib
PYTHONPATH=$PREFIX/lib/python2.6/site-packages
echo -n checking for $xorg_macros directory...
if [ ! -d $xorg_macros ]
then
echo no
else
echo yes
rm -rf ./$xorg_macros
fi
mkdir $srcPath/xorg-macros
# Download latest software
echo -n "downloading $xorg_macros... "
git clone git://anongit.freedesktop.org/git/xorg/util/macros $srcPath/xorg-macros &>>$outfile
echo [done]
echo -n "installing xorg_macros... "
# Install xorg-macros
cd ./$xorg_macros
./autogen.sh --prefix=/usr &>>$outfile
make &>>$outfile
make install &>>$outfile
echo [done]
#Restore original directory
cd $workdir
echo
echo ------------------------------------------------------------------------------
echo Downloading and installing xf86-input-wacom...
echo ------------------------------------------------------------------------------
echo -n checking for $xf86_input_wacom directory...
if [ ! -d $xf86_input_wacom ]
then
echo no
else
echo yes
rm -rf ./$xf86_input_wacom
fi
mkdir $srcPath/$xf86_input_wacom
# Download latest software
echo -n "downloading $xf86_input_wacom... "
git clone git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/xf86-input-wacom &>>$outfile
echo [done]
echo -n "installing xf86-input-wacom... "
cd ./$xf86_input_wacom
machine=$(uname -m)
if [ "$machine" == "x86_64" ] || [ "$machine" == "ia64" ] || [ "$machine" == "amd64" ]
then
# if 64 bit
./autogen.sh --prefix=/usr --libdir=/usr/lib64 &>>$outfile
elif [ "$machine" == "i386" ] || [ "$machine" == "i586" ] || [ "$machine" == "i686" ]
then
# if 32 bit
./autogen.sh --prefix=/usr --libdir=/usr/lib &>>$outfile
else
./autogen.sh --prefix=/usr --libdir=/usr/lib &>>$outfile
fi
make &>>$outfile
make install &>>$outfile
#Setup xorg
cp conf/50-wacom.conf /etc/X11/xorg.conf.d/50-wacom.conf
echo [done]
#Restore original directory
cd $workdir
fi
if $linuxwacom_install; then
#Do not install linuxwacom drivers if xserver packages are equal or greater than 1.8.0
#vercomp=`zypper vcmp $xorg_ver 1.8 | grep -i "older"`
#if [ -n "$vercomp" ]
# then
echo
echo ------------------------------------------------------------------------------
echo Downloading and configuring linuxwacom...
echo ------------------------------------------------------------------------------
echo -n checking for $linuxwacom directory...
if [ ! -d $linuxwacom ]
then
echo no
else
echo yes
rm -rf ./$linuxwacom
fi
echo -n "downloading linuxwacom... "
cvs -z3 -d:pserver:anonymous@linuxwacom.cvs.sourceforge.net:/cvsroot/linuxwacom co -d linuxwacom -P linuxwacom-prod &>>$outfile
echo [done]
echo -n "installing linuxwacom... "
cd ./$linuxwacom
#Patch wacom_wac.c file
if [ -n "$(grep "struct input_absinfo" /usr/include/linux/input.h)" ]; then
cp ./src/2.6.30/wacom_wac.c ./src/2.6.30/wacom_wac.c.orig
sed -i -e 's/abs\[ABS_X\]/absinfo\[ABS_X\].value/g' -e 's/abs\[ABS_Y\]/absinfo\[ABS_Y\].value/g' ./src/2.6.30/wacom_wac.c
fi
./bootstrap &>>$outfile
machine=$(uname -m)
if [ "$machine" == "x86_64" ] || [ "$machine" == "ia64" ] || [ "$machine" == "amd64" ]
then
# if 64 bit
./configure --enable-wacom --prefix=/usr --libdir=/usr/lib64 &>>$outfile
elif [ "$machine" == "i386" ] || [ "$machine" == "i586" ] || [ "$machine" == "i686" ]
then
# if 32 bit
./configure --enable-wacom --prefix=/usr &>>$outfile
else
./configure --enable-wacom --prefix=/usr &>>$outfile
fi
# Check to see if module is already loaded.
if [ -n "`lsmod | grep -i wacom`" ]
then
modprobe -r wacom &>>$outfile # remove module
fi
echo [done]
echo
echo ------------------------------------------------------------------------------
echo Creating /etc/udev/rules.d/60-wacom.rules
echo ------------------------------------------------------------------------------
cp src/util/60-wacom.rules /etc/udev/rules.d/
echo
echo ------------------------------------------------------------------------------
echo Loading driver
echo ------------------------------------------------------------------------------
cp src/2.6.30/wacom.ko /lib/modules/`uname -r`/kernel/drivers/input/tablet/ && depmod -a && echo "Driver loaded successfully." || echo -e "There was a problem installing the driver. \nPlease see $outfile."
fi
echo
echo ------------------------------------------------------------------------------
echo You may now plug in your tablet...GOOD LUCK!
echo ------------------------------------------------------------------------------
exit
Running
In order to run the script open a terminal window. Navigate to the location of the linuxwacom_installer.sh script.
Make the file executable.
> chmod a+x ./linuxwacom_installer.sh
Launch the script.
> sudo ./linuwacom_installer.sh
Troubleshooting
If the script fails look at the linuxwacom_error.log for any error messages.
OpenSuse 12.1
What I would suggest you do on 12.1 is:
- First, just try what you have. It may work.
- If not, update your kernel etc via Yast and try again.
- If not, and `lsmod | grep wacom` shows nothing, try `sudo modprobe wacom` and then try again (restarting KDE by logging out + in).
- If that didn't help, plug in your tablet, type `dmesg`, check if you see "input: Wacom Bamboo Connect Pen as /devices/pci..." (or similar - the important part is that the "input:" appears after the usb lines). If you don't then you may have a model that is newer than that supported by the kernel module. The script above won't help, but the instructions at http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Input-wacom will - go ahead and build that module and install it.
- If you see the "input:" but still don't have a working tablet, then you may need to update the X driver (the above was for the kernel driver - you need both). In that case, run the script and select option 1.
I personally didn't follow exactly the instructions above (I ran the script first, but it didn't help, and I then searched around + tried various things), but I think those are the required steps from everything I tried. I now have a working Bamboo Connect Model CTL-470 which I understand may be a "third gen" device (and so was not supported by the 3.1 kernel in 12.1 latest). Credit to http://comments.gmane.org/gmane.linux.drivers.wacom/6217
External links
- Linuxwacom Project
- Linux Tablet - Lenovo S10-3t
- openSUSE-Edu-Li-f-e-11.4 kernel module here