LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-25-2014, 09:31 AM   #1
insectiod
Member
 
Registered: Feb 2013
Posts: 34

Rep: Reputation: Disabled
Problem passing through usb devices in qemu


I'm running qemu without libvirt on slackware 14.1. I want to pass through a usb device from host to guest. I start the quest machine as root and add -usb. Typing info usbhost in guest monitor gives: USB host devices not supported.

Some tutorials mention looking at permissions in /proc/bus/usb/devices. But I only have /proc/bus/input and /proc/bus/pci. But lsusb works and shows my devices. Could this be related to my problem?

I have tried with both ubuntu and slackware as guests.

Versions:
Slackware 14.1 32 bit (host)
qemu 1.7.0
 
Old 01-26-2014, 04:24 PM   #2
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Rep: Reputation: 68
I use qemu without libvirt on Slackware as well. I use the following to connect to my HP printer from the guest:

Code:
      -usb -device usb-host,vendorid=0x03f0,productid=0x1312
It took me a while to find the syntax for using the vendorid and productid - instead of the hostbus and hostaddr which most online examples seem to use.

Coming back to your problem, I don't know how you installed qemu - but I used the SlackBuilds.org script. If you want to use usb redirection, you have to install first the usbredir package - than build qemu and the SBo build script will automatically enable usbredirection for qemu.

The usbredir package can be found here:

http://slackbuilds.org/repository/14...earch=usbredir

Otherwise, if you compile qemu by hand, you will have to install somehow the usbredir package first, and then pass --enable-usb-redir when configuring qemu.

Hope the above helps.

Last edited by xj25vm; 01-26-2014 at 04:25 PM.
 
1 members found this post helpful.
Old 01-27-2014, 06:32 PM   #3
insectiod
Member
 
Registered: Feb 2013
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks for helping out.

I tried uninstalling qemu, then building and installing usbredir-0.6, and then building and installing qemu-1.7.0, both from slackbuilds. info usbhost in guest monitor still gives: USB host devices not supported.

I also tried with the command line options suggested:
Code:
>>>qemu-system-i386 -usb -device usb-host,vendorid=0x0781,productid=0x5151 slack.vmdk
qemu-system-i386: -device usb-host,vendorid=0x0781,productid=0x5151: Parameter 'driver' expects device type
Maybe this is because I got the vendor or product id wrong. But either way I dont think thats the problem. I think the problem is that I somehow don't have usb support in qemu.

All I want is to pass through usb from host to guest. So I think that what I need is libusb, not usb-redir:
Code:
>>>./configure --help | grep usb
  --disable-libusb         disable libusb (for usb passthrough)
  --enable-libusb          enable libusb (for usb passthrough)
  --disable-usb-redir      disable usb network redirection support
  --enable-usb-redir       enable usb network redirection support
Trying to compile qemu manually I get this:
Code:
>>>./configure --target-list=i386-softmmu,x86_64-softmmu --enable-kvm --enable-libusb
ERROR: User requested feature libusb
       configure was not able to find it
But I have checked and libusb-1.0.9 is installed.
 
Old 01-28-2014, 03:31 AM   #4
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Rep: Reputation: 68
Hmm - yes, thinking about it libusb sounds the more likely candidate. I'm not really sure though why the config process can't find it. On the other hand, looking at my qemu.Slackbuild script, it looks like I didn't add --enable-libusb, so it must get enabled automatically if it finds libusb. Maybe somebody with a bit more experience of libraries/compilation issues could weigh in.

On my box, I get the following when searching for libusb, in case it helps:

Code:
# ls /var/log/packages/ | grep libusb
libusb-1.0.9-x86_64-1
libusb-compat-0.1.4-x86_64-1
 
1 members found this post helpful.
Old 01-28-2014, 07:28 AM   #5
insectiod
Member
 
Registered: Feb 2013
Posts: 34

Original Poster
Rep: Reputation: Disabled
I also have libusb-1.0.9.

It is strange because qemu 1.6.1 (and 1.7.0) have this line in configure:
Code:
if $pkg_config --atleast-version=1.0.13 libusb-1.0 >/dev/null 2>&1 ; then
If that returns false then libusb support is not added. But the latest version of libusb is 1.0.9. Not only for slackware, I couldn't even find a development version of libusb with version 1.0.13.

xj25vm, if you have the time could you check this. Goto the monitor prompt of any guest machine and run 'info usbhost' and post the result.

Did your version of qemu compile with libusb support? Post the output of:
Code:
grep libusb /tmp/SBo/qemu-1.6.1/config-host.mak
 
Old 01-28-2014, 11:46 AM   #6
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Maybe this helps

http://sourceforge.net/projects/libu...libusb-1.0.18/

enjoy
 
1 members found this post helpful.
Old 01-28-2014, 04:40 PM   #7
insectiod
Member
 
Registered: Feb 2013
Posts: 34

Original Poster
Rep: Reputation: Disabled
Ok, I got it working.

I switched to libusb-1.0.18 and then built qemu-1.7.0 using the slackbuild script. Started qemu with -usb option and now I can add usb devices in qemu monitor with usb_add. I also had to check permissions for the device I wanted to pass through in /dev/bus/usb/bus/port.
 
Old 01-29-2014, 03:11 AM   #8
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Rep: Reputation: 68
Great stuff. Glad it is working. It's strange that you needed libusb-1.0.18 as at least qemu 1.6.1 seems to be happy with libusb-1.0.9
 
Old 11-09-2014, 03:53 PM   #9
SpiderTux
Member
 
Registered: Sep 2009
Distribution: Slackware64 15
Posts: 32

Rep: Reputation: 17
Sorry for re-open this old thread.
I need "passing through usb devices in qemu" release 2.1.2
Reading this old thread and comments in slackbuilds.org qemu.SlackBuild:
http://slackbuilds.org/slackbuilds/1...emu.SlackBuild
#usb passthrough may fail since Slackware's libusb is too old.
# Slackware-14.1 ships with an ancient libusb. Check for updates to enable.

Are there known issues with last release (libusb-1.0.19)?
Lib is used in many other Slackware packages...
anyone have try it?
why has not been updated in a long time?

P.S. seems there is new site http://libusb.info/
 
  


Reply

Tags
qemu, slackware 14.1, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Passthrough Problem with KVM/QEMU on FC12 wdsnyc Linux - Virtualization and Cloud 1 02-23-2010 09:49 PM
Problem mounting USB devices aldend123 Linux - Hardware 3 06-07-2009 09:13 PM
Mounting USB Devices Problem NickViper1024 Linux - Newbie 7 10-18-2008 10:01 PM
Qemu can't locate /proc/bus/usb/devices [Zenwalk] POW R TOC H Linux - Newbie 1 10-05-2008 09:50 AM
Problem mount USB devices. jonostew Linux - Hardware 4 08-20-2004 12:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration