CF-72 Touch Screen Automated
I stretched my shell scripting abilities a bit today automating the driver patch for the touch screen on my notebook. I first tried to fix the lifebook.c file with sed. However, I found the multi-line editing functions a little to complex for me to just pick up. Next time. This time I took the easy way out and embedded the text of the entire source file in the script and simply printed it out to a file before compilation. This will work as long as the rest of the driver source doesn’t get rewritten in the future.
here are the excerpts:
echo -n ' '
echo -e \\r"** Installing necessary packages"
apt-get -y install xserver-xorg-input-evtouch linux-source linux-headers-`uname -r` 1>/root/psmlog.txt 2>/root/psmerr.txt &
while [ `pgrep apt-get` ]
echo -e \\r"** Removing conflicting packages"
apt-get -y remove xorg-driver-fglrx 1>>/root/psmlog.txt 2>>/root/psmerr.txt &
while [ `pgrep apt-get` ]
if [ -e "/usr/src/linux-source-$KernNum" ]; then
echo -e \\r"** Linux Source is up-to-date"
echo -e \\r"** Extracting Linux Source Files, This may take some time . . ."
tar -xjf "linux-source-"$KernNum".tar.bz2" &
while [ `pgrep tar` ]
echo -e \\r"** Preparing touch screen driver source"
cp -R /usr/src/linux-source-$KernNum/drivers/input/mouse /root/
mv ./lifebook.c lifebook.old
* Fujitsu B-series Lifebook PS/2 TouchScreen driver
~ ~ ~ ~ driver source code here ~ ~ ~ ~
mv ./Makefile ./Makefile.old
# Makefile for the psmouse driver.
~ ~ ~ ~ Makefile text here ~ ~ ~ ~
echo -e \\r”** Compiling device driver”
make 1>>/root/psmlog.txt 2>>/root/psmerr.txt
echo -e \\r”** Driver compiled successfully”
read -sn 1 -p “** Close any other open windows and press any key to continue…”
echo -e \\n\\r”** Installing touch screen driver”
mv /lib/modules/`uname -r`/kernel/drivers/input/mouse/psmouse.ko /lib/modules/`uname -r`/kernel/drivers/input/mouse/psmouse.bak
cp ./psmouse.ko /lib/modules/`uname -r`/kernel/drivers/input/mouse/psmouse.ko
make clean 1>>/root/psmlog.txt 2>>/root/psmerr.txt
mv /etc/X11/xorg.conf /etc/X11/xorg.old
# xorg.conf (X.Org X Window System server configuration file)
~ ~ ~ ~ Contents of /etc/X11/xorg.conf here ~ ~ ~ ~
killall -1 gdm
I am sure that there are better ways to do this (using sed for instance), but this gets it done for now. Now maybe I will upgrade to Ubuntu 9.04 and see if this works there.
Ok I just tried this on ubuntu 9.04 and discovered that I had forgotten to include the ‘-y’ option to the ‘apt-get’ commands (fixed now). Also, the driver compile section fails unless you add ‘elantech.o hgpk.o’ to the Makefile section. And I added a 0.05 pause to the spinner so you can actually see it spin.
This post is outdated please use the new script here