<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">On November 19, 2015 at 00:55:41, Gerd Hoffmann (<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>) wrote:</div> <div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span><div><div></div><div>This patch adds support for reading input events directly from linux<span class="Apple-converted-space"> </span><br>evdev devices and forward them to the guest. Unlike virtio-input-host<span class="Apple-converted-space"> </span><br>which simply passes on all events to the guest without looking at them<span class="Apple-converted-space"> </span><br>this will interpret the events and feed them into the qemu input<span class="Apple-converted-space"> </span><br>subsystem.<span class="Apple-converted-space"> </span><br><br>Therefore this is limited to what the qemu input subsystem and the<span class="Apple-converted-space"> </span><br>emulated input devices are able to handle. Also there is no support for<span class="Apple-converted-space"> </span><br>absolute coordinates (tablet/touchscreen). So we are talking here about<span class="Apple-converted-space"> </span><br>basic mouse and keyboard support.<span class="Apple-converted-space"> </span><br><br>The advantage is that it'll work without virtio-input drivers in the<span class="Apple-converted-space"> </span><br>guest, the events are delivered to the usual ps/2 or usb input devices<span class="Apple-converted-space"> </span><br>(depending on what the machine happens to have). And for keyboards<span class="Apple-converted-space"> </span><br>qemu is able to switch the keyboard between guest and host on hotkey.<span class="Apple-converted-space"> </span><br>The hotkey is hard-coded for now (both control keys), initialy the<span class="Apple-converted-space"> </span><br>guest owns the keyboard.<span class="Apple-converted-space"> </span><br><br>Probably most useful when assigning vga devices with vfio and using a<span class="Apple-converted-space"> </span><br>physical monitor instead of vnc/spice/gtk as guest display.<span class="Apple-converted-space"> </span><br><br>Usage: Add '-input-linux /dev/input/event<nr>' to the qemu command<span class="Apple-converted-space"> </span><br>line. Note that udev has rules which populate /dev/input/by-{id,path}<span class="Apple-converted-space"> </span><br>with static names, which might be more convinient to use.<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p><br></p><p>Hi Gerd,</p><p>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. </p><p>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.</p><p>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? </p><p><br></p><p>This is my additional QEMU script lines:</p><p><font face="Courier"># Input passthrough</font></p><p><font face="Courier">OPTS="$OPTS -input-linux /dev/input/by-id/usb-Logitech_Gaming_Mouse_G502_1192346A3437-event-mouse"</font></p><p><font face="Courier">OPTS="$OPTS -input-linux /dev/input/by-id/usb-04d9_USB_Keyboard-event-kbd”</font></p><p><br></p><p>This is the contents of my /dev/input/by-id</p><p><font face="Courier">okky@freyja:~</font></p><p><font face="Courier">[09:35 PM] $ ls -l /dev/input/by-id/</font></p><p><font face="Courier">total 0</font></p><p><font face="Courier">lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-04d9_USB_Keyboard-event-if01 -> ../event20</font></p><p><font face="Courier">lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-04d9_USB_Keyboard-event-kbd -> ../event19</font></p><p><font face="Courier">lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-event-mouse -> ../event17</font></p><p><font face="Courier">lrwxrwxrwx 1 root root 10 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-if01-event-kbd -> ../event18</font></p><p><font face="Courier">lrwxrwxrwx 1 root root  9 Nov 19 21:15 usb-Logitech_Gaming_Mouse_G502_1192346A3437-mouse -> ../mouse1</font></p><p><font face="Courier">lrwxrwxrwx 1 root root  9 Nov 19 20:44 usb-Microsoft_Microsoft_Basic_Optical_Mouse_v2.0-event-mouse -> ../event4</font></p><p><font face="Courier">lrwxrwxrwx 1 root root  9 Nov 19 20:44 usb-Microsoft_Microsoft_Basic_Optical_Mouse_v2.0-mouse -> ../mouse0</font></p><p><br></p><p>Thank you.</p><p><font face="helvetica, arial">-- </font><br><span data-mce-style="orphans: 2; text-align: -webkit-auto; widows: 2; background-color: #ffffff; color: #020103; font-family: 'Times New Roman', serif;" style="color: rgb(2, 1, 3);"><font face="Calibri"><b>Okky Hendriansyah</b></font></span></p></body></html>