CF-72 Touchscreen script 1.04
Here it is folks, it utilizes sed to edit the source code and and hal to configure X. The script has to be named ps2touchscreen.sh to function correctly, and it was written for Ubuntu 9.04. It may work on other distros but will most likely need editing, for instance; on 8.10 you will have to alter the make file section.
** The new script tested on Ubuntu 9.10 Karmic Koala(it should also work on 9.04) can be found here :
CF-72 Tchscreen 2.0
download here ps2touchscreen.sh review code below.
#!/bin/bash # script builds and installs a custom touchscreen module for CF-72 toughbook # script variables psmE="/root/psm_error.txt" psmL="/root/psm_log.txt" KernNum=`uname -r` # for checking kernel source version KernNum=${KernNum:0:6} # <--- number matches current kernel CompDir="/tmp/mouse" # Compile in temp directory easy cleanup ScriptL=`find ~/ -name ps2touchscreen.sh` # locate the script MouseD="/lib/modules/`uname -r`/kernel/drivers/input/mouse" #this is a processing indicator (aka spinner) i=1 sp="/-\|" echo -n ' ' IsWorking() { while [ -n "`pgrep $RUNNING`" ] do sleep 0.01 printf "\b${sp:i++%${#sp}:1}" done ErrChck } # error checking routine ErrChck() { ERCHK=`cat $psmE` if [ -n "$ERCHK" ]; then echo " ######################################################## ## Errors were ecountered! ## ## read /root/psm_error.txt and /root/psm_log.txt ## ## to find out what went wrong. ## ########################################################" exit 0 else echo -e \\b" done " fi } # make sure script is run with root permissions ls /root 1>/dev/null 2>/tmp/chkperm CHKP=`cat /tmp/chkperm` if [ -n "$CHKP" ]; then echo -e \\r"** You must have root permission to execute this script, try: sudo "$ScriptL rm /tmp/chkperm exit 0 else # checking for and installing any required packages PkgStrng="" echo -e \\r"** Checking for required packages . . . " if [ -e "/usr/lib/xorg/modules/input/evtouch_drv.so" ]; then echo -e \\r"** evtouch driver . . . . . . . . . . . . present" else PkgStrng="xserver-xorg-input-evtouch " fi if [ -e "/usr/src/linux-source-"$KernNum".tar.bz2" ]; then echo -e \\r"** linux-source-"$KernNum" . . . . . . . . . present" else PkgStrng=$PkgStrng"linux-source " fi if [ -e "/usr/src/linux-headers-`uname -r`/Makefile" ]; then echo -e \\r"** linux-headers-`uname -r`. . . . present" else PkgStrng=$PkgStrng"linux-headers-`uname -r` " fi if [ -n "$PkgStrng" ]; then echo -en \\r"** Installing "$PkgStrng" . . . " apt-get -y install $PkgStrng 1>$psmL 2>$psmE & RUNNING=apt-get IsWorking else echo -e \\r"** All of the necessary packages are present" fi if [ -e "/usr/lib/xorg/modules/drivers/fglrx_drv.so" ]; then echo -n \\r"** Removing ATI fglrx graphics driver . . . ." apt-get remove xorg-driver-fglrx 1>>$psmL 2>>$psmE & RUNNING=apt-get IsWorking fi # Check kernel source version - extract if necessary if [ -e "/usr/src/linux-source-$KernNum" ]; then echo -e \\r"** Linux Source is up-to-date" else echo -en \\r"** Extracting Linux Source, please wait . . . " cd /usr/src tar -xjf "linux-source-"$KernNum".tar.bz2" 1>>$psmL 2>>$psmE & RUNNING="tar" IsWorking fi echo -e \\r"** Preparing the driver source code for the compiler" cp -R /usr/src/linux-source-$KernNum/drivers/input/mouse /tmp cd $CompDir # repair the CF-72 entry in the source file sed -i ' /.*"CF-72"),/ {; n; n; N s/.*serio3\",/\t\t.callback\ =\ lifebook_set_6byte_proto,/ }' $CompDir/lifebook.c echo '''# # Makefile for the psmouse driver. # obj-m := psmouse.o psmouse-objs := psmouse-base.o synaptics.o alps.o lifebook.o trackpoint.o \ logips2pp.o elantech.o hgpk.o all: $(MAKE) -C /lib/modules/`uname -r`/build M=`pwd` modules clean: $(MAKE) -C /lib/modules/`uname -r`/build M=`pwd` clean $(RM) Module.markers modules.order ''' >Makefile echo -en \\r"** Compiling the PS/2 Touchscreen driver . . . " make 1>>$psmL 2>>$psmE & RUNNING="make" IsWorking echo -e \\r"** Touchscreen driver compiled successfully!" echo -e \\n\\r"+-------------------------------------------------+ | After installation of the touchscreen driver | | the computer will need to reboot, please save | | your work and close all other open windows. | +-------------------------------------------------+" read -sn 1 -p "** Press any key to continue" echo -e \\n\\r"** Installing touchscreen driver . . . " sleep 5 mv $MouseD/psmouse.ko $MouseD/psmouse.bak 1>>$psmL 2>>$psmE cp $CompDir/psmouse.ko $MouseD/psmouse.ko 1>>$psmL 2>>$psmE make clean 1>>$psmL 2>>$psmE # the driver has been successfully installed now clean up rm -R $CompDir # backup and remove /etc/X11/xorg.conf it is no longer needed with hal # supress messages in case it is gone already mv /etc/X11/xorg.conf /etc/X11/xorg-`date +%I%M%m%d%Y`.conf > /dev/null 2>&1 # create /etc/hal/fdi/policy/10-x11-input.fdi for hal echo '''<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- --> <!-- Pointer inputs for the Panasonic CF-72 w/ Touchscreen. Models without touchscreen do not need this file, they are automatically configured by hal --> <deviceinfo version="0.2"> <device> <match key="info.product" contains="LBPS/2 Fujitsu Lifebook TouchScreen"> <merge key="input.x11_driver" type="string">evtouch</merge> <merge key="input.x11_options.Device" type="string">/dev/input/by-path/platform-i8042-serio-1-event-mouse</merge> <merge key="input.x11_options.ReportingMode" type="string">Raw</merge> <merge key="input.x11_options.MinX" type="string">240</merge> <merge key="input.x11_options.MinY" type="string">220</merge> <merge key="input.x11_options.MaxX" type="string">3900</merge> <merge key="input.x11_options.MaxY" type="string">3800</merge> <merge key="input.x11_options.MoveLimit" type="string">5</merge> <merge key="input.x11_options.SendCoreEvents" type="string">true</merge> </match> </device> </deviceinfo>'''>/etc/hal/fdi/policy/10-x11-input.fdi rmmod psmouse 1>>$psmL 2>>$psmE sleep 2 modprobe psmouse 1>>$psmL 2>>$psmE sleep 2 ErrChck # last error check makes sure driver loaded and then final cleanup rm $psmL $psmE echo "** Touchscreen driver successfully installed!" read -sn 1 -p "** Press any key to reboot (or Ctrl-c to exit)" sudo reboot fi exit 0
If you want to use this script with Ubuntu 8.10 you will need to remove ‘elantech.o hgpk.o‘ from the make file section. It may have other issue as well, I no longer have an 8.10 system to test it on.

HI I have a panasonic cf-72,
i’m italian..
i use your script to active a touchscreen but while start compile a lifebook.c it’s stop with error makefile:11 separatore mancante arrestato.
Sorry for my terrible english
do you help me?
Tnx…:)
but on the script result a 4 spaces instead a TAB..
I wanted to thank you for your swift response and for the wonderful script that you have made…:)
It’s work..
tnx bye bye
Oops! I accidentally broke the script while trying make one that would survive copy paste to the blog. I fixed the file at the link. glad it worked.
Oops! The blog destroyed the formating. The lines after ‘all:’ and ‘clean:’ need indentation. like this;
all:
[indent]$(MAKE) -C /lib/modules/`uname -r`/build M=`pwd` modules
clean:
[indent]$(MAKE) -C /lib/modules/`uname -r`/build M=`pwd` clean
[indent]$(RM) Module.markers modules.order
There may be other problems as well. Here is the file ps2touchscreen.sh