Keyboard and mouse initialization

Hi everybody,

I have been using SDL since quite a few months, but something is really
bugging me right now. I haven’t found nothing yet on the archives nor
while googling so I hope you guys can give me some inputs.

I was wondering if it is possible, using SDL, to initialize the keyboard
and the mouse in order to know if those peripherals are present or not.
In my case, if those peripherals aren’t detected, I would like my
application to stop until a keyboard and a mouse are plugged.

So far, I’ve seen a guy using VGL functions (VGL_initkeymaps and
VGL_initmouse) which themselves use ioctl function.

Before going that way, I would like to know if there already are
functions in the SDL library to detect the keyboard and mouse. The only
thing that I’ve seen using SDL would be to use the keyboard and mouse
events detection with a time out but would require the user to intervene
and that solution would be too shabby.

So any inputs would be very much appreciated. If you need more
information on what I want to do, please don’t hesitate to contact me.

Thanks,

Jerome

Hiyyya, well windows, linix, mac, and ect have different ways to handle kayboard and mouse. Are you looking for cross platform detection? With what I see sdl has failure as a result as you said. Unless I misunderstand you’d need to guess from that and build on it or use different methods for each os.

---- Jerome Guilmette <jerome.guilmette at gmail.com> wrote:=============
Hi everybody,

I have been using SDL since quite a few months, but something is really
bugging me right now. I haven’t found nothing yet on the archives nor
while googling so I hope you guys can give me some inputs.

I was wondering if it is possible, using SDL, to initialize the keyboard
and the mouse in order to know if those peripherals are present or not.
In my case, if those peripherals aren’t detected, I would like my
application to stop until a keyboard and a mouse are plugged.

So far, I’ve seen a guy using VGL functions (VGL_initkeymaps and
VGL_initmouse) which themselves use ioctl function.

Before going that way, I would like to know if there already are
functions in the SDL library to detect the keyboard and mouse. The only
thing that I’ve seen using SDL would be to use the keyboard and mouse
events detection with a time out but would require the user to intervene
and that solution would be too shabby.

So any inputs would be very much appreciated. If you need more
information on what I want to do, please don’t hesitate to contact me.

Thanks,

Jerome


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

Hi,

“Are you looking for cross platform detection?” --> I would have liked
to, even though my main application is running mainly under Linux.

“… you’d need to guess from that and build on it or use different
methods for each os .” --> That is what I was afraid of, unless I come
with something else, I guess I will have to enjoy playing with the Linux
Kernel to see how the kernel detects mouse and keyboards.

Thanks for replying,

Jerome

necronology at cox.net wrote:> Hiyyya, well windows, linix, mac, and ect have different ways to handle kayboard and mouse. Are you looking for cross platform detection? With what I see sdl has failure as a result as you said. Unless I misunderstand you’d need to guess from that and build on it or use different methods for each os.

---- Jerome Guilmette <jerome.guilmette at gmail.com> wrote:

=============
Hi everybody,

I have been using SDL since quite a few months, but something is really
bugging me right now. I haven’t found nothing yet on the archives nor
while googling so I hope you guys can give me some inputs.

I was wondering if it is possible, using SDL, to initialize the keyboard
and the mouse in order to know if those peripherals are present or not.
In my case, if those peripherals aren’t detected, I would like my
application to stop until a keyboard and a mouse are plugged.

So far, I’ve seen a guy using VGL functions (VGL_initkeymaps and
VGL_initmouse) which themselves use ioctl function.

Before going that way, I would like to know if there already are
functions in the SDL library to detect the keyboard and mouse. The only
thing that I’ve seen using SDL would be to use the keyboard and mouse
events detection with a time out but would require the user to intervene
and that solution would be too shabby.

So any inputs would be very much appreciated. If you need more
information on what I want to do, please don’t hesitate to contact me.

Thanks,

Jerome


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


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

Hey,

My computers were also never able to detect a PS/2 mouse or keyboard that was not present on-boot.

Sounds to me as though what you need applies only to USB keyboards, though I may be wrong.

Pat> ----- Original Message -----

From: jerome.guilmette@gmail.com (Jerome Guilmette)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Monday, March 9, 2009 2:27:53 PM
Subject: Re: [SDL] Keyboard and mouse initialization

Hi,

“Are you looking for cross platform detection?” --> I would have liked to, even though my main application is running mainly under Linux.

“… you’d need to guess from that and build on it or use different methods for each os .” --> That is what I was afraid of, unless I come with something else, I guess I will have to enjoy playing with the Linux Kernel to see how the kernel detects mouse and keyboards.

Thanks for replying,

Jerome

necronology at cox.net wrote:

Hiyyya, well windows, linix, mac, and ect have different ways to handle kayboard and mouse. Are you looking for cross platform detection? With what I see sdl has failure as a result as you said. Unless I misunderstand you’d need to guess from that and build on it or use different methods for each os.

---- Jerome Guilmette <jerome.guilmette at gmail.com> wrote:

Hi everybody,

I have been using SDL since quite a few months, but something is really bugging me right now. I haven’t found nothing yet on the archives nor while googling so I hope you guys can give me some inputs.

I was wondering if it is possible, using SDL, to initialize the keyboard and the mouse in order to know if those peripherals are present or not. In my case, if those peripherals aren’t detected, I would like my application to stop until a keyboard and a mouse are plugged.

So far, I’ve seen a guy using VGL functions (VGL_initkeymaps and VGL_initmouse) which themselves use ioctl function.

Before going that way, I would like to know if there already are functions in the SDL library to detect the keyboard and mouse. The only thing that I’ve seen using SDL would be to use the keyboard and mouse events detection with a time out but would require the user to intervene and that solution would be too shabby.

So any inputs would be very much appreciated. If you need more information on what I want to do, please don’t hesitate to contact me.

Thanks,

Jerome


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


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


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

SDL 1.3 has a SDL_GetNumKeyboards () function. You could check to see if it
returns a value greater than 0.

At present, however, SDL does not increment this value when a keyboard is
plugged in or make the keyboard available for input.

There is a SDL_AddKeyboard() function, but it is not part of the API.

Likewise, for mouses, there is SDL_GetNumMice() and SDL_AddMouse(), but the
number of mouses is not incremented when a mouse is plugged in and
SDL_AddMouse() is not part of the API.

Same is also true for joysticks (SDL_NumJoysticks()), though there is no
SDL_AddJoystick() function at all.