[mythtv-users] mouse support

Jim Beckett beckett.jim at gmail.com
Sat Jan 23 21:15:29 UTC 2010


Ben Newman wrote:
> I just got a new remote with a built in mouse for my myth box.  The
> way the thing is set up it would be really great if I could map mouse
> movement to the arrow keys and a left mouse button push to enter and a
> right mouse button push to escape when the mythtv frontend is up.  Any
> way to do this?  I know I can display the mouse cursor through the set
> up menu but that's not what I'm looking for.
>   
If I understand correctly, you want lirc to catch the IR codes for 
(mouse) up, down, left, right, left button click, right button click, 
and pass them to mythtv as Up, Down, Left, Right, Esc, and Return 
keyboard button pushes (or whatever custom keyboard bindings that you 
have defined).

I just did something similar last month for using an old vcr/dvd remote 
I had laying around with my usb-uirt.

This should get you close, I am going mostly from memory, and didn't 
take the time to actually run through it, nor do I have a remote that 
has a built-in mouse handy to test with. Hopefully, if there are holes 
in this, someone with more knowledge will respond...

1. You need to know the keyboard bindings that are set in mythtv, so 
that you know what keys to map in lirc. (http://www.lirc.org)

2. If it is not already done, your remote (Name and raw Button Codes) 
must be defined in lircd.conf.

If you are lucky, someone has already created the lircd.conf file, which 
stores information about your remote. Look here: 
http://lirc.sourceforge.net/remotes/

Otherwise, you will need to use the irrecord utility to generate 
lirc.conf information yourself.

Once you have finished the recording, moved the remote information to 
/etc/lirc/lircd.conf (or wherever it goes in your distro), and restarted 
the lirc daemon, you can test it by running the irw utility in a 
terminal. This will show you the raw code, the namespace it is 
translated to, and the remote name that sent it, when you use the mouse 
on the remote.

3. Once you know the namespace name that is detected when each mouse 
action is triggered, you can specify what command to pass mythtv in the 
~/.lirc/mythtv file*.
(* There are several possible locations for this info.  On my mythbuntu 
FE/BE box it is in the ~/.lirc/mythtv file, on my debian frontend, the 
information is in the ~/.lircrc file.)

LIRC Namespace mappings (my assumptions):

- MOUSE_UP would be the mouse move up button
- MOUSE_DOWN would be the mouse move down button
- MOUSE_RIGHT would be the mouse move right button
- MOUSE_LEFT would be the mouse move left button
- BTN_LEFT would be the left mouse button
- BTN_RIGHT would be the right mouse button

(MOUSE_UP might be something different, like KEY_UP, or KEY_U, it is 
whatever corresponds to the namespace value in lircd.conf for the 
particular button you are mapping... the same goes for the rest of these.)

Add this to the end of your active .lircrc (or .lirc/mythtv) file - 
modified as appropriate, then restart the system, or at least restart 
lirc, I think it should work for you:

#  Remote Control Mouse functions
#  Replace CUSTOM_REMOTE with the actual name of your remote as defined 
in lirc.conf
#  Replace the button namespaces with the actual namespace that 
corresponds to the code received when each different button is pressed

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = MOUSE_UP
    repeat = 0
    config = Up
end

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = MOUSE_DOWN
    repeat = 0
    config = Down
end

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = MOUSE_LEFT
    repeat = 0
    config = Left
end

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = MOUSE_RIGHT
    repeat = 0
    config = Right
end

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = BTN_LEFT
    repeat = 0
    config = Esc
end

begin
    prog = mythtv
    remote = CUSTOM_REMOTE
    button = BTN_RIGHT
    repeat = 0
    config = Return
end


More information about the mythtv-users mailing list