wiki/gofurther/evdev.md

1.5 KiB
Raw Blame History

title description published date tags editor dateCreated
Share an input device with a guest using evdev true 2022-08-25T20:26:02.610Z markdown 2022-08-13T00:26:02.801Z

Share an input device

Input grabbing on Wayland doesn't currently work as expected. Destkop environments based on the X session manager may work better in this regard {.is-warning}

There are multiple ways to share an input device with a virtual machine.

Event device

Event device or simply evdev is a generic input event interface that is part of the Linux kernel.

The following is an XML snippet example for sharing a mouse and a keyboard.

<input type='evdev'>
      <source dev='/dev/input/by-path/platform-i8042-serio-1-event-mouse/'>
</input>
<input type='evdev'>
      <source dev='/dev/input/by-path/platform-i8042-serio-0-event-kbd' grab='all' repeat='on'/>
</input>

Replace the platform-i8042-serio-1-event-mouse value with the value under /dev/input/by-path/* or /dev/input/by-id/*

If there are multiple possible options, the input device has to have event in the name.

sudo cat /dev/input/by-path/pci-0000:09:00.0-event-mouse
<EFBFBD><EFBFBD>c      $
<0A><>c<EFBFBD><63><EFBFBD>c<EFBFBD><63><EFBFBD>c<EFBFBD>$<24><>c<EFBFBD>$<24><><63><D78F><63><D78F>c
<0A><>c                          3
<0A><>c<EFBFBD><63><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD><EFBFBD>cd<63><64><EFBFBD>cd<63><64><EFBFBD>c<EFBFBD>2<EFBFBD><32>c<EFBFBD>2<EFBFBD><32>cz<63><7A>cz<63><7A>c<EFBFBD>Q<EFBFBD><51>c<EFBFBD>Q<EFBFBD><51>c<EFBFBD><63><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD><EFBFBD>cda
                                                                         <20><>cda