This file documents the Guts package, an X11 driver for A-Touch and Onetouch touchscreen devices. I plan to add support for other protocols as I find time.
The package supports serial and USB touch panels manufactured by A-Touch and Onetouch, under GNU/Linux and XFree86. The latest version of this driver can be downloaded from:
The latest source tree can be accessed from my CVS server, instructions
are available at http://www.gnudd.com/software/#cvs . The
package name to use is guts
. As an alternative, you can use
viewcvs at http://cvs.gnudd.com. The latest CVS snapshot
can also be downloaded from ftp://ftp.gnudd.com/pub/guts
or the mirror site ftp://ftp.linux.it/pub/People/rubini/guts .
The driver has been designed to run under XFree86 version 4.x. It has been tested on 4.1 and 4.2.
In order to use the touch screen in X, you should install in your system the "guts_drv" module, part of this distribution.
The compiled module (guts_drv.o
) should be
copied in the module
directory of your X server, usually or /usr/X11R6/lib/modules/input
.
When the file is in place, a proper XF86Config
will arrange for
its loading.
In order to recompile the module
you need access to the complete X source tree, and you can
compiling issuing:
make XFREE_SOURCE=<location-of-source> guts_drv.o
The "location of source" above should be the full path name to the directory called "xc" after you uncompress the source tar file.
XFREE_SOURCE
can be defined
in your environment if you prefer. Note that if the variable
is defined, calling make without arguments will
compile the module.
To compile guts you'll most likely need to compile X first
(by issuing make World
and waiting a huge lot of time). A freshly
uncompressed source tree lacks the proper header files for compilation
to succeed; since one of the errors happens inside an X header, you
can only fix it by compiling X first - I can't fix things in my source.
In order to use a Guts device with XFree 4, you need to add an
InputDevice
section to your XF86Config
. The following example shows
how it looks like. The options that are shown commented are not
implemented in this version of the module, and are ignored
if specified.
Section "InputDevice" Identifier "Touchscreen0" Driver "guts" Option "Device" "/dev/ttyS0" Option "BaudRate" "9600" #Option "Protocol" "a-touch" #Option "CalibrationFile" "/etc/guts.calib" Option "Smoothness" "0" Option "TappingDelay" "0" Option "JitterDelay" "50" Option "DebugLevel" "0" Option "SendCoreEvents" EndSection
Moreover, you need to add an InputDevice
line in the
ServerLayout
section. After the addition,
the section will most likely look like this:
Section "ServerLayout" Identifier "Simple Layout" Screen "Screen 1" InputDevice "Mouse1" "CorePointer" InputDevice "Keyboard1" "CoreKeyboard" InputDevice "Touchscreen0" EndSection
Note that if your system has no mouse device, you can remove
the InputDevice "Mouse1"
line and add "CorePointer"
to the touch screen line.
The meaning of individual options is as follows:
Identifier "Touchscreen0"
InputDevice
directive within the ServerLayout
section that is usually found at the end of the configuration file.
Driver "guts"
guts_drv.o
.
Option "Device" "/dev/ttyS0"
/dev/ttyUSB0
or similar.
Option "BaudRate" "9600"
Option "CalibrationFile" "/etc/guts.calib"
Option "Smoothness" "0"
Option "TappingDelay" "0"
Option "JitterDelay" "50"
Option "DebugLevel" "0"
Option "SendCoreEvents"
Please note that with XFree you can still use a normal mouse together with the touch panel. Also, can use the touch screen as its only pointer device.
If, when calling startx
, it fails with a message of
Invalid Subsection Name
, please check the previous error
lines, as they explain what is wrong. They usually look like:
(--) no ModulePath specified using default: /usr/X11R6/lib/modules xf86Guts.so: Unknown error loading module
The messages are pretty clear, if your are careful in reading them (I am not that careful, and lose half an hour in trying to figure out what was wrong).
To calibrate the touch panel, run the guts_calib
script, under X.
The program needs to find guts_control
and
guts_to_ascii
in the command search path or the current
directory. This usually means you can simply "make install
"
before running the calibration, but you can also run the calibration
program from the source directory, provided ".
" is in your
PATH
.
The control program is used to turn off the touchscreen in X, so the calibrator can read input data (see guts_control). The conversion tool is used so that the calibrator can read ASCII data instead of binary data (see guts_to_ascii).
The new 5-point calibration, as of release 1.2 of the package, is a
full-screen application that takes complete control of your
desktop. Since it disables the touchscreen in X in order to directly
read the serial port, you'll need to invoke "guts_control
on
" or "guts_control raw
" if the program terminates
unexpectedly. Premature death of the application is not foreseeable,
but you may want to send a termination signal to the calibrator for
whatever reason. See guts_control.
The package includes three tools that work by connecting with the X server:
The program receives a single command-line argument and uses it as a command to be performed by communicating with the X server.
The following commands are supported:
devinfo
off
on
raw
b1
b2
b3
b2once
b3once
getleds
The program is a simple graphical application to control generation of button-2 and button-3 mouse events. Running the application is optional, and you won't need to run it if your setup only uses button-1 events.
The program window is made up of two buttons, labelled "2" and "3". They are inactive by default.
After clicking on one of the buttons, it becomes yellow and the touch screen will report a button-2 or button-3 event once. After the event is reported the button turns back gray and the touchscreen will go back to report button-1 events.
After clicking twice on one of the buttons, the button becomes red and button-2 or button-3 events will be generated from now on. To go back to button-1 events just click on the button again to inactivate it.
The program reads from the serial port specified on the command-line and converts binary packet to ascii information. Besides being used by the calibration program, the program can be used for basic diagnosis of hardware problems.
The program moves the mouse pointer. It can be used to move the mouse when there is no active mouse. It accepts a series of letters on the command line: each uppercase N, S, W, E moves the pointer by 100 pixels to the north, south, west, east. Each lowercase n, s, w, e moves the pointer by 10 pixels.