Blog Projects, Tips, Tricks, and How-Tos

Intro

Welcome, this is an Innovations Tech Tip. I recently did some work with an ELO Touchsystems 1515L 15″ LCD Desktop Touchmonitor. I was pleased with the touchmonitor’s hardware and performance, but in order to make it work properly in Linux I had to find a suitable calibration program. Out of the box on several distributions this touchscreen exhibits Y-axis inversion, where touching the top of the screen moves the cursor to the bottom and vice versa. xinput-calibrator is a freedesktop.org project that worked well for calibration, fixing the Y-axis inversion issue, and as a bonus it works for any standard Xorg touchscreen driver.

The Hardware

Installation

Click here to go to xinput-calibrator‘s website and choose your package. Be aware that if you’re using the ARM version of Bodhi (in alpha at the time of this writing) it’s based on Debian, so you’ll want to grab the Debian testing package. You can also add a PPA if you’re running Ubuntu, but I had trouble getting that to work during my tests. Last but not least, you can grab the source and compile it yourself by downloading the tarball or using git.

Before you actually install xinput-calibrator on a freshly installed Debian based system (including Ubuntu and Bodhi), make sure to update your package management system or you’ll get failed dependencies. This is because the package management system doesn’t know what packages are available in the repositories yet. This isn’t a problem with Fedora since the package management index is updated every time you use YUM. Once you’ve ensured that the system is or will be updated, you’ll be ready to install xinput-calibrator via the package that you downloaded or the PPA.

Calibration

Once xinput-calibrator is installed, it should show up in your application menu(s). Look for an item labeled “Calibrate Touchscreen”. If you don’t see it anywhere, you can launch it from the terminal with the xinput_calibrator (note the underscore) command.

Figure 1 – xinput_calibrator screenshot

Using It

The use of xinput-calibrator is very simple. You’re presented with a full-screen application that asks you to touch a series of 4 points. The instructions say that you can use a stylus to increase precision, but I find that using my finger works well for the ELO touchscreen. One of the nice features of xinput-calibrator is that it’s smart enough to know when it encounters an inverted axis. After I run through the calibration the Y-axis inversion problem is fixed, so I’m ready to start using the touchscreen.

Persistent Calibration

You’ll probably want your calibration to persist across reboots, so you’ll need to do a little more work now to make the settings permanent. First you’ll need to run the xinput_calibrator command from the terminal and then perform the calibration.

Toward the bottom of the output you can see instructions for "Making the calibration permanent". This section will vary depending what xinput_calibrator detects about your system. In my case under Ubuntu the output was an xorg.conf.d snippet, which I then copied into the xorg.conf.d directory on my distribution. Be aware that even though the output says that xorg.conf.d should be located in /etc/X11, it might actually be located somewhere else like /usr/share/X11 on your distribution. Once you've found the xorg.conf.d directory you can use your favorite text editor (with root privileges) to create the 99-calibration.conf file inside of it. Now when you reboot, you should see that your calibration has stayed in effect.

If you have a reason to avoid using an xorg.conf.d file to store your calibrations, you can run xinput_calibrator with the --output-type xinput option/argument combo.

At the bottom of this output you can see that there are instructions for using xinput to make your calibration persistent. If it's not already present, you'll need to install xinput and then copy the command line in xinput_calibrator's instructions into a script that starts with your X session. You can usually also add it to your desktop manager's startup programs via something like gnome-session-properties if you would prefer.

Another option that might be of use to you is -v. The -v (--verbose) option displays extra output so that you can see more of what's going on behind the scenes. If you have any trouble getting your calibration to work, this would be a good place to start.

Your output will probably vary from what I have here depending on what type of hardware you have and which distribution you run. For instance, on Fedora 15 I get the xinput instructions by default instead of an xorg.conf.d snippet. Make sure that you run the above commands yourself, and don't copy the output from my listings.

If you have a desire or need to redo the calibration periodically, you might want to consider creating a wrapper script to automate the process of making the calibration permanent. Such a script might use sed to strip out the relevant code and then a simple echo statement to dump it into the correct xorg.conf.d file or startup script.

Wrapping Up

That concludes this Tech Tip. Have a look at innovationsts.com for other tips, projects, how-tos, and service offerings available from Innovations Technology Solutions. Thanks, and stay tuned for more from Innovations.

Josiah

@Josiah – Actually, I just stayed with the generic evdev driver. That was what was used automatically for the touchscreen in my tests. xinput-calibrator should work fine with either the elographics or evtouch driver though since they’re both standard Xorg drivers. Are you having trouble getting it to work with either of those?

ctopher

2011/10/07 at 12:37 PM

I have this working with a Dell ST2220T under Fedora 15 and it works well. I use the xorg.conf.d method as it supports hutplugging (e.g if you use the xinput method, you have to but the command in an .xinputrc file so that the clibration is loaded at startup but if you unplug the monitor’s USB and plug it back in, the calibration is lost. Not so with the xorg.conf.d method.)

But what I would like to be able to do is read out the current calibration. The xinput man page didn’t seem to show a way. evtest –query doesn’t appear to give that information

ctopher

2011/10/07 at 12:56 PM

My bad, xinput does the job!
Use xinput –list-props DEV and you’ll get all the properties. (replace DEV with the device name or number.

@ctopher – Thanks for the feedback. That’s a good point about hotplugging and the xinput method, and I too prefer the xorg.conf.d snippet. I’m not sure if that method will continue to work in Ubuntu with the planned Xorg/Wayland change though. That will be something to watch.

The –list-props option is a good one to point out. There are times when you just want to gather info about your touchscreen, and that does the trick.

[…] The following might be slightly off topic, but it offers details about X11 configuration. http://www.innovationsts.com/blog/?p=3040 The "off topic" part is "touch calibration". The relevant part is that it […]

ctopher

2011/10/14 at 10:37 AM

@Jeremy – We have simple touch working. This is for a kiosk application so at this point, multi-touch might be asking too much of the general population user. I believe that the Dell ST2220T is capable of Multi-Touch, but the hacked driver we’re using does not support it.

Another tip. After running for a long time the touch sometimes stops working. (Heat?) so we have a cron job that simulates plugging and unplugging the USB which fixes the problem. just a modprobe -r usbtouchscreen wait a sec to unload then modprobe usbtouchscreen and it is back in business.