Lazarus

Using the Lazarus IDE => General => Topic started by: fuzzy1985 on June 23, 2019, 11:47:01 am

Title: USB keyboard
Post by: fuzzy1985 on June 23, 2019, 11:47:01 am
Hi,

I'm trying to make a program for a local club. The program needs to be used for judging.

Now i have multiple keyboard. How can i know from whick keyboard the key is pressed?

I already saw some documentation on codeprojects for c#, but i do not understand it.

Can someone help me?
Title: Re: USB keyboard
Post by: SymbolicFrank on June 23, 2019, 01:04:44 pm
On which OS? Either way, this is not easy.
Title: Re: USB keyboard
Post by: fuzzy1985 on June 23, 2019, 01:52:15 pm
Windows 10
Title: Re: USB keyboard
Post by: trev on June 24, 2019, 07:52:11 am
Could you elaborate on this unusual setup where Windows 10 has multiple keyboards? Perhaps describe the use case?

I know Windows 10 _can_ have multiple keyboards plugged in, but the keystrokes from all of them end up in the same place, as does the mouse pointer. I'm failing to see how multiple people can use their keyboard/mouse all at the same time...
Title: Re: USB keyboard
Post by: SymbolicFrank on June 24, 2019, 08:43:47 am
Something like this: https://www.dicolab.com/products_teamplayer.html (https://www.dicolab.com/products_teamplayer.html)?

Title: Re: USB keyboard
Post by: PascalDragon on June 24, 2019, 09:02:43 am
I know Windows 10 _can_ have multiple keyboards plugged in, but the keystrokes from all of them end up in the same place, as does the mouse pointer. I'm failing to see how multiple people can use their keyboard/mouse all at the same time...
Well, there certainly are possibilities as the remastered versions of the games Settler I and II (released November '18) support split screen multiplayer with two mice (as they did back on DOS ;) ).
Title: Re: USB keyboard
Post by: SymbolicFrank on June 24, 2019, 09:19:21 am
You need to install a keyboard hook.

See: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v=vs.85) (https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v=vs.85))

But it doesn't say if you have to do that once (and how you determine the keyboard), or if you can select the keyboard.

And if that doesn't work, you have to write an USB HID driver.
Title: Re: USB keyboard
Post by: avra on June 24, 2019, 10:04:00 am
I'm trying to make a program for a local club. The program needs to be used for judging.

Now i have multiple keyboard. How can i know from whick keyboard the key is pressed?
I would prefer hardware way to solve such a problem. Like using some embedded microcontroller (like Arduino) via RS485, Bluetooth, or USB to provide custom buttons for each judge. If sticking with USB, then you can either emulate a HID gamepad/joystick, or give each judge a different set of HID keyboard keys.

Some related links:
https://www.obdev.at/products/vusb/prjhid.html
https://github.com/MHeironimus/ArduinoJoystickLibrary
https://github.com/Amadiro/arcade-joystick
https://github.com/menczel/avrhid
https://www.engineersgarage.com/contribution/atmega-32u4-based-gamepad
https://www.engineersgarage.com/contribution/atmega-32u4-based-generic-usb-keyboard
http://www.fourwalledcubicle.com/LUFA.php
Title: Re: USB keyboard
Post by: engkin on June 25, 2019, 05:27:43 am
I already saw some documentation on codeprojects for c#, but i do not understand it.

Can someone help me?

Perhaps a link to the article would help.
TinyPortal © 2005-2018