PDA

Ver la Versión Completa : Script para instalar tableta gráfica



Uranzu
28-oct-2010, 19:32
Opensuse a día de hoy no detecta las tabletas gráficas Wacom. En el foro hermano en inglés opensuse Forums (http://forums.opensuse.org/) me pasaron un script que compila y hace todo lo necesario de una tirada. Muy útil para usuarios noveles como yo.

1. Copiar este código y guardarlo en un archivo de texto.

#!/bin/sh
set -u
set -e

xorg_ver=$(xdpyinfo | grep -i "X.Org version" | gawk -F ":" '{ print $2 }')

# Make sure the script is run as root.
if [ "`whoami`" != "root" ]
then
echo "Please run this script as root."
exit
fi
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 "------------------------------------------------------------------------------"


srcPath="/usr/src"
xf86_input_wacom="xf86-input-wacom"
linuxwacom="linuxwacom"
xorg_macros="xorg-macros"

echo ------------------------------------------------------------------------------
echo Please make sure that your tablet is not connected!
echo ------------------------------------------------------------------------------
echo
read -s -n 1 -p "Press any key to begin installation..."
echo

echo -n "checking for linuxwacom directory... "
if [ ! -d $srcPath ]
then
echo no
mkdir -p $srcPath
else
echo yes
fi
cd $srcPath
workdir="`pwd`"

echo ------------------------------------------------------------------------------
echo Installing Dependencies...
echo ------------------------------------------------------------------------------

kernel_flavor=$(uname -r | gawk -F "-" '{print $3}')
kernel_number=$(uname -r | gawk -F "-" '{print $1"-"$2}')
kernel_version=$(zypper se -is kernel-${kernel_flavor} | grep -m 1 $kernel_number | gawk -F "|" '{print $4}' | sed "s/[ ]*//g")
kernel_version=${kernel_version}

echo "Kernel version = $kernel_version"

# List of dependencies
deplist="gcc make automake git-core cvs gettext-runtime gettext-tools libtool gawk tcl tk tcl-devel tk-devel ncurses ncurses-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 | gawk -F "=" '{print $1}')
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 "Installing $dep... "
zypper --non-interactive in $dep || {
read -p "$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 || 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 Prepare sources for building firmware module...
echo ------------------------------------------------------------------------------
cd /usr/src/linux-`uname -r | cut -d- -f1,2`
make oldconfig && make modules_prepare
echo [Done]

#Restore original directory
cd $workdir

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
#ln -s /usr/include/dbus-1.0/dbus /usr/include/dbus
echo [Done]

#Restore original directory
cd $workdir

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

# Download latest software
echo -n "downloading $xorg_macros... "
git clone git://anongit.freedesktop.org/git/xorg/util/macros $srcPath/xorg-macros
echo [Done]

echo -n "installing xorg_macros... "
# Install xorg-macros
cd $xorg_macros
./autogen.sh --prefix=/usr
make
make install
echo [Done]

#Restore original directory
cd $workdir

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

# Download latest software
echo -n "downloading $xf86_input_wacom... "
git clone git://linuxwacom.git.sourceforge.net/gitroot/linuxwacom/xf86-input-wacom
echo [Done]

echo -n "installing xf86-input-wacom... "
cd $xf86_input_wacom
#./configure
./autogen.sh --prefix=/usr
make
make check
make install
echo [Done]

#Restore original directory
cd $workdir

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
echo [Done]

echo -n "installing linuxwacom... "
cd $linuxwacom
./bootstrap

machine=$(uname -m)
if [ "$machine" == "x86_64" ] || [ "$machine" == "ia64" ] || [ "$machine" == "amd64" ]
then
# if 64 bit
./configure --enable-wacom --prefix=/usr --libdir=/usr/lib64
elif [ "$machine" == "i386" ] || [ "$machine" == "i586" ] || [ "$machine" == "i686" ]
then
# if 32 bit
./configure --enable-wacom --prefix=/usr
else
./configure --enable-wacom --prefix=/usr
fi

cd src/2.6.30

# Check to see if module is already loaded.
if [ -n "`lsmod | grep -i wacom`" ]
then
modprobe -r wacom # remove module
fi

echo ------------------------------------------------------------------------------
echo Creating /etc/udev/rules.d/60-wacom.rules
echo ------------------------------------------------------------------------------
cat > /etc/udev/rules.d/60-wacom.rules <<DELIM
# udev rules for wacom tablets.
KERNEL!="event[0-9]*", GOTO="wacom_end"
# Multiple interface support for stylus and touch devices.
DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="00", ENV{WACOM_TYPE}="stylus"
DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="01", ENV{WACOM_TYPE}="touch"
# Convenience links for the common case of a single tablet. We could do just this:
#ATTRS{idVendor}=="056a", SYMLINK+="input/wacom-\$env{WACOM_TYPE}"
# but for legacy reasons, we keep the input/wacom link as the generic stylus device.
ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/wacom"
ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}=="touch", SYMLINK+="input/wacom-touch"
# Check and repossess the device if a module other than the wacom one
# is already bound to it.
ATTRS{idVendor}=="056a", ACTION=="add", RUN+="check_driver wacom \$devpath \$env{ID_BUS}"
LABEL="wacom_end"
DELIM

cp wacom.ko /lib/modules/`uname -r`/kernel/drivers/input/tablet/
depmod -a
echo [Done]
echo
echo ------------------------------------------------------------------------------
echo You may now plug in your tablet...GOOD LUCK!
echo ------------------------------------------------------------------------------

exit

2. Pinchar con el botón derecho sobre el archivo, ir a propiedades y en la pestaña "permisos" hacer click en la casilla es "ejecutable" y Aceptar.

3. Abrir la consola y entrar como superusuario:
su + intro
contraseña + intro

4. Arrastrar el archivo de texto a la consola y dar a intro.

Y ya está.

Saludos

Uranzu
04-nov-2010, 07:43
Han actualizado el script. (http://en.opensuse.org/SDB:Wacom_Tablet_Installer) Supongo que será para mejor :)