<?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>João Ferreira &#187; archlinux</title>
	<atom:link href="http://www.joaoff.com/tag/archlinux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joaoff.com</link>
	<description>Programming, Algorithms, and Mathematics</description>
	<lastBuildDate>Wed, 09 Jun 2010 10:41:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Making ThinkFinger Faster</title>
		<link>http://www.joaoff.com/2009/06/30/making-thinkfinger-faster/</link>
		<comments>http://www.joaoff.com/2009/06/30/making-thinkfinger-faster/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 10:47:55 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Computing Science]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[fingerprint]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[lenovo]]></category>
		<category><![CDATA[tablet]]></category>
		<category><![CDATA[thinkfinger]]></category>
		<category><![CDATA[timeout]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[usb_bulk_read]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=197</guid>
		<description><![CDATA[Some time ago, I have installed and configured ThinkFinger, a driver for the fingerprint-readers found in most IBM/Lenovo Thinkpads, including my Lenovo X61 Tablet. Although it worked well, it was very slow! I had to wait 5 to 10 seconds for the prompt to show, then a bit more before I could swipe my finger [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I have installed and configured <a title="ThinkFinger" href="http://thinkfinger.sourceforge.net">ThinkFinger</a>, a driver for the fingerprint-readers found in most IBM/Lenovo Thinkpads, including my Lenovo X61 Tablet. Although it worked well, it was very slow! I had to wait 5 to 10 seconds for the prompt to show, then a bit more before I could swipe my finger or write my password, and then a bit more for the password to be accepted.</p>
<p>To make my world a better place to live, I have downloaded the development version of the driver and tried to figure out why it was being so slow. It turns out that in the library that is used to communicate with the fingerprint-reader, there was a call to the function <i>usb_bulk_read</i> that was taking too long. I have tried to find some official documentation about this function, but all I could find was <a title="How not to document your functions" href="http://libusb.sourceforge.net/doc/function.usbbulkread.html">how not to document a function</a> (seriously, what is the role of the parameter <i>timeout</i>? and is it measured in seconds? milliseconds?).</p>
<p>Anyway, I have changed the value of the <i>USB_TIMEOUT</i> constant from 5000 to 5 and the fingerprint-reader is much, much better! In detail, here is the patch:</p>
<p><code>Index: libthinkfinger/libthinkfinger.c<br />
===================================================================<br />
--- libthinkfinger/libthinkfinger.c     (revision 118)<br />
+++ libthinkfinger/libthinkfinger.c     (working copy)<br />
@@ -35,7 +35,7 @@<br />
<br />
 #define USB_VENDOR_ID     0x0483<br />
 #define USB_PRODUCT_ID    0x2016<br />
-#define USB_TIMEOUT       5000<br />
+#define USB_TIMEOUT       5<br />
 #define USB_WR_EP         0x02<br />
 #define USB_RD_EP         0x81<br />
 #define DEFAULT_BULK_SIZE 0x40</code></p>
<p>I am not sure why this works and what are the implications, but all the tests I did were satisfactory. If you know more about this problem, please let me know! I would be more than happy to understand why the <i>USB_TIMEOUT</i> constant seems to be acting as a time-wait delay, rather than as a timeout in the following call (line 324, <a href="http://thinkfinger.svn.sourceforge.net/viewvc/thinkfinger/libthinkfinger/libthinkfinger.c?view=markup#l_324" title="libthinkfinger/libthinkfinger.c">libthinkfinger/libthinkfinger.c</a>):</p>
<p><code>usb_retval = usb_bulk_read (tf-&gt;usb_dev_handle, USB_RD_EP, bytes, size, USB_TIMEOUT);</code></p>
<p>(I think it is strange that I haven&#8217;t found anyone complaining about the same problem. Nevertheless, I&#8217;ve decided to publish this post anyway, in case someone runs into the same problem.)</p>
<p><strong>Update (2009/07/31)</strong>: I&#8217;ve upload a patched SRC RPM: <a href="http://www.joaoff.com/downloads/thinkfinger-0.3-9.jff.src.rpm">thinkfinger-0.3-9.jff.src.rpm</a>. Please note that I have added the patch to Fedora&#8217;s SRC RPM.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2009/06/30/making-thinkfinger-faster/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
