Controlling two computers with one infrared remote.

| July 17, 2007 | Reply

My mythtv server has one infrared receiver because it comes with the pvr-150 card.
My mythfrontend is a different machine that has no infrared receiver.
This is how I pass the infrared signals over the network to control both boxes with one receiver and one remote.I’ve done this 3 times and it’s always a headache to figure out, so I figure i’ll write it down this time.

I’m assuming you’ve already got an infrared receiver, it shouldn’t matter if it’s a pvr-150 or not, and that you’ve got lirc installed and accepting signals on one host.

Reading through the LIRC documentation suggested this could be done, but I haven’t found any tutorials, or even anyone else that’s doing it.

Anyway. On the lirc server. The one that has the infrared reciever working (which can be verified by typing “irw” and pressing buttons on the remote) we have to start lirc with the –listen option.

This may vary between different versions of lirc and different distros.

On my debian server, I manually edited the /etc/init.d/lircd file, and modified this line:
start-stop-daemon –start –quiet –exec /usr/sbin/lircd — –listen

by adding –listen to the startup script, lirc opens up a port and listens for client connections. I found out later that it’s better to edit /etc/lirc/hardware.conf and add “–listen” to the LIRCD_ARGS variable. Either way works. The second is cleaner.

So now LIRC is listening for client connections on the server that has the infrared reciever.

On my mythfrontend, which is now running on ubuntu studio, I installed lirc, copied the lircd.conf file for my remote to /etc/lirc and set the /etc/lirc/hardware.conf LIRCD_ARGS to LIRCD_ARGS=”–connect=ip.of.the.server”.

After doing that and tring to run lirc, I noticed irw wasn’t working. And here is what it said in the messages file:

Jul 17 18:03:37 cambridge lircd-0.8.2-CVS[3665]: lircd(userspace) ready
Jul 17 18:03:37 cambridge lircd-0.8.2-CVS[3665]: connected to 192.168.0.102
Jul 17 18:03:40 cambridge lircd-0.8.2-CVS[3665]: accepted new client on /dev/lircd
Jul 17 18:03:40 cambridge lircd-0.8.2-CVS[3665]: could not open /dev/lirc
Jul 17 18:03:40 cambridge lircd-0.8.2-CVS[3665]: default_init(): No such device or address
Jul 17 18:03:40 cambridge lircd-0.8.2-CVS[3665]: caught signal

So, even though it was connected to my lirc server, it was still trying to access a raw infrared device at /dev/lircd.

To resolve this, I set the lirc driver to NULL in /etc/lirc/hardware.conf.

After that, I can control my frontend by passing infrared signals to my backend.
This is obviously useful for MythTV, but think of all the possibilities… data centers can assign commands to infrared signals. Reboot boxes with a remote control.. anything. All with one remote and one infrared receiver.

Tags:

Category: Uncategorized

About the Author ()