[vfio-users] [PATCH 2/2] input: linux evdev support

Okky Hendriansyah okky at nostratech.com
Thu Nov 19 14:39:34 UTC 2015


On November 19, 2015 at 00:55:41, Gerd Hoffmann (kraxel at redhat.com) wrote:
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. 


Hi Gerd,

Fantastic update, I just compiled and tried out this patch. It’s working alright, like you said initially the keyboard and mouse are owned by the guest. I didn’t felt any lag or so. Still testing though. 

However I cannot switch the keyboard and mouse back to the host while the guest is still running. What is the hotkey? Is it pressing both Ctrl keys together at the same time? Since I’ve already done that but nothing happens, both my keyboard and my mouse are still owned by the guest.

I was testing using the USB mouse and keyboard usually intended for the guest, and aside from switching back to the host, I think there is no issue. Currently my setup are 2 mouses (USB and PS/2) and 2 keyboards (both USB). Where I could find the PS/2 event device? 



This is my additional QEMU script lines:

# Input passthrough

OPTS="$OPTS -input-linux /dev/input/by-id/usb-Logitech_Gaming_Mouse_G502_1192346A3437-event-mouse"

OPTS="$OPTS -input-linux /dev/input/by-id/usb-04d9_USB_Keyboard-event-kbd”



This is the contents of my /dev/input/by-id

okky at freyja:~

[09:35 PM] $ ls -l /dev/input/by-id/

total 0

lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-04d9_USB_Keyboard-event-if01 -> ../event20

lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-04d9_USB_Keyboard-event-kbd -> ../event19

lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-event-mouse -> ../event17

lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-if01-event-kbd -> ../event18

lrwxrwxrwx 1 root root  9 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-mouse -> ../mouse1

lrwxrwxrwx 1 root root  9 Nov 19 20:44 usb-Microsoft_Microsoft_Basic_Optical_Mouse_v2.0-event-mouse -> ../event4

lrwxrwxrwx 1 root root  9 Nov 19 20:44 usb-Microsoft_Microsoft_Basic_Optical_Mouse_v2.0-mouse -> ../mouse0



Thank you.

-- 
Okky Hendriansyah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20151119/a2be7f04/attachment.htm>


More information about the vfio-users mailing list