[vfio-users] Ongoing mouse issues

Alex Kretzschmar alexktz at gmail.com
Mon Nov 20 11:04:23 UTC 2017


To handle switching of my keyboard and mouse between host and guest I use
two binaries (which are just bash scripts) located in `/usr/bin/`... The
naming of these binaries is up to you of course but for me 'swin' = switch
to win and 'slin' = switch to linux. The downside of the 'slin' method is
that you might need to SSH using putty to the host from the guest to run it
(I do this currently). A simpler option would be a hardware USB switch in
my opinion but this method is quite elegant in it's simplicity.

[alex at zaphod ~]$ cat /usr/bin/swin
#!/bin/bash

# Hotplug USB devices to Windows
sudo virsh attach-device win10 /opt/usb-xmls/logi.xml
sudo virsh attach-device win10 /opt/usb-xmls/k70.xml

[alex at zaphod ~]$ cat /usr/bin/slin
#!/bin/bash

# Hot unplug USB devices to Windows
sudo virsh detach-device win10 /opt/usb-xmls/logi.xml
sudo virsh detach-device win10 /opt/usb-xmls/k70.xml

The contents of the .xml files is key here. One example is my k70 keyboard.

[alex at zaphod ~]$ cat /opt/usb-xmls/k70.xml
<hostdev mode='subsystem' type='usb'>
  <source>
    <vendor id='0x*1b1c*'/>
    <product id='0x*1b09*'/>
  </source>
</hostdev>

This is created via lsusb

Bus 002 Device 007: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 004: ID *1b1c*:*1b09* Corsair Vengeance K70R keyboard

Simply add *0x* as a prefix before the vendor ID and product ID and it
should 'just work'.

A full example is available here - http://rolandtapken.de/blog/
2011-04/how-auto-hotplug-usb-devices-libvirt-vms-update-1

On 20 November 2017 at 04:40, Samuel Holland <samuel at sholland.org> wrote:

> On 11/19/17 18:08, Patrick O'Callaghan wrote:
>
>>
>>
>> On 19 November 2017 at 23:13, Scott C <shewless at unleashed-web.org
>> <mailto:shewless at unleashed-web.org>> wrote:
>>
>> You can pass your existing USB devices back and forth between host and
>> guest with some commands. It’s been discussed on this mailing list before.
>>
>> It’s scriptable
>>
>>
>> I have a vague memory of that but can't seem to find it.
>>
>
> https://www.redhat.com/archives/vfio-users/2016-February/msg00110.html
> http://www.sholland.org/thoughts.html#2016-02-29
>
> Regards,
> Samuel
>
>
> _______________________________________________
> vfio-users mailing list
> vfio-users at redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users
>



-- 
Alex Kretzschmar
07796 863 373
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20171120/38de80a9/attachment.htm>


More information about the vfio-users mailing list