<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 01:09, Scott C <span dir="ltr"><<a href="mailto:shewless@unleashed-web.org" target="_blank">shewless@unleashed-web.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><a href="https://rokups.github.io/#!pages/full-software-kvm-switch.md" target="_blank">https://rokups.github.io/#!<wbr>pages/full-software-kvm-<wbr>switch.md</a><div><br></div><div>This one goes into a lot of detail. You can take it as is it just rip the parts you need. </div><div><br></div><div>In the past I setup my host to run sshd and I installed Cygwin on my guest so that it could ssh into my host to run the detach command when I wanted to give Control back to my host. <span class="HOEnZb"><font color="#888888"><br><br><div id="m_1655453629418327590AppleMailSignature">-Scott</div></font></span><div><div class="h5"><div><br>On Nov 19, 2017, at 7:08 PM, Patrick O'Callaghan <<a href="mailto:poc@usb.ve" target="_blank">poc@usb.ve</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 19 November 2017 at 23:13, Scott C <span dir="ltr"><<a href="mailto:shewless@unleashed-web.org" target="_blank">shewless@unleashed-web.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">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. <div><br></div><div>It’s scriptable <span class="m_1655453629418327590HOEnZb"></span></div></div></blockquote><div><br></div><div>I have a vague memory of that but can't seem to find it.</div><div><br></div><div>poc<br></div></div></div></div>
</div></blockquote></div></div></div></div><br>______________________________<wbr>_________________<br>
vfio-users mailing list<br>
<a href="mailto:vfio-users@redhat.com">vfio-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/vfio-users</a><br>
<br></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>