SDB:Wacom 平板电脑安装程序
版本:11.3,11.4 此脚本仅在 openSUSE 11.3 和 11.4 上进行了测试。
简介
此脚本的目的是自动化和简化 Wacom 平板电脑的安装。此脚本已在 Wacom Bamboo Pen & Touch(CTH-460) 和 Hanwang (Hanvon) Artmaster III 平板电脑上进行了测试。但是,该脚本也应该适用于其他 Wacom(以及一些兼容 Wacom 的)平板电脑。该脚本已修改为考虑 openSUSE 11.4 当前版本的 xorg。只有在必要时才会安装 linuxwacom 驱动程序。感谢 Frankstappers 指出这一点。
获取
只需将下面的脚本复制并粘贴到您最喜欢的编辑器中,并将其保存为“linuxwacom_installer.sh”到您将记住的位置(推荐您的主目录)。
#!/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
运行
为了运行脚本,请打开一个终端窗口。导航到 linuxwacom_installer.sh 脚本的位置。
使文件可执行。
> chmod a+x ./linuxwacom_installer.sh
启动脚本。
> sudo ./linuwacom_installer.sh
故障排除
如果脚本失败,请查看 linuxwacom_error.log 以获取任何错误消息。
OpenSuse 12.1
我建议您在 12.1 上执行的操作是
- 首先,尝试您已有的内容。它可能有效。
- 如果不行,请通过 Yast 更新您的内核等,然后再次尝试。
- 如果不行,并且 `lsmod | grep wacom` 显示没有任何内容,请尝试 `sudo modprobe wacom` 然后再次尝试(通过注销 + 重新登录来重启 KDE)。
- 如果这没有帮助,请插入您的平板电脑,键入 `dmesg`,检查您是否看到“input: Wacom Bamboo Connect Pen as /devices/pci...”(或类似内容 - 重要部分是“input:” 出现在 usb 行之后)。如果您没有看到,那么您可能拥有的型号比内核模块支持的更新。上面的脚本无济于事,但是 http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Input-wacom 上的说明会 - 继续构建该模块并安装它。
- 如果您看到“input:” 但平板电脑仍然无法正常工作,那么您可能需要更新 X 驱动程序(上述内容是针对内核驱动程序的 - 您需要两者)。在这种情况下,运行脚本并选择选项 1。
我个人没有完全按照上面的说明操作(我首先运行了脚本,但没有帮助,然后我四处搜索 + 尝试了各种方法),但我认为这些是我尝试过的所有内容所需的步骤。我现在有一个可用的 Bamboo Connect Model CTL-470,我了解到它可能是一个“第三代”设备(因此在 12.1 的最新内核中不受支持)。感谢 http://comments.gmane.org/gmane.linux.drivers.wacom/6217
外部链接
- Linuxwacom 项目
- Linux 平板电脑 - Lenovo S10-3t
- openSUSE-Edu-Li-f-e-11.4 内核模块 在此