USB Keyboard and Drive issue

I have a system that needs to ‘hot swap’ between a USB keyboard and thumb drive.
I have a thread that waits for keyboard inputs via SDL_waitEvent(), and
occasionally, the thread will die a terrible death when a thumb drive is being
accessed (typically on a write). Is there a way to ‘disable’ keyboard SDL events
from occurring while the thumb drive is in place (or while there is no keyboard
inserted)? I could not ‘listen’ for events, but that won’t stop spurious events
from getting in the queue.

I’m using SDL version 1.2.11 on linux kernel 2.6.17 (CPU is XScale-PXA270)

thanks much!

I have a system that needs to ‘hot swap’ between a USB keyboard and thumb drive.
I have a thread that waits for keyboard inputs via SDL_waitEvent(), and
occasionally, the thread will die a terrible death when a thumb drive is being
accessed (typically on a write). Is there a way to ‘disable’ keyboard SDL events
from occurring while the thumb drive is in place (or while there is no keyboard
inserted)?

To be clear, the thumb drive is generating keyboard events, or you just
don’t want keyboard events while the drive is inserted?

(in the former case, that sounds like a kernel bug, and in the later,
I’d say just ignore keyboard events while the drive is inserted.)

–ryan.

Ryan C. Gordon <icculus icculus.org> writes:

I have a system that needs to ‘hot swap’ between a USB keyboard and thumb
drive.

I have a thread that waits for keyboard inputs via SDL_waitEvent(), and
occasionally, the thread will die a terrible death when a thumb drive is
being

accessed (typically on a write). Is there a way to ‘disable’ keyboard SDL
events

from occurring while the thumb drive is in place (or while there is no
keyboard

inserted)?

To be clear, the thumb drive is generating keyboard events, or you just
don’t want keyboard events while the drive is inserted?

(in the former case, that sounds like a kernel bug, and in the later,
I’d say just ignore keyboard events while the drive is inserted.)

–ryan.

It seems like the USB drive is generating keyboard events. Hard to tell
what as the system crashes pretty hard.

How can I disable the keyboard events and/or clear the queue? Seems like they
are activated when SDL is intialized and I haven’t seen a function to
disable events. If I don’t do the waitEvent(), I assume that the events
still get queued up - which doesn’t help me any.

Thanks.
Kevin

The thumb drive generating keyboard events sounds like a pretty severe
OS bug. Can you confirm that it’s an OS issue and not SDL ignoring a
return value somewhere?

Also, I may have missed it, but what platform and version of OS and SDL
are you using?

Thanks!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment