Friday, February 13, 2009

Linux, LIRC, Imon, and Antec Veris

This is as much for me as for anyone else looking for info.

In my earlier post where I fixed my TV, I mentioned that I use a Linux box for a media center. So this job has been done on the cheap, spare parts and existing setup were being modified to work. No buying an Apple TV or a special set top system.

So i have been bouncing back and forth between Boxee, MythTv and XBMC. All of them have their own merits, but I have been leaning towards XBMC and Boxee. MythTV really doesn't meet my particular needs, though it is a great system.

But the ultimate suck of my setup was the lack of a remote.

So last week I had to meet up with my boss to pick up a Mac Mini for work ( I'll be posting my thoughts on that later), I had to run over to Best Buy and get a keyboard. While I was there I saw an Antec Veris Basic remote for relatively cheap. 30 bucks later and I had myself a remote for my XBMC use.

Well my initial browsing showed that the Antec was compatible with LIRC so I figured I was good to go. Fuck was I ever wrong. First off, Soundmon which makes these devices and then repackages them with other companies names is known to work differently than most standard remotes, the particular version I bought has only recently been added to the LIRC builds, and it wasn't available in the APT repository for my Ubuntu distro. So my first thought was to go back to my favorite distro Debian, but after finding out that neither Boxee nor XBMC will build worth a damn in Debian and their LIRC modules were out of date even using the Unstable files I gave up. Better to build from source on one item and not on three.

So here is what I had to do to get it to work.

First thing first, this thing is taken over by usbhid. That means it tries to treat my shit like it's a mouse or keyboard. Well that won't work. So in Debian and Ubuntu you need to do acouple of things to find out what driver it is using and also what the the hardware is.

So in Ubuntu and Debian you need to take these two steps...


mount -t usbfs none /proc/bus/usb

then

cat /proc/bus/usb/devices


This took me some googling to find out about the usbhid issue.

This next part come from here

1) Edit /etc/modprobe.d/usbhid (create it if it doesn't exist) and add the following line. The first hex code is the vendor ID, the second is the product ID, and the 0x0004 means ignore this device.

options usbhid quirks=0x15c2:0x0038:0x0004

2) Run the command: depmod -ae
3) You need to rebuild your initrd. If you are running a typical installation, you can do this by running:

update-initramfs -u


Mine has a different set of codes, so usbhid number was 0x15c2:0x0043

So I made the appropriate edits. And then I followed the rest of the steps from the site.

From here it was time to build my modules. Since I wasn't lucky enough that my stuff was handled in the version easily available to me, I had to go and build from source. The CVS actually.

So I had to add CVS to my Ubuntu build and then I created a folder in my home directory called source. Mainly fearing that this will not be the last time I have to do something like this.

From here I had to do this from the terminal...

sudo cvs -d:pserver:anonymous@lirc.cvs.sourceforge.net:/cvsroot/lirc login
then
sudo cvs -z8 -d:pserver:anonymous@lirc.cvs.sourceforge.net:/cvsroot/lirc co lirc
Once the files were downloaded I cd'd into the new directory and did...
./autogen.sh
Then
./setup.sh

Selecting the correct options for me, in this case the imon IR driver.

Once this was done I rebooted me system since it created some crap in my /dev directory.

After that I went back into the terminal and did a
sudo ls /dev/lir*
This gave me
lirc0 lirc1 lircd
Woohoo!!!! Just what I wanted to see. Now onto testing out my install.
sudo mode2 -d /dev/lirc0 --raw
and
sudo mode2 -d /dev/lirc1 --raw

respectively.

The aggravating thing about the imon systems is that the buttons don't go through a single lirc like other remotes, instead it goes through two. So there is a few tweaks to get it to work, neither were what I needed. And the new CVS has a section for my RM100 remote, but the codes were wrong. I am wondering if they changed them recently. So I had to build an lircd.conf file for both lirc0 and lirc1 using irrecord.

I then created a folder in /etc named lirc. In there I placed my two lircd files named rm100_0.conf and rm100_1.conf respectively.

Once I did this I had to get the lircd daemon running. Since I need two of them and also needed them to link up together I had to run these commands.


