mirror of
https://github.com/PhyllomeOS/wiki.git
synced 2024-12-22 13:45:23 +00:00
676136cb05
reorganize the wiki using only two-levels of directories
2.0 KiB
2.0 KiB
title | description | published | date | tags | editor | dateCreated |
---|---|---|---|---|---|---|
Share an input device with a guest using evdev | true | 2023-05-13T16:00:21.759Z | markdown | 2022-08-13T00:26:02.801Z |
Share an input device
In this section, we focus on sharing a locally attached input device with a guest virtual machine.
Using Evdev
Since version 7.4.0, Libvirt added a low-latency local-only way to share an input device with a guest, using the Linux evdev event interface.
Configuration
- List input devices based on their identification, only listing those with an event in their name and excluding these with if:
ls /dev/input/by-id/* | grep event | grep -v if
/dev/input/by-id/usb-Corsair_CORSAIR_HARPOON_RGB_PRO_Gaming_Mouse_1902B02BAF5E04655DEB612AF5001C05-event-mouse
/dev/input/by-id/usb-Logitech_G513_RGB_MECHANICAL_GAMING_KEYBOARD_156930783132-event-kbd
/dev/input/by-id/usb-Logitech_USB_Keyboard-event-kbd
/dev/input/by-id/usb-Logitech_USB_Optical_Mouse-event-mouse
- Make sure that the correct one is selected by registering its inputs in the console:
cat /dev/input/by-id/usb-Logitech_G513_RGB_MECHANICAL_GAMING_KEYBOARD_156930783132-event-kbd
- Clicking or typing on the device you wish to share should display gibberish characters on the screen:
<EFBFBD><EFBFBD>c $
<0A><>c<EFBFBD><63><EFBFBD>c<EFBFBD><63><EFBFBD>c<EFBFBD>$<24><>c<EFBFBD>$<24><>c<63><D78F>c<63><D78F>c
- Add the following snippet to the XML domain definition of an existing virtual machine, inside the
<device>
section:
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Logitech_G513_RGB_MECHANICAL_GAMING_KEYBOARD_156930783132-event-kbd' grab='all' repeat='on'/>
</input>
Usage
Press Left Ctrl + Right Ctrl simultaneously to switch your devices between the guest and the host. {.is-info}