{"id":344,"date":"2011-01-24T01:50:36","date_gmt":"2011-01-24T01:50:36","guid":{"rendered":"http:\/\/blog.cyberwizzard.nl\/?p=344"},"modified":"2016-03-19T16:42:54","modified_gmt":"2016-03-19T15:42:54","slug":"upgrading-lirc-to-ir-core-and-imon","status":"publish","type":"post","link":"https:\/\/blog.cyberwizzard.nl\/?p=344","title":{"rendered":"Upgrading LIRC to ir-core and imon"},"content":{"rendered":"<p>While the title may sound a tad cryptic, that matched my first impression about the new infrared remote subsystem used in Ubuntu 10.10 and kernel 2.6.36+ based distributions. In Linux 2.6.36, a new sub-system is introduced for remote controls. This subsystem is a partial replacement for lirc as it features complete IR\u00a0drivers for numerous devices.<\/p>\n<p>In reality, the glass is only half full as some IR\u00a0receivers (and transmitters)\u00a0deal with raw data. Writing universal drivers for such devices can be bothersome or even impossible, for example when dealing with universal receivers. As such, LIRC is not completely written off as it can be used to do userspace IR\u00a0processing as it used to. The exact details are unknown to me as I\u00a0have an SoundGraph iMon receiver (device ID\u00a00038 &#8211; LCD), which does not deliver raw sensory input but rather complete scancodes.<\/p>\n<p>When I\u00a0upgraded from Ubuntu 10.04 running lirc 0.8.6 to Ubuntu 10.10 and lirc 0.8.7, the entire IR subsystem died on me. To my surprise, while the remote was dead, the LCD\u00a0screen was working fine. Further inspection showed that the &#8216;lirc_imon&#8217; driver was not loaded at all.<\/p>\n<p>With the move to the new input layer driver for supported IR\u00a0devices in the kernel, the new &#8216;imon&#8217; driver (version 0.8 at the time of writing)\u00a0no longer provides a &#8216;lirc0&#8217; device. As such, lircd will fail when attempting to claim it and loading &#8216;lirc_imon&#8217; (provided you still have it)\u00a0will not work as the device is already claimed by the &#8216;imon&#8217; driver.<\/p>\n<p>The fastest way to get up and running again is as follows. The &#8216;imon&#8217; receiver will now be a HID input device. I got the impression it would send keystrokes to a graphical application but I didn&#8217;t get that working. Instead, we will use &#8216;lircd&#8217; again using a special driver called &#8216;devinput&#8217;. This driver reads the key strokes from the input layer device and converts them into LIRC\u00a0events. All your LIRC capable programs will then use LIRC like they used to &#8211; we only need to use the new button names.<\/p>\n<p>To find the iMon receiver in the list of input devices, lets create a udev rule to symlink to the device. This way we will not have to rely on obscure device names like &#8216;input1&#8217;. Make sure the device name matches whatever hardware you have. I inserted this rule in a file called <code class=\"not-hl\">\/etc\/udev\/rules.d\/99-imon.rules<\/code>:<\/p>\n<pre class=\"code not-hl\">KERNEL==&quot;event*&quot;, SYSFS{name}==&quot;iMON Remote (15c2:0038)&quot;, NAME=&quot;input\/%k&quot;, SYMLINK=&quot;input\/imon_remote&quot;, MODE=&quot;0666&quot;<\/pre>\n<p>Lets begin by stopping lirc if you still have it running. Next, reconfigure LIRC to use the devinput driver &#8211; when it asks which device you have, DOT\u00a0NOT\u00a0SELECT\u00a0THE\u00a0SOUNDGRAPH\u00a0IMON but &#8216;Linux input layer (\/dev\/input\/eventX)&#8217;. In the next screen select &#8216;None&#8217; as you probably do not use a transmitter.<\/p>\n<pre class=\"code not-hl\">\/etc\/init.d\/lirc stop\nsudo dpkg-reconfigure lirc\n&gt; Linux input layer (\/dev\/input\/eventX)\n&gt;\u00a0None\n\/etc\/init.d\/lirc start<\/pre>\n<p>In case you are not using Ubuntu Linux, I will explain the key parts of the LIRC\u00a0configuration. The <code class=\"not-hl\">\/etc\/lirc\/lircd.conf<\/code> file now has this part in it:<\/p>\n<pre class=\"code not-hl\">#Configuration for the Linux input layer (\/dev\/input\/eventX) remote:\ninclude &quot;\/usr\/share\/lirc\/remotes\/devinput\/lircd.conf.devinput&quot;<\/pre>\n<p>The <code class=\"not-hl\">lirc.conf.devinput<\/code> file is a standard (generated)\u00a0file with key codes as provided with LIRC. There is no need to manually set up a file with button scan codes as the new ir-core kernel subsystem will generate standard codes.<\/p>\n<p>The file called <code class=\"not-hl\">\/etc\/lirc\/hardware.conf<\/code> has something like this in it:<\/p>\n<pre class=\"code hl hl-ini\"><span class=\"re1\">REMOTE<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;Linux input layer (\/dev\/input\/eventX)&quot;<\/span>\n<span class=\"re1\">REMOTE_MODULES<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;&quot;<\/span>\n<span class=\"re1\">REMOTE_DRIVER<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;devinput&quot;<\/span>\n<span class=\"re1\">REMOTE_DEVICE<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;\/dev\/input\/imon_remote&quot;<\/span>\n<span class=\"re1\">REMOTE_LIRCD_CONF<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;devinput\/lircd.conf.devinput&quot;<\/span>\n<span class=\"re1\">REMOTE_LIRCD_ARGS<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;&quot;<\/span><\/pre>\n<p>All that remains is to use the new buttons in your LIRC capable program. For example, this is a part of my configuration of XBMC\u00a0(Lircmap.xml) for use with the SoundGraph iMon receiver:<\/p>\n<div class=\"code hl hl-xml code-linenum\">\n<table class=\"xml\">\n<tbody>\n<tr class=\"li1\">\n<td class=\"ln\">\n<pre class=\"de1\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n<\/pre>\n<\/td>\n<td class=\"de1\">\n<pre class=\"de1\"><span class=\"sc3\"><span class=\"re1\">&lt;lircmap<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;remote<\/span> <span class=\"re0\">device<\/span>=<span class=\"st0\">&quot;devinput&quot;<\/span><span class=\"re2\">&gt;<\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;hash<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_EJECTCD<span class=\"sc3\"><span class=\"re1\">&lt;\/hash<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;play<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_PLAY<span class=\"sc3\"><span class=\"re1\">&lt;\/play<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;pause<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_PAUSE<span class=\"sc3\"><span class=\"re1\">&lt;\/pause<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;stop<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_STOP<span class=\"sc3\"><span class=\"re1\">&lt;\/stop<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;forward<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_FASTFORWARD<span class=\"sc3\"><span class=\"re1\">&lt;\/forward<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;reverse<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_REWIND<span class=\"sc3\"><span class=\"re1\">&lt;\/reverse<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;skipplus<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_NEXT<span class=\"sc3\"><span class=\"re1\">&lt;\/skipplus<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;skipminus<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_PREVIOUS<span class=\"sc3\"><span class=\"re1\">&lt;\/skipminus<span class=\"re2\">&gt;<\/span><\/span><\/span>\n&nbsp; &nbsp; <span class=\"sc3\"><span class=\"re1\">&lt;record<span class=\"re2\">&gt;<\/span><\/span><\/span>KEY_RECORD<span class=\"sc3\"><span class=\"re1\">&lt;\/record<span class=\"re2\">&gt;<\/span><\/span><\/span>...<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>While the title may sound a tad cryptic, that matched my first impression about the new infrared remote subsystem used in Ubuntu 10.10 and kernel 2.6.36+ based distributions. In Linux 2.6.36, a new sub-system is introduced for remote controls. This subsystem is a partial replacement for lirc as it features complete IR\u00a0drivers for numerous devices. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-344","post","type-post","status-publish","format-standard","hentry","category-how-tos"],"views":5615,"_links":{"self":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344"}],"version-history":[{"count":4,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":533,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions\/533"}],"wp:attachment":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}