<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Northern Nerd &#187; Evtouch</title>
	<atom:link href="http://www.rantakokko.net/tapani/blog/tag/evtouch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rantakokko.net/tapani/blog</link>
	<description>Just another blogging geek</description>
	<lastBuildDate>Sun, 16 Aug 2009 16:17:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>LG L1730SF touch screen display in Ubuntu Linux 8.04 Hardy Heron, part 2</title>
		<link>http://www.rantakokko.net/tapani/blog/2009/08/10/lg-l1730sf-touch-screen-display-in-ubuntu-linux-8-04-hardy-heron-part-2/</link>
		<comments>http://www.rantakokko.net/tapani/blog/2009/08/10/lg-l1730sf-touch-screen-display-in-ubuntu-linux-8-04-hardy-heron-part-2/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 18:23:53 +0000</pubDate>
		<dc:creator>trk</dc:creator>
				<category><![CDATA[Ubuntu/Linux]]></category>
		<category><![CDATA[Evtouch]]></category>
		<category><![CDATA[Hardy Heron]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[touch screen]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.rantakokko.net/tapani/blog/?p=171</guid>
		<description><![CDATA[Let&#8217;s continue with setting up the touch feature. In the end of part 1, we managed to rotate and mirror the display properly and just started calibrating it, when we encountered a problem where the cursor at first does not seem to follow the finger, and then suddenly jumps ahead. Let&#8217;s solve that next. Note: [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s continue with setting up the touch feature. In the end of <a title="Part 1" href="http://www.rantakokko.net/tapani/blog/2009/04/29/lg-l1730sf-touch-screen-display-in-ubuntu-linux-804-hardy-heron/">part 1</a>, we managed to rotate and mirror the display properly and just started calibrating it, when we encountered a problem where the cursor at first does not seem to follow the finger, and then suddenly jumps ahead. Let&#8217;s solve that next.</p>
<p><strong>Note: You should only read this through, you don&#8217;t need to repeat everything I did. The actual solution is in the end of the text, so there&#8217;s what you need to do.</strong></p>
<p>Since we now have two drivers in the system for the touch feature, <em>usbtouchscreen</em> for the display device and <em>evtouch</em> for converting the input events to a suitable format for X, the first question that comes to mind is, which one of the drivers is causing the jumpiness? We should go to the source of the information first, i.e. <em>usbtouchscreen</em>.</p>
<p><span id="more-171"></span></p>
<p>When you move your finger on the screen, does the data that is output from the <em>usbtouchscreen</em> driver actually change continuously, or does it first stay the same and then suddenly change when the jump occurs? One test could be to type <em>sudo cat /dev/input/eventX</em>, where X represents the event number in your system (recall that you can use <em>cat /proc/bus/input/devices</em> to find it out), but its output is all gibberish. A better alternative is to use a tool that decrypts the event data to plain text. One suitable tool is <em>evtest</em>, which can be found in <em>dvb-utils</em> (yes, tools for watching TV!) package. That package is located in Ubuntu universe repository that we have already enabled. To install it, type</p>
<blockquote>
<pre>sudo apt-get install dvb-utils</pre>
</blockquote>
<p>Now you can observe the output of the driver as informative textual message by typing</p>
<blockquote>
<pre>sudo evtest /dev/input/eventX</pre>
</blockquote>
<p>(replace X with your event number).</p>
<p>This test reveals for example that 1) as long as you keep your finger on the screen, new data keeps coming in, 2) the display reports the pressure too, although it seems to me somewhat random, 3) when you keep your finger still, you&#8217;ll get mainly events with all fields zeros, whereas when you keep moving your finger, values seem to be more reasonable, and 4) the X and Y coordinate values are quite hard to pick from the information stream. Press CTRL+C to stop now.</p>
<p>To get a better idea of the actual coordinates, we can filter the output to only contain Y coordinates with the following command: <em> </em></p>
<blockquote>
<pre>sudo evtest /dev/input/eventX/ | grep Y</pre>
</blockquote>
<p>(replace X with your event number). However, when you are testing, remember that X and Y axels are swapped! When tapping the left edge, the values are near 3950. Right edge yields 200. You can use the same technique to observe the X axel (<em>grep X</em>). When tapping the bottom edge, I got values near 340, and when tapping the top edge, it was somewhere near 3850. These values are very useful for calibration (you can use them in your <em>xorg.conf</em> file), but what is even more important is that when you move your finger, the values seem to grow gradually and continuously. Now we can be sure that <em>usbtouchscreen</em> driver is working just fine, and <strong>the jumpiness problem is somehow caused by <em>evtouch</em></strong>.</p>
<p>When using the values from the previous step for calibration settings in the <em>xorg.conf</em> file (instead of the max range values 0, 4095), I got better coverage of the whole screen area with the touch control, although it is still jumpy. I calculated that there are 20 locations along X axel and also 20 locations along Y axel, or 20&#215;20 grid of which intersections the mouse cursor will stop. This is interesting: same amount of stops for both axels, although the screen is not square! Another thing is that when you draw back and forth for a couple of times, possibly sometimes lifting your finger for a while, the cursor does not return to exactly same spots on the screen (you can test that easily with a piece of paper, do not use a marker pen on your screen <img src='http://www.rantakokko.net/tapani/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . In other words, the grid is not fixed but seems to drift a little. This also means that it does not start from 0 coordinate points at the sides of the screen. So, what is going on here? We need to dive in to <em>evtouch&#8230;</em></p>
<h3>Evtouch torn open</h3>
<p>Next, we can try to find out more about the <em>evtouch</em> driver to learn why it makes the cursor to jump. In console, type command <em> </em></p>
<blockquote>
<pre>sudo updatedb</pre>
</blockquote>
<p>and then <em> </em></p>
<blockquote>
<pre>locate evtouch</pre>
</blockquote>
<p>to find out what files have been installed to the system that include the term <em>evtouch</em>. This reveals for example that there is some readme files in <em>/usr/share/doc/xserver-xorg-input-evtouch</em> folder, which describe the calibration procedure etc. &#8211; we will get back to that later. It also reveals that the Debian style package that contained the driver has been cached in the system here: <em>/var/cache/apt/archives/xserver-xorg-input-evtouch_0.8.7-3ubuntu1_i386.deb</em>. The package itself can be manipulated with <em>dpkg-deb</em> tool to list its contents:</p>
<blockquote>
<pre>dpkg-deb --contents /var/cache/apt/archives/xserver-xorg-input-evtouch_0.8.7-3ubuntu1_i386.deb</pre>
</blockquote>
<p>This reveals that in addition to readme etc. informational files, the driver package contains these files:</p>
<ul>
<li><em>calibrate.sh</em> and <em>ev_calibrate</em> scripts in <em>/usr/lib/xf86-input-evtouch</em></li>
<li><em>evtouch_drv.so</em> driver in <em>/usr/lib/xorg/modules/input</em></li>
<li><em>empty_cursor.xbm</em> image in <em>/usr/share/xf86-input-evtouch</em></li>
</ul>
<p>However, anything in these files could not reveal what is causing the jumpiness. So, once again, let&#8217;s look at the source code.</p>
<p>You can download source code for <em>evtouch</em> driver from <a title="Evtouch source code" href="http://www.conan.de/touchscreen/evtouch.html"><em>http://www.conan.de/touchscreen/evtouch.html</em></a>. At the bottom of the page, there are many download links. Use this one: <em>X driver sources V0.8.7      xf86-input-evtouch-0.8.7.tar.bz2</em>. Download the package and extract it somewhere so that you can look at the files that it contains. There are a lot of files, but only a few with .h and .c filename extensions; these are the source files. As files related to calibration are not necessary for normal operation, you are left with these four files: <em>evtouch.h, evtouch.c, libtouch.h, </em>and <em>libtouch.c. </em>So, there are basically two modules: one is the actual driver, the other contains a state machine for converting taps to mouse clicks. Also, there is <em>INSTALL.txt</em> file that describes a) how to compile the driver and install it, and b) how to turn debug printing on. Let&#8217;s do these steps next, so that we can begin testing and modifying the driver.</p>
<p>First, because we&#8217;re going to compile the driver, we need the build tools:</p>
<blockquote>
<pre>sudo apt-get build-essential</pre>
</blockquote>
<p>Let&#8217;s also download and extract the driver source package to a suitable folder:</p>
<blockquote>
<pre>cd ~</pre>
<pre>mkdir Source</pre>
<pre>cd Source</pre>
<pre>mkdir evtouch</pre>
<pre>cd evtouch</pre>
<pre>wget http://www.conan.de/touchscreen/xf86-input-evtouch-0.8.7.tar.bz2</pre>
<pre>tar -xjf xf86-input-evtouch-0.8.7.tar.bz2</pre>
<pre>cd xf86-input-evtouch-0.8.7</pre>
</blockquote>
<p><em>INSTALL.txt</em>, which contains instructions for compiling and installing from source, says that we need to have sources also for XFree86. However, in Ubuntu we have X.org, which is a newer fork of XFree86 (you can read more about this here: <a title="X.org vs. XFree86" href="http://ubuntuforums.org/showthread.php?t=87794">http://ubuntuforums.org/showthread.php?t=87794</a>). The installation instructions seem somewhat outdated, so we will not follow them exactly. To check X.org version, you can type this:</p>
<blockquote>
<pre>cat /var/log/Xorg.0.log | grep "X.Org X Server"</pre>
</blockquote>
<p>I got this line: <em>X.Org X Server 1.4.0.90</em>. Note that the debug output of the driver will go to this same file, <em>/var/log/Xorg.0.log</em> &#8211; we&#8217;ll come back to that later. Assuming you are still in the folder that contains the driver source files, type</p>
<blockquote>
<pre>./configure</pre>
</blockquote>
<p>to prepare for building the driver. You may get errors, for example: <em>No package &#8216;xorg-server&#8217; found</em>, <em>No package &#8216;xproto&#8217; found</em>. To solve these, you need to install related source packages and try to configure the driver again:</p>
<blockquote>
<pre>sudo apt-get install xserver-xorg-dev
./configure</pre>
</blockquote>
<p>This time I got no errors and a ready makefile as output:<br />
<em> config.status: creating Makefile<br />
config.status: creating config.h<br />
config.status: executing depfiles commands<br />
</em></p>
<p>Next, let&#8217;s compile the driver with debug output and raw packets output turned on:</p>
<blockquote>
<pre>make DEBUG=y LOGRAW=y</pre>
</blockquote>
<p>Unfortunately, I got compilation errors: <em>evtouch.c: In function &#8216;DeviceOn&#8217;: evtouch.c:495: error: invalid use of void expression</em>. If you google around, you&#8217;ll notice that other people have had the same problem, apparently because the driver is compatible with Xorg 6.8.x and we have 7.3 in Ubuntu Hardy Heron. Someone even went on to create a new driver (<a title="Another touch driver for X.org" href="http://www.plop.at/en/touchscreen.html">http://www.plop.at/en/touchscreen.html</a>), I haven&#8217;t tested that as currently I prefer to get the most common driver, <em>evtouch</em> to work.</p>
<p>So, let&#8217;s fix the error. Line 495 contains this text: <em> </em></p>
<blockquote>
<pre>DBG (9, XisbTrace (priv-&gt;buffer, 1));</pre>
</blockquote>
<p>We can see that it is used for debugging with a debug macro. If you run</p>
<blockquote>
<pre>grep DGB *</pre>
</blockquote>
<p>in the driver&#8217;s source folder, you can see that <em>DBG</em> macro is defined in <em>libtouch.c</em> file:</p>
<blockquote>
<pre> #define DBG(lvl, f) {if ((lvl) &lt;= debug_level) f;}</pre>
</blockquote>
<p>This means that if the given number is at most the same contained in <em>debug_level</em> variable, we should run the given function <em>f</em>. We don&#8217;t need to debug the contents of the buffer, so we can safely comment it out as follows:</p>
<blockquote>
<pre>// #define DBG(lvl, f) {if ((lvl) &lt;= debug_level) f;}</pre>
</blockquote>
<p>Now we can compile again:</p>
<blockquote>
<pre>make DEBUG=y LOGRAW=y</pre>
</blockquote>
<p>and it succeeds without errors. Next, type</p>
<blockquote>
<pre>sudo make install</pre>
</blockquote>
<p>to install the newly compiled driver.</p>
<p>We need to make sure that X will begin to use our own, compiled driver. Recall that we installed the binary release already, <em>evtouch_drv.so</em> driver located in <em>/usr/lib/xorg/modules/input</em>. We will rename that as follows:</p>
<blockquote>
<pre>cd /usr/lib/xorg/modules/input
sudo mv sudo mv evtouch_drv.so evtouch_drv.so.orig</pre>
</blockquote>
<p>Then press <em>CTRL+ALT+F7</em> to go to X, and restart it with <em>CTRL+ALT+BACKSPACE</em>. In my case, the touch feature stopped working now, so I checked the errors:</p>
<blockquote>
<pre>cat /var/log/Xorg.0.log | grep EE</pre>
</blockquote>
<p>Which revealed this:</p>
<blockquote>
<pre>(EE) Failed to load module "evtouch" (module does not exist, 0)
(EE) Failed to load module "void" (module does not exist, 0)</pre>
<pre>(EE) No Input driver matching `evtouch'</pre>
<pre>(EE) No Input driver matching `void'</pre>
</blockquote>
<p>Apparently, the installation script did not install the driver to correct location. With</p>
<blockquote>
<pre>sudo updatedb</pre>
<pre>locate evtouch_drv.so</pre>
</blockquote>
<p>you can see that it went to here: <em>/usr/local/lib/xorg/modules/input/evtouch_drv.so</em>. So, lets copy that to correct place:</p>
<blockquote>
<pre> sudo mv /usr/local/lib/xorg/modules/input/evtouch_drv.so /usr/lib/xorg/modules/input/evtouch_drv.so</pre>
</blockquote>
<p>Now, try to restart X again. For some reason, Ubuntu switched to safe mode in graphics, and began to use <em>usbtouchscreen</em> without <em>evtouch</em>. Apparently, there is something wrong with the driver, although the source code is supposed to be the latest version. To get rid of the safemode, I had to boot the computer. I wanted to see if <em>DEBUG=y</em> <em>LOGRAW=y</em> parameters had any problems, so I built the driver again and tested it without them as follows:</p>
<blockquote>
<pre> make clean
 ./configure
 make
 sudo make install
 sudo mv /usr/local/lib/xorg/modules/input/evtouch_drv.so /usr/lib/xorg/modules/input/evtouch_drv.so</pre>
</blockquote>
<p>In X, <em>CTRL+ALT+BACKSPACE</em> restulted again to failsafe mode. Apparently, the driver that is compiled directly from source does not work properly as-is. This is getting pretty laborious now.</p>
<h3>Get patched</h3>
<p>Next, I found out that there are many patches available for the driver in Debian&#8217;s (Ubuntu is based on Debian) packages: <a title="Debian's Evtouch patches" href="http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-input-evtouch.git;a=tree;f=debian/patches;hb=HEAD">http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-input-evtouch.git;a=tree;f=debian/patches;hb=HEAD</a></p>
<p>The file <em>series</em> contains this information:</p>
<blockquote>
<pre> 1 #02-buttonless-device.patch</pre>
<pre> 2 #03_fix_compile_warns.patch</pre>
<pre> 3 04_include_xf86_ansic_h.patch</pre>
<pre> 4 #05_build_with_1_4.patch</pre>
<pre> 5 06_xf86-input-evtouch-0.8.7-misc.patch</pre>
<pre> 6 07_random_fixes_for_06.patch</pre>
</blockquote>
<p>So I decided to merge the patches 04, 06 and 07 to the source code that I loaded from <em>evtouch</em> module&#8217;s home page, after reviewing the comments in patch files. Especially patch 06 seemed promising with this comment in it: <em>Changed code to compile a working driver for both XInput ABI 0.x and 2.0 (Xorg 1.4.0)</em>. Recall that Hardy Heron&#8217;s X server version is 1.4.0.90. I loaded the raw patch files with a web browser, copied them to <em>evtouch</em> driver&#8217;s source folder and applied them like this:</p>
<blockquote>
<pre>patch -p1 &lt; debian_patches_04_include_xf86_ansic_h.patch
patch -p1 &lt; debian_patches_06_xf86-input-evtouch-0.8.7-misc.patch</pre>
</blockquote>
<p>Now I got an error saying: <em>1 out of 22 hunks FAILED &#8212; saving rejects to file evtouch.c.rej</em>. With <em>cat evtouch.c.rej</em> I saw that this change was related to that one line with improper <em>DBG</em> macro usage, which we commented out ourself. No problem, continue:</p>
<blockquote>
<pre>patch -p1 &lt; debian_patches_07_random_fixes_for_06.patch</pre>
</blockquote>
<p>After applying the patches, I recompiled and tried again. I also learned from Debian packages that I don&#8217;t need to manually copy the driver to correct location, if I give the path in configuration step as follows:</p>
<blockquote>
<pre> make clean
 ./configure --prefix=/usr
 make
 sudo make install</pre>
</blockquote>
<p>In X, give <em>CTRL+ALT+BACKSPACE</em>. This time it did not go to failsafe mode, and the touchscreen worked just like with the pre-built driver version &#8211; jumpy.</p>
<p>Now that we have a working setup for building the driver, we can begin modifying it. First thing is to rebuild with debug and raw output:</p>
<blockquote>
<pre>make clean
 ./configure --prefix=/usr
 make DEBUG=y LOGRAW=y
 sudo make install</pre>
</blockquote>
<p>In X, give <em>CTRL+ALT+BACKSPACE</em>. The touchscreen works as earlier, and there is no debug information. Apparently, because I did not raise the debug level! Do it like this: in <em>evtouch.c</em>, line 109:</p>
<blockquote>
<pre>static int debug_level = 3;</pre>
</blockquote>
<p>i.e. use higher value than 0, at least 2. The higher the value, the more information you get into the log file. However, after recompilation the debug information still did not appear! It seems that the parameters <em>DEBUG=y</em> and <em>LOGRAW=y</em> do now work and <em>INSTALL.txt</em> really is outdated. For example, if you do <em>grep LOGRAW *</em>, you&#8217;ll see that the parameter is only mentioned in <em>INSTALL.txt</em> file &#8211; so how could it work. However, the <em>DBGOUT</em> macros are in place in the source files, so we can manually turn the debug printing and raw logging on as follows: in file <em>evtouch.h</em>, just below line <em>#define _evtouch_H_</em>, add these two lines:</p>
<blockquote>
<pre> #define EVDBG
 #define LOG_RAW_PACKET</pre>
</blockquote>
<p>Recompile, install and test as usual. This time, debug information appears into the log file. You can view it easily like this:</p>
<blockquote>
<pre>less /var/log/Xorg.0.log</pre>
</blockquote>
<h3>Reading the log</h3>
<p>As you use the touchscreen, new information is added to the file, and this command prints it on the screen so that you can view it easily:</p>
<blockquote>
<pre> tail -f /var/log/Xorg.0.log</pre>
</blockquote>
<p>Let&#8217;s see if we can find out anything from debug information. I could see that the screen resolution and desktop size were recognized correctly, and the viewport was initialized ok. To observe if jumpiness is already in the input, I used this command:</p>
<blockquote>
<pre>tail -f /var/log/Xorg.0.log | grep FIRST</pre>
</blockquote>
<p>and swiped the screen slowly with my finger from left to right &#8211; and I could clearly see how the number first stayed the same and then suddenly jumped! The other alternative would have been input is ok, but calibration goes wrong. Anyway, I moved my finger slowly up, then back down, observing and writing down the numbers. The jump was about 200, most typically 198 (these are not screen pixels, but values from the touch screen. This appeared to be the same for both X and Y axels. <strong>Warning: the size of the file <em>/var/log/Xorg.0.log</em> grows pretty fast to tens of megabytes with logging, don&#8217;t play around too long (it grows mostly when you touch the screen).</strong></p>
<p>Next question is: what happens to the data before this step? It was alright in the event channel where data was pushed from <em>usbtouchscreen</em>. This debug print comes from function <em>ConvertProc</em>, and these are parameter values that are printed directly, without modification. Thus they are wrong before given to <em>ConvertProc</em>. So, who calls <em>ConvertProc</em> function? Its interesting that in the original, unpatched driver version it does not seem to be called at all in <em>evtouch.c</em> file&#8217;s functions. However, in the patched version, there are new functions in the end of the file, and it is called from there. Since there are 4 functions and I don&#8217;t know which one is called, I added</p>
<blockquote>
<pre>DBGOUT(2, "EVTouch: %s\n", __FUNCTION__);</pre>
</blockquote>
<p>in the beginning of each of these functions, and rebuild the driver. It turned out that when you tap the screen, many one of these gets called. And when you trace the data path<br />
backwards, next you get <em>ReadInput</em> function. There is a debug print function that prints the input event&#8217;s basic information: type, code and value. When you do this</p>
<blockquote>
<pre>tail -f /var/log/Xorg.0.log | grep ReadInput</pre>
</blockquote>
<p>you can observe what data comes in. When you tap the screen, many lines are printed onto the screen:</p>
<p><em>EVTouch: ReadInput type:01 code: 0x014a value:1<br />
EVTouch: ReadInput type:03 code: 0&#215;0000 value:2086<br />
EVTouch: ReadInput type:03 code: 0&#215;0001 value:2153<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:214<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:215<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:216<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:217<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:218<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:219<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:220<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:221<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:222<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:223<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:224<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:226<br />
EVTouch: ReadInput type:00 code: 0&#215;0000 value:0<br />
EVTouch: ReadInput type:03 code: 0&#215;0018 value:227<br />
&#8230;<br />
</em><br />
When I looked at the data, I noticed the first 3 lines: the first one probably is some kind of initiator (screen tapped), the next two are the coordinates from the touch sensor. What is the rest of the data? Why there is so much of it? Then I got it: the values close to 200 are the pressure data. There are many of them because you can keep pressing the same spot on the screen, but alter the pressure. Sampling is fast, so even from a short tap you get many, many samples. Next, try this:</p>
<blockquote>
<pre>tail -f /var/log/Xorg.0.log | grep "ReadInput type:03 code: 0x0000"</pre>
</blockquote>
<p>When you move your finger across the screen, the values are changing just fine &#8211; no jumpiness. Then why doesn&#8217;t the cursor move as it should?</p>
<h3>Move limit!</h3>
<p>When looking at the code, I noticed that the <em>EVTouchProcessAbs</em> function does not store the X and Y values, if they don&#8217;t differ enough from previously set values, and there is a variable for this limit, it is called <em>move_limit</em> in the code. This did not exist in the original driver, it was added in one of the patches (that otherwise made the driver to work with this Xorg version). In function <em>EVTouchPreInit</em>, this value is initialized in code to <em>180</em>, and it stays in that value UNLESS you configure it differently in your <em>xorg.conf</em> file. Of course, you need to KNOW that such a value exist. And you need to KNOW that the version of the driver that you get with Ubuntu is NOT the original one, but a patched version where many new features have been added. This is just one of them.</p>
<p>Now you can set the debug_level back to 0, and remove debug definitions from <em>evtouch.h</em> file to disable debugging. Recompile and apply.</p>
<p><strong>So, finally to fix the issue: you do not need to compile the driver at all, just use the one provided with Ubuntu, and edit your <em>xorg.conf</em> file as follows:</strong></p>
<blockquote>
<pre>sudo nano /etc/X11/xorg.conf</pre>
</blockquote>
<p>Then go to the touch screen section and add this parameter:</p>
<blockquote>
<pre>Option         "MoveLimit"     "180"</pre>
</blockquote>
<p>But change the value to smaller! In fact, I found the original patch from the web and there in comments the author explains his <em>xorg.conf</em> file and has used value <em>18</em> (!) there, but in code it is set to 180! And, I even found a bug created for Debian about too high default value: <a title="Debian Evtouch default value bug" href="http://lists.debian.org/debian-x/2008/06/msg01287.html">http://lists.debian.org/debian-x/2008/06/msg01287.html</a></p>
<p>So, in the end, the solution was really simple, it was just a configuration bug. But it took quite a lot of work and some crazy stubbornness to find this out.</p>
<p>In <a title="3rd part" href="http://www.rantakokko.net/tapani/blog/2009/08/16/lg-l1730sf-touch-screen-display-in-ubuntu-linux-8-04-hardy-heron-part-3/">part 3</a>, we will finally continue to fine-tuning the calibration of the touch feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rantakokko.net/tapani/blog/2009/08/10/lg-l1730sf-touch-screen-display-in-ubuntu-linux-8-04-hardy-heron-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

