<div dir="ltr"><div dir="auto" style="font-size:12.8px">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.</div><div dir="auto" style="font-size:12.8px"><br></div><div dir="auto" style="font-size:12.8px"><div dir="auto"><font face="monospace, monospace">[alex@zaphod ~]$ cat /usr/bin/swin</font></div><div dir="auto"><font face="monospace, monospace">#!/bin/bash</font></div><div dir="auto"><font face="monospace, monospace"><br></font></div><div dir="auto"><font face="monospace, monospace"># Hotplug USB devices to Windows</font></div><div dir="auto"><font face="monospace, monospace">sudo virsh attach-device win10 /opt/usb-xmls/logi.xml</font></div><div dir="auto"><font face="monospace, monospace">sudo virsh attach-device win10 /opt/usb-xmls/k70.xml</font></div><div dir="auto"><font face="monospace, monospace"><br></font></div><div dir="auto"><div dir="auto"><font face="monospace, monospace">[alex@zaphod ~]$ cat /usr/bin/slin</font></div><div dir="auto"><font face="monospace, monospace">#!/bin/bash</font></div><div dir="auto"><font face="monospace, monospace"><br></font></div><div dir="auto"><font face="monospace, monospace"># Hot unplug USB devices to Windows</font></div><div dir="auto"><font face="monospace, monospace">sudo virsh detach-device win10 /opt/usb-xmls/logi.xml</font></div><div dir="auto"><font face="monospace, monospace">sudo virsh detach-device win10 /opt/usb-xmls/k70.xml</font></div></div></div><div class="gmail_extra" style="font-size:12.8px"><br></div><div class="gmail_extra" style="font-size:12.8px">The contents of the .xml files is key here. One example is my k70 keyboard.</div><div class="gmail_extra" style="font-size:12.8px"><br></div><div class="gmail_extra" style="font-size:12.8px"><div class="gmail_extra"><font face="monospace, monospace">[alex@zaphod ~]$ cat /opt/usb-xmls/k70.xml</font></div><div class="gmail_extra"><font face="monospace, monospace"><hostdev mode='subsystem' type='usb'></font></div><div class="gmail_extra"><font face="monospace, monospace">  <source></font></div><div class="gmail_extra"><font face="monospace, monospace">    <vendor id='0x<b>1b1c</b>'/></font></div><div class="gmail_extra"><font face="monospace, monospace">    <product id='0x<b>1b09</b>'/></font></div><div class="gmail_extra"><font face="monospace, monospace">  </source></font></div><div class="gmail_extra"><font face="monospace, monospace"></hostdev></font></div><div class="gmail_extra"><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif">This is created via </font><font face="monospace, monospace">lsusb</font></div><div class="gmail_extra"><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><div class="gmail_extra" style="font-family:monospace,monospace">Bus 002 Device 007: ID 046d:c52b Logitech, Inc. Unifying Receiver</div><div class="gmail_extra" style="font-family:monospace,monospace">Bus 002 Device 004: ID <b>1b1c</b>:<b>1b09</b> Corsair Vengeance K70R keyboard</div><div class="gmail_extra" style="font-family:monospace,monospace"><br></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif">Simply add </font><font face="monospace, monospace"><b>0x</b></font><font face="arial, helvetica, sans-serif"> as a prefix before the vendor ID and product ID and it should 'just work'.</font></div></div><div class="gmail_extra"><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif">A full example is available here - <a href="http://rolandtapken.de/blog/2011-04/how-auto-hotplug-usb-devices-libvirt-vms-update-1" target="_blank">http://rolandtapken.de/blog/<wbr>2011-04/how-auto-hotplug-usb-<wbr>devices-libvirt-vms-update-1</a></font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 November 2017 at 04:40, Samuel Holland <span dir="ltr"><<a href="mailto:samuel@sholland.org" target="_blank">samuel@sholland.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 11/19/17 18:08, Patrick O'Callaghan wrote:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On 19 November 2017 at 23:13, Scott C <<a href="mailto:shewless@unleashed-web.org" target="_blank">shewless@unleashed-web.org</a> <mailto:<a href="mailto:shewless@unleashed-web.org" target="_blank">shewless@unleashed-web<wbr>.org</a>>> wrote:<br>
<br>
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.<br>
<br>
It’s scriptable<br>
<br>
<br>
I have a vague memory of that but can't seem to find it.<br>
</blockquote>
<br>
</span><a href="https://www.redhat.com/archives/vfio-users/2016-February/msg00110.html" rel="noreferrer" target="_blank">https://www.redhat.com/archive<wbr>s/vfio-users/2016-February/<wbr>msg00110.html</a><br>
<a href="http://www.sholland.org/thoughts.html#2016-02-29" rel="noreferrer" target="_blank">http://www.sholland.org/though<wbr>ts.html#2016-02-29</a><br>
<br>
Regards,<br>
Samuel<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
vfio-users mailing list<br>
<a href="mailto:vfio-users@redhat.com" target="_blank">vfio-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/vfio-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Alex Kretzschmar<br>07796 863 373</div>
</div>