[vfio-users] Using input-linux in qemu-git; mouse works, but keyboard doesn't

Gerd Hoffmann kraxel at redhat.com
Wed Apr 13 13:08:43 UTC 2016


On Mi, 2016-04-13 at 07:21 +0000, Jonathan Scruggs wrote:
> Hi,
> 
> It took me awhile to figure out what was going on when I got my new
> keyboard. It turns out when you list all devices in by-id there were
> three entries for the keyboard. The third one was the keyboard part
> and the other ones were the macro keys.

Each physical usb device can have multiple functions, which are more or
less independent devices.  Those can be different hid functions.  My
wireless usb mouse comes with a receiver which looks like this:

nilsson root ~# lsinput -vs4
/dev/input/event4
   id   : 045e:0745, USB, v273
   phys : "usb-0000:00:14.0-1/input0"
   name : "Microsoft Microsoft® Nano Transceiver v2.0"
   KEY  : [ 143 codes ]
   MSC  : SCAN
   LED  : NUML CAPSL SCROLLL

nilsson root ~# lsinput -vs6
/dev/input/event6
   id   : 045e:0745, USB, v273
   phys : "usb-0000:00:14.0-1/input1"
   name : "Microsoft Microsoft® Nano Transceiver v2.0"
   KEY  : [ 126 codes ]
   REL  : X Y HWHEEL DIAL WHEEL MISC
   ABS  : VOLUME
   MSC  : SCAN

nilsson root ~# lsinput -vs7
/dev/input/event7
   id   : 045e:0745, USB, v273
   phys : "usb-0000:00:14.0-1/input2"
   name : "Microsoft Microsoft® Nano Transceiver v2.0"
   KEY  : [ 251 codes ]
   REL  : HWHEEL
   ABS  : [ 36 codes ]
   MSC  : SCAN

I guess they are using the same thing for all kinds of wireless input
devices as clearly only the second is a mouse.

But it can also be completely different things.  A webcam for example
can have a video device (obviously), a audio device (for the builtin
mic) and a hid device (for the record button).

> Gerd, would it possible to use the device as listed by lsusb (the user
> pass in the bus and port numbers so a small amount of detail) because
> it shows only one for the keyboard.

That is not so easy.  Also probably better to have upper management
layers (libvirt/virt-manager) handle that, they partly already have the
code needed to handle that (scan host device database).

> Also would it be possible to scan the keyboard details and pass that
> information through to the VM so the VM thinks that device is plugged
> into the USB port then we can use the software from the manufacturer
> to make the macro keys and special features work.  Then press both
> control keys to switch the device back and forth between guest and
> host?

You have the option to use usb device assignment of course, but then the
guest owns the device exclusively and therefore the host will not see
the hotkeys.

How do the macro keys work?  What special features you are missing?

cheers,
  Gerd







More information about the vfio-users mailing list