commit 8a7ecbd
chld
·
2026-03-22 23:07:08 +0000 UTC
parent 0d03b7c
prevent input falling through from neuswc to TTY on freebsd
1 files changed,
+13,
-1
+13,
-1
1@@ -53,6 +53,7 @@
2 #if defined(__FreeBSD__)
3 #include <sys/consio.h>
4 #include <sys/kbio.h>
5+#include <dev/evdev/input.h> /* needed for eviocgrab */
6 #elif defined(__NetBSD__)
7 #include <dev/wscons/wsdisplay_usl_io.h>
8
9@@ -264,6 +265,17 @@ handle_socket_data(int socket)
10 fprintf(stderr, "too many input devices opened\n");
11 goto fail;
12 }
13+ #ifdef __FreeBSD__
14+ /* this (EVIOCGRAB) is the only way to
15+ * prevent the TTY from recieving
16+ * input from the neuswc session.
17+ */
18+ if (ioctl(fd, EVIOCGRAB, (void*)1) == -1)
19+ {
20+ fprintf(stderr, "EVIOCGRAB %s: %s", path, strerr(errno));
21+ goto fail;
22+ }
23+ #endif
24 input_fds[num_input_fds++] = fd;
25 } else if (device_is_drm(st.st_rdev)) {
26 if (num_drm_fds == ARRAY_LENGTH(drm_fds)) {
27@@ -450,7 +462,7 @@ setup_tty(int fd)
28 die("failed to set keyboard mode to K_OFF:");
29 }
30 #elif defined(__FreeBSD__)
31- if (ioctl(fd, KDSKBMODE, K_RAW) == -1) {
32+ if (ioctl(fd, KDSKBMODE, K_CODE) == -1) {
33 die("failed to set keyboard mode to K_RAW:");
34 }
35 #endif