Sipie + lirc + ATI remote

ATI Remote

I’ve setup a Linux machine to pipe audio into my house. I use Amarok to listen to mp3’s and internet radio. Recently I’ve added an RF remote and and the capability to listen to Sirius radio. A few people have asked how I did it, so I thought it would be worth a blog post.

I found and app called Sipie. Sipie is a simple little Linux application to listen to listen to Sirius radio. I decided on using the ATI remote because it’s an RF remote, I can use it in any room in the house. Lirc the program that delivers commands from my remote to Amarok (and Sipie).

The truth is that neither Amarok nor Sipie have native LIRC support :( But I worked around this by using irexec to control Sipie. And I used dcop to control Amarok. Thankfully Amarok does have a very complete dcom interface, but I could find very little useful documentation on it.


Hacking Sipie

Sipie is just a small python program. I modified xSipie so that it would take a channel number as a command line argument. I modified Sipie version 1171984823. Newer versions of Sipie have this feature built-in; no modifications should be required.
Installing LIRC:

There are a number of howtos there. I followed this one.

After you have lirc working (not always an easy task). You’ll need to assigned the remote buttons to do different tasks. Below is my .lircrc file. It includes my mappings for Sirius radio and for amarok.

# lircrc for ati remote wonder

# Command bindings

begin
    button = POWER
    prog = irexec
    repeat = 0
    config = amarok &
end
#watch web cam
begin
     button = tv
     prog = irexec
     repeat = 0
     config = killSipie; mplayer -fs rtsp://user:pass@192.168.15.73/mpeg4/media.amp &
end

begin
     button = dvd
     prog = irexec
     repeat = 0
     config = mplayer dvd://
end

begin
     button = web
     prog = irexec
     repeat = 0
     config = firefox
end

begin
    button = a
    prog = irexec
    repeat = 0
    config = xmms
end

begin
 prog = irexec
 button = 9
 repeat = 0
 config = killSipie; sipie thepulse &
end

begin
 prog = irexec
 button = 8
 repeat = 0
 config = killSipie; sipie newcountry &
end

begin
 prog = irexec
 button = 7
 repeat = 0
 config = killSipie; sipie bbcradio1 &
end

begin
 prog = irexec
 button = 6
 repeat = 0
 config = killSipie; sipie jazzcafe &
end

begin
 prog = irexec
 button = 5
 repeat = 0
 config = killSipie; sipie cnn &
end

begin
 prog = irexec
 button = 4
 repeat = 0
 config = killSipie; sipie thebeat &
end

begin
 prog = irexec
 button = 3
 repeat = 0
 config = killSipie; sipie altnation &
end

begin
 prog = irexec
 button = 2
 repeat = 0
 config = killSipie; sipie hotjams &
end

begin
 prog = irexec
 button = 1
 repeat = 0
 config = killSipie; sipie siriushits1 &
end

begin
 prog = irexec
 button = 0
 repeat = 0
 config = killSipie; sipie 90salternative &
end

# Program Specific
#

begin
 prog = irexec
 button = FFWD
 repeat = 3
 config = dcop amarok player next
end

begin
 prog = irexec
 button = REW
 repeat = 3
 config = dcop amarok player prev
end

begin
 prog = irexec
 button = PLAY
 config = dcop amarok player play
end

begin
 prog = irexec
 button = PAUSE
 config = dcop amarok player playPause
end

begin
 prog = irexec
 button = STOP
 config = dcop amarok player stop
end

begin
 prog = irexec
 button = VOL_UP
 repeat = 2
 config = dcop amarok player volumeUp
end

begin
 prog = irexec
 button = VOL_DOWN
 repeat = 2
 config = dcop amarok player volumeDown
end

begin
 prog = irexec
 button = MUTE
 config = dcop amarok player mute
end

begin
 prog = irexec
 button = LIST
 config = dcop amarok player showOSD
end

begin
   prog = irexec
   button = TIMER
   repeat = 0
   config = killSipie
end

begin
   prog = irxevent
   button = OK
   repeat = 3
   config = Key Return CurrentWindow
end

begin
    prog = irxevent
    button = UP
    repeat = 3
    config = Key Up CurrentWindow
end

begin
 prog = irxevent
 button = DOWN
 repeat = 3
 config = Key Down CurrentWindow
end

begin
 prog = irxevent
 button = LEFT
 repeat = 3
 config = Key Left CurrentWindow
end

begin
 prog = irxevent
 button = RIGHT
 repeat = 3
 config = Key Right CurrentWindow
end

#begin
#    button = power
#    prog = xmms
#    config = quit
#end

begin
     button = vol-up
     prog = mplayer
     config = volume 1
     repeat = 1
end

begin
    button = vol-down
    prog = mplayer
    config = volume -1
    repeat = 1
end

begin
    button = pause
    prog = mplayer
    config = pause
end

begin
   button = play
   prog = mplayer
   config = play
end

begin
   button = stop
   prog = mplayer
   config = stop
end

In the above script you may have saw that I was calling a script called killSipie.

Below is the contents of that script:

$cat /usr/bin/killSipie
#!/bin/sh
kilall mplayer
kill $(ps -ef | grep “/usrbin/sipie” | head -n1 | awk ‘{ print$2 }’)

Here is my ~/.Xmdmapfile

$cat .Xmodmap
keycode 179 = XF86AudioPlay
keycode 232 = XF86AudioStop
keycode 152 = XF86AudioPrev
keycode 233 = XF86AudioNext
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 160 = XF86AudioMute
keycode 110 = XF86AudioPause

And lastly, I wrote a script to load my remote settings start up:

$ cat ~/remoteStartup.sh

#!/bin/sh
xmodmap ~/.Xmodmap

irxevent &
irexec ~/.lircrc &


About this entry