Subject: Re: Breaking binary compatibility for /dev/joy
To: None <jdolecek@netbsd.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-kern
Date: 04/17/2002 10:49:11
On Wed, 17 Apr 2002, Jaromir Dolecek wrote:
> I was thinking about something like this too. However, is it
> possible to find out if you have two joysticks or one joystick
> with two axes and 4 buttons?

You could easily find out if one or two joysticks are connected. Force 2
button mode if two joysticks are connected, and 4-button mode if one is
connected. The third and fourth buttons would have no effect if one
joystick was connected, so your app would simply not see the button-3 and
4 presses.

> FWIW, you can get at the 'other' two buttons by reading /dev/joy1
> currently.

Yuk.

> I also think that it's better to use something like
>
>  struct {
> 	int x, y, buttons;
>  };
> rather than having a special member for each button. It'd be
> fairly easy to have ioctl to switch between the two interfaces.
> (One of the rare moments where Linux interface seems to be better).

Maybe, as someone mentioned earlier, go with a generic /dev/wsjoy0
interface?

> Post 1.6, I'd like to have the joy(4) reorganized slightly,
> especially make the include <machine/joystick.h> MI and deal
> somehow with the 'joy0 is actually /dev/joy0 and /dev/joy1'
> thing.

How about:
    game*	at isapnp?
    joy*	at game?

Jared