{"id":48,"date":"2009-04-25T15:25:13","date_gmt":"2009-04-25T13:25:13","guid":{"rendered":"http:\/\/raftaman-net.lahno-web2.de\/wordpress\/?p=48"},"modified":"2021-05-15T11:46:42","modified_gmt":"2021-05-15T09:46:42","slug":"rf-remote-with-fedora-10","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=48","title":{"rendered":"RF remote with Fedora 10"},"content":{"rendered":"\n<p>Remote controls for PCs are really great. With an ordinary remote for just a few bucks you can control almost everything on your PC while sitting on your couch. Well, thanks to <a href=\"http:\/\/www.lirc.org\/\">lirc<\/a>, of course. But most of them have one major design flaw: They&#8217;re infrared based, i.e. remote controls transmit data on an modulated infrared beam to your IR-receiver. Even a (think) sheet of paper can block the beam. So your remote always has to be within visual range of your receiver.<\/p>\n<p>But there are some remotes out there which use a 433MHz beam instead of the short-waved IR-beam. For example this one by X10 <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/possiblelossofprecision.net\/wordpress\/wp-content\/uploads\/2009\/04\/x10remote.jpg\" alt=\"RF Remote by X10\" \/><\/p>\n<p><!--more--><\/p>\n<h2><a name=\"section1\">1. lircd<\/a><\/h2>\n<p>Installing lirc is really no big deal<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nyum install lirc\r\n<\/pre>\n<p>It&#8217;s as simple as that!<\/p>\n<p>You may want to tell Fedora to start the daemon automatically<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nchkconfig lirc on\r\n<\/pre>\n<h2><a name=\"section1.1\">1.1 lirc_driver<\/a><\/h2>\n<p>You have to tell lirc which receiver you are using. Change the value for LIRC_DRIVER in <code>\/etc\/sysconfig\/lirc<\/code> to atilibusb:<\/p>\n<pre class=\"brush: plain; highlight: [5]; light: true; title: ; notranslate\" title=\"\">\r\n&#x5B;...]\r\n# The infrared receiver (and\/or transmitter) driver to be used by lircd(8),\r\n# similar to passing &quot;-H driver&quot; to lircd(8).\r\n# Run &quot;\/usr\/sbin\/lircd -H help&quot; to get a listing of supported drivers.\r\nLIRC_DRIVER=&quot;atilibusb&quot;\r\n&#x5B;...]\r\n<\/pre>\n<h2><a name=\"section1.2\">1.2 lircd.conf<\/a><\/h2>\n<p>There a basically two ways of configuring your remote control: You can use one of the config files in <code>\/usr\/share\/lirc-remotes\/<\/code> that come with lirc or create your own with a small program called irrecord<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# \/etc\/init.d\/lirc stop\r\n# irrecord -H atilibusb ~\/lircd.conf\r\n<\/pre>\n<p>The instructions are quite self-explaining. You may want to backup your original <code>lircd.conf<\/code> before replacing it with the one generated by irrecord<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# mv \/etc\/lircd.conf \/etc\/lircd.conf.orig\r\n# cp ~\/lircd.conf \/etc\/lircd.conf\r\n# \/etc\/init.d\/lirc restart\r\n<\/pre>\n<p>If you don&#8217;t want to go through the whole process of generating you own config file, you can use the one from <a href=\"http:\/\/linuxundich.de\/de\/2009\/04\/pc-funkfernbedienung-x10-unter-ubuntu-mit-lirc\/\">Christoph Langner&#8217;s Blog<\/a> located <a href=\"http:\/\/christoph-langner.de\/static\/lircd.conf.txt\">here<\/a> (<a href=\"https:\/\/possiblelossofprecision.net\/wordpress\/wp-content\/uploads\/2009\/04\/lircdconf.txt\">local mirror<\/a>).<\/p>\n<p>You can check if your configuration is working fine with irw. You should be able to see output for every configured button on you remote<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ irw\r\n00000014709b0000 00 world x10\r\n00000014709b0000 01 world x10\r\n&#x5B;...]\r\n<\/pre>\n<p>If you get strange results or no output, you should check if you&#8217;ve <a href=\"#section1.1\">set up the driver<\/a> correctly and lirc is not interfering with an <a href=\"#section4\">existing kernel module<\/a>.<\/p>\n<h2><a name=\"section2\">2. MythTV<\/a><\/h2>\n<p>Now that the remote is completely configured, you can start telling your applications which action to perform when a certain button is pressed. Every (lirc supporting) application scans ~\/.lircrc (or a similar config file, e.g. <a href=\"http:\/\/www.mythtv.org\/wiki\/LIRC#IR_Reception_.28to_MythTV.29\">MythTV<\/a> uses ~\/.mythtv\/lircrc) and has some predefined functions you can use.<\/p>\n<p>You may want to split the ~\/.lircrc-file per application<\/p>\n<pre class=\"brush: plain; highlight: [2]; light: true; title: ; notranslate\" title=\"\">\r\n## MythTV\r\ninclude ~\/.lirc\/mythtv\r\n\r\n## MediaKeys\r\ninclude ~\/.lirc\/mediakeys\r\n&#x5B;...]\r\n<\/pre>\n<p>Now you can create an new folder ~\/.lirc and place a seperate config-file for every application in it<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ mkdir ~\/.lirc\r\n$ touch ~\/.lirc\/mythtv\r\n<\/pre>\n<p>Don&#8217;t forget to add a new include statement in ~\/.lircrc for every new file in ~\/.lirc<\/p>\n<p>The stucture within ~\/.lirc\/[appname] is quite simple. A short excerpt from my ~\/.lirc\/mythtv:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n&#x5B;...]\r\nbegin\r\n  prog = mythtv\r\n  button = ok\r\n  config = Space\r\nend\r\nbegin\r\n  prog = mythtv\r\n  button = up\r\n  config = Up\r\nend\r\n&#x5B;...]\r\n<\/pre>\n<p>Every button has to be surrounded by one <em>begin<\/em>&#8211; and one <em>end<\/em>-statement. You have to specify the program that listens to this configuration in the <em>prog<\/em>-statement. The values for <em>button<\/em> matches the values you configured in <code>\/etc\/lirc<\/code> and with the <em>config<\/em>-statement you can map every button on your remote to one of the predefined functions of you application (all functions you can use in MythTV can be found in the <a href=\"http:\/\/www.mythtv.org\/wiki\/Keybindings\">MythTV-Wiki<\/a>).<\/p>\n<h2><a name=\"section3\">3. Multimedia keys<\/a><\/h2>\n<p>Using you multimedia keys with lirc is a little more complicated. Let&#8217;s have a look at the config file <code>~\/.lirc\/mediakeys<\/code> first (don&#8217;t forget to add the include-statement to <code>~\/.lircrc<\/code> !):<\/p>\n<pre class=\"brush: plain; collapse: true; gutter: false; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n### MediaKeys\r\nbegin\r\n        prog = irexec\r\n        button = volume+\r\n        repeat = 1\r\n        delay = 5\r\n        config = echo KeyStrPress XF86AudioRaiseVolume KeyStrRelease XF86AudioRaiseVolume | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = volume-\r\n        repeat = 1\r\n        delay = 5\r\n        config = echo KeyStrPress XF86AudioLowerVolume KeyStrRelease XF86AudioLowerVolume | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = mute\r\n        repeat = 0\r\n        config = echo KeyStrPress XF86AudioMute KeyStrRelease XF86AudioMute | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = play\r\n        config = echo KeyStrPress XF86AudioPlay KeyStrRelease XF86AudioPlay | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = pause\r\n        config = echo KeyStrPress XF86AudioPause KeyStrRelease XF86AudioPause | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = next\r\n        config = echo KeyStrPress XF86AudioNext KeyStrRelease XF86AudioNext | xmacroplay $DISPLAY\r\nend\r\nbegin\r\n        prog = irexec\r\n        button = previous\r\n        config = echo KeyStrPress XF86AudioPrev KeyStrRelease XF86AudioPrev | xmacroplay $DISPLAY\r\nend\r\n<\/pre>\n<p>irexec is a small program that listens to incoming lirc-events and starts the program you configured within the <em>config<\/em>-statement. To emulate that a multimedia key on your keyboard is pressed you can use <a href=\"http:\/\/xmacro.sourceforge.net\/\">xmacroplay<\/a>. Unfortunately there is no xmacro-rpm-package available in the Fedora-repository. But you can find one in <a href=\"http:\/\/n8wood.wordpress.com\/about\/\">Nathan Wood&#8217;s<\/a> <a href=\"http:\/\/n8wood.wordpress.com\/2008\/12\/02\/logitech-revolution-mx-in-fedora-and-centos\/\">Pan-Galactic Memory Bank<\/a> (mirrored here: <a href=\"https:\/\/possiblelossofprecision.net\/wordpress\/wp-content\/uploads\/2009\/04\/xmacro-pre03-200009110i386.rpm\">i386<\/a>, <a href=\"https:\/\/possiblelossofprecision.net\/wordpress\/wp-content\/uploads\/2009\/04\/xmacro-pre03-200009110x86_64.rpm\">x86_64<\/a>, <a href=\"https:\/\/possiblelossofprecision.net\/wordpress\/wp-content\/uploads\/2009\/04\/xmacro-pre03-200009110fc9src.rpm\">source rpm<\/a>).<\/p>\n<p>For testing your multimedia key configuration you simply start irexec without any options:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ irexec\r\n<\/pre>\n<p>You may want to start irexec automatically when you log in to your system. Adding irexec as daemon to gnome autostart is one way of doing it (of course, if you use kde this looks a little different&#8230;). Create a new file called <code>irexec.desktop<\/code><\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ touch ~\/.config\/autostart\/irexec.desktop\r\n<\/pre>\n<p>with the following content:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n&#x5B;Desktop Entry]\r\nType=Application\r\nName=irexec\r\nExec=\/usr\/bin\/irexec -d\r\nIcon=system-run\r\nComment=\r\nName&#x5B;en_US]=irexec\r\nComment&#x5B;en_US]=\r\nX-GNOME-Autostart-enabled=true\r\n<\/pre>\n<h2><a name=\"section4\">4. blacklist ati_remote<\/a><\/h2>\n<p>Actually you don&#8217;t need lirc to use this RF receiver from X10:<\/p>\n<pre class=\"brush: plain; highlight: [3]; light: true; title: ; notranslate\" title=\"\">\r\n# lsusb\r\n&#x5B;...]\r\nBus 002 Device 002: ID 0bc7:0006 X10 Wireless Technology, Inc. Wireless Transceiver (ACPI-compliant)\r\n&#x5B;...]\r\n<\/pre>\n<p>There already is a native kernel module called ati_remote which can talk to the receiver. Now why am I telling you this after you went through the whole lirc configuration? Easy: It doesn&#8217;t support every key on every remote and you cannot change the keymappings manually, so lirc is definitly the more flexible choice (<a href=\"http:\/\/linuxundich.de\/de\/2009\/04\/pc-funkfernbedienung-x10-unter-ubuntu-mit-lirc\/\">Christoph Langner&#8217;s Blog<\/a> (german!)).<br \/>\nBut it could be, that ati_remote comes as kernel module with you distribution as it does with Fedora 10. Every time you plugin your receiver, the kernel will automatically load the ati_remote module which heavily interferes with lirc. So if you&#8217;re facing unexpected output from irrecord (or even no output at all) you should probably unload the module:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nrmmod ati_remote\r\n<\/pre>\n<p>To prohibit the kernel from loading the module again, you can blacklist it by adding &#8216;blacklist ati_remote&#8217; to your modprobe configuration:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\necho blacklist ati_remote &gt;&gt; \/etc\/modprobe.d\/blacklist\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Remote controls for PCs are really great. With an ordinary remote for just a few bucks you can control almost everything on your PC while sitting on your couch. Well, thanks to lirc, of course. But most of them have one major design flaw: They&#8217;re infrared based, i.e. remote controls transmit data on an modulated infrared beam to your IR-receiver&#8230;. <a href=\"https:\/\/possiblelossofprecision.net\/?p=48\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,58,8,9],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-fedora","tag-hardware","tag-lirc","tag-mythtv"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48"}],"version-history":[{"count":92,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":1837,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions\/1837"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}