<?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>edwi.nl/og &#187; vlc</title>
	<atom:link href="http://edwi.nl/og/tag/vlc/feed/" rel="self" type="application/rss+xml" />
	<link>http://edwi.nl/og</link>
	<description>Edwin Woudt's weblog</description>
	<lastBuildDate>Sat, 18 Apr 2009 00:15:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MCE Remote on a Mac &#8211; or: I want more buttons!</title>
		<link>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-or-i-want-more-buttons/</link>
		<comments>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-or-i-want-more-buttons/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 16:30:12 +0000</pubDate>
		<dc:creator>edwin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[lirc]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mce remote]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[vlc]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://edwi.nl/og/?p=182</guid>
		<description><![CDATA[This is a series on using an MCE Remote Control with a Mac.
While programs like Remote Buddy and Mira allow you to get much more from your apple remote, there is one drawback: it has only 6 buttons. This may work well for many people, and for applications specifically designed for it, but I just [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-93 alignleft" style="border: 1px solid #dddddd; margin-bottom: 12px; margin-right: 20px;" title="mac-mce-120x120" src="http://edwi.nl/og/uploads/2009/04/mac-mce-120x120.png" alt="MCE Remote on a Mac" width="120" height="120" />This is a series on using an <a href="http://www.mythtv.org/wiki/MCE_Remote">MCE Remote Control</a> with a Mac.</p>
<p>While programs like <a href="http://www.iospirit.com/">Remote Buddy</a> and <a href="http://twistedmelon.com/mira/">Mira</a> allow you to get much more from your apple remote, there is one drawback: it has only 6 buttons. This may work well for many people, and for applications specifically designed for it, but I just like to have much more control. As a recent switcher from a Windows desktop/media pc and FreeBSD/Unix server to a one-Mac-Mini-fits-all setup, I had one of those MCE remotes lying around, so that&#8217;s the one I wanted to use.</p>
<p>However, an intensive search on google and all sorts of forums did not help: as far as I know, the thing just isn&#8217;t supported. Using Remote Buddy or Mira I can use the eHome receiver delivered with my MCE Remote, but only with an Apple Remote and not the MCE Remote itself. Even looking at the Linux community did not help: while a port of the <a href="http://www.lirc.org">LIRC</a> software is available in <a href="http://www.macports.org/">MacPorts</a> it does not have any hardware support, but can only connect to a remote host. Having some good experience with running Windows and Linux as a virtual machine in <a href="http://www.parallels.com/">Parallels Desktop</a> I came to the following &#8220;solution&#8221; for my problem:</p>
<ul>
<li>Take a small Linux distribution, and run it as a VM</li>
<li>Install LIRC and the needed linux kernel modules in this VM</li>
<li>Connect my USB eHome IR receiver to LIRC in this VM</li>
<li>Also install LIRC on the Mac natively and connect it to LIRC in the Linux VM</li>
<li>Convert the button presses on the Remote Control to keypresses on my Mac using a combination of LIRC software and AppleScript</li>
</ul>
<p>It took quite a bit of digging, but in the end I got everything working and I am now controlling my <a href="http://www.videolan.org/vlc/">VLC media player</a> using an MCE remote control.</p>
<p>A few words of warning: this tutorial is not for people who:</p>
<ul>
<li>Expect ready to use software with a graphical installer, neat configuration screens etc. All of this is basically a clever workaround, and it works well for me, but if the only thing you want is a way to reconfigure some buttons from your Apple remote, then Remote Buddy or Mira is the way to go.</li>
<li>Are afraid of using the Terminal. You do not need to be a UNIX guru to follow the steps in this tutorial, but if you do not know what the Terminal is within Mac OS X, you better look through some <a href="http://www.google.com/search?q=mac%20terminal">basic toturials</a> first.</li>
</ul>
<p>If you still want to proceed, read the following three articles for the nitty gritty instructions:<br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-1-installing-finnix-as-a-parallels-vm/">Step 1: installing Finnix as a Parallels VM</a><br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-2-installing-lirc-in-the-finnix-vm/">Step 2: installing LIRC in the Finnix VM</a><br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-3-configuring-lirc-in-os-x/">Step 3: configuring LIRC in OS X</a></p>
]]></content:encoded>
			<wfw:commentRss>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-or-i-want-more-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MCE Remote on a Mac &#8211; Step 3: configuring LIRC in OS X</title>
		<link>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-3-configuring-lirc-in-os-x/</link>
		<comments>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-3-configuring-lirc-in-os-x/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 16:08:49 +0000</pubDate>
		<dc:creator>edwin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[lirc]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mce remote]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[vlc]]></category>

		<guid isPermaLink="false">http://edwi.nl/og/?p=156</guid>
		<description><![CDATA[This is part 3 in a series on using an MCE Remote Control with a Mac. See the:
- Main article
- Step 1: installing Finnix as a Parallels VM
- Step 2: installing LIRC in the Finnix VM
Installing LIRC using MacPorts
The LIRC client executables can be installed using MacPorts. We will use these executables to connect to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-93 alignleft" style="border: 1px solid #dddddd; margin-bottom: 12px; margin-right: 20px;" title="mac-mce-120x120" src="http://edwi.nl/og/uploads/2009/04/mac-mce-120x120.png" alt="MCE Remote on a Mac" width="120" height="120" />This is part 3 in a series on using an MCE Remote Control with a Mac. See the:<br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-or-i-want-more-buttons/">Main article</a><br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-1-installing-finnix-as-a-parallels-vm/">Step 1: installing Finnix as a Parallels VM</a><br />
- <a href="http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-2-installing-lirc-in-the-finnix-vm/">Step 2: installing LIRC in the Finnix VM</a></p>
<h3>Installing LIRC using MacPorts</h3>
<p>The <a href="http://www.lirc.org/">LIRC</a> client executables can be installed using <a href="http://www.macports.org/">MacPorts</a>. We will use these executables to connect to the LIRC daemon in the Finnix VM.</p>
<p>First you need to install:</p>
<ul>
<li>Apple <a href="http://developer.apple.com/TOOLS/xcode/">Xcode</a></li>
<li>MacPorts (<a href="http://www.macports.org/install.php">installation instructions</a>)</li>
</ul>
<p>Then fire up a terminal, and execute the following commands in a Mac terminal to initialize your ports tree and install LIRC:<br />
<code>$ sudo port -v selfupdate<br />
$ sudo port install lirc</code></p>
<p>While you are waiting for lirc to install, let&#8217;s already execute the next step: in order to connect to your virtual machine, you need to know the IP address used by it. Run the ifconfig command in your Finnix VM. The output looks someting like:<br />
<code>root@tty1:~# ifconfig eth0<br />
eth0&nbsp;&nbsp;&nbsp;&nbsp;Link encap:Ethernet  HWaddr 00:1c:42:f0:e5:19<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet addr:10.37.129.3  Bcast:10.37.129.255  Mask:255.255.255.0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX packets:813 errors:0 dropped:0 overruns:0 frame:0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TX packets:145 errors:0 dropped:0 overruns:0 carrier:0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;collisions:0 txqueuelen:1000<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RX bytes:73804 (72.0 KiB)  TX bytes:11687 (11.4 KiB)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Interrupt:10 Base address:0x8200</code></p>
<p>The ip address you are looking for is the one after &#8216;inet addr:&#8217; on the second line.</p>
<p>When lirc is installed, let&#8217;s connect to it by typing the following in your <em>Mac</em> terminal (and not the Finnix VM), obviously replacing the ip address with the one you found in the previous step:<br />
<code># sudo lircd --connect 10.37.129.3<br />
# sudo chmod 666 /opt/local/var/run/lircd</code></p>
<p>Now let&#8217;s test your setup by running &#8216;irw&#8217; and pushing some buttons. Your terminal should look like:<br />
<code># irw<br />
000000037ff07bf2 00 Home mceusb<br />
000000037ff07bf2 01 Home mceusb<br />
000000037ff07bf2 02 Home mceusb<br />
000000037ff07be9 00 Play mceusb<br />
000000037ff07be0 00 Down mceusb</code></p>
<p>Congratulations! You are now receiving your MCE Remote events on your Mac. Read on for information on how to control an application with it.<br />
<span id="more-156"></span></p>
<h3>Controlling VLC with LIRC</h3>
<p>This tutorial will now show you how to control the <a href="http://www.videolan.org/vlc/">VLC media player</a> using your MCE remote by mapping your remote buttons to keypresses.</p>
<p>First of all a script is needed that can send keystrokes. <a href="http://www.apple.com/applescript/">AppleScript</a> is the most logical candidate. A script like the following should do the trick (note: at the end of this posting you can find a link to download a full version of this script):<br />
<code>--&nbsp;Filename:&nbsp;keystroke-simple.applescript<br />
--&nbsp;Author:&nbsp;&nbsp;&nbsp;Edwin&nbsp;Woudt<br />
--&nbsp;Version:&nbsp;&nbsp;20090407-1<br />
--<br />
--&nbsp;Note:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;simplified&nbsp;version&nbsp;of&nbsp;the&nbsp;full&nbsp;script.<br />
--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Download&nbsp;keystroke.applescript&nbsp;below&nbsp;for&nbsp;the&nbsp;full&nbsp;version.<br />
&nbsp;<br />
on run argv<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;set xkey to (item 1 of argv)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if ((count of argv) > 1) then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set xmod to (item 2 of argv)<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set xmod to ""<br />
&nbsp;&nbsp;&nbsp;&nbsp;end if<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;set xcode to 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;if xkey = "down" then set xcode to 125<br />
&nbsp;&nbsp;&nbsp;&nbsp;if xkey = "up" then set xcode to 126<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if xmod = "" then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if xcode = 0 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tell application "System Events" to keystroke xkey<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tell application "System Events" to key code xcode<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if xcode = 0 then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if xmod = "x" then tell application "System Events" to keystroke xkey using command down<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if xmod = "x" then tell application "System Events" to key code xcode as integer using command down<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if<br />
&nbsp;&nbsp;&nbsp;&nbsp;end if<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
end run</code></p>
<p>This script can be called with two command line parameters:</p>
<ol>
<li>A key, either a letter or a special key like &#8216;up&#8217;, &#8216;down&#8217;, &#8216;esc&#8217; or &#8216;enter&#8217;</li>
<li>An optional modifier, consisting of one or more of the following letters: &#8216;c&#8217; for Control, &#8216;o&#8217; for Option, &#8217;s&#8217; for Shift and/or &#8216;x&#8217; for Command (note: the simple version only supports the &#8216;x&#8217; modifier, the full version below supports all modifiers and all combinations).</li>
</ol>
<p>This script will be called from a &#8216;lircrc&#8217; file, of which the following is a small example:<br />
<code>#&nbsp;Filename:&nbsp;vlc-simple.lircrc<br />
#&nbsp;Author:&nbsp;&nbsp;&nbsp;Edwin&nbsp;Woudt<br />
#&nbsp;Version:&nbsp;&nbsp;20090407-1<br />
&nbsp;<br />
#&nbsp;&nbsp;Note:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;simplified&nbsp;version&nbsp;of&nbsp;the&nbsp;full&nbsp;file.<br />
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Download&nbsp;vlc.lirrc&nbsp;below&nbsp;for&nbsp;the&nbsp;full&nbsp;version.<br />
&nbsp;<br />
#&nbsp;Play&nbsp;button<br />
begin<br />
&nbsp;&nbsp;&nbsp;&nbsp;prog&nbsp;&nbsp;&nbsp;=&nbsp;irexec<br />
&nbsp;&nbsp;&nbsp;&nbsp;button&nbsp;=&nbsp;Play<br />
&nbsp;&nbsp;&nbsp;&nbsp;config&nbsp;=&nbsp;/usr/bin/osascript&nbsp;~edwin/Documents/Scripts/keystroke.applescript&nbsp;p&nbsp;x<br />
end<br />
&nbsp;<br />
#&nbsp;Volume&nbsp;buttons<br />
begin<br />
&nbsp;&nbsp;&nbsp;&nbsp;prog&nbsp;&nbsp;&nbsp;=&nbsp;irexec<br />
&nbsp;&nbsp;&nbsp;&nbsp;button&nbsp;=&nbsp;VolUp<br />
&nbsp;&nbsp;&nbsp;&nbsp;config&nbsp;=&nbsp;/usr/bin/osascript&nbsp;~edwin/Documents/Scripts/keystroke.applescript&nbsp;up&nbsp;x<br />
end<br />
begin<br />
&nbsp;&nbsp;&nbsp;&nbsp;prog&nbsp;&nbsp;&nbsp;=&nbsp;irexec<br />
&nbsp;&nbsp;&nbsp;&nbsp;button&nbsp;=&nbsp;VolDown<br />
&nbsp;&nbsp;&nbsp;&nbsp;config&nbsp;=&nbsp;/usr/bin/osascript&nbsp;~edwin/Documents/Scripts/keystroke.applescript&nbsp;down&nbsp;x<br />
end</code></p>
<p>This file will basically instruct lirc to output a &#8216;Command-P&#8217; when I click on the Play button, &#8216;Command-Up Arrow&#8217; for the volume up button and &#8216;Command-Down Arrow&#8217; for the volume down button. These correspond to the default keys used by VLC, according to the VLC Preferences -> Hotkeys.</p>
<p>Create the file with a texteditor (or download my full version below) and run it in a terminal using:<br />
<code>irexec ~edwin/Documents/Scripts/vlc.lircrc</code></p>
<p>Note: all my scripts assume their location to be in the Documents/Scripts subdirectory of my home directory. Feel free to change it to a different location.</p>
<p>Now start up a video in VLC media player and try to use some buttons!</p>
<p>Download attachments:<br />
<a href="http://edwi.nl/og/uploads/2009/04/vlc.lircrc">vlc.licrc</a><br />
<a href="http://edwi.nl/og/uploads/2009/04/keystroke.applescript">keystroke.applescript</a></p>
<h3>Next steps</h3>
<p>You have now reached the end of this three part tutorial on getting your MCE remote control to work on your Mac.  Hopefully this has all worked out for you: let me know through a comment or by mailing me at <em>edwin AT woudt DOT nl</em>. </p>
<p>A few things you could do after this tutorial:</p>
<ul>
<li>change the configuration for the VLC media player to be more of your liking</li>
<li>add configuration files for other applications</li>
<li>somehow extend all this with detection of which application is running (using AppleScript?) and change the behaviour of the remote based on that</li>
<li>use a different linux distribution</li>
<li>use VirtualBox as a free alternative to Parallels</li>
</ul>
<p>If I get around to one of these things, I will post the results on this blog. Of course: should you have anything to add, let me know, whether it is a solution to one of the above suggestions, or a completely different thing. </p>
]]></content:encoded>
			<wfw:commentRss>http://edwi.nl/og/2009/04/08/mce-remote-on-a-mac-step-3-configuring-lirc-in-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

