NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/46391



The following reply was made to PR kern/46391; it has been noted by GNATS.

From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: kooda%upyum.com@localhost
Subject: Re: kern/46391
Date: Tue, 28 Aug 2012 12:45:37 +1000

 Hi.
 
 Sorry I missed the problem
 
 Going back to your original post.  It seems the mouse is attached: wsmouse1 at 
 uhidev2.  The device has multiple report ids.  I also agree that the usage id 
 for stylus' is 0x20.
 
 Try this:
 
 mousepacketsniffer.c
 
 #include <sys/ioctl.h>
 
 #include <err.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
 
 #include <dev/wscons/wsconsio.h>
 
 int main() {
        int fd, errno, bytesRead;
        struct wscons_event event;
        char *fileName = "/dev/wsmouse1";
        fd = open(fileName, O_RDONLY);
        if (fd < 0) {
                err(errno, "Error opening %s", fileName);
                return -1;
        }
        for (;;) {
                bytesRead = read(fd, &event, sizeof(event));
 
                if (bytesRead = sizeof(event)) {
                        /* Absolute events. */
                        if (event.type == WSCONS_EVENT_MOUSE_ABSOLUTE_X)
                                printf("ABSOLUTE_X: %d\n", event.value);
 
                        if (event.type == WSCONS_EVENT_MOUSE_ABSOLUTE_Y)
                                printf("ABSOLUTE_Y: %d\n", event.value);
 
                        /* Relative events. */
                        if (event.type == WSCONS_EVENT_MOUSE_DELTA_X)
                                printf("DELTA_X: %d\n", event.value);
 
                        if (event.type == WSCONS_EVENT_MOUSE_DELTA_Y)
                                printf("DELTA_Y: %d\n", event.value);
 
                        /* Button events. */
                        if (event.type == WSCONS_EVENT_MOUSE_UP)
                                printf("BUTTON_UP: %d\n", event.value);
 
                        if (event.type == WSCONS_EVENT_MOUSE_DOWN)
                                printf("BUTTON_DOWN: %d\n", event.value);
                }
        }
 
        close(fd);
        return 0;
 }
 
 
 Note: Have to run using sudo or root unless you have permission to the device.
 Press control c to exit the programme.
 
 
 If it reports absolute packets you'll have to use the ws(4) driver for X 
 windows.
 
 You can use this programme tee it to a file and grep and sort the absolute x 
 and y values to find the limits for ws(4) refer to the manual page for more 
 info.
 
 Regards,
 
 Nat.
 


Home | Main Index | Thread Index | Old Index