wiki/virt/vm/input.md
lukas 676136cb05 clean-up
reorganize the wiki using only two-levels of directories
2023-05-27 21:34:15 +02:00

2.2 KiB
Raw Blame History

title description published date tags editor dateCreated
Input devices How to share input devices with a virtual machine true 2022-08-02T09:59:31.526Z markdown 2022-08-01T10:42:14.864Z

Input devices

Input devices such as keyboards and mice are a must to directly interact with a virtual machine. There are multiple ways to share an input device with your virtual machine.

Summary

  • to-be done. Add table here.

Methods

Evdev

Event devices (evdev) is a generic input event interface available in the Linux and FreeBDS kernels.

  • Identify available input devices under /dev/input/by-path/ or /dev/input/by-id/ and look for devices that contains the string event in their name.
ls /dev/input/*
/dev/input/by-path:
pci-0000:07:00.0-event-mouse  
pci-0000:09:00.0-mouse
pci-0000:07:00.0-mouse        platform-i8042-serio-0-event-kbd
pci-0000:08:00.0-event-kbd    platform-i8042-serio-1-event-mouse
pci-0000:09:00.0-event-mouse  platform-i8042-serio-1-mouse
  • Check if it's the correct device using the following command and typing or clicking on your device
sudo cat /dev/input/by-path/pci-0000:08:00.0-event-kbd
  • If gibberish symbols appear on your console as you type, it means that the device has been correctly identified, and that you can Ctrl+Z
<EFBFBD><EFBFBD>b<EFBFBD><EFBFBD><EFBFBD><EFBFBD>b<EFBFBD><EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>!<21><>b<EFBFBD><62><EFBFBD>b<EFBFBD><62> <20><>b<EFBFBD><62><EFBFBD><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD>b<EFBFBD><62>fdsa<73><61>b<EFBFBD>( <20><>b<EFBFBD>(<28><>b!<21><>b<EFBFBD><62>bR<62><52>bR<62><52>bW<62><57>bW<62><57>b<EFBFBD>!<21><>b<EFBFBD>f<EFBFBD><66>b4 <20><>b4<62><34>bV<62><56>bV<62><56>bX<62><58>bXdsa<73><61>b!:	!<21><>b!:	<09><>b>:	 <20><>b>:	<09><>b<EFBFBD>
<0A><>b<EFBFBD>
<0A><>b<EFBFBD>y
<0A><>b<EFBFBD>y

Edit the virtual machine's definition and replace MOUSE_NAME and KEYBOARD_NAME with the previously identified devices.

<input type="evdev">
  <source dev="/dev/input/by-path/MOUSE_NAME"/>
</input>
<input type="evdev">
  <source dev="/dev/input/by-path/KEYBOARD_NAME" grab="all" repeat="on"/>
</input>

Go to parent page