Subject: Direction of wsmouse at mms(4)
To: None <port-dreamcast@netbsd.org>
From: Yasushi Oshima <oshimaya@sc.starcat.ne.jp>
List: port-dreamcast
Date: 07/06/2003 14:23:40
Hi all,

I have some problems with wsmouse at mms(4),
the vertical direction differs from other NetBSD architecture.

There is a very simple test program:

#include <stdio.h>
#include <fcntl.h>
#include <dev/wscons/wsconsio.h>

#define DEV_WSM "/dev/wsmouse"

int main( int argc, char *argv[] )
{
        int mouse_fd;
        struct wscons_event ev;

        if ((mouse_fd= open(DEV_WSM, O_RDONLY, 0)) < 0)
                err(1, "open");
        while (1) {
                if (read(mouse_fd, &ev, sizeof(ev) ) != sizeof(ev))
                        err(1, "read");
                if ( ev.type == WSCONS_EVENT_MOUSE_DELTA_Y )
                        printf("delta_y = %d\n",ev.value);
                if ( ev.type == WSCONS_EVENT_MOUSE_DOWN )
                        printf("button = %d\n",ev.value);
        }
}

When run it on my Dreamcast and Dreamcast Mouse(HKT-9900),

  Moving mouse to Up direction, the delta_y is minus value     
  Moving mouse to Down direction, the delta_y is plus value

However, on my i386(PS2 and USB) and macppc, there are reverse:

  Moving mouse to Up direction, the delta_y is plus     
  Moving mouse to Down direction, the delta_y is minus

The delta_x and delta_z is the same.

I think the direction of wsmouse should be the same on all NetBSD
machines.

To change vertical direction of mms(4)

Index: mms.c
===================================================================
RCS file: /export/cvsroot/src/sys/arch/dreamcast/dev/maple/mms.c,v
retrieving revision 1.7
diff -u -r1.7 mms.c
--- mms.c       10 Dec 2002 13:19:10 -0000      1.7
+++ mms.c       21 Jun 2003 11:19:49 -0000
@@ -246,6 +246,6 @@
                        buttons |= 0x08;

                wsmouse_input(sc->sc_wsmousedev, buttons,
-                   dx, dy, dz, WSMOUSE_INPUT_DELTA);
+                   dx, -dy, dz, WSMOUSE_INPUT_DELTA);
        }
 }

Is it right?

And,
the button of scroll wheel on my Dreamcast Mouse returns
"Button 3", not "Button 1".
The left button is "Button 0", and right button is "Button 2".
Is it only my mouse?

Thanks,

-- 
Yasushi Oshima,
oshimaya@sc.starcat.ne.jp