<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>0110.be</title>
    <link>http://0110.be</link>
    <description>Recente posts</description>
    <item>
      <pubDate>Wed, 21 Jul 2010 10:24:23 GMT</pubDate>
      <title>Ijsland</title>
      <link>http://0110.be/artikels/lees/Ijsland</link>
      <author>Joren</author>
      <description>&lt;p&gt;Ijsland.&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Thu, 22 Apr 2010 18:08:08 GMT</pubDate>
      <title>Doorhacking: Opening a Door With Your Cellphone</title>
      <link>http://0110.be/artikels/lees/Doorhacking%3A_Opening_a_Door_With_Your_Cellphone</link>
      <author>Joren</author>
      <description>&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; There is a group of people that want access to  &lt;a href="http://0x20.be"&gt;Hackerspace Ghent&lt;/a&gt; but there is only one remote to open the gate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The solution:&lt;/strong&gt; Build a system that reacts to a phone call by opening the gate if the number of the caller is whitelisted.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What you need:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;A &lt;a href="http://beagleboard.org/"&gt;BeagleBoard&lt;/a&gt; or some &lt;a href="http://beagleboard.org/breeds"&gt;BeagleBoard alternative&lt;/a&gt; with a Linux distribution running on it. Any server running a unix like operating system should be usable.&lt;/li&gt;
	&lt;li&gt;A Huaweii e220 or an alternative &lt;span class="caps"&gt;GSM&lt;/span&gt; that supports (a subset of) AT commands and has a &lt;span class="caps"&gt;USB&lt;/span&gt; port.&lt;/li&gt;
	&lt;li&gt;A team of hackers that know how to solder something togeher. E.g. The hardware guys of hackerspace Ghent.&lt;/li&gt;
	&lt;li&gt;A &lt;a href="/attachment/be.0110/188/gatekeeper.py"&gt;python script&lt;/a&gt; that reacts to calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The Hack&lt;/strong&gt;:  First of all try to get caller id working by following the &lt;a href="http://0110.be/artikels/lees/Caller_ID_with_Linux_and_Huawei_e220"&gt;Caller ID with Linux and Huawei e220 tutorial&lt;/a&gt;. If this works you can listen to the serial communication using &lt;a href="http://pyserial.sourceforge.net/"&gt;pySerial&lt;/a&gt; and react to a call. The following python code shows the wait for call method:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;def wait_for_call(self):&lt;br /&gt;
  self.data_channel.open()&lt;br /&gt;
  call_id_pattern = re.compile(&amp;#8216;.&lt;strong&gt;&lt;span class="caps"&gt;CLIP&lt;/span&gt;.&lt;/strong&gt;&amp;#8220;\&lt;ins&gt;([0-9]&lt;/ins&gt;)&amp;#8221;,.*&amp;#8217;)&lt;br /&gt;
  while True:&lt;br /&gt;
    bytes = self.data_channel.inWaiting()&lt;br /&gt;
    buffer = self.data_channel.readline(bytes)&lt;br /&gt;
    call_id_match = call_id_pattern.match(buffer)&lt;br /&gt;
    if call_id_match:&lt;br /&gt;
      number = call_id_match.group(1)&lt;br /&gt;
      self.handle_call(number)&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;The &lt;code&gt;handle_call&lt;/code&gt; method &amp;#8230; handles the call.&lt;/p&gt;
&lt;p&gt;The second thing that is needed is &lt;a href="http://blog.makezine.com/archive/2009/02/blinking_leds_with_the_beagle_board.html"&gt;a way to send a signal from the beagle board&lt;/a&gt; to the remote. Sending a signal from the beagle board using Linux is really simple. The following bash commands initialize, activate and deactivate a pin.&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;echo 168 &amp;gt; /sys/class/gpio/export&lt;br /&gt;
echo &amp;#8220;high&amp;#8221; &amp;gt; /sys/class/gpio/gpio168/direction&lt;br /&gt;
echo &amp;#8220;low&amp;#8221; &amp;gt; /sys/class/gpio/gpio168/direction&lt;/p&gt;
&lt;/source&gt;</description>
    </item>
    <item>
      <pubDate>Wed, 21 Apr 2010 14:30:59 GMT</pubDate>
      <title>Reactie van Gast (21/04/10 - 14:30) op  Eindwerk over Beeldschermtechnologie&#235;n: LCD, PDP &amp; CRT</title>
      <link>http://0110.be/posts/lees/1714</link>
      <author>Gast</author>
      <description>thx</description>
    </item>
    <item>
      <pubDate>Sun, 18 Apr 2010 10:27:38 GMT</pubDate>
      <title>Jobsopschool.be beter beveiligd</title>
      <link>http://0110.be/artikels/lees/Jobsopschool.be_beter_beveiligd</link>
      <author>Joren</author>
      <description>&lt;p&gt;&lt;img src="/attachment/be.0110/185/SSL.png" alt="SSL icon" style="float:right"/&gt;Omdat er op jobsopschool gevoellige informatie te vinden is (bijvoorbeeld C.V.&amp;#8217;s van kandidaten) is de beveiliging ervan belangrijk. Om die veiligheid te garanderen werd de &lt;a href="https://jobsopschool.be"&gt;vacaturesite voor onderwijzers&lt;/a&gt; op een volledig dichtgetimmerde aparte virtuele server geplaatst. Een server met enkel de broodnodige software zorgt voor een veilige en snelle afhandeling van requests.&lt;/p&gt;
&lt;p&gt;Ook werd er voor gezorgd dat alle verkeer versleuteld wordt via &lt;acronym title="Secure Socket Layer"&gt;&lt;span class="caps"&gt;SSL&lt;/span&gt;&lt;/acronym&gt;. De lighttpd webserver server werd geconfigureerd met deze tutorial die de configuratie van &lt;a href="http://www.cyberciti.biz/tips/how-to-install-ssl-lighttpd-https-configuration.html"&gt;lighttpd met &lt;span class="caps"&gt;SSL&lt;/span&gt;&lt;/a&gt; bespreekt. Er werd een &lt;span class="caps"&gt;SSL&lt;/span&gt; certificaat van godaddy aangekocht omdat het root certificaat van godaddy in zowat alle browsers aanwezig is en omdat ze een redelijke prijs vragen.&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 13 Apr 2010 20:00:57 GMT</pubDate>
      <title>Reactie van Gast (13/04/10 - 20:00) op  SQL-bestand met een lijst van alle Belgische postcodes en steden</title>
      <link>http://0110.be/posts/lees/1712</link>
      <author>Gast</author>
      <description>Dan maak je gewoon een functionele index aan, dan wordt de bewerking niet uitgevoerd in je query, maar is al voorbewerkt in de index. En dus wordt bij het sorteren een index gebruikt.CREATE INDEX idx_naam ON tabelnaam (translate(structure, ' ', 'z'));</description>
    </item>
    <item>
      <pubDate>Sun, 11 Apr 2010 18:09:13 GMT</pubDate>
      <title>Caller ID with Linux and Huawei e220</title>
      <link>http://0110.be/artikels/lees/Caller_ID_with_Linux_and_Huawei_e220</link>
      <author>Joren</author>
      <description>&lt;p&gt;&lt;img src="/attachment/be.0110/181/huawei_e220.jpg" title="huawei e220" style="float:right"&gt;This is the scenario: you have a Huawei e220, a linux computer and you want to react to a call from a set of predefined numbers. E.g. &lt;a href="/artikels/lees/Order_Pizza_with_USB_Pizza_Button"&gt;ordering a pizza&lt;/a&gt; when you receive a call from a certain number.&lt;/p&gt;
&lt;p&gt;The Huawei e220 supports a subset of the &lt;a href="http://en.wikipedia.org/wiki/AT_commands"&gt;AT commands&lt;/a&gt;, which subset is &lt;a href="http://forum.huawei.com/jive4/thread.jspa?threadID=324487"&gt;an enterprise secret&lt;/a&gt; of te Huawei company. So there is no documentation available for the device I bought, thanks Huawei. Anyhow when you attach the e220 to a Linux machine you should get two serial ports:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;/dev/ttyUSB0&lt;br /&gt;
/dev/ttyUSB1&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;To connect to the devices you can use a serial client. &lt;a href="http://www.gnu.org/software/screen/"&gt;&lt;span class="caps"&gt;GNU&lt;/span&gt; Screen&lt;/a&gt; can be used as a serial client like this: &lt;code&gt;screen /dev/ttyUSB0 115200&lt;/code&gt;. The first device, &lt;code&gt;ttyUSB0&lt;/code&gt; is used to control &lt;code&gt;ttyUSB1&lt;/code&gt;, so to enable caller ID on te Huawei e220 you need to send this message to &lt;code&gt;ttyUSB0&lt;/code&gt;:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;AT+CLIP=1&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;To check for calls you should listen to &lt;code&gt;ttyUSB1&lt;/code&gt;. A serial session for &lt;code&gt;ttyUSB1&lt;/code&gt; looks like:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;^&lt;span class="caps"&gt;BOOT&lt;/span&gt;:44594282,0,0,0,6&lt;br /&gt;
^&lt;span class="caps"&gt;RSSI&lt;/span&gt;:18&lt;br /&gt;
&lt;span class="caps"&gt;RING&lt;/span&gt;&lt;br /&gt;
&lt;ins&gt;&lt;span class="caps"&gt;CLIP&lt;/span&gt;: &amp;quot;&lt;/ins&gt;33499311152&amp;quot;,145,,,,0&lt;br /&gt;
^&lt;span class="caps"&gt;BOOT&lt;/span&gt;:44594282,0,0,0,6&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;The &lt;code&gt;RING&lt;/code&gt; and &lt;code&gt;CLIP&lt;/code&gt; messages are the most interesting. The &lt;code&gt;RING&lt;/code&gt; signifies an incoming call, the &lt;code&gt;CLIP&lt;/code&gt; is the caller ID. The &lt;code&gt;BOOT&lt;/code&gt; and &lt;code&gt;RSSI&lt;/code&gt; are some kind of ping messages. The following Python script demonstrates a complete session that enables caller ID, waits for a phone call and prints the number of the caller.&lt;/p&gt;
&lt;source:python&gt;
&lt;p&gt;#!/usr/bin/env python&lt;br /&gt;
import serial, re&lt;/p&gt;
&lt;p&gt;command_channel = serial.Serial(&lt;br /&gt;
	port=&amp;#8216;/dev/ttyUSB0&amp;#8217;,&lt;br /&gt;
	baudrate=115200,&lt;br /&gt;
	parity=serial.PARITY_NONE,&lt;br /&gt;
	stopbits=serial.STOPBITS_ONE,&lt;br /&gt;
	bytesize=serial.&lt;span class="caps"&gt;EIGHTBITS&lt;/span&gt;&lt;br /&gt;
)&lt;br /&gt;
command_channel.open()&lt;br /&gt;
#enable caller id&lt;br /&gt;
command_channel.write(&amp;#8220;AT+CLIP=1&amp;#8221; + &amp;#8220;\r\n&amp;#8221;)&lt;br /&gt;
command_channel.close()&lt;/p&gt;
&lt;p&gt;ser = serial.Serial(&lt;br /&gt;
	port=&amp;#8216;/dev/ttyUSB1&amp;#8217;,&lt;br /&gt;
	baudrate=9600,&lt;br /&gt;
	parity=serial.PARITY_NONE,&lt;br /&gt;
	stopbits=serial.STOPBITS_ONE,&lt;br /&gt;
	bytesize=serial.&lt;span class="caps"&gt;EIGHTBITS&lt;/span&gt;&lt;br /&gt;
)&lt;/p&gt;
&lt;p&gt;ser.open()&lt;/p&gt;
&lt;p&gt;pattern = re.compile(&amp;#8216;.&lt;strong&gt;&lt;span class="caps"&gt;CLIP&lt;/span&gt;.&lt;/strong&gt;&amp;#8220;\&lt;ins&gt;([0-9]&lt;/ins&gt;)&amp;#8221;,.*&amp;#8217;)&lt;/p&gt;
&lt;p&gt;while 1:&lt;br /&gt;
	buffer = ser.read(ser.inWaiting()).strip()&lt;br /&gt;
	buffer = buffer.replace(&amp;#8220;\n&amp;#8221;,&amp;quot;&amp;quot;)&lt;br /&gt;
	match = pattern.match(buffer)&lt;br /&gt;
	if match:&lt;br /&gt;
		number = match.group(1)&lt;br /&gt;
		print number&lt;/p&gt;
&lt;/source&gt;</description>
    </item>
    <item>
      <pubDate>Fri, 09 Apr 2010 14:07:04 GMT</pubDate>
      <title>YIN Pitch Tracker in JAVA</title>
      <link>http://0110.be/artikels/lees/YIN_Pitch_Tracker_in_JAVA</link>
      <author>Joren</author>
      <description>&lt;p&gt;To make &lt;a href="http://tarsos.0110.be/"&gt;Tarsos&lt;/a&gt; more portable I wrote a pitch tracker in pure &lt;span class="caps"&gt;JAVA&lt;/span&gt; using the &lt;a href="http://recherche.ircam.fr/equipes/pcm/cheveign/ps/2002_JASA_YIN_proof.pdf"&gt;&lt;span class="caps"&gt;YIN&lt;/span&gt; algorithm&lt;/a&gt; based on the implementation in C of &lt;a href="http://aubio.org"&gt;aubio&lt;/a&gt;. The implementation also uses some code written by Karl Helgasson and Teun de Lange of the &lt;a href="http://www.jazzperiments.com/jazzperiments.html"&gt;Jazzperiments project&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It can be used to perform real time pitch detection or to analyse files. To use it as a real time pitch detector just start the &lt;a href="/attachment/be.0110/182/pitch_detector_yin.jar"&gt;&lt;span class="caps"&gt;JAR&lt;/span&gt;-file&lt;/a&gt; by double clicking. To analyse a file execute one of the following. The first results in a list of annotations (text), the second shows the annotations graphically.&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;java -jar pitch_detector_yin.jar  flute.novib.mf.C5B5.wav&lt;br /&gt;
java -jar pitch_detector_yin.jar  &amp;#8212;file flute.novib.mf.C5B5.wav&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;The provided &lt;a href="/attachment/be.0110/184/flute.novib.mf.C5B5.wav"&gt;flute sample&lt;/a&gt; is from &lt;a href="http://theremin.music.uiowa.edu/MIS.html"&gt;&lt;i&gt;The Musical Samples&lt;/i&gt; library of the University of Iowa&lt;/a&gt; and converted to mono wav. The source code of the pitch tracker can be found below.&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 21 Mar 2010 17:33:28 GMT</pubDate>
      <title>Reactie van Gast (21/03/10 - 17:33) op  Order Pizza with USB Pizza Button</title>
      <link>http://0110.be/posts/lees/1709</link>
      <author>Gast</author>
      <description>i'd find it more usefull if you could get it to work on openwrt using package/shellscripts without too much big libraries</description>
    </item>
    <item>
      <pubDate>Fri, 12 Mar 2010 14:06:31 GMT</pubDate>
      <title>Reactie van Gast (12/03/10 - 14:06) op  Rotel RA-812</title>
      <link>http://0110.be/posts/lees/1708</link>
      <author>Gast</author>
      <description>een half jaar geleden heb ik er een op de vlooienmarkt opgevist 40 euro.De beste 40 euro die ik in tijden heb besteed.Met een stel Dali's erop aangesloten heeft hij een natuurgetrouwe weergave en een mooie verdeling over het toonbereik. </description>
    </item>
    <item>
      <pubDate>Fri, 22 Jan 2010 17:48:21 GMT</pubDate>
      <title>Boids 3D with Processing</title>
      <link>http://0110.be/artikels/lees/Boids_3D_with_Processing</link>
      <author>Joren</author>
      <description>
				
            			
					
				
					
					
				
					
					
					
				
					
			
				
				
						
					
					
					
					
					
					
					
					
					
					
									
				
				
			
				
			</description>
    </item>
    <item>
      <pubDate>Mon, 18 Jan 2010 16:56:20 GMT</pubDate>
      <title>Reactie van Gast (18/01/10 - 16:56) op  Zelf een devilstick maken</title>
      <link>http://0110.be/posts/lees/1704</link>
      <author>Gast</author>
      <description>Hoelang moeten die kleine stokjes zijn?</description>
    </item>
    <item>
      <pubDate>Sat, 28 Nov 2009 16:35:42 GMT</pubDate>
      <title>Reactie van Gast (28/11/09 - 16:35) op  Zelf een devilstick maken</title>
      <link>http://0110.be/posts/lees/1703</link>
      <author>Gast</author>
      <description>Echt bedankt! Wrkt Perfect!</description>
    </item>
    <item>
      <pubDate>Wed, 11 Nov 2009 12:01:33 GMT</pubDate>
      <title>Order Pizza with USB Pizza Button</title>
      <link>http://0110.be/artikels/lees/Order_Pizza_with_USB_Pizza_Button</link>
      <author>Joren</author>
      <description>&lt;p&gt;Recently I bought a big shiny red &lt;span class="caps"&gt;USB&lt;/span&gt;-button. It is big, red and shiny.  Initially I planned to use it to deploy new versions of websites to a server but I found a much better use: &lt;i&gt;ordering pizza&lt;/i&gt;. Graphically the use case translates to something akin to:&lt;/p&gt;
&lt;div style=" text-align:center;margin-bottom:1em"&gt;&lt;img src="/attachment/be.0110/156/order_pizza_with_panic_button.jpg"/&gt;&lt;/div&gt;
&lt;p&gt;If you would like to enhance your life quality leveraging the power of a &lt;span class="caps"&gt;USB&lt;/span&gt; pizza-button: you can! This is what you need:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;A PC running Linux. This tutorial is specifically geared towards Debian-based distos. &lt;span class="caps"&gt;YMMV&lt;/span&gt;.&lt;/li&gt;
	&lt;li&gt;A big, shiny red &lt;span class="caps"&gt;USB&lt;/span&gt; button. Just google &amp;#8220;&lt;span class="caps"&gt;USB&lt;/span&gt; panic button&amp;#8221; if you want one.&lt;/li&gt;
	&lt;li&gt;A location where you can order pizzas via a website. I live in Ghent, Belgium and use just-eat.be. Other websites can be supported by modifying a Ruby script.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Technically we need &lt;strong&gt;a driver&lt;/strong&gt; to check when the button was pushed, a way to &lt;strong&gt;communicate&lt;/strong&gt; the fact that the button was pushed and lastly we need to be able to &lt;strong&gt;react&lt;/strong&gt; to the request.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The driver&lt;/strong&gt;: on the internets I found &lt;a href="http://www.aeracode.org/2009/1/22/panic-button/"&gt;a driver for the button&lt;/a&gt;.  Another modification was done to make the driver process a daemon.&lt;/p&gt;
&lt;p&gt;&lt;img src="/attachment/be.0110/177/usb-panic-button.png" style="float:right"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The communication&lt;/strong&gt;: The original Python script executed another script on the local pc. A more flexible approach is possible using sockets. With sockets it is possible to notify any computer on a network.&lt;/p&gt;
&lt;source:ruby&gt;
&lt;p&gt;if PanicButton().pressed():&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;create a &lt;span class="caps"&gt;TCP&lt;/span&gt; socket&lt;br /&gt;
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;/li&gt;
	&lt;li&gt;connect to server on the port&lt;br /&gt;
  s.connect((&lt;span class="caps"&gt;SERVER&lt;/span&gt;, SERVER_TCP_PORT))&lt;/li&gt;
	&lt;li&gt;send the order (margherita at restaurant mario)&lt;br /&gt;
  s.send(&amp;#8220;mario:  [margherita_big]\n&amp;#8221;)&lt;br /&gt;
&lt;/source&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;The reaction&lt;/strong&gt;: a ruby &lt;span class="caps"&gt;TCP&lt;/span&gt; server waits for message from the driver. When it does it automates a &lt;span class="caps"&gt;HTTP&lt;/span&gt; session on a website. It executes a series of &lt;span class="caps"&gt;HTTP&lt;/span&gt;-GET&amp;#8217;s and POST&amp;#8217;s. It uses the &lt;a href="http://mechanize.rubyforge.org/mechanize/"&gt;mechanize library&lt;/a&gt;.&lt;/p&gt;
&lt;source:ruby&gt;
&lt;p&gt;login_url = &amp;#8220;http://www.just-eat.be/pages/member/login.aspx&amp;#8221;&lt;br /&gt;
a = &lt;span class="caps"&gt;WWW&lt;/span&gt;::Mechanize.new&lt;br /&gt;
a.get(login_url) do |login_page|   &lt;br /&gt;
  #post login_form&lt;br /&gt;
  login_form = login_page.forms.first&lt;br /&gt;
  login_form.txtUser = &amp;#8220;username&amp;#8221;&lt;br /&gt;
  login_form.txtPass  = &amp;#8220;password&amp;#8221;&lt;br /&gt;
  a.submit(login_form, login_form.buttons&lt;sup class="footnote" id="fnr1"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;)&lt;br /&gt;
end&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;Some libraries are needed. For python you need the usb library, the &lt;a href="http://pypi.python.org/pypi/python-daemon/"&gt;python deamons lib&lt;/a&gt; needs to be installed seperatly. Setuptools are needed to install the deamons package.&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;sudo apt-get install python-usb python-setuptools&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;Ruby needs rubygems to install the needed mechanize and daemons library. Mechanize needs the &lt;code&gt;libxslt-dev&lt;/code&gt; package. You also need the &lt;code&gt;build-essential package&lt;/code&gt; to build mechanize.&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;sudo apt-get install rubygems libxslt-dev&lt;br /&gt;
sudo gem install mechanize daemons&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;To automatically start the daemons on boot you can use the &lt;a href="http://mkaz.com/ref/unix_cron.html"&gt;crontab &lt;code&gt;@reboot&lt;/code&gt; directive&lt;/a&gt; of the root user. E.g.:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;@reboot /opt/pizza_service/pizza_daemon.rb&lt;br /&gt;
@reboot /opt/pizza_service/pizza_button_driver.py&lt;/p&gt;
&lt;/source&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 05 Oct 2009 19:46:06 GMT</pubDate>
      <title>Touchatag RFID reader and Ubuntu Linux</title>
      <link>http://0110.be/artikels/lees/Touchatag_RFID_reader_and_Ubuntu_Linux</link>
      <author>Joren</author>
      <description>&lt;p style="float:right;"&gt;&lt;img src="/attachment/be.0110/151/touchatag_logo.png" style="margin-left:1em;margin-bottom:0.4em;" title="Touchatag Logo" alt="Touchatag Logo" /&gt;&lt;/p&gt;
&lt;p&gt;This blog post is about how to use the &lt;a href="http://www.touchatag.com"&gt;Touchatag&lt;/a&gt; &lt;span class="caps"&gt;RFID&lt;/span&gt; reader hardware on Ubuntu Linux without using the Touchatag web service.&lt;/p&gt;
&lt;p&gt;An &lt;span class="caps"&gt;RFID&lt;/span&gt; reader with tags can used to fire events. With a bit of scripting the events can be handled to do practically any task.&lt;/p&gt;
&lt;p&gt;Normally a Touchatag reader is used together with the &lt;a href="http://www.touchatag.com/developer/tools/advanced-http-application"&gt;Touchatag web service&lt;/a&gt; but for some &lt;span class="caps"&gt;RFID&lt;/span&gt; applications the web service is just not practical. E.g. for embedded Linux devices without an Internet connection. In this tutorial I wil document how I got the Touchatag hardware working under Ubuntu Linux.&lt;/p&gt;
&lt;p&gt;To follow this tutorial you will need:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Touchatag hardware: the &lt;span class="caps"&gt;USB&lt;/span&gt; reader and some tags&lt;/li&gt;
	&lt;li&gt;A Ubuntu Linux computer (I tested 9.10 Karmic Koala and 8.04 )&lt;/li&gt;
	&lt;li&gt;&lt;span class="caps"&gt;SVN&lt;/span&gt; to download source code from a repository&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The touchatag &lt;span class="caps"&gt;USB&lt;/span&gt; reader works at 13.56MHz (High Frequency &lt;span class="caps"&gt;RFID&lt;/span&gt;) and has a readout distance of about 4 cm (1.5 inch) when used with the touchatag &lt;span class="caps"&gt;RFID&lt;/span&gt; tags. Internally it uses an &lt;span class="caps"&gt;ACS&lt;/span&gt; ACR122U reader with a &lt;span class="caps"&gt;SAM&lt;/span&gt; card. A Linux driver is readily available so when you plug it in &lt;code&gt;lsusb&lt;/code&gt; you should get something like this:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;lsusb&lt;/p&gt;
&lt;p&gt;Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;
Bus 005 Device 004: ID 072e:90dd Advanced Card Systems, Ltd&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;lsusb recognizes the device incorrectly but that&amp;#8217;s &lt;a href="http://code.google.com/p/tageventor/wiki/SupportedReadersAndTags"&gt;not a problem&lt;/a&gt;. To read &lt;span class="caps"&gt;RFID&lt;/span&gt;-tags and respond to events additional software is needed: &lt;a href="http://code.google.com/p/tageventor/"&gt;tagEventor&lt;/a&gt; is a software library that does just that. It can be downloaded using an svn command:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;svn export http://tageventor.googlecode.com svn/trunk/ tageventor&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;To compile tagEventor a couple of other software packages or header files should be available on your system. Te &lt;a href="http://code.google.com/p/tageventor/wiki/SoftwareDependencies"&gt;tagEventor software dependencies&lt;/a&gt; are described on the &lt;a href="http://code.google.com/p/tageventor/w/list"&gt;tagEventor wiki&lt;/a&gt;. On Ubuntu (and possibly other Debian based distro&amp;#8217;s the installation is simple:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;sudo aptitude install build-essential libpcsclite-dev build-essential pcscd libccid&lt;br /&gt;
#if you need gnome support&lt;br /&gt;
#sudo aptitude install libgtk2.0-dev&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;&lt;del&gt;Now the tricky part. Two header files of the pcsclite package need to be modified&lt;/del&gt; (update: this bug is fixed &lt;a href="http://code.google.com/p/tageventor/issues/detail?id=2"&gt;see here&lt;/a&gt;). tagEventor builds and can be installed:&lt;/p&gt;
&lt;source&gt;
&lt;p&gt;cd tageventor&lt;br /&gt;
make&lt;br /&gt;
&amp;#8230;&lt;br /&gt;
tagEventor &lt;span class="caps"&gt;BUILT&lt;/span&gt; (./bin/Release/tagEventor)&lt;/p&gt;
&lt;p&gt;sudo ./install.sh&lt;br /&gt;
&amp;#8230;&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;When tagEventor is correctly installed the only thing left is &amp;#8230; to build your application. When an event is fired tagEventor executes the &lt;code&gt;/etc/tageventor/generic&lt;/code&gt; script with three parameters (see below). Using some kind of &lt;a href="http://en.wikipedia.org/wiki/Inter-process_communication" title="Inter Process Communication"&gt;&lt;span class="caps"&gt;IPC&lt;/span&gt;&lt;/a&gt; an application can react to events. A simple and flexible way to propagate events (inter-processes, over a network, platform and programming language independent) uses sockets. The code below is the &lt;code&gt;/etc/tageventor/generic&lt;/code&gt; script (make sure it is executable), it communicates with the server: the second script. To run the server execute &lt;code&gt;ruby /name/of/server.rb&lt;/code&gt;&lt;/p&gt;
&lt;source:ruby&gt;
&lt;p&gt;#!/usr/bin/ruby&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;$1 = &lt;span class="caps"&gt;SAM&lt;/span&gt; (unique ID of the &lt;span class="caps"&gt;SAM&lt;/span&gt; chip in the smart card reader if exists, &amp;#8220;NoSAM&amp;#8221; otherwise&lt;/li&gt;
	&lt;li&gt;$2 = &lt;span class="caps"&gt;UID&lt;/span&gt; (unique ID of the tag, as later we may use wildcard naming)&lt;/li&gt;
	&lt;li&gt;$3 = Event Type (IN for new tag placed on reader, &lt;span class="caps"&gt;OUT&lt;/span&gt; for tag removed from reader)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;require &amp;#8216;socket&amp;#8217;&lt;/p&gt;
&lt;p&gt;data = &lt;span class="caps"&gt;ARGV&lt;/span&gt;.join(&amp;#8216;|&amp;#8217;)&lt;br /&gt;
puts data&lt;/p&gt;
&lt;p&gt;streamSock = TCPSocket.new( &amp;#8220;127.0.0.1&amp;#8221;, 20000 )&lt;br /&gt;
streamSock.send(data, 0)&lt;br /&gt;
streamSock.close&lt;/p&gt;
&lt;/source&gt;
&lt;source:ruby&gt;
&lt;p&gt;require &amp;#8220;socket&amp;#8221;  &lt;br /&gt;
dts = TCPServer.new(&amp;#8216;localhost&amp;#8217;, 20000) &lt;br /&gt;
loop do  &lt;br /&gt;
   Thread.start(dts.accept) do |s|&lt;br /&gt;
     puts s.gets&lt;br /&gt;
     s.close  &lt;br /&gt;
   end  &lt;br /&gt;
end&lt;/p&gt;
&lt;/source&gt;
&lt;p&gt;The tagEventor software is made by &lt;a href="http://www.autelic.org/"&gt;the Autelic Association&lt;/a&gt; a Non-Profit association dedicated to making technology easier to use for all. I would like to thank Andrew Mackenzie, the founder and president of the association for creating the software and the support.&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Sat, 09 May 2009 11:20:36 GMT</pubDate>
      <title>Reactie van Gast (09/05/09 - 11:20) op  Zelf een devilstick maken</title>
      <link>http://0110.be/posts/lees/1698</link>
      <author>Gast</author>
      <description>vet man</description>
    </item>
  </channel>
</rss>
