Jump to content

Mapping to keys not on the physical keyboard


Recommended Posts

I just received my Flirc the other day and am enjoying it so far.

I would like to program my Flirc to emit keystrokes that are not present on my physical keyboard; for example, the function keys F13‒F24, or even “reserved” keys, such as those in the 0xA5‒0xAF range (as documented in the HID spec). My idea is to intercept these keystrokes using something like EventGhost or AutoHotkey and transform them into useful complex actions, without having to worry about the actual keystrokes conflicting with those that might happen to be used in normal applications.

I'm having trouble getting this to work. For example, if I use the Flirc GUI app to map something to F13 (using the “Full Keyboard” controller), it appears to take, but then I don't get an F13 when I press the associated remote button. Neither EventGhost nor AutoHotkey sees any keystroke at all. Microsoft Spy++ doesn't see any messages generated either.

Same thing happens when I use flirc_util to map, say, 0xA5 using the following command line:


flirc_util record_api 0 165

Am I doing something wrong? Or have I run into a limitation or bug in Flirc, the HID driver, or the OS?

I'm using Flirc 1.3.6 with firmware version 3.6 [07F892FC] under Windows 8.1 Update 1 (x64).

In the meantime I've set things up using unlikely keystrokes (such as Ctrl+Alt+Shift+F1), but I'd really prefer to do things the way I described.

Link to comment
Share on other sites

That's very interesting and I may very well end up doing as you suggest. Thanks!

That said, it would still be nice to get an answer to my original question: Why does F13 not work when mapped using the Flirc GUI app? It's from HID usage table 7 (just like any regular keyboard key), and the GUI explicitly exposes it, so I would expect it to work.

Link to comment
Share on other sites

I suspect there's more to it than that. I'm able to remap arbitrary keys on my keyboard to F13 using the following registry key:


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

(Or by using a GUI utility such as SharpKeys that does the registry editing for me.)

When I do so, I'm successfully able to capture F13 keystrokes using EventGhost or AutoHotkey when I press the remapped key on the keyboard. The F13 key on the “Full Keyboard” controller in the Flirc GUI app even lights up when I press the remapped key. However, the Flirc unit itself still fails to emit any F13 keystrokes when I press the remote button associated with F13.

BTW, there are also keyboards available that have an F13 key, such as the Apple Keyboard with Numeric Keypad. I would be surprised if the F13 key on these keyboards didn't work under Windows.

Link to comment
Share on other sites

You are mixing key codes with HID codes. You are able to map arbitrary key to F13 but it happens in much higher layer in the system. What I've said before is that the HID keyboard filter driver (which works at very low level) does not recognize HID code for F13 it receives from Flirc. It may be so because there are no keyboards right now with physical keys F13-F24 so maybe Microsoft decided to just drop their support in the HID keyboard filter driver. Because of that the driver does not emit key code for F13 to the system.


The HID keyboard filter driver converts HID codes received from the keyboard into key codes according to selected keyboard layout. HID codes are not assigned to specific key functions or letters but the key physical position on the keyboard (the tables which can be found on the Internet describing HID standard are just based on the keyboard with US QWERTY layout for convenience). For example when US QWERTY layout is selected then HID code 0x1C is translated into key code 0x59 which is letter Y. But when you select german QWERTZ layout then the same HID code 0x1C will be translated into keycode 0x5A which is letter Z.


So if you are able to edit keyboard layout definitions then there should be possible to just add an entry for HID code 0x68 (F13) to be translated into correct key code for F13 (I think it's 0x7C).


But I still think that if you are going to use EG or AHK anyway then using Flirc as a HID input device instead of keyboard (at least for some buttons - you can mix both modes) is better way because you skip the HID keyboard filter driver entirely.

Link to comment
Share on other sites

Join the conversation

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

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...