LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 05-31-2007, 07:48 PM   #1
xp_newbie
Member
 
Registered: Nov 2006
Posts: 86

Rep: Reputation: 16
How to "unclaim" USB device?


My configuration is as follows:
  1. Ubuntu 6.06
  2. VMware 5.5.4 build-44386
  3. Windows XP SP2 running as a virtual machine inside VMWare.
  4. ISSC Bluetooth USB dongle
It works - inside the Windows XP VM - but whenever I unplug and re-plug the USB dongle (or reboot the XP virtual machine), I get after a very long delay (minutes) the following message:
Quote:
The specified device appears to be claimed by another driver (hci_usb) on the host operating system which means that the device may be in use. To continue, the device will first be disconnected from its current driver.
Once I confirm this message box (press OK), all is well. However, this is very annoying since it significantly impacts my productivity (I need to reboot and plug/unplug frequently for a project I am working on).

As I understand it, this stems from VMWare attempting to grab the device (hci_usb) from Linux. I believe that if I tell Linux in some way to disown/release the device, those delays will be eliminated.

Here is some relevant info:
Code:
~> lsusb
Bus 002 Device 002: ID 2101:0201 ActionStar SIIG 4-to-2 Printer Switch
Bus 002 Device 001: ID 0000:0000  
Bus 005 Device 010: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter
Bus 005 Device 001: ID 0000:0000  
Bus 004 Device 001: ID 0000:0000  
Bus 003 Device 001: ID 0000:0000  
Bus 001 Device 001: ID 0000:0000
Code:
~> uname -r
2.6.15-28-686
Is there a way to tell Linux to NOT CLAIM hci_usb?

