Testing multiple keyboards with SDL on Linux

OK, so my old keyboard broke up so I had to resort to a spare one.
Works but the keys are kind of hard to press so I wasn’t all that fond
of it. Now my mum bought a new one but got the wrong port so now I
have an USB keyboard while the PS/2 port is still available. Which
means I can have two keyboards together at the same time.

If I recall correctly one of the things that were suggested to be
added in the future to SDL is support for multiple keyboards. If
somebody ever gets around doing that, I could test that on this
system. Using Ubuntu 12.04 at the moment, chances of me moving away
from Linux are pretty much nil at this point.

Just saying :slight_smile: Unless Linux doesn’t like having both PS/2 and USB
keyboards at the same time, that is…

OK, so my old keyboard broke up so I had to resort to a spare one.
Works but the keys are kind of hard to press so I wasn’t all that fond
of it. Now my mum bought a new one but got the wrong port so now I
have an USB keyboard while the PS/2 port is still available. Which
means I can have two keyboards together at the same time.

If I recall correctly one of the things that were suggested to be
added in the future to SDL is support for multiple keyboards. If
somebody ever gets around doing that, I could test that on this
system. Using Ubuntu 12.04 at the moment, chances of me moving away
from Linux are pretty much nil at this point.

Just saying :slight_smile: Unless Linux doesn’t like having both PS/2 and USB
keyboards at the same time,

On a related note, was libmanymice integrated in sdl? As a user I
tried to see how it ran with a commercial software (world of goo) but
I couldn’t make it work.
I think it’s a nice idea and hope that sdl exposes a nice API for it.
Cheers
VittorioIl giorno 28/mar/2013, alle ore 16:54, Sik the hedgehog <sik.the.hedgehog at gmail.com> ha scritto:

Message-ID:
<CAEyBR+X6tsLyz2BoAZ6tzisr_LM2OcQFbeZHCjcRppZ5rJ-=Xg at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

OK, so my old keyboard broke up so I had to resort to a spare one.
Works but the keys are kind of hard to press so I wasn’t all that fond
of it. Now my mum bought a new one but got the wrong port so now I
have an USB keyboard while the PS/2 port is still available. Which
means I can have two keyboards together at the same time.

If I recall correctly one of the things that were suggested to be
added in the future to SDL is support for multiple keyboards. If
somebody ever gets around doing that, I could test that on this
system. Using Ubuntu 12.04 at the moment, chances of me moving away
from Linux are pretty much nil at this point.

Just saying :slight_smile: Unless Linux doesn’t like having both PS/2 and USB
keyboards at the same time, that is…

I dare say it’ll be at least a few weeks, since I think Sam’s in
push-to-the-first-release mode. Apparently most of the GSoC projects
are expected to be based around that as well.

Unless you’re up for writing a library implementation, I don’t forsee
this until the fall, at the earliest.> Date: Thu, 28 Mar 2013 12:53:57 -0300

From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: SDL Development List
Subject: [SDL] Testing multiple keyboards with SDL on Linux

? 2013?03?28? 23:53, Sik the hedgehog ??:

OK, so my old keyboard broke up so I had to resort to a spare one.
Works but the keys are kind of hard to press so I wasn’t all that fond
of it. Now my mum bought a new one but got the wrong port so now I
have an USB keyboard while the PS/2 port is still available. Which
means I can have two keyboards together at the same time.

If I recall correctly one of the things that were suggested to be
added in the future to SDL is support for multiple keyboards. If
somebody ever gets around doing that, I could test that on this
system. Using Ubuntu 12.04 at the moment, chances of me moving away
from Linux are pretty much nil at this point.

Just saying :slight_smile: Unless Linux doesn’t like having both PS/2 and USB
keyboards at the same time, that is…


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
I got the same problem with you . But I hadn’t used SDL.At the computer
boot time , my USB-keyboard
didn’t work if I connectd my PS/2-keyboard too.
So I gussed that’s the Linux OS’s setting did that.

That looks more like the BIOS doing it, not Linux (some motherboards
emulate PS/2 keyboards with USB ones when a real PS/2 keyboard isn’t
inserted - though the opposite way is more common these days).

2013/4/27, ??? :> ? 2013?03?28? 23:53, Sik the hedgehog ??:

OK, so my old keyboard broke up so I had to resort to a spare one.
Works but the keys are kind of hard to press so I wasn’t all that fond
of it. Now my mum bought a new one but got the wrong port so now I
have an USB keyboard while the PS/2 port is still available. Which
means I can have two keyboards together at the same time.

If I recall correctly one of the things that were suggested to be
added in the future to SDL is support for multiple keyboards. If
somebody ever gets around doing that, I could test that on this
system. Using Ubuntu 12.04 at the moment, chances of me moving away
from Linux are pretty much nil at this point.