/usr/local/sbin/lircd --driver=default --device=/dev/lirc0 --pidfile=/var/run/lirc0.pid --listen=8765 /etc/lirc/rm100_0.conf
/usr/local/sbin/lircd --driver=default --device=/dev/lirc1 --pidfile=/var/run/lirc1.pid --output=/dev/lircd --connect=localhost:8765 /etc/lirc/rm100_1.conf

This linked up both of the daemon processes and then pointed them to their respective config files.

Now I was able to run irw to test out my config. Well this stupid fucking remote does a double signal. One for press and the other when you let go. Now the shitty part is that there are ways to delay and make the config files ignore double presses, but these are not double key presses. Nope two seperate events, so that mean that I had to figure out a way to get my lirc to ignore the second event. Some more googling garnered me a post somewhere that showed how a person changed the toggle_bit_mask in the config files to basically fuck up the remote codes. Crappy breaking code hack, but fuck it, it worked.

So in one remote I had


0x28
so I changed it to
0x140000

The other had

0x4000
So I changed it to
0x0

Sufficiently broken. So now when I click a button it only showed one event.

Now that it was finally working, I needed to get this stuff to autostart when I botted up. So onto making a shell script with the commands to kick in the two daemons and placing it into /etc/init.d/ . I named my script lirc and then added it as a startup item. Google it, this one is not hard to find.

From here I created my Lircmap.xml for XBMC and got all the keys to do what I wanted.

T was looking over my shoulder while I was writing this up and said "Are you still working on that post?"

And I have to agree with her. this was one shitty, nasty, painful install. I should learn to just get easily supported crap for my Linux boxes, but really I am not that smart. So instead I am writing a blog post so I can remember what I did.

If you made it this far I commend you. Because fi you are coming from the motorcycle sites, you probably didn't really give a fuck about this, and if you bought one of these Soundmon things, you have probably spent a fucking week trying to get it to run. Just. Like. Me.

Damn

5 comments:

Anonymous said...

I've been wrestling with the Antec Veris that comes with the Antec MicroFusion Remote 350 case all weekend.

I've also got an Antec Veris Basic to try out later too, but I found this thread helpful for the MicroFusion case:

http://www.gossamer-threads.com/lists/mythtv/users/370936

I'm hoping it helps with the Veris Basic in the same way.

-- snip from thread --

For those running Ubuntu (tested on
Ubuntu 8.10 beta)

I've made a patch to the existing lirc modules, the advantage being
that they will be installed in the proper location, and it will be
easier to maintain in the future.
Patch is available there:
http://www.avenard.org/mythtv/lirc-0.8.3.imon.patch

How to use it:

# apt-get install lirc-modules-source
# cd /usr/src/lirc-0.8.3
# patch -p1 /path/th/lirc-0.8.3.imon.patch
# dpkg-reconfigure lirc-modules-source

either reboot or type:
rmmod lirc_imon
rmmod lirc_dev
modprobe lirc_imon

That's it

-- /snip --

There are also lirc configs and a modified init script for pain reduction, it handles the two lircds you need.

Anonymous said...

oops.. those confs aren't for the RM100, some of the codes work tho. ah well.

S.G. said...

I had seen that thread also. It was one of my earlier filures. The thing that caught me is the patch didn't cover the 0x0043 version I am running. And when I tried tweaking it, I broke a bunch of stuff.

That's why I went over to the CVS instead, it was being supported by default in there.

That said, someone better at Linux than myself may have good luck with it.

Anonymous said...

I have the same antec veris basic with the little rm100 remote.
Bus 001 Device 004: ID 15c2:0043 SoundGraph Inc.
I have followed your guide as well as a few others and the fucking thing is still not creating the /dev/lirc0 or /dev/lirc1. It only creates a lircd.

When I execute mount -t usbfs none /proc/bus/usb and then follow with cat /proc/bus/usb/devices it shows no drivers. Even after following your write up step by step.

If you ran the cat /proc/bus/usb/devices, what are the drivers saying now?

I think I got a broken CVS package. I am totally frustrated and jealous that you got this veris basic working. I think I am going for a bike ride right now to eliminate some of this stress. Oh, what version of Ubuntu are you running? I feel the need for speed!

MrBook said...

Non-related to article, but definitely related to your music collection.

Good call on picking Devil Makes Three. I was just listening to that song yesterday, great stuff.