<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>olivetalks &#187; usb passthrough</title>
	<atom:link href="http://www.olivetalks.com/tag/usb-passthrough/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.olivetalks.com</link>
	<description>The Olive has arrived and it has things to say…</description>
	<lastBuildDate>Tue, 16 Nov 2010 19:25:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>USB forwarding on Xen &#8211; it just does not work</title>
		<link>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/</link>
		<comments>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 13:59:41 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[fully virtualized]]></category>
		<category><![CDATA[paravirtualized]]></category>
		<category><![CDATA[pci passthrough]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[USB export]]></category>
		<category><![CDATA[usb passthrough]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[Xen guest]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/</guid>
		<description><![CDATA[Xen can forward individual USB devices to guest. Learn how to do it.]]></description>
			<content:encoded><![CDATA[<p>In <a href="/2008/01/24/usb-forwarding-on-xen/">one of my previous posts</a> I was writing about how I setup USB forwarding to a Xen guest by forwarding the whole USB controller. I used PCI pass-through method also known as PCI forwarding. I was able to see the USB controller and the USB device from the Xen guest.</p>
<p>Unfortunately the Xen guest was not stable. It would crash after half an hour, sometimes after two hours. I tried increasing the amount of RAM allocated to the guest, tried both paravirtualized and fully virtualized guests and the result was the same. The guest would crash.</p>
<p>I tried again to use <strong>USB forwarding</strong> and pass only a single USB device to the guest. After a few more attempts I noticed that I could &#8220;partially&#8221; forward the USB device itself to a fully virtualized guest (HVM) using this syntax:<br />
<code><br />
usb=1<br />
usbdevice="host:xxxx:yyyy"<br />
</code><br />
The values for xxxx and yyyy are the vendor ID and product ID for the USB device. They can be found out by using the <code>lsusb</code> command. For example on my laptop <code>lsusb</code> produces this output:<br />
<code><br />
Bus 007 Device 001: ID 0000:0000<br />
Bus 005 Device 003: ID 0b97:7772 O2 Micro, Inc.<br />
Bus 005 Device 002: ID 0b97:7761 O2 Micro, Inc.<br />
Bus 005 Device 001: ID 0000:0000<br />
Bus 004 Device 009: ID 062a:0000 Creative Labs<br />
Bus 004 Device 008: ID 413c:2002 Dell Computer Corp. SK-8125 Keyboard<br />
Bus 004 Device 007: ID 413c:1002 Dell Computer Corp. Keyboard Hub<br />
Bus 004 Device 001: ID 0000:0000<br />
Bus 003 Device 001: ID 0000:0000<br />
Bus 006 Device 001: ID 0000:0000<br />
Bus 002 Device 001: ID 0000:0000<br />
Bus 001 Device 001: ID 0000:0000<br />
</code><br />
So if I wanted to forward the device <em>Dell Computer Corp. SK-8125 Keyboard</em> I&#8217;d put the following in the Xen guest configuration file:<br />
<code><br />
usb=1<br />
usbdevice="host:413c:2002"<br />
</code></p>
<p>Ok, so in theory this should have let me see the USB device in Xen guest. Well it did, kind of. One thing I noticed was that I was only able to see some output when running <code>lsusb</code> on the guest when the guest was started from command line using the <code>xm create</code> command. When starting the guest from Virtual Machine Manager GUI I&#8217;d see absolutely no USB devices in the guest. Second, even when starting the guest from command line I&#8217;d see this kind of output from <code>lsusb</code>:<br />
<code><br />
Bus 001 Device 001: ID 0000:0000<br />
</code><br />
So it looks like something was being forwarded to the guest but it wasn&#8217;t the device I wanted to export. It looks like <strong>USB pass-through</strong> works on Xen only with some USB devices. That matches with what I&#8217;ve read at <a href="http://xgu.ru/wiki/USB_%D0%B2_Xen">xgu.ru</a>.</p>
<p>The final result &#8211; at the moment I&#8217;m using the USB device from the physical host. At least until I have time to look at it again.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/" title="USB forwarding on Xen">USB forwarding on Xen (1)</a></li><li><a href="http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion in seven simple steps">Xen p2v conversion in seven simple steps (1)</a></li><li><a href="http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/" title="USB in Xen &#8211; how to make it work">USB in Xen &#8211; how to make it work (0)</a></li><li><a href="http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/" title="Xen and CentOS 5.1 on PowerEdge 2950">Xen and CentOS 5.1 on PowerEdge 2950 (2)</a></li><li><a href="http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/" title="How to Xenify office servers">How to Xenify office servers (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>USB forwarding on Xen</title>
		<link>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/</link>
		<comments>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 22:00:11 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[pci passthrough]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[USB export]]></category>
		<category><![CDATA[usb passthrough]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[Xen guest]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/</guid>
		<description><![CDATA[Xen can forward USB ports to guest by PCI forwarding the whole controller. Learn how to do it.]]></description>
			<content:encoded><![CDATA[<p>Recently I was setting up a Xen guest which needed access to a USB port on a CentOS 5.1 host. I searched the Internet for instructions on how to use <strong>USB forwarding</strong> or <strong>USB pass-through</strong>  but I was not able to find anything which would work on the Xen 3.0.3 I&#8217;m using. I decided to set up <strong>PCI pass-through</strong> instead.</p>
<p>To set it up, I followed instructions written by Jón Fairbairn at <a href="http://wiki.xensource.com/xenwiki/Assign_hardware_to_DomU_with_PCIBack_as_module">xensource.com</a>. The <em>pciback</em> module in the CentOS 5.1 kernel doesn&#8217;t support the <em>hide</em> parameter so I left that out from my setup. It doesn&#8217;t seem to be necessary, anyway, for the driver for the USB controller in the host can be unbound from the PCI slot used by the controller.</p>
<p>To make sure the PCI slot is exported to Xen guests when the host system boots I created a <em>xenpciexport</em> script and placed it in the <em>/etc/init.d/</em> directory. You can download the code from here <a href="http://www.olivetalks.com/wp-content/uploads/2008/01/xenpciexport.txt" title="xenpciexport.txt">xenpciexport.txt</a></p>
<p>The script <em>xenpciexport</em> is set up to start before <em>xend</em> and <em>xendomains</em> to make sure the PCI forwarding is working before any guest is running. It stops after <em>xend</em> and <em>xendomains</em>. That&#8217;s controlled by the line:</p>
<p><code># chkconfig: 2345 97 02</code></p>
<p>you can see in the script header.</p>
<p>After copying the file to <em>/etc/init.d</em> you need to run</p>
<p><code>chkconfig --add xenpciexport</code></p>
<p>to create the appropriate links in the <em>/etc/rc*.d/</em> directories.</p>
<p>To find out the slot number for the USB controller use <em>lspci</em> and <em>lsusb</em> commands. If the script is set up correctly you can plug in the USB device and run</p>
<p><code>service xenpciexport stop</code></p>
<p>After that the results of <em>lsusb</em> should include the USB device you want to export. Then run</p>
<p><code>service xenpciexport start</code></p>
<p>and now <em>lsusb</em> won&#8217;t show this device anymore &#8211; it&#8217;s hidden from the host and visible to Xen guests.</p>
<p>Before you start the Xen guest which is supposed to have access to the exported device add this line to its configuration file:</p>
<p><code>pci = [ '0000:00:1d.1' ]</code></p>
<p>The number in quotes must be the same as the <em>SLOT</em> variable in the <em>xenpciexport</em> script.</p>
<p>After that you need to patch your Xen installation. The version installed in CentOS 5.1 contains a bug which makes it impossible to use PCI pass-through. The fix can be found at <a href="http://bugs.centos.org/view.php?id=2485">CentOS Bug Tracker</a>. Make sure you also fix the file <em>pciif.py</em> as specified in the note. In total there are three files which need to be edited: <em>iopif.py</em>, <em>irqif.py</em> and <em>pciif.py</em>.</p>
<p>Now you can finally start the Xen guest. When it finishes booting log into it and run <em>lsusb</em> there to confirm that the device is visible to the guest. <em>lspci</em> in the guest should also show you the USB controller. It is important to run the <em>xenpciexport</em> script before you start your guest, otherwise the USB device will not be visible to the guest OS.</p>
<p>The Xen guest has now full access to the USB device.</p>
<p>Here you can read more about <a href="http://www.wlug.org.nz/XenPciPassthrough" title="XenPciPassthrough">PCI passthrough on Xen</a>.</p>
<p><em><strong>Update:</strong></em><br />
It turns out that this setup was causing the Xen guest to crash. You can read more in a <a href="/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/">new post</a>.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/" title="USB forwarding on Xen &#8211; it just does not work">USB forwarding on Xen &#8211; it just does not work (6)</a></li><li><a href="http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion in seven simple steps">Xen p2v conversion in seven simple steps (1)</a></li><li><a href="http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/" title="Xen and CentOS 5.1 on PowerEdge 2950">Xen and CentOS 5.1 on PowerEdge 2950 (2)</a></li><li><a href="http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/" title="USB in Xen &#8211; how to make it work">USB in Xen &#8211; how to make it work (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

