Jump to content
Flirc Forums

How to use EventGhost and Flirc for maximum XMBC awesomeness.


evilestegg

Recommended Posts

How to use EventGhost and Flirc for maximum XMBC awesomeness.

 

OK folks, I’ve been really waiting for a way to interface FLIRC with XBMC. Unfortunately, the buttons that the FLIRC program provides for XBMC are pretty limited; most universal remotes come with a bajillion buttons that aren’t used under normal conditions for XBMC. Additionally, some buttons don’t really have counterparts in FLIRC or the keyboard, such as YELLOW, BLUE, RED and GREEN. Finally, the practice of editing keymaps.xml or whatever XBMC uses is painful. Because of this, I wanted to interface EventGhost’s XBMC2 plugin as well as FLIRC to maximize the capacity of my remote.

 

Requirements:

FLIRC – Duh.

XBMC – Double Duh.

EventGhost  - WINDOWS ONLY, I don’t know any comparable linux or mac software, and don’t ask me about it.

A remote control - I am using Vizio Remote Control XRV1TV 3D ($20 on amazon), which comes with the normal remote keys and a qwerty keyboard on the back. This remote is pretty kickass since it has QWERTY if you need it, and is purely IR-based, so FLIRC can program all the buttons for it.  However, programming the QWERTY remote makes it more difficult than a regular universal remote. If someone could just create a sexy universal IR remote with QWERTY keys underneath it, it would make me so happy.  Unfortunately, no such remote exists, and these VIZIO remotes are probably the best I’ve seen for this purpose. Someone needs to make a kickstarter for these.

 

remotesmall.jpg

 

Technical Background:

FLIRC processes signals from your remote control and turns them into keypresses on a virtual keyboard. Eventghost can intercept those keypresses using the Keyboard Plugin, and with the correct addons, can re-translate those button-presses into any arbitrary action you want. In this case, I’ll use it to program specific XBMC-related keys, but this could be extended to many other things, as long as you figure out how to do it in eventghost.  

 

Step by Step Instructions.

 

I presume that you know how to navigate XBMC, FLIRC, and hopefully Eventghost. If not, ask someone more technically inclined to help you. 

 

1. Verify that your remote control does not interfere with your TV!

 

This step is very important; I found out after the fact that certain buttons on my Vizio remote work on my Element TV. Power, Info, Menu, Volume, Channel and some QWERTY keys all had effects on my TV. Since the remote isn’t programmable, there’s no way to avoid it.  I used a marker to erase the labels on the buttons that had weird effects on my TV so I wouldn’t press them. If you are using a universal remote, try to select a code which has no overlap with your TV or other electronics.

 

2. Install FLIRC and verify it works with your remote.

3. Install XBMC and verify it works. Maybe setup your library and some videos for or something you can browse through or troubleshoot.

4. Program your basic remote keys on FLIRC.

pic2iu.jpg

Programming your keys depends on whether you have an ordinary remote, or one with QWERTY keys. An ordinary remote is simple; just use FLIRC’s GUI to program all the keys that you can see direct equivalents for. For example, use the XBMC keyboard layout to program the keys in your remote. Don’t worry at this point if you have a lot of extra keys on your remote that don’t correspond to any keyboard keys. We’ll deal with them later. For the time being, try to map the buttons with the corresponding keys on the XBMC keyboard. (http://wiki.xbmc.org/index.php?title=Keyboard)

 

 

For a QWERTY remote, the best way to do it is to program the QWERTY keys first, then program the non-qwerty keys (play, pause, ff etc) last. This way, you later have a way of determining which remote buttons collide (are mapped to the same key). 

 

Note that switching controllers on the FLIRC menu doesn’t change buttons you programmed on another controller. This means that you can use the extra set of buttons on the Windows Media Player controller and program it to your remote, then switch over to Full keyboard and program another set of keys without losing the WMP-labelled buttons. This allows you to map some extra keys easily.

 

SAVE YOUR WORK AT THIS TIME.

 

5. Map out remaining keys with modifier keystrokes.

 

Your remote should be pretty well-stocked to do the basics at this point. However, some buttons (color keys, special manufacturer keys etc) have no direct keyboard equivalents. Additionally, I might want to not use a particular button that is keyed to a QWERTY button. To bypass this limitation, let’s program our own keys for these buttons.

 

 I want to map out the Yellow button on my remote. To avoid collisions/overlap with other buttons, I’m going to use modifier keystrokes (control, shift, alt, windows keys etc). In this case, setting FLIRC to recognize Control-Alt-Shift-Y should be unique enough as a keystroke. Open FLIRC and go to full keyboard mode, and press the Control-Alt-Shift-Y keys on the on-screen keyboard. I then associate it with the Yellow Button on my remote. This set of keystrokes is unique enough that it is unlikely that any other program requires this keystroke.  You can do this for any button, as long as it hasn’t been programmed or something. Feel free to play with any other key combination; I suggest using  Control-Alt-Shift or Control-Alt-Win and go down the QWERTY keyboard to simplify mapping your buttons. SAVE YOUR WORK UNDER A DIFFERENT FILENAME SO YOU HAVE A BACKUP.

 

pic3ty.jpg

 

6. Install Eventghost and make a new configuration.

Eventghost will give you some default configuration, which is actually pretty helpful if you want to tinker around and learn some things. But in our case, we’ll start from scratch and just click New Configuration.

 

pic4go.jpg

 

7. Install the appropriate plugins.

 

Now the only ones that we really need are Keyboard, the XBMC2 and the Task Create/Switch Events plugins. Feel free to replace the XBMC plugin with whatever one you are using (like WMP/VLC). We add Task Switcher for a later step to ensure that all buttons we map specifically to XBMC will only work when XBMC is run.

 

pic5us.jpg

 

At this point, you should see something similar to this. For now, right-click the XBMC2 folder, and press “Disable Item” so that we can program buttons easily. Remember to enable it later on.

 

pic6kh.jpg

 

8. At this point, press a button on your remote, and you should see something (an event) pop up on Eventghost’s left pane. For example, I mapped the Yellow remote button as the Control-Alt-Shift-U key, and if I press it, I see the command Keyboard.LShift+LCtrl+LAlt+U. Several lines pop up for this key combination, but just use the full command. (Ignore the LAlt and L+Alt+Printscreen stuff, this is just an artifact of taking screencaps). Whenever you press anything on your keyboard (real keyboard or FLIRC remote), this will pop up and be accessible as a command.

 

9. Earlier I mentioned I wanted to map the Yellow button on the remote to the “Movies” screen of XBMC. To do this, open the XBMC2 folder in Eventghost and go to Windows > Show Movies Screen. Press the Yellow button (or whatever button you want to map) to underneath the XBMC2.Show Movies Screen action. This associates pressing Yellow on the remote with XBMC’s Show Movies command. Repeat this for the other buttons you want. Once you are satisfied, right click the XBMC2 folder and enable it. Run XBMC and test the remote if you like (it helps if you run it in windowed mode (the key is “\”). Experiment with the button assignments until you are happy with it. Note that there are bajillion options you can try, which can be confusing, but with luck you can do it. Take a look at the XBMC keyboard map (http://wiki.xbmc.org/index.php?title=Keyboard) for whatever keys are being used by XBMC natively and try to work with or around them.

 

pic7h.jpg

 

Repeat as necessary for any other special keys you would like. In this way, I was able to program my remote for all the buttons I want. This step is insanely powerful; I can associate any unique keystroke I want with an XBMC action, without it overlapping with the QWERTY keyboard. I can even arbitrarily associate keystrokes with windows functions (restart/reboot/suspend etc)! Just take note which keystrokes you have used for which buttons.

 

Note: The Buttons>Remote section and the Actions>General sections have identical macros for some commands such as direction keys. If there are identical macros, map only one, otherwise you might get multiple keypresses from one button press.

 

Warning: It is not a good idea to associate common keystrokes with eventghost commands, especially with QWERTY remotes. You may get collisions and key interceptions which are hard to diagnose (See last section of this document for details).  I suggest leaving most keys unprogrammed, and only map the special 4-button combination keystrokes for those keys you want to remap.

 

10. Configure the Enable Exclusive commands.

 

Create a new folder (I name it Context) and move the XBMC2 folder inside it. This is a needed step in order for us to use the Enable Exclusive commands. After that, create a new macro (the orange gear thingie) and select “Enable Exclusive folder/macro”, and in the next dialog box, select the XBMC2 folder inside the Context folder. This should give you a macro that says “Enable Exclusive:XBMC2.” Create another macro in the root directory and select “Disable”, and in the next dialog box, select the same XBMC2 folder as before. 

 

 Start up XBMC, and alt-tab or go to windowed mode, and look at Eventghost’s log. It should have an action “Task.Activated.XBMC” which you should drag to the “Enable Exclusive:XBMC2” macro. Similarly, there should be a “Task.Deactivated.XBMC” which you should drag to the “Disable XBMC” macro.

pic8hx.jpg

What was the point of this whole thing? If set up correctly, this tells Eventghost to only activate the XBMC remote commands when XBMC is the active window. Once XBMC is minimized/alt-tabbed/closed, the Disable XBMC macro disables the XBMC commands to prevent other apps from recognizing the keyboard commands. Although we used combination keystrokes to map certain buttons, there is still a small chance that a keystroke will be recognized by another program, and using Enable Exclusive will prevent some of that problems. Anything in the same folder at the same level as XBMC2 will be disabled by the Enable Exclusive when it is triggered, so you could put remote commands for another application there.  Finally, if you want to map other buttons to work outside XBMC (such as power or others), simply put it outside the Context folder, and it will not be subjected to the Enable-Exclusive command.

 

11. Sit back and enjoy! (Or swear profusely and bugger with the configuration more.)

 

Notes and Warning:

 

1. Since FLIRC acts as a virtual keyboard, and since Eventghost can’t distinguish between multiple keyboards, ALL YOUR COMMANDS ARE SENT AS IF YOU TYPED IT ON ANY OF YOUR KEYBOARDS. There isn’t any way (as far as I know) to respond to commands coming from Keyboard#1 separately from commands coming from Keyboard#2. In other words, Eventghost treats all keyboard commands as coming from the same source, and can’t distinguish keystrokes from different keyboards. To sidestep this, the Eventghost forums suggest using something called the HID plugin instead of the keyboard plugin, but it doesn’t seem to work for FLIRC, and I know nothing about it.

 

2. When using the keyboard plugin, note that Eventghost will intercept the keystrokes if they are assigned to a particular action. As stated in the Keyboard Plugin Description:

 

“Notice: If such a keyboard event is assigned to a macro, the plugin will block the key, so Windows or another application will not see it anymore. This is needed to permit remapping of keys as otherwise the old key would reach the target in conjunction of another action you might want to do and this is mostly not what you intend.  But this blocking only happens, if a macro would actually execute in succession of the event. So if the macro or any of its parents is disabled, the keypress will pass through.”

 

In other words, if you’ve mapped a buttonpress, eventghost will intercept it, unless that button-press is disabled. If you forget this, you might wonder why you start missing letters or have strange program behavior when you are typing while eventghost is on. Since many keypresses are pretty much universal and standard (up, down, left right, enter etc) don’t program them, and remember to use the “Enable Exclusive” macro. Only reprogram the keys if necessary. This is a necessary consequence of Note#1, since we can’t do it in a keyboard specific way.

 

3. The main reason why QWERTY remote programming is more difficult than regular remote programming is you could have collisions between keystrokes (eg. the space button in the QWERTY keyboard works as the pause button in XBMC, but you might want them to be totally separate for your remote). You have to take note which keys correspond to which. Coupled with Note #2, this is why my suggestion is “Only reprogram the keys if necessary.

 

4. I still don’t know how to associate XBMC addons to eventghost applications. For example, I want to figure out if I can map the Pandora or XBMCflix app to a button, but so far I don’t know. Online guides mention JSON or some other thing in Eventghost, but I can’t get any namespaces to appear in the JSON options in eventghost.

 

5. Eventghost has some features which can get around some limitations of FLIRC (Long keypresses, context-dependent button presses, button timing features), but its requires reading and diving into Eventghost. Using these options, I was able to get my HTPC and TV to turn on/off simultaneously  with one button. However, the wakeup button requires setting the command-line interface (see elsewhere in the flirc forums on how to do that), and does not actually map a physical button keyboard, but some sort of device-based means to go from suspend mode to normal mode.

 

6. FLIRC still has some bugs which make the process a little tricky. For example, I had a FLIRC-related bug which prevented me from deleting and remapping several keys. Also, using the command line interface “keys” flag does not show keys with modifiers (see step 5), so try to remember the keystrokes you use for them.  All and all, it can be done with some hard work and enough ADHD.  

  • Like 2
Link to comment
Share on other sites

One thing to note (and I just though of when you said that Yellow, Blue, Red, and Green have no keyboard counterpart), I have noticed that they do weird things in Plex when I press the colors and I just realized that it is probably because they're mapped to the letters they show on the controller side, A B X Y.

 

Dunno if you mentioned it in your guide here as I don't have Eventghost and pretty much just skipped to commenting.  :P 

 

Nice work though, I'm actually interested in Eventghost now. Thanks.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

if i'm using windows, is it really possible to turn on/off my computer using the op's tv remote from dead-state using flirc/event ghost?

I think the OP has used on/off but really means awake/sleep.

 

Depending on computer specs you can wake up a computer using flirc

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...

evilestegg,

 

Another way to handle this is by using XBMC's built-in 'keyboard.xml' file.  This thread actually introduced me to the Vizio XRV1TV Remote Control.  I liked it so much that I told my brother about it and he picked it up for me for Christmas.

 

So, I initially setup EventGhost to control this remote similar to the way you mention in this thread.  It has worked great for about a month but I don't really want to use EventGhost as it's just another piece of software running.  There is also the bit about it being ONLY for Windows.  As I'll be building some form of permanent XBMC machine this summer (OpenElec, Android, or Arch Linux + XBMC) I would really like to keep the same setup with the remote.

 

Digging through some more of the forums this weekend and finally trying an almost perfect Flirc firmware version 1.2.0 (still can't seem to ERASE a key), I reprogrammed my Vizio remote and finally have all of the keys functioning.  Just a note here: I save about twenty times when setting up my remote so I can go back to a previous save if needed.

 

So XBMC has a 'keyboard.xml' file that you can customize for any setup.  I delved into the specifics of this file and have created an incredible setup for myself that I'm going to share with you guys.  As this is my first entry, I hope I can attach an image and a copy of my 'keyboard.xml' file along with my Flirc config file.

 

Inside of the 'keyboard.xml' file is a listing of the webpages and all of the information required to create your own custom configurations.  The image shows what the buttons are mapped to and what functions those buttons have within XBMC itself.  If the buttons are not labeled specifically to do some other function, they function as the buttons image implies.  Every button on this remote works using my Flirc config file.

 

Sorry!  I don't have this image posted on a webserver somewhere in order to make it visible.  You'll have to actually click on it.

 

Let me know what you guys think of this setup.

keyboard.xml

flirc_xbmc-vizio_xrv1tv.fcfg

post-13149-0-32213800-1390798376_thumb.j

  • Like 1
Link to comment
Share on other sites

  • 6 months later...
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...