Patch for SDL_sysjoystick.c / FreeBSD

Hello,

I’m using SDL 1.2.6 on FreeBSD, with a MS SideWinder USB joypad, but it
does not run “out of the box”: SDL tries to open the device in O_RDWR,
and it fails.

After this minor patch:

— src/joystick/bsd/SDL_sysjoystick.c.orig Sat Aug 30 21:13:05 2003
+++ src/joystick/bsd/SDL_sysjoystick.c Thu Oct 2 23:18:12 2003
@@ -234,7 +234,7 @@
struct report *rep;
int fd;

  • fd = open(path, O_RDWR);
  • fd = open(path, O_RDONLY);
    if (fd == -1) {
    SDL_SetError("%s: %s", path, strerror(errno));
    return (-1);

it works.

There exist perhaps joysticks which accept a write mode, and we could
use something like

fd = open(path, O_RDWR);
if (fd == -1) {
fd = open(path, O_RDONLY);
if (fd == -1) {
SDL_SetError("%s: %s", path, strerror(errno));

but it does not seem useful.

Regards,–
Th. Thomas.

Could you please let me know how SDLJoytest works w/ the broken setup?
I’d like to see it work under such a failure condition?

Thanks
Samuel E. BrayOn Friday 03 October 2003 2:21 pm, Thierry Thomas wrote:

Hello,

I’m using SDL 1.2.6 on FreeBSD, with a MS SideWinder USB joypad, but it
does not run “out of the box”: SDL tries to open the device in O_RDWR,
and it fails.

After this minor patch:

— src/joystick/bsd/SDL_sysjoystick.c.orig Sat Aug 30 21:13:05 2003
+++ src/joystick/bsd/SDL_sysjoystick.c Thu Oct 2 23:18:12 2003
@@ -234,7 +234,7 @@
struct report *rep;
int fd;

  • fd = open(path, O_RDWR);
  • fd = open(path, O_RDONLY);
    if (fd == -1) {
    SDL_SetError("%s: %s", path, strerror(errno));
    return (-1);

it works.

There exist perhaps joysticks which accept a write mode, and we could
use something like

fd = open(path, O_RDWR);
if (fd == -1) {
fd = open(path, O_RDONLY);
if (fd == -1) {
SDL_SetError("%s: %s", path, strerror(errno));

but it does not seem useful.

Regards,


"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety. "
–Benjamin Franklin