[keyboard] - differentiate between different keyboards

Questions and comments specific to a particular plugin should go here.
Post Reply
dequi
Experienced User
Posts: 79
Joined: Wed Jul 20, 2016 12:31 pm
Location: Belgium

[keyboard] - differentiate between different keyboards

Post by dequi » Sun Sep 17, 2017 1:22 pm

Is there an existing way to differentiate between key-presses by origin? like I have 2 (or more) keyboards connected to a pc and want only the key-press from keyboard B launch a macro same key-press on keyboard A should be ignored.
something like http://www.hidmacros.eu/
does the missing keyboard+ plugin do that?
/dequi

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Sun Sep 17, 2017 2:42 pm

no it does not. in order to be able to tell where the keystrokes are coming from you need to have a kernel mode driver to do this.
If you like the work I have been doing then feel free to Image

dequi
Experienced User
Posts: 79
Joined: Wed Jul 20, 2016 12:31 pm
Location: Belgium

Re: [keyboard] - differentiate between different keyboards

Post by dequi » Sun Sep 17, 2017 3:00 pm

Bummer, but thanks, I'll see how I can rig this up in an other way then.

Don't want to buy a programmable keyboard like http://xkeys.com/XkeysKeyboards/index.php (those are expensive) when I have multiple laying around. maybe http://www.instructables.com/id/Making- ... -less-tha/ can help. who knows.
/dequi

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Sun Sep 17, 2017 3:08 pm

you always have the multitap plugin.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Sun Sep 17, 2017 3:28 pm

I found something that is already made up to do exactly what you want. I am going to attach a zip. run it and see if it is able to tell what keyboard sent the keystrokes. if it works then I might be able to convert the dll's to pyd's and get them to work inside of python.
Attachments
Keyboard Hooking.zip
(24.8 KiB) Downloaded 24 times
If you like the work I have been doing then feel free to Image

dequi
Experienced User
Posts: 79
Joined: Wed Jul 20, 2016 12:31 pm
Location: Belgium

Re: [keyboard] - differentiate between different keyboards

Post by dequi » Mon Sep 18, 2017 2:37 pm

kgschlosser wrote:run it and see if it is able to tell what keyboard sent the keystrokes.

Yes this works fine on a Windows 7 Pro, 64 bit machine.

Although it needed a restart when adding a new keyboard when it was running, and the source of the one already attached was changed. name stayed the same so that is good.
/dequi

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Mon Sep 18, 2017 8:27 pm

ok so it will work. now the hard part is i have to convert the code to c++ and add it to cFunctions
If you like the work I have been doing then feel free to Image

dequi
Experienced User
Posts: 79
Joined: Wed Jul 20, 2016 12:31 pm
Location: Belgium

Re: [keyboard] - differentiate between different keyboards

Post by dequi » Tue Sep 19, 2017 6:48 pm

While looking where you got the demo from, reading some of the needed windows api calls and investigating on my own I found a plugin called RawInput in the repository https://github.com/EventGhost/EventGhos ... s/RawInput but it has a noinclude. I think could be the basis or even completely what I'm looking for.
going to test further.
/dequi

dequi
Experienced User
Posts: 79
Joined: Wed Jul 20, 2016 12:31 pm
Location: Belgium

Re: [keyboard] - differentiate between different keyboards

Post by dequi » Tue Sep 19, 2017 7:06 pm

Well the RawInput plugin detects the 2 keyboards (don't know what the first one is though) and links KEYDOWN, KEYUP to the correct keyboards.
Apparently not a finished product, but a startpoint. maybe I'll find some time this weekend :roll:
Attachments
2017-09-19 20_55_57-Clipboard.png
/dequi

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Tue Sep 19, 2017 7:11 pm

well hey if there is a start point to a model that is working then completing a full plugin should not be an issue. I can leverage WMI to grab device captions (device name) we are going to have to make sure it can handle key combinations properly.
If you like the work I have been doing then feel free to Image

User avatar
topix
Experienced User
Posts: 381
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: [keyboard] - differentiate between different keyboards

Post by topix » Mon Sep 25, 2017 10:51 am

Just a thought: would the generic HID plugin work?

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: [keyboard] - differentiate between different keyboards

Post by kgschlosser » Mon Sep 25, 2017 3:24 pm

the issue with the whole keyboard hooking and raw input is the capturing of the keystrokes. if you use the one that can capture the keystrokes you do not get notifications of what keyboard it is taking place on. and the current setup of eg is if the keystrokes is used in a macro then it doesn't get passed on to the program it was intended for.
If you like the work I have been doing then feel free to Image

Post Reply