Subject: 3MAX + PX -- Re: 1.6 install
To: None <port-pmax@netbsd.org>
From: Toru Nishimura <locore32@gaea.ocn.ne.jp>
List: port-pmax
Date: 09/18/2002 12:02:34
The following is a tiny wsmouse diagnose program.  It will respond for
mouse movement on screen if things work well.

Toru Nishimura/ALKYL Technology

#include <sys/types.h>
#include <sys/time.h>
#include <dev/wscons/wsconsio.h>
#include <stdio.h>

main()
{
        int fd, nread;
        unsigned type;
        struct wscons_event ev;

        fd = open("/dev/wsmouse0", 2);
        if (fd < 0) {
                perror("/dev/wsmouse0");
                exit(1);
        }
        if (ioctl(fd, WSMOUSEIO_GTYPE, &type) < 0) {
                perror("WSMOUSEIO_GTYPE");
                exit(1);
        }
        printf("mouse type = %d\n", type);
        while ((nread = read(fd, &ev, sizeof(ev))) > 0) {
                switch (ev.type) {
                case WSCONS_EVENT_MOUSE_DOWN:
                        fprintf(stderr, "%c", "LMR"[ev.value & 03]);
                        break;
                case WSCONS_EVENT_MOUSE_UP:
                        fprintf(stderr, "%c", "lmr"[ev.value & 03]);
                        break;
                default:
                        fprintf(stderr, ".");
                }
        }
        if (nread < 0) 
                perror("read");
        exit(0);
}