Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter Web Forum > Simpit Forum
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Simpit Forum Share & discuss simpit projects for Orbiter here!

Reply
 
Thread Tools
Old 04-03-2013, 10:08 PM   #1
kamaz
Unicorn hunter
 
kamaz's Avatar
Default Changing keyboard layout & multiple keyboards

Keyboard remapping for fun and profit!

- Are you dissatified with default key bindings in Orbiter?

- Do you want to use a cheap keyboard / keypad in your simpit, but feel too limited by the default layout of controls?

- Would you like to use multiple keyboards?

- Would you like to send multiple key combos with a single key press?

If yes, then this program is for you!

Installation

The program is based on Oblitum Interception library, which performs a low-level keyboard interception using a kernel driver. For more information, see http://oblita.com/Interception.html

1. Download the installer from https://github.com/downloads/oblitum...terception.exe

2. Run the command prompt as administrator: Start Menu > All Programs > Accessories > Command prompt, right click, Run as administrator

3. Navigate to the directory, where you downloaded install-interception.exe and run install-interception.exe /install

4. Reboot the system.

Tutorial

This tutorial assumes that you have 2 keyboards connected to your computer. We will remap the "x" key on the first keyboard to generate "foo" keystrokes, while the "x" key on the second keyboard will generate "bar".

First, start the program. If no parameters are given, it will start in interactive mode. (Use /help switch to learn more about command line parameters).

Code:
D:\intercept\Release>intercept

*** Keyboard Remapper v. 1
*** Based on Oblitum Interception http://oblita.com/Interception.html

Use /help for help on command-line options

Using configuration file D:\intercept\Release\keyremap.ini
The program configuration is kept in an .ini file referenced above. By default, it is keyremap.ini located in the current directory. To use another ini file, use /ini command line switch.

Let's list existing filters -- press "L" at the prompt:

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: l

(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?:
Predictably, there are none, because we are just starting. If you do that at the end of the tutorial, the output will look like that:

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: l

(1) x -> foo keyboard 1
(2) x -> bar keyboard 2

(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?:
Okay, let's remap the "X" key on the first keyboard, so pressing it will be equivalent to pressing F,O,O. Select the "Add" option by pressing "A":

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: a

Defining filter

Press key which will trigger the combo
Press "X" on the first keyboard.

Code:
  Trigger key: [X]↓
     Keyboard: HID\VID_046D&PID_C22D&REV_0165&MI_00
The macro will trigger when pressing (↓) the "X" key on keyboard with Device ID HID\VID_046D&PID_C22D&REV_0165&MI_00.

Now, time to define what the macro does:

Code:
Enter combo for this trigger, end with Esc
(Empty combo will inhibit trigger key)
Press F,O,O followed by Esc:

Code:
[F]↓ [F]↑ [O]↓ [O]↑ [O]↓ [O]↑
Both pressing (↓) and releasing (↑) keys is recorded.

Pressing just Esc (i.e. defining empty combo) will have an effect of disabling the key. This can be useful e.g. to prevent accidentally pressing the Windows key while playing.

Enter macro description...

Code:
Enter filter label: x -> foo keyboard 1
The program now displays new macro definition for you to check:

Code:
  Trigger key: [X]↓
     Keyboard: HID\VID_046D&PID_C22D&REV_0165&MI_00
        Combo: [F]↓ [F]↑ [O]↓ [O]↑ [O]↓ [O]↑
        Label: [x -> foo keyboard 1]

(S)ave filter or (C)ancel?:
Pressing "S" will save the new definition to the INI file.

Now, let us remap the "X" key on the second keyboard. Press "A" to define a new filter...

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: a

Defining filter

Press key which will trigger the combo
Press "X" again, but this time on the second keyboard:

Code:
  Trigger key: [X]↓
     Keyboard: HID\VID_046E&PID_55A5&REV_0120&MI_00
Notice that the device identifier is different than in the first macro!

Enter the B,A,R,Esc combo, does not matter which keyboard you use...

Code:
Enter combo for this trigger, end with Esc
(Empty combo will inhibit trigger key)

[B]↓ [B]↑ [A]↓ [A]↑ [R]↓ [R]↑
Set macro label and save...

Code:
Enter filter label: x -> bar keyboard 2


  Trigger key: [X]↓
     Keyboard: HID\VID_046E&PID_55A5&REV_0120&MI_00
        Combo: [B]↓ [B]↑ [A]↓ [A]↑ [R]↓ [R]↑
        Label: [x -> bar keyboard 2]

(S)ave filter or (C)ancel?: s
Time to activate our setup, press "Y" in the main menu:

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: y


Keyboard filters activated.
Please close this window to restore normal behavior.
To activate filters on startup, add /apply to the command line.


Running filters...
Now, start notepad. Press "x" on the first keyboard. You should see that "foo" gets input instead of "x". Now, press "x" on the second keyboard. This should result in inputting "bar". All other keys should work normally.

Your new key assignments will remain active as long as the program is running.
Attached Thumbnails
intercept.png  
Attached Files
File Type: zip intercept.zip (48.9 KB, 306 views)
kamaz is offline   Reply With Quote
Thanked by:
Old 08-13-2013, 10:21 PM   #2
AHKPPRO
Orbinaut
Default Excellent!

This is absolutely great - very easy to configure and 100% reliable, unlike other methods for remapping multiple keyboards, like HidMacros.

I have a few questions on the format of the .ini file, however. Say I have an entry like this:

Code:
[o] ; = w
device=ACPI\PNP0303
trigger=18,0,0
combo=11,0,0|11,0,1
This remaps o to w. I have realized that 0 or 1 following the second comma means key down or up, respectively, but here are my questions:

1. How can I remap or send extended keys like the left Windows key? I've tried setting the 0 after the first comma to 1, but that doesn't seem to work as an identifier for extended keys. See here for what I would like to send:
Code:
ext Scan    VK
E0 5B(91)  5B(91)             LeftWin
2. Is there any way to use Virtual Keycodes instead of scancodes?

Many thanks!
AHKPPRO is offline   Reply With Quote
Old 08-15-2013, 06:54 PM   #3
kamaz
Unicorn hunter
 
kamaz's Avatar
Default

I have a user!

You of course CAN remap extended key. I'm not sure why you want to edit the INI yourself, if you can set mappings from within the program. Just press the key you want to remap. The session below is how I have remapped the left windows key to the sequence a,l,a:

Code:
(L)ist filters, (S)how/(A)dd/(R)emove filter, appl(Y) filters or (Q)uit?: a

Defining filter

Press key which will trigger the combo

  Trigger key: [Left Windows]↓
     Keyboard: HID\VID_046E&PID_55A5&REV_0120&MI_00

Enter combo for this trigger, end with Esc
(Empty combo will inhibit trigger key)

[A]↓ [A]↑ [L]↓ [L]↑ [A]↓ [A]↑

Enter filter label: ala


  Trigger key: [Left Windows]↓
     Keyboard: HID\VID_046E&PID_55A5&REV_0120&MI_00
        Combo: [A]↓ [A]↑ [L]↓ [L]↑ [A]↓ [A]↑
        Label: [ala]

(S)ave filter or (C)ancel?: s
This has produced the following in the INI file:

Code:
[ala]
device=HID\VID_046E&PID_55A5&REV_0120&MI_00
trigger=5b,0,2
combo=1e,0,0|1e,0,1|26,0,0|26,0,1|1e,0,0|1e,0,1
I have then selected apply filters, and it worked

Frankly, I am not 100% sure what the codes actually mean -- I simply dump the data structure that the interception driver returns

One key the program does not allow you to use in remapping is Esc, because it's used to terminate the keystroke sequence. But if you put 01 code in the ini file, then remapping to/from Esc will probably work

Last edited by kamaz; 08-15-2013 at 07:01 PM.
kamaz is offline   Reply With Quote
Old 08-15-2013, 09:04 PM   #4
blixel
Donator
 
blixel's Avatar
Default

I was just shopping around online for a USB numeric keypad so I could have a small device that would give me an extra set of keys for Orbiter. (So I can map the commonly used ALT and CTRL key combos to one key stroke.) So it sounds like this is what I'll need to make that work.
blixel is offline   Reply With Quote
Old 09-11-2013, 10:42 AM   #5
Ripley
Tutorial translator
 
Ripley's Avatar
Default

Sounds cool!
Are we talking about USB keyboards/keypads only, or with every kind of connection?

What about keypresses with modifiers, like "CTRL+T"?
Should I just record the macro as in "CTRL(↓) T(↓) T(↑) CTRL(↑)"?

Last edited by Ripley; 09-11-2013 at 12:07 PM.
Ripley is offline   Reply With Quote
Old 09-12-2013, 12:05 AM   #6
kamaz
Unicorn hunter
 
kamaz's Avatar
Default

Quote:
Originally Posted by Ripley View Post
 Sounds cool!
Are we talking about USB keyboards/keypads only, or with every kind of connection?
I've tested only with USB keyboards. Theoretically though, it should work with anything.

Quote:
Originally Posted by Ripley View Post
 What about keypresses with modifiers, like "CTRL+T"?
Should I just record the macro as in "CTRL(↓) T(↓) T(↑) CTRL(↑)"?
Yes!
kamaz is offline   Reply With Quote
Thanked by:
Old 10-01-2013, 05:14 PM   #7
gefliptemens
Orbinaut
Default Wow!

This is absolutely great, the first tool I've come across to do the job reliable!

Thank you so much, you've done an amazing job on this!

Now all I have to do is learn some C to modify it to my needs : P
gefliptemens is offline   Reply With Quote
Old 12-03-2015, 07:19 PM   #8
geoffff
Orbinaut
Default

Quote:
Originally Posted by kamaz View Post
I found that the Interception installer link you provided here is old, and does not work with Windows 8.1. The latest installer on github does work, and can be found here (download the "Interception.zip" link):
https://github.com/oblitum/Intercept...ases/tag/1.0.0
Anyway, thank you so much for posting this! This tool does a much better job than HID macros for keeping track of USB keyboards that are unplugged and then reattached.

-- Geoff
geoffff is offline   Reply With Quote
Old 05-14-2016, 09:44 PM   #9
Grey
Orbinaut
Default Thank you

I know its an old thread, but even in 2016 this is a relevant thread.
For over 10 years I have been off and on trying to get a usb numpad to work separate from the numpad on the keyboard.
I thank you for the thread, thank you for the original author, thank you to the site for this thread, as without this thread I would still be waiting.
Grey is offline   Reply With Quote
Old 12-12-2016, 01:51 AM   #10
tripleg58
Orbinaut
Default

This does not work if keyboards have same HID!!!!!!!!!!!!!!!!!!!!!!!

Please fix!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tripleg58 is offline   Reply With Quote
Old 05-28-2017, 03:08 AM   #11
facelesssoul
Orbinaut
Thumbs up

I just wanted to thank the OP for the program. I bought a 7 button mouse, only to discover that the 'extra' buttons are actually mapped as keyboard multimedia keys!

After a little search around the web, this forum post was the only thing that was relevant so now I can map the multimedia mouse keys to keyboard keys as well as use an old keyboard as a 'pedal' AND I was introduced to this simulator

Thanks again to the OP and I hope that this post is not counted as a necro as it will help many others with the same situation.
facelesssoul is offline   Reply With Quote
Old 10-18-2017, 07:19 AM   #12
AlbertNew
Orbinaut
Default

Quote:
Originally Posted by tripleg58 View Post
 This does not work if keyboards have same HID!!!!!!!!!!!!!!!!!!!!!!!

Please fix!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Aah, you're right. Is there a fix guys?
AlbertNew is offline   Reply With Quote
Old 10-23-2017, 09:45 AM   #13
Ripley
Tutorial translator
 
Ripley's Avatar
Default

Sorry for necro, but I just saw there is a new 1.0.1 version of these very nice libraries!
https://github.com/oblitum/Intercept...ses/tag/v1.0.1
Ripley is offline   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter Web Forum > Simpit Forum


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 08:19 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.