aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/evdev.c26
-rw-r--r--common/wscons.c27
2 files changed, 31 insertions, 22 deletions
diff --git a/common/evdev.c b/common/evdev.c
index d2398fb..7ec0fe2 100644
--- a/common/evdev.c
+++ b/common/evdev.c
@@ -9,11 +9,6 @@
#include <sys/sysmacros.h>
#elif defined(__FreeBSD__)
#include <dev/evdev/input.h>
-#elif defined(__NetBSD__)
-#include <stdlib.h>
-#include <sys/stat.h>
-#else
-#error Unsupported platform
#endif
#include "evdev.h"
@@ -30,28 +25,15 @@ int path_is_evdev(const char *path) {
int evdev_revoke(int fd) {
return ioctl(fd, EVIOCREVOKE, NULL);
}
-#endif
-
-#if defined(__linux__)
-int dev_is_evdev(dev_t device) {
- return major(device) == INPUT_MAJOR;
-}
#elif defined(__NetBSD__)
-int dev_is_evdev(dev_t device) {
- return major(device) == getdevmajor("wskbd", S_IFCHR) ||
- major(device) == getdevmajor("wsmouse", S_IFCHR) ||
- major(device) == getdevmajor("wsmux", S_IFCHR);
-}
int path_is_evdev(const char *path) {
- const char *wskbd = "/dev/wskbd";
- const char *wsmouse = "/dev/wsmouse";
- const char *wsmux = "/dev/wsmux";
- return strncmp(path, wskbd, STRLEN(wskbd)) == 0 ||
- strncmp(path, wsmouse, STRLEN(wsmouse)) == 0 ||
- strncmp(path, wsmux, STRLEN(wsmouse)) == 0;
+ (void)path;
+ return 0;
}
int evdev_revoke(int fd) {
(void)fd;
return 0;
}
+#else
+#error Unsupported platform
#endif
diff --git a/common/wscons.c b/common/wscons.c
new file mode 100644
index 0000000..7fc8df5
--- /dev/null
+++ b/common/wscons.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__NetBSD__)
+#include <stdlib.h>
+#include <sys/stat.h>
+#endif
+
+#include "wscons.h"
+
+#define STRLEN(s) ((sizeof(s) / sizeof(s[0])) - 1)
+
+#if defined(__NetBSD__)
+int path_is_wscons(const char *path) {
+ const char *wskbd = "/dev/wskbd";
+ const char *wsmouse = "/dev/wsmouse";
+ const char *wsmux = "/dev/wsmux";
+ return strncmp(path, wskbd, STRLEN(wskbd)) == 0 ||
+ strncmp(path, wsmouse, STRLEN(wsmouse)) == 0 ||
+ strncmp(path, wsmux, STRLEN(wsmouse)) == 0;
+}
+#else
+int path_is_wscons(const char *path) {
+ (void)path;
+ return 0;
+}
+#endif