Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have MythTV front-end, XBMC and Steam Linux installed and running fine on my Ubuntu 12.04 HTPC and would like to be able to control the machine by IR Remote Control, without having to plug in a keyboard or use another entry device every time I boot up, just to be able to launch my apps.

I set up lirc for my MCE Remote Control, using the Mythbuntu Control Panel and tested it successfully with irw. It works fine within the applications mentioned, but I need to be able to use it to launch these applications, too.

I have searched around for a solution and come up with very little which helps. Even the suggestions on LIRC's homepage (http://www.lirc.org/software.html) are out of date, poorly maintained and/or would not install.

I think that these sort of common input methods should be able to be used 'out of the box' with the new Unity interface, so it surprises me that the Launcher isn't compatible.

Anyway, does anybody have any idea how to make this work, or have any other solution to my problem?

Thanks,

Rich.

share|improve this question
add comment

2 Answers

I found this lifehacker article on LIRC. It suggests that you install the lirc-x package. If you do that, and then modify your .lircrc file as I am about to show, and then run the irxevent program (from a terminal window or as part of startup — note that you can use irxevent -d to fork and run it in the background) you can then navigate the Unity launcher. But there is a downside - when irxevent is running and then you go into a program that knows how to operate with LIRC (such as XBMC), what happens is that your remote keys are received by both programs, and both try to act on them, with semi-predictable results. I haven't figured out a way around that yet.

Here is what I added to my .lircrc file:

begin
 prog = irxevent
 button = KEY_UP
 repeat = 0
 config = Key Up CurrentWindow
end

begin
 prog = irxevent
 button = KEY_DOWN
 repeat = 0
 config = Key Down CurrentWindow
    end

begin
 prog = irxevent
 button = KEY_LEFT
 repeat = 0
 config = Key Left CurrentWindow
end

begin
 prog = irxevent
 button = KEY_RIGHT
 repeat = 0
 config = Key Right CurrentWindow
end

begin
 prog = irxevent
 button = KEY_PLAY
 config = Key Return CurrentWindow
 repeat = 0
end

begin
 prog = irxevent
 button = KEY_OK
 config = Key Return CurrentWindow
 repeat = 0
end

This is just a demonstration that only defines six buttons on the remote (the arrow keys, OK and Play, the latter two both sending the equivalent of the Return/Enter key on the keyboard. It is enough to do basic navigation of the launcher. Now if there was only some way to kill irxevent when a program that is LIRC compatible is running, and restart it when you have exited all such programs, without putting too much load on system resources, this would work great!

NOTE: There is a documentation page on irxevent here. By looking at that I was finally able to deduce that if you replace CurrentWindow with unity-2d-shell, then it will only work on the Launcher. But the problem with that is that it brings the Launcher to the foreground (sometimes), even if you are inside another program. There is supposed to be a way to use a "Focus" option, so the keypresses will only work if the target program has focus. But besides the obvious issue of "how do you give focus to Launcher in the first place after exiting another program?", the other problem is that using Focus in the manner shown in the documentation, for example...

begin
 prog = irxevent
 button = KEY_UP
 repeat = 0
 config = Key Up Focus unity-2d-shell
end

...seems to kill the operation of irxevent altogether - it won't respond to button presses at all. Remove the word "Focus" and it works fine again, but interferes with other software.

The only way I can see that might make this work is to have a way to kill irxevent when any software on an "exclusion list" is running, and restart it if none of that software is running. But I don't know how to do that, and I would hope there is a more elegant solution.

share|improve this answer
    
Sorry for the belated acknowledgement, but thanks for your input, jack. I have been trying to get a MythTV Backend server up and running lately, so this one has gone on the back burner. I will try this, along with @Bullwinkle_Moose's suggestion as soon as I get the opportunity. This does seem the right way to go. Thanks. ;) –  Rich.T. Apr 23 '13 at 15:41
add comment

I found this article and worked the problem quite a while, and finally got it working, sort of. You can see what I did in the first two posts in this thread on Ubuntu Forums. I hope someone can develop this a bit further.

share|improve this answer
    
Thanks, Bullwinkle. I have posted a couple of suggestions to your Ubuntu Forum thread, so check them out and see what you think. –  Rich.T. Apr 23 '13 at 13:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.