{"id":20,"date":"2014-06-14T00:20:14","date_gmt":"2014-06-13T22:20:14","guid":{"rendered":"http:\/\/www.depieri.net\/?p=20"},"modified":"2014-06-14T00:20:14","modified_gmt":"2014-06-13T22:20:14","slug":"connect-usb-hardware-to-kvm","status":"publish","type":"post","link":"https:\/\/www.depieri.net\/?p=20","title":{"rendered":"connect usb hardware to kvm"},"content":{"rendered":"<p>Since I&#8217;ve found really few documentation on connecting usb devices to kvm virtual machine without middle software like spice or libvirt I&#8217;ll post what I found here.<\/p>\n<p>&nbsp;<\/p>\n<p>I&#8217;ve found two method but only the 2nd work with usb2serial adapter.<\/p>\n<p>[enlighter lang=&#8221;shell&#8221;]<br \/>\nUSBVIDPID=0403:6001<br \/>\nUSBD=&#8221;&#8221;<br \/>\nfor line in $(lsusb | grep $USBVIDPID | sed -n &#8220;s\/Bus 0*\\([0-9]*\\) Device 0*\\([0-9]*\\).*\/-device usb-host,hostbus=\\\\1,hostaddr=\\\\2\/p&#8221;)<br \/>\ndo<br \/>\nUSBD=&#8221;$USBD $line&#8221;<br \/>\ndone<br \/>\n[\/enlighter]<\/p>\n<p>[enlighter lang=&#8221;shell&#8221;]<br \/>\nUSBVIDPID=0403:6001<br \/>\ncnt=0<br \/>\nUSBD=&#8221;&#8221;<br \/>\nkillall usbredirserver<br \/>\nfor line in $(lsusb | grep $USBVIDPID | sed -n &#8220;s\/Bus 0*\\([0-9]*\\) Device 0*\\([0-9]*\\).*\/\\\\1-\\\\2\/p&#8221;)<br \/>\ndo<br \/>\n\/usr\/sbin\/usbredirserver -p $(( 4000 + $cnt )) $line &gt;\/var\/log\/kvm\/${NAME}-usb-$line.log 2&gt;&amp;1 &amp;<br \/>\nUSBD=&#8221;$USBD -chardev socket,id=usbredirchardev${cnt},host=localhost,port=$(( 4000 + $cnt )) \\<br \/>\n-device usb-redir,chardev=usbredirchardev${cnt},id=usbredirdev${cnt},debug=3&#8243; #,bus=ehci.0,<br \/>\nlet cnt=cnt+1<br \/>\ndone<br \/>\n[\/enlighter]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since I&#8217;ve found really few documentation on connecting usb devices to kvm virtual machine without middle software like spice or libvirt I&#8217;ll post what I found here. &nbsp; I&#8217;ve found two method but only the 2nd work with usb2serial adapter. [enlighter lang=&#8221;shell&#8221;] USBVIDPID=0403:6001 USBD=&#8221;&#8221; for line in $(lsusb | grep $USBVIDPID | sed -n &#8220;s\/Bus &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.depieri.net\/?p=20\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;connect usb hardware to kvm&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-programming","entry"],"_links":{"self":[{"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.depieri.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20"}],"version-history":[{"count":8,"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/www.depieri.net\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/www.depieri.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.depieri.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.depieri.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}