aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2016-03-04 11:25:14 +0100
committerGerd Hoffmann <kraxel@redhat.com>2016-03-08 12:20:11 +0100
commite0d2bd5195fdc032c8da566027a35a97aaa0394b (patch)
tree23d9aa3398e95b38cb9ac9fd23f57f50f883bb9c /vl.c
parent91ec41dc3f9cf28f93af0630b20ba8e7dcefa16b (diff)
input: linux evdev support
This patch adds support for reading input events directly from linux evdev devices and forward them to the guest. Unlike virtio-input-host which simply passes on all events to the guest without looking at them this will interpret the events and feed them into the qemu input subsystem. Therefore this is limited to what the qemu input subsystem and the emulated input devices are able to handle. Also there is no support for absolute coordinates (tablet/touchscreen). So we are talking here about basic mouse and keyboard support. The advantage is that it'll work without virtio-input drivers in the guest, the events are delivered to the usual ps/2 or usb input devices (depending on what the machine happens to have). And for keyboards qemu is able to switch the keyboard between guest and host on hotkey. The hotkey is hard-coded for now (both control keys), initialy the guest owns the keyboard. Probably most useful when assigning vga devices with vfio and using a physical monitor instead of vnc/spice/gtk as guest display. Usage: Add '-input-linux /dev/input/event<nr>' to the qemu command line. Note that udev has rules which populate /dev/input/by-{id,path} with static names, which might be more convinient to use. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1457087116-4379-2-git-send-email-kraxel@redhat.com
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index adeddd98a6..7a28982eaa 100644
--- a/vl.c
+++ b/vl.c
@@ -72,6 +72,7 @@ int main(int argc, char **argv)
#include "net/slirp.h"
#include "monitor/monitor.h"
#include "ui/console.h"
+#include "ui/input.h"
#include "sysemu/sysemu.h"
#include "sysemu/numa.h"
#include "exec/gdbstub.h"
@@ -3728,6 +3729,12 @@ int main(int argc, char **argv, char **envp)
#endif
break;
}
+ case QEMU_OPTION_input_linux:
+ if (!qemu_opts_parse_noisily(qemu_find_opts("input-linux"),
+ optarg, true)) {
+ exit(1);
+ }
+ break;
case QEMU_OPTION_no_acpi:
acpi_enabled = 0;
break;
@@ -4591,6 +4598,10 @@ int main(int argc, char **argv, char **envp)
qemu_spice_display_init();
}
#endif
+#ifdef CONFIG_LINUX
+ qemu_opts_foreach(qemu_find_opts("input-linux"),
+ input_linux_init, NULL, &error_fatal);
+#endif
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);