New driver for OpenBSD/wscons

Hello,

I’ve written an SDL driver for OpenBSD/wscons (console mode, somewhat
resembling the functionality of the svga driver for Linux). I use it
for playing MAME on my Sharp Zaurus. The alternative is to play under
X, which is slower.

I asked how to submit the driver a few days ago, and posted a link to
the patch in a follow-up, so maybe it was missed?

Anyway, the patch is on the web at:

http://multivac.fatburen.org/SDL-wscons.patch

Comments?

Staffan

I asked how to submit the driver a few days ago, and posted a link to
the patch in a follow-up, so maybe it was missed?

It wasn’t missed; examining it is on my TODO list.

–ryan.

“Ryan C. Gordon” writes:

I asked how to submit the driver a few days ago, and posted a link to
the patch in a follow-up, so maybe it was missed?

It wasn’t missed; examining it is on my TODO list.

Ok, good!

Staffan

I asked how to submit the driver a few days ago, and posted a link to
the patch in a follow-up, so maybe it was missed?

It wasn’t missed; examining it is on my TODO list.

Ok, good!

Patch looks pretty good, just two questions:

You added this in the joystick code:

-#if defined(FreeBSD) || defined(NetBSD) || defined(OpenBSD)
+#if defined(FreeBSD) || defined(NetBSD) ||
(defined(OpenBSD) && defined(i386))

Is there any reason that piece of code is x86 specific? Does that
interface only exist as a legacy thing on OpenBSD/x86?

Also, the configure.in script added this:

  •    AC_MSG_CHECKING(for wscons support)
    
  •    video_wscons=no
    
  •    AC_LANG_C
    
  •    AC_TRY_COMPILE([
    
  •   #include <sys/time.h>
    
  •   #include <dev/wscons/wsconsio.h>
    
  •    ],[
    
  •    ],[
    
  •    video_wscons=yes
    
  •    ])+
    

…it looks like you are only concerned with the existence of
wsconsio.h…can we just use AC_CHECK_HEADER instead?

Let me know and I’ll commit this to CVS.

Thanks,
–ryan.

“Ryan C. Gordon” writes:

You added this in the joystick code:

-#if defined(FreeBSD) || defined(NetBSD) || defined(OpenBSD)
+#if defined(FreeBSD) || defined(NetBSD) ||
(defined(OpenBSD) && defined(i386))

Is there any reason that piece of code is x86 specific? Does that
interface only exist as a legacy thing on OpenBSD/x86?

I do not really understand the code, but the following suggests it is
i386 specific:

  • The code does not compile on my arm system without the patch.
  • The OpenBSD port of SDL includes this patch.
  • The only “joystick.h” file on my system is in
    /usr/sys/arch/i386/include/joystick.h.

Maybe it would have been better to submit two patches, since this is
not strictly part of the wscons driver? (There are also some patches
in src/audio/openbsd/SDL_openbsdaudio.c, without which the code deos
not compile, so I threw them in with the other stuff, even if the
patches are not strictly part of the wscons driver.)

Also, the configure.in script added this:

  •    AC_MSG_CHECKING(for wscons support)
    
  •    video_wscons=no
    
  •    AC_LANG_C
    
  •    AC_TRY_COMPILE([
    
  •   #include <sys/time.h>
    
  •   #include <dev/wscons/wsconsio.h>
    
  •    ],[
    
  •    ],[
    
  •    video_wscons=yes
    
  •    ])
    

…it looks like you are only concerned with the existence of
wsconsio.h…can we just use AC_CHECK_HEADER instead?

Sure! This is the first time I’ve ever written something for
autoconf, so I didn’t realize the simpler alternative! :slight_smile:

Staffan

I do not really understand the code, but the following suggests it is
i386 specific:

  • The code does not compile on my arm system without the patch.
  • The OpenBSD port of SDL includes this patch.
  • The only “joystick.h” file on my system is in
    /usr/sys/arch/i386/include/joystick.h.

Good enough for me. I put it in CVS.

Maybe it would have been better to submit two patches, since this is
not strictly part of the wscons driver? (There are also some patches
in src/audio/openbsd/SDL_openbsdaudio.c, without which the code deos
not compile, so I threw them in with the other stuff, even if the
patches are not strictly part of the wscons driver.)

It’s fine, I split them up into seperate CVS commits.

Sure! This is the first time I’ve ever written something for
autoconf, so I didn’t realize the simpler alternative! :slight_smile:

Hmm…actually, I’m not sure how to do this if it requires sys/time.h to
be included first for the test. I say it ain’t broke, let’s not fix it. :slight_smile:

The wscons driver is in CVS now. Please sync up to the head of the
repository and make sure it still works.

Thanks!

–ryan.

“Ryan C. Gordon” writes:

The wscons driver is in CVS now. Please sync up to the head of the
repository and make sure it still works.

It works, thanks!

Staffan