(without jeopardizing VMWare's chance of recognizing that the USB device is in, that is.)

If so, how do I do that?

Thanks!
Alex

P.S. This ISSC (Integrated System Solution Corp.) dongle is identified in the User's Manual as "BT Dongle-IS1002N Horus Module". In the Windows BlueSoleil software it is identified as IVT. In Ubuntu's Device Manager it is identified as KY-BT100 Bluetooth Adapter. This is soooooo confusing.
 
Old 05-31-2007, 10:28 PM   #2
Coldfire
LQ Newbie
 
Registered: May 2003
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 15
Interesting. Have you tried unmounting the device using the umount or eject commands before unplugging it or restarting the XP VM? You should do that anyways with external drives on Linux before unplugging them, as I am sure you know.

I've not a lot of experience running Windows in a VM on Linux, but it seems to me that Linux will still be mounting the filesystem and if you don't umount it you may run into issues with your VM "thinking" someone else owns it.
 
Old 06-01-2007, 05:49 AM   #3
mcummings
LQ Newbie
 
Registered: Oct 2006
Location: Fredericksburg, Va, USA
Distribution: Gentoo
Posts: 9

Rep: Reputation: 0
you've found vmware's hidden "feature"

Congratulations intrepid explorer, you've found a hidden feature in vmware that they claim doesn't exist - the inability to reattach a usb device a second time!

This bug was introduced sometime after the last vmware-4 release (so, as far as I've seen, >= vmware-5). The only way we've found to cleanly get around it, and this is not only hokey but only seems to work 90% of the time, is to unload and load the kernel module for usb support (iirc, its the uhci_hcd module). Your usual rmmod <kernel-mod> && modprobe <kernel-mod> should do the trick. If you're using a usb keyboard, i'd highly recommend that you do it in one line (literally, first command && second command ), otherwise you'll find yourself with an unloaded module and no way of typing in the command to load it

The boring details, as I recall so don't quote me, is that the first time you use the usb device, the kernel cedes controls over to vmware, but vmware fails to give the signal back saying its done with the device, use it as you will, so the kernel thinks the device is in use even after you stop (or unload the device) in vmware, and now vmware can't claim the device because the kernel says its already used. lovely, i know.
 
Old 06-01-2007, 05:51 AM   #4
xp_newbie
Member
 
Registered: Nov 2006
Posts: 86

Original Poster
Rep: Reputation: 16
Coldfire, thank you so much for your reply:
Quote:
Originally Posted by Coldfire
Interesting. Have you tried unmounting the device using the umount or eject commands before unplugging it or restarting the XP VM?
How I unmount this Bluetooth device?

Quote:
Originally Posted by Coldfire
You should do that anyways with external drives on Linux before unplugging them, as I am sure you know.
It's not an external drive, it's a Bluetooth radio. This is what makes me clueless about "unclaiming" it.

In the meanwhile I found a description of an interesting bug in #92111 in linux-source-2.6.20 (Ubuntu) which may provide a clue:

Quote:
After I boot. I have to reset the dongle using hciconfig hci0 reset to get it to scan and send or receive files.
I am not sure that what I am experiencing is "bug #92111", but is it possible that the answer to my original question is simply:
Code:
hciconfig hci0 reset
I am afraid to issue this command while working on my project, so I will try it as soon as the machine "becomes available" (or if an expert/guru can explain what this command does).

Thanks,
Alex
 
Old 06-01-2007, 09:16 AM   #5
Coldfire
LQ Newbie
 
Registered: May 2003
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 15
Sorry about the confusion there. Not unmounting a device before yanking it out can leave your system a little upset sometimes. My old ubuntu box used to get really cranky about it, using up /dev numbers as I unplugged and replugged USB non-drive accessories.

Good luck to you. If your hciconfig attempt doesn't work, try what mcummings suggests. Unloading a kernel module usually forces things to behave a little better.
 
Old 06-01-2007, 11:05 PM   #6
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
To tell the kernel to not load a module add "alias module_name off" to either /etc/modules.conf or /etc/modprobe.conf. If you do not want a certain brand and model to be used by Linux, add a line to udev scripts. udev scripts are cryptic so read the documentation thoroughly. I recommend backup the udev scripts before editing them.

Bluetooth dongles or Bluetooth transceivers works in Linux, so I do not know why you are using VMware. Using USB 2.0 devices with in VMware virtual machine running Windows 2000 and Windows XP can crash the virtual machine. If you use Windows 98 with USB 2.0 devices, the virtual machine will not crash. I have used a USB storage and USB scanner with out any problems in a virtual machine running Windows 98 and Linux under a Linux host. Now my scanner works with out any problems in Linux, so using VMware is getting useless for me.

The following message just means that a module is using the device. In order for the VMware virtual machine to take control, you have to unload the module. I suggest using modprobe -r hci_usb as root or sudo to unload the module.
Quote:
The specified device appears to be claimed by another driver (hci_usb) on the host operating system which means that the device may be in use. To continue, the device will first be disconnected from its current driver.
For the PCI ID or USB ID of the device, you can always send a bug report to kernel.org so they can provide a more accurate name for the desire device.

The following is the output of lsusb from my setup.
Code:
Bus 003 Device 001: ID 0000:0000  
Bus 002 Device 002: ID 03f0:0105 Hewlett-Packard ScanJet 4200c
Bus 002 Device 001: ID 0000:0000  
Bus 001 Device 002: ID 04f9:0021 Brother Industries, Ltd 
Bus 001 Device 001: ID 0000:0000
See you can tell that I have HP ScanJet 4200c, but can you tell what model of printer that I have. Though the model of my Brother printer shows up when doing cat /proc/bus/usb/devices which is the following listing.

Code:
T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.16-gentoo-r12 ohci_hcd
S:  Product=OHCI Host Controller
S:  SerialNumber=0000:03:08.1
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 3
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.16-gentoo-r12 ohci_hcd
S:  Product=OHCI Host Controller
S:  SerialNumber=0000:03:08.0
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=03f0 ProdID=0105 Rev= 1.00
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   1 Ivl=1ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 5
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.16-gentoo-r12 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=0000:03:08.2
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=04f9 ProdID=0021 Rev= 1.00
S:  Manufacturer=Brother
S:  Product=HL-5140
S:  SerialNumber=E6J191088
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=usblp
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I have not yet used Bluetooth, so I can not help you any further.
 
Old 01-13-2009, 07:13 AM   #7
tardyp
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
generic way to make linux kernel driver unclaim an interface

Here is a generic way to unclaim a usb device on linux 2.6.This is not implemented on virtualbox (dont know why), but it is on qemu.
You can use lsusb to know which BUS and DEVICE number put.
Code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/ioctl.h>
#include <linux/usbdevice_fs.h>

int main(int argc, char**argv)
{
        struct usbdevfs_ioctl command;
        int ret;
        int fd;
        int i;
        if (argc>1)
        {
                fd = open(argv[1],O_RDWR);
                if (fd<1){
                        perror("unable to open file");
                        return 1;
                }
                for (i=0;i<255;i++){ // hack: should fetch how many interface there is.
                        command.ifno = i;
                        command.ioctl_code = USBDEVFS_DISCONNECT;
                        command.data = NULL;
                        ret = ioctl(fd, USBDEVFS_IOCTL, &command);
                        if(ret!=-1)
                                printf("un claimed interface %d %d\n",i,ret);
                }
                //}
        }else
        {
                printf ("usage: %s /dev/bus/usb/BUS/DEVICE\n",argv[0]);
                printf("Release all interfaces of this usb device for usage in virtualisation\n");
        }
}

Last edited by tardyp; 01-13-2009 at 07:30 AM.
 
  


Reply


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 device stops working after a time" 'fix' stops cdrom device mount/readability adamben Slackware 6 04-18-2007 01:18 PM
"Unable to open USB device "usb://hp/LaserJet%201000": No such device" lordshipmayhem Mandriva 2 08-08-2004 04:56 PM
USB storage device works in 2.4 not 2.6 "no device error" critch Linux - Hardware 4 05-18-2004 11:13 AM
./MAKEDEV usb error - dont know hot to make device "usb" Zero-0-Effect Linux From Scratch 4 04-10-2004 07:09 PM


All times are GMT -5. The time now is 11:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration