Jump to content
Flirc Forums

evilestegg

Members
  • Posts

    5
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by evilestegg

  1. 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
  2. Hi evilestegg, welcome to the forums

     

    Just to check, how are you deleting the button?

    In the GUI you delete the button by pressing delete in the GUI then the button on the remote control. This then deletes the pairing off the Flirc.

     

    Is this what you are doing?

    Yes, that's what I've been doing.  Pairing and deleting in the GUI is not a problem for me up to a certain point. 

     

    Oddly, most buttons delete correctly in GUI mode and in the command line up to a certain point (maybe after I've programmed ~30 keys or so). After that, deleting several other buttons fail, even though it displays a successful deletion attempt ("Erased Button" on the GUI, "Button Deleted Successfully" in the command line). The only way to delete these entries is to wipe everything out. I can still add entries, but I can't delete them.  I'm running Flirc Version 1.0.5 [fw_v255.9-18-geb49aca]  Firmware Version: 256 04-01-2013, so I think I'm up to date with firmware and software. I'm going to do more tests to see if there are any issues (try another PC or something), but please let me know if you have any ideas.

  3. More information about this error: in both command line mode and in GUI mode, I can attempt to delete the key, and both mention that the deletion is successful. However, using "flirc_util keys" shows that the key is not deleted, and still remains. I tried multiple attempts to delete it in Gui mode, and it keeps saying "Erased Button". Trying to program a keystroke to replace it does not work, and gives the message "Button already exists." Certain other buttons can be programmed and deleted as normal, but not others. Any ideas?

  4. I'm also having a similar issue with version 1 firmware running on flirc 0.96. I can't delete the button from the gui, although I can remap it when I clear the configuration. Reloading the old configuration and trying to erase the button does not work, although i can set empty buttons correctly. This occurs whether I use a normal keystroke or a weird modifier keystroke (control-alt-shift-F). Any ideas on how to fix it? The reason I don't want to start from scratch is because I'm using flirc in combination with eventghost to control XBMC, and I've gotten deep into messing around with eventghost to get my perfect setup. Attached is my config file. Also, seconding the xml idea, an easy way to edit keystrokes would be really handy. 

    vizio fix.fcfg

×
×
  • Create New...