Jump to content
Flirc Forums


Popular Content

Showing content with the highest reputation on 11/24/2019 in all areas

  1. 1 point
    This is probably unsupported in any way by Jason so please don't report bugs in other threads when using this solution. If you have any problems with this setup it is better to post them here and I'll try to help if I have time to do so. Hi, This how-to is for users who want to build more advanced control schemes using their Flirc devices. It is mainly directed to Windows users because there is no way in Windows to capture input from a single keyboard, but can be done in Linux. But it should be also applicable in other OS-es when used with correct software. The problem is that not everything can be done just by defining a single key combinations. There are applications like AutoHotKey (AHK) or EventGhost (EG) that can capture specific key combinations but there is a problem. Having many buttons on the mapped remote it is sometimes hard to find key combinations that are not used as OS or other apps shortcuts already. By capturing the specific key combination in AHK or EG user basically blocks this combination even on a normal keyboard connected to the PC (as there is no way in Windows to capture only input from one specific keyboard). Here comes HID standard for the rescue. HID keyboards are just one of the many usages of this standard. Because of that the HID standard has been split into multiple usage tables. Standard keys on keyboards use table 7 and in Windows codes from this table are immediately captured by HID keyboard filter driver and are converted into key presses. On the other hand keys like multimedia keys are defined in usage table 12. Codes from this table are not captured by the Windows. Only a few of them are natively supported (like volume, mute, play, pause etc). Flirc GUI and CLI util provide the ability to map only a few of the keys from table 12. Those keys when mapped are not recognized by AHK or EG when used with keyboard input plugins. This gave me an idea to do some experiments. I needed to find out how these multimedia keys are stored in the Flirc which can be checked by inspecting saved config file. After that I checked if I can assign any HID code from the table 12 and I was successful. I've found out that there is a key code which acts as a marker for Flirc to send usage 12 instead o 7. When this marker is found then the actual HID key ID is stored as a modifier. It is possible to use flirc_util to map almost any code from table 12: flirc_util.exe record_api 176 102 where 176 is decimal value of key ID (Play key in this case) and 102 is a marker that tells Flirc that this is key from table 12. Table 12 has more than 256 keys defined but unfortunately Flirc can only hold a single byte value so there is still a restriction in the number of keys. There are also holes in the list of keys in this table which I've used in my own config so I don't have any conflicts with other hardware and software. These are the usable values: 4-31, 34-47, 55-63, 73-95, 103-127, 159, 165-175. There are probably more but I've stopped looking other codes that are not mentioned by the standard. I think that other keys that are in the standard are also usable. Most of them are not natively supported by the Windows but I used these ranges in my case to be on the safe side. The way to record these keys is to change the first value to one in these ranges and record a button to them incrementally. In my setup I've used EventGhost to capture HID events and map them to things I want them to do. It provides some nice features like programmable on screen menus and many plugins for specific apps like XBMC (it uses XBMC RPC API). To capture events from HID device a Generic HID plugin must be used. Unfortunately there is a small problem with this plugin and it sometimes sends multiple HID events on single button press (this is not the same problem as with repeated keys). I have a modifier Generic HID plugin that works very well with Flirc in this mode of operation. I can share it if there is a demand for it. I can also extend the how-to to some basic EG configuration. I haven't used AHK but I know that there is also a way to capture HID events in it and use them to control things. All the numbers I'm referring to are taken from this document http://www.freebsddiary.org/APC/usb_hid_usages.php
  2. 1 point
    By "modified Generic HID plugin" I mean that I've copied original Generic HID plugin code, changed its internal ID and name (added a suffix to its name) so both plugin versions can coexist in a single EventGhost install and changed the code so it works better with Flirc sending custom HID codes. The EventGhost differentiates between single events (short events) and enduring ones, which can have extended length. The original HID plugin for EG uses only short events so when you hold down the remote button you get a lot of short events. I've modified the code so HID plugin is generating an enduring event for as long as you keep the button pressed, so you only get a single event but it is active as long as you keep holding the button down. That way you can define repeats and long-press actions in the EventGhost without any problems. You can download the plugin here: https://www.dropbox.com/s/j7ajh7rvoa2qpa9/MyHID.zip?dl=0 Go to the folder where you have EventGhost installed. You'll find plugins folder there. Unpack the downloaded zip to the plugins folder (it should create a MyHID folder). You can compare the __init__.py file with the original plugin code in the plugins\HID folder. There are only a few changes so it's easy to check that there is nothing malicious added in the code (even for non-programmers I think). To use the plugin in EG you need to first restart EG for it to see new plugin. Then you add "Generic HID (mod)" plugin to Autostart folder in your EG config. You need to select Flirc from the device list in the plugin config window. There can be more than one device there so you need to do some testing which one works. You can also enter a prefix into Event prefix text input (I've set it to Flirc). I'm also using Remote event mapper plugin where I map Flirc.Button.X (where X is the HID code) events as Remote.YYYY (where YYYY is given button name like Play, Pause etc). That way I don't need to remember under which HID code I have a specific button mapped in Flirc. The rest of the EG config is very specific to my needs. Of course I use XBMC2 plugin to control Kodi using remote API and also I use Task Create/Switch Events plugin to enable/disable actions groups depending on the app in focus (you don't need that if you want to control Kodi out of focus).
  • Create New...