aboutsummaryrefslogtreecommitdiff
path: root/common/wscons.c
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2022-03-29 10:41:16 +0200
committerKenny Levinsen <kl@kl.wtf>2022-03-29 10:54:27 +0200
commit0462e9331d1648171bd47e62a2808f0a4d647239 (patch)
tree2d91785d72da23c25fa4146fab09580f7e2d9375 /common/wscons.c
parent684dd619455011bc08c85ae4c1b39394268b5646 (diff)
wscons: Move to its own device type
This reduces ifdefs and avoids overloading evdev as something it is not.
Diffstat (limited to 'common/wscons.c')
-rw-r--r--common/wscons.c27
1 files changed, 27 insertions, 0 deletions
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