While I plan to eventually use a cheap Nintendo touchscreen, I want to start with a touchscreen that I already have, one that used to be in my EeePC. This way, I don't have to deal with as many variables at once.
The interface board for this touchscreen usually speaks to a proprietary kernel module, and proprietary X driver. I would rather not use proprietary software, as proprietary software doesn't let me change things if I need to.
Once upon a time, X was configured with a file called /etc/X11/xorg.conf. This file was a description of all the input and output devices that X had to speak to. You could tell X about a device such as a touchscreen, by having an InputDevice stanza in /etc/X11/xorg.conf, which would cause X to load a driver for that input device. The touchscreen maker provides a proprietary driver for this purpose.
Those days are now gone. In Fedora (and probably in other recent Linux distributions), there's no longer an /etc/X11/xorg.conf file. Instead, it's all done with auto-detection.
The Linux kernel has a subsystem called evdev. It unifies handling of keyboards and pointing devices (and can even "mix" different input devices into one virtual device). The kernel contains drivers for many input devices, which use the services of evdev. One of those drivers is for the touchscreen I have. And for each input device, there'll be a device file in /dev/input.
To start off, I did an ls of /dev/input for files matching event*:
mjd@blackcat [/] ls /dev/input/event* /dev/input/event0 /dev/input/event2 /dev/input/event4 /dev/input/event1 /dev/input/event3 /dev/input/event5After I plugged in the touchscreen, I saw this:
mjd@blackcat [/] ls /dev/input/event* /dev/input/event0 /dev/input/event2 /dev/input/event4 /dev/input/event6 /dev/input/event1 /dev/input/event3 /dev/input/event5So it appears that /dev/input/event6 is the device file for the touchscreen. I ran evtest on this device: (evtest is in the evtest package)
[root@blackcat /]# evtest /dev/input/event6 Input driver version is 1.0.0 Input device ID: bus 0x3 vendor 0xeef product 0x1 version 0x100 Input device name: "eGalax Inc. USB TouchController" Supported events: Event type 0 (Sync) Event type 1 (Key) Event code 330 (Touch) Event type 3 (Absolute) Event code 0 (X) Value 249 Min 0 Max 2047 Event code 1 (Y) Value 1397 Min 0 Max 2047 Testing ... (interrupt to exit) Event: time 1265760809.718325, type 1 (Key), code 330 (Touch), value 1 Event: time 1265760809.718331, type 3 (Absolute), code 0 (X), value 246 Event: time 1265760809.718332, type 3 (Absolute), code 1 (Y), value 1390 Event: time 1265760809.718335, -------------- Report Sync ------------ Event: time 1265760809.770319, type 3 (Absolute), code 1 (Y), value 1389 Event: time 1265760809.770322, -------------- Report Sync ------------ Event: time 1265760809.810320, type 3 (Absolute), code 1 (Y), value 1388 Event: time 1265760809.810325, -------------- Report Sync ------------ Event: time 1265760809.822320, type 3 (Absolute), code 0 (X), value 303 Event: time 1265760809.822322, type 3 (Absolute), code 1 (Y), value 1331 Event: time 1265760809.822326, -------------- Report Sync ------------ Event: time 1265760809.834320, type 3 (Absolute), code 0 (X), value 331 Event: time 1265760809.834322, type 3 (Absolute), code 1 (Y), value 1303 Event: time 1265760809.834326, -------------- Report Sync ------------ Event: time 1265760809.846321, type 3 (Absolute), code 0 (X), value 403 Event: time 1265760809.846323, type 3 (Absolute), code 1 (Y), value 1235 Event: time 1265760809.846326, -------------- Report Sync ------------ Event: time 1265760809.878320, type 1 (Key), code 330 (Touch), value 0 Event: time 1265760809.878326, -------------- Report Sync ------------ ^C [root@blackcat mjd]#When I touch the touchscreen, I get data! And the data looks sensible, with values for each axis from 0-2047! Now to get it working with X...
No comments:
Post a Comment