Add "FN Button" to simulated keys list

x64 Replacement/Alternative to Microsoft's IntelliMouse application.
Forum rules
Please read the forum rules before posting for the first time.
The more information you can provide, the quicker and more accurately someone can help.
NOTE: To reduce spam, new users can not post links, files or images until they have at least 4 posts.
Post Reply
konfuzius
New User
Posts: 5
Joined: Wed Aug 28, 2013 1:44 am

Add "FN Button" to simulated keys list

Post by konfuzius »

http://upload.wikimedia.org/wikipedia/c ... fn_key.png

FN + F1 = touchpad buttons off
FN + F2 = LCD off
FN + F5/F6 = Volume +/-
FN + F8/F9 = Brightness +/-
FN + F11 = WiFi
FN + F12 = BT
FN + Ins = Scrolllock
FN + Del = Numlock
...
F0, FN, Fn, Apps are not FN, unfortunately o_O
User avatar
phil
Site Admin
Posts: 7601
Joined: Sun Apr 06, 2003 11:12 pm

Re: Add "FN Button" to simulated keys list

Post by phil »

I wish it was that easy - because my laptop has a similar key. However, as far as I am aware (and I could be wrong) that key does not send the usual scancode. You can already use ANY scancode/virtual key code in sim keys, but if the key does not generate such a code, then the windows API will not recognise it.

I will have to do some more investigation on this one so I will add it to the to-do list, but in the meantime if you can find a scancode/virtual keycode (maybe someone at AutoHotkey may know) then you can already send it in simulated keystrokes.

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
konfuzius
New User
Posts: 5
Joined: Wed Aug 28, 2013 1:44 am

Re: Add "FN Button" to simulated keys list

Post by konfuzius »

What I found
Fn is not a normal keyboard key, such as the modifiers Ctrl, Shift and AltGr. For a standard modifier key, the microcontroller inside the keyboard sends a scancode for the modifier itself, which is then interpreted by the operating system and combined with other simultaneous key-presses. The Fn key is a form of meta-modifier key, in that it causes the operating system to see altered scancodes when other keys on the keyboard are pressed. This allows the keyboard to directly emulate a full-sized keyboard, so the operating system can use standard keymaps designed for a full-sized keyboard. However, because the operating system has no notion of the Fn key, the key can not normally be remapped in software, unlike all other standard keyboard keys.
Ahhh-ha.

But.

http://www.daonlyfreez.net/tutorials/3p/Veil/fnkey.htm
https://code.google.com/p/uawks/downloads/list fnmapper.ahk inside
User avatar
phil
Site Admin
Posts: 7601
Joined: Sun Apr 06, 2003 11:12 pm

Re: Add "FN Button" to simulated keys list

Post by phil »

Right, and from the first link you posted....

The Fn key works a bit different. When you press and hold the Fn key, it'll change the scan codes of (some of) the other keys on the keyboard.

So its not as simple as all that, and the sendinput API clearly wont allow just to send a FN key. Which pretty much means without a significant change to XMBC, its not going to be easy to add this support.

Maybe its just a case of setting another bit in the simkey sequences, but turing it on and off - well maybe it can be done, and I will look, but its going to be a change, and not currently possible in XMBC.

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
User avatar
phil
Site Admin
Posts: 7601
Joined: Sun Apr 06, 2003 11:12 pm

Re: Add "FN Button" to simulated keys list

Post by phil »

OK I've been doing some more research. It seems that the SendInput API can not send the Fn key (as I suspected). The Fn key is a hard wired key that modifies the scan codes of other keys on the keyboard. So your best bet is to work out what scancodes are sent when the Fn key + other key is pressed.

However, on my laptop, the keys pressed with Fn held down do not even come through (are not recognised by windows). This may be because the key is hooked at a lower level by the software supplied with the laptop and remapped in there.

Sorry about that, but there is very little information to go by that I can find with google. The links you sent all seem to be related to remapping keys sent with Fn pressed rather that actually sending a Fn+key combo?.

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
Post Reply