Just saying :slight_smile: Unless Linux doesn’t like having both PS/2 and USB
keyboards at the same time, that is…


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
I got the same problem with you . But I hadn’t used SDL.At the computer
boot time , my USB-keyboard
didn’t work if I connectd my PS/2-keyboard too.
So I gussed that’s the Linux OS’s setting did that.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Multiple Keyboards: I’ve looked into this. The implementation of this
feature is highly platform dependent, so you would have to program and
test it for different SDL platforms separately. So far I have looked
into the possibilities under Linux and Windows.

  1. Windows
    There is some API called “RawInput”. With it you can get much more
    information about a keyboard event, including the device where it came
    from. Implementing multi keyboard support on Windows will be a piece of
    cake.

  2. Linux
    As far as my searching has brought me now, I think there is no way to
    get X to tell you, which keyboard a key event came from. But there is a
    way: You can read the device files for each of the keyboards manually (
    /dev/input/… ). However only root can do that. So, for multi keyboard
    support on Linux you need root (please correct me, if I’m wrong).
    The best way to handle this imho would be a setuid-program like a sudo,
    but just for granting specific applications rights to read specific
    files via a whitelist (could use a group “input” to whom the input
    device files would have to belong then instead of becoming full root)
    Then again, this program (or root permissions, which you probably don’t
    want to give a usual SDL app) would be an additional dependency for SDL
    on Linux, which is always unpleasant.

3 Android
I don’t know much about android keyboard handling, but it also has input
device files in /dev/input, like Linux. But as I didn’t research this
much, there could be a nicer, Android-specific solution.

As this seems to be complicated, maybe we should first create an SDL
addon lib, say SDL_multikbd, and later, when it works and is well-tested
(far in the future), talk about a merge into SDL.

Does anybody have a better idea for Linux multi keyboard support? What
about the other platforms of SDL?

Linux supports multi mouse keyboard etc with xinput2.right now it is
used in sdl2 for relative mouse motion.Sent from my Windows Phone From: Constantin Berhard
Sent: 28/4/2013 15:37
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Testing multiple keyboards with SDL on Linux
Multiple Keyboards: I’ve looked into this. The implementation of this
feature is highly platform dependent, so you would have to program and
test it for different SDL platforms separately. So far I have looked
into the possibilities under Linux and Windows.

  1. Windows
    There is some API called “RawInput”. With it you can get much more
    information about a keyboard event, including the device where it came
    from. Implementing multi keyboard support on Windows will be a piece of
    cake.

  2. Linux
    As far as my searching has brought me now, I think there is no way to
    get X to tell you, which keyboard a key event came from. But there is a
    way: You can read the device files for each of the keyboards manually (
    /dev/input/… ). However only root can do that. So, for multi keyboard
    support on Linux you need root (please correct me, if I’m wrong).
    The best way to handle this imho would be a setuid-program like a sudo,
    but just for granting specific applications rights to read specific
    files via a whitelist (could use a group “input” to whom the input
    device files would have to belong then instead of becoming full root)
    Then again, this program (or root permissions, which you probably don’t
    want to give a usual SDL app) would be an additional dependency for SDL
    on Linux, which is always unpleasant.

3 Android
I don’t know much about android keyboard handling, but it also has input
device files in /dev/input, like Linux. But as I didn’t research this
much, there could be a nicer, Android-specific solution.

As this seems to be complicated, maybe we should first create an SDL
addon lib, say SDL_multikbd, and later, when it works and is well-tested
(far in the future), talk about a merge into SDL.

Does anybody have a better idea for Linux multi keyboard support? What
about the other platforms of SDL?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

What happens is that there’s a special group that allows access to those
device files. Here, it’s “plugdev” (that’s on Gentoo Linux):

$ ls -l /dev/input/
total 0
drwxr-xr-x 2 root root 80 Apr 28 17:44 by-id
drwxr-xr-x 2 root root 120 Apr 28 17:44 by-path
crw-rw---- 1 root plugdev 13, 64 Apr 28 17:44 event0
crw-rw---- 1 root plugdev 13, 65 Apr 28 17:44 event1
crw-rw---- 1 root plugdev 13, 66 Apr 28 17:44 event2
crw-rw---- 1 root plugdev 13, 67 Apr 28 17:44 event3
crw-rw---- 1 root plugdev 13, 68 Apr 28 17:44 event4
crw-r----- 1 root root 13, 63 Apr 28 17:44 mice
crw-r----- 1 root root 13, 32 Apr 28 17:44 mouse0

Other distros might have a different group, I assume. User-friendly
distros, like Ubuntu or openSUSE, should already have a working setup
for this. In distros where the user is responsible for low-level setup,
like Gentoo or Arch, it might be that the user has no access to those files.On 28/04/13 15:37, Constantin Berhard wrote:

  1. Linux
    As far as my searching has brought me now, I think there is no way to
    get X to tell you, which keyboard a key event came from. But there is a
    way: You can read the device files for each of the keyboards manually (
    /dev/input/… ). However only root can do that. So, for multi keyboard
    support on Linux you need root (please correct me, if I’m wrong).