initial version
This commit is contained in:
commit
6cdb039c6c
9 changed files with 556 additions and 0 deletions
48
wsmouse_type.c
Normal file
48
wsmouse_type.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *device;
|
||||
int fd, wsmouse_type;
|
||||
|
||||
if (argc == 1)
|
||||
device = "/dev/wsmouse0";
|
||||
else
|
||||
device = argv[1];
|
||||
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
err(2, "open %s", device);
|
||||
|
||||
if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) == -1)
|
||||
err(2,"ioctl get mouse type");
|
||||
|
||||
|
||||
switch (wsmouse_type) {
|
||||
case WSMOUSE_TYPE_SYNAP_SBTN:
|
||||
printf("SYNAP_SBTN\n");
|
||||
break;
|
||||
case WSMOUSE_TYPE_SYNAPTICS:
|
||||
printf("SYNAPTICS\n");
|
||||
break;
|
||||
case WSMOUSE_TYPE_ALPS:
|
||||
printf("ALPS\n");
|
||||
break;
|
||||
case WSMOUSE_TYPE_TOUCHPAD:
|
||||
printf("TOUCHPAD\n");
|
||||
break;
|
||||
case WSMOUSE_TYPE_ELANTECH:
|
||||
printf("ELANTECH\n");
|
||||
break;
|
||||
default:
|
||||
printf("unkonwn type %d\n", wsmouse_type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue