Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Fedora 8 Touchscreen egalax/evtouch driver not working

Posted by: NMangal Jun 12 2008, 02:26 PM

Hi there,
I am stuck tyring to figure out how to get my monitor's touchscreen working.
Driver: egalax Touchkit.
X-version :1.3.0

I have downloaded and copied an to /usr/lib/xorg/modules/input and modified my xorg.conf file as per instructions.

I get the folloiwng message in my /var/log/Xorg.0.log

[nmangal@localhost ~]$ cat /var/log/Xorg.0.log | grep egalax
(II) LoadModule: "egalax"
(II) Loading /usr/lib/xorg/modules//input/
dlopen: /usr/lib/xorg/modules//input/ wrong ELF class: ELFCLASS64
(EE) Failed to load /usr/lib/xorg/modules//input/
(II) UnloadModule: "egalax"
(EE) Failed to load module "egalax" (loader failed, 7)
(EE) No Input driver matching `egalax'

Has anyone faced similar problems before? Any help will be really really appreciated.

Also tried with evtouch driver and the module loaded up fine however I couldn't get the touchscreen working.


Posted by: rlevanm Aug 13 2008, 04:37 PM

Yes but I was using XFree86/Xfbdev instead of Xorg and my platform was embedded with kernel 2.6.22. It took me awhile to figure out.
I hope that my solution could give you some clues.

To make the USB touchscreen from eGalax to work with my USB optical mouse, I had to make few changes to the kernel AND the XFree86/tinyx code.

1. Kernel: I followed and made my usbtouchscreen driver to ignore the eGalax. The io /dev/hiddev0 will pick up the device instead.
Check the input with cat on console.

2. Tslib: download tslib (1.0) and use it in X as well as the calibration tool provided with this package. The original raw input plugin didn't work well with eGalax.
Taking clues from, I added a pluggin tk-raw.c (to tslib/plugins) to read HID messages from /dev/hiddev0.
The incoming messages are of 8 bytes with bytes (0,1)=type, (2,3)=code, (4,5)=value, (6,7)=pad.

The types and codes looked something like this:


/* Event type */
#define HID_EVENT_TYPE_X 0x30
#define HID_EVENT_TYPE_Y 0x31
#define HID_EVENT_TYPE_SYNC 0x32

/* Event code */
#define HID_EVENT_CODE_ABS 0x1
#define HID_EVENT_CODE_PEN 0xd
static int
ts_read_bytes (int fd, struct input_event *ev, int timeout)
int n, i;
int type1, code1, val1, pad1;

if (timeout && (TsWaitForReadable (fd, timeout) != 0))
return -1;
n = read (fd, b, HID_EVENT_MSG_SIZE);
if (n <= 0)
return -1;

type1 = (int)((b[1]<<8)|b[0]);
code1 = (int)((b[3]<<8)|b[2]);
val1 = (int)((b[5]<<8)|b[4]);
pad1 = (int)((b[7]<<8)|b[6]);

ev->type = EV_SYN;
return 1;
if (code1 == HID_EVENT_CODE_PEN)
ev->type = EV_ABS;
ev->code = ABS_PRESSURE;
ev->value = val1;
return 1;
if (code1 == HID_EVENT_CODE_ABS)
ev->type = EV_ABS;
ev->code = ABS_X;
ev->value = val1;
return 1;
if (code1 == HID_EVENT_CODE_ABS)
ev->type = EV_ABS;
ev->code = ABS_Y;
ev->value = val1;
return 1;
static int ts_tk_read(struct tslib_module_info *inf,
struct ts_sample *samp, int nr)
struct tslib_input *i = (struct tslib_input *)inf;
struct tsdev *ts = inf->dev;
struct input_event ev;
int ret = nr;
int total = 0;

if (i->sane_fd == 0)
i->sane_fd = check_tk_fd(i);

if (i->sane_fd == -1)
return 0;

if (i->using_syn)
samp->x = 0;
samp->y = 0;
samp->pressure = 0;

while (total < nr)
ret = ts_read_bytes (ts->fd, &ev, 0);
if (ret != 1)
total = -1;

switch (ev.type)
static const struct tslib_ops __ts_tk_ops = {
.read = ts_tk_read,
.fini = ts_tk_fini,

3. In /etc/ts.conf, I changed module_raw to use my newly created plugin tk-raw instead of input.

4. I cross-compiled tslib libraries and its tools. I installed the tool to my target platform (using make) and used ts_calibrate to generate the calibration file. Then used ts_test to check the calibration.
This should worked fine with the changes above.

5. To have my USB mouse working with the egalax using tslib, I added an option -ts to tinyx.c. I create a new KdMouseInfo container (KdTsInfo) in txinfo.c and use it in linux/tslib.c instead of KdMouseInfo.

6. I made sure that X used the generated tslib libraries. I then cross-compild XFree86 with option HasTsLib equals YES (xc/config/cf/host.def) and installed X on the target.

7. I tested >Xfbdev -mouse /dev/input/mice -ts /dev/hiddev0. And everything worked fine.

If there is less complicated ways to do it, I am all ears.

Posted by: davidtgbe Sep 6 2008, 02:18 PM

Hi rlevanm, I would be very pleased to you if you could send me your tk-raw.c. I'm trying to make working a Lilliput with TSLIB using the HID RAW kernel driver, using /dev/usb/hiddev0. I have made it working on X windows without problem, but I would like to it with QT4 embedded as well using the framebuffer.

Thank you very much!

Posted by: davidtgbe Sep 8 2008, 12:51 PM

First of all thank you for send me the source. I have compiled it and changed ts.conf to make use of the new module, I have also set the env. variables but the result is the same, the known "selected device is not a touchscreen I understand". It is given by the check_fd function but I ignore why it works for you and not for me sad.gif . Here I post some information of my configuration.

/proc/bus/usb/devices and /proc/bus/input/devices

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0eef ProdID=0001 Rev= 1.00
S: Manufacturer=eGalax Inc.
S: Product=Touch
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 44mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms

I: Bus=0003 Vendor=0eef Product=0001 Version=0112
N: Name="eGalax Inc. Touch"
P: Phys=usb-0000:00:10.0-1/input0
S: Sysfs=/class/input/input4
U: Uniq=
H: Handlers=mouse0 event4
B: EV=b
B: KEY=401 0 30000 0 0 0 0 0 0 0 0
B: ABS=f

Env. variables:

declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -x TSLIB_CALIBFILE="/etc/pointercal"
declare -x TSLIB_CONFFILE="/etc/ts.conf"
declare -x TSLIB_CONSOLEDEVICE="/dev/tty1"
declare -x TSLIB_FBDEVICE="/dev/fb0"
declare -x TSLIB_PLUGINDIR="/usr/local/lib/ts"
declare -x TSLIB_TSDEVICE="/dev/usb/hiddev0"

Output of the ts_calibrate command:

xres = 640, yres = 480
selected device is not a touchscreen I understand
Took 14 samples...
Top left : X = 1065796996 Y = 1065797004
Took 14 samples...
Top right : X = 1065796996 Y = 1065797004
Took 14 samples...
Bot right : X = 1065796996 Y = 1065797004
Took 14 samples...
Bot left : X = 1065796996 Y = 1065797004
Took 14 samples...
Center : X = 1065796996 Y = 1065797004
34.206677 -536.553298 544.045782
23.905008 -404.541788 404.541788
Calibration constants: 2241768 -35163556 35654584 1566638 -26512050 26512050 65536


# Uncomment if you wish to use the linux input layer event interface
#module_raw input
module_raw tk

# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie

# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi

# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00

# Uncomment if you're using an HP iPaq h3600 or similar
# module_raw h3600

# Uncomment if you're using a Hitachi Webpad
# module_raw mk712

# Uncomment if you're using an IBM Arctic II
# module_raw arctic2

module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

Any ideas?
Thanks again.

Posted by: blindber May 11 2009, 07:27 PM

Hi rlevanm,

I would every much like to get a copy of your tk-raw.c as well. Is it available to download from somewhere?

Thank you in advance

Powered by Invision Power Board (
© Invision Power Services (