Bug#607908: libsdl1.2debian: does not reopen joystick device

Vladislav Naumov vnaum at vnaum.com
Fri Dec 24 06:14:39 UTC 2010


Package: libsdl1.2debian
Version: 1.2.14-6.1
Severity: normal
Tags: patch upstream


Problem description:
SDL opens joystick device only once at startup. If usb connection is
lost
for some reason (bad USB cable, cheap gamepad, little brother tripping
on the wire)
- your game is ruined. Input device file is gone for a short time,
opened file handle is no longer valid. Kernel re-creates device file
after connection is back, but libsdl does not re-open it.

Steps to reproduce: plug USB joystick, run SDL-based application that
uses joystick, unplug your joystick for a brief time and plug it back
in.

The patch tries to re-open the device if read operation reports bad file
/ no such device.  I know about possible caveats (like, the new device
can have different name, multiple joysticks can re-appear in different
order or maybe the device plugged is totally different one), but still I
believe anything is better then forcing user to start the game from the
very beginning. Especially annoying if user is 3 years old and can't
start the game on his own.

I (OK, not I but my son) tested it for a week, and it work just fine
with mame, mess, mednafen and supertux.

It also works for lenny version of libsdl, but you have to
#define SDL_INPUT_LINUXEV 1
#define NO_LOGICAL_JOYSTICKS
, because patch only fixes this flag combination (the one that is used in
squeeze build).


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-openvz-686 (SMP w/1 CPU core)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libsdl1.2debian depends on:
ii  libsdl1.2debian-oss           1.2.14-6.1 Simple DirectMedia Layer (with X11

libsdl1.2debian recommends no packages.

libsdl1.2debian suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sdl_reopenjoystick.diff
Type: text/x-diff
Size: 704 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-sdl-maintainers/attachments/20101224/c590b964/attachment.diff>


More information about the Pkg-sdl-maintainers mailing list