#include #include #include #include #include #include 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; }