osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: device not opened for exclusive access? -
msg#00058

List: lib.libusb.devel.general

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

> From: Kevin Horton <khorton01@xxxxx> - 2006-11-03 14:29
> For the archives, for the next time that someone has a similar problem:
>
> The pointer to kernel extensions was the clue that I needed. I tried
> moving the AppleUSBCDCACMData kernel extension aside, rebuilding the
> kernel cache and restarting, but that did not solve the problem.
> Then I moved the whole IOUSBFamily.kext aside, as I couldn't think of
> anything else that could need it, rebuilt the cache and restarted -
> big mistake, as I discovered that my USB keyboard and mouse were
> dead. ssh and VNC saved the day.

> I used kextunload to unload the kext after I plugged in the GPS -
> "sudo kextunload AppleUSBCDC.kext ", and now python can claim the
> interface to the GPS.

Since I've come across the problem as well, and now spent a few
days tracking down a reasonable solution, I thought I'd better
add it to the mail archive.

Possible solutions are:

Use the class interface these drivers create instead of Libusb
(ie. typically serial, modem etc. interface). This then looses a lot
of the portability advantage of Libusb.

Write an OS X kernel driver to driver the device, and don't use Libusb
(could be a lot of OS X specific work).

Manually unloading the offending driver may work, although
with AppleUSBCDC there are a lot of bits to it, and it will
probably break any device that you do want this driver to operate with.

The solution I've used is to implement a codeless kernel extension.
This effectively uses an existing driver to claim the particuar device,
by adding another personality to it, preventing the class drivers from
claiming it.

Basically you create this minimum extension by (somewhere convenient)
creating an extension directory :- ie. LibusbSheild.kext,
and creating in it one file called Info.plist, containing the following:

----------------- cut here ---------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleGetInfoString</key> <string>Libusb USB device
Shield</string>
<key>CFBundleIdentifier</key> <string>com.libusb.USB_Shield</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleName</key> <string>Libusb USB device Shield</string>
<key>CFBundlePackageType</key> <string>KEXT</string>
<key>CFBundleSignature</key> <string>????</string>
<key>CFBundleVersion</key> <string>6.0</string>
<key>IOKitPersonalities</key>
<dict>
<key>HCFR</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBComposite</string>
<key>IOClass</key> <string>AppleUSBComposite</string>
<key>IOProviderClass</key> <string>IOUSBDevice</string>
<key>idVendor</key> <integer>1243</integer>
<key>idProduct</key> <integer>91</integer>
</dict>
</dict>
<key>OSBundleCompatibleVersion</key> <string>1.8</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kernel.iokit</key> <string>6.0</string>
</dict>
</dict>
</plist>
----------------- cut here ---------------------

The device I'm protecting is called "HCFR", but you can expand the
personalities list with a number of devices if you want to, giving each
a different name, and setting the vendor and product id's appropriately.

You then need to install it by using:

sudo cp -R LibusbSheild.kext /System/Library/Extensions

supplying the appropriate root password when prompted.

You can test if you've setup the extension correctly
by using:

sudo kextload -n -t /System/Library/Extensions/LibusbSheild.kext

and then reboot the system to activate the extension.

Hope this is useful to someone,

Graeme Gill.




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Thread at a glance:

Previous Message by Date:

Re: Loop with usb_bulk_read()

Everyone, Success story here. Just changed some logic in the FPGA, and was able to transfer 2GB of data at 27 MB/sec. Nothing but bliss at work today. Next thing is to get to 2 devices transferring around 13.5MB/ sec on the same hub. > That doesn't make sense. I'd suspect a firmware problem. Is this an > FX2-based device? Unfortunately yes. Thanks everyone for their help. Lloyd On Jan 24, 2007, at 10:31 AM, Tim Roberts wrote: > Lloyd Rochester wrote: >> It does make sense I am getting a timeout error because there are 2 >> bytes in the endpoint. > > What doesn't make sense is that you have 2 bytes left in your > endpoint. > Is there a way for you to verify that the packets you get back are > all full? > >> For a 512 byte packet to be committed it >> lacks 510 bytes, and the FPGA will not fill the endpoint because >> there are 2 bytes left in the buffer, thus, it is not empty. So the >> endpoint can neither be emptied or filled. >> > > Yes, it's usually better to design your buffering so that this can't > happen. If your FPGA was shoving in packets of 1024 bytes into a 2048 > byte FIFO, for example, then this wouldn't have happened. Of > course, if > you are getting off by 2 bytes somewhere, you'll still get bad data. > >> I can make this problem happen more quickly if I request say 512*10 >> bytes from usb_bulk_read() which will ultimately lead to a timeout >> error as well because of the 2 byte issue, and I can make the error >> happen less quickly if I call usb_bulk_read() with 512 bytes and >> insert a for loop that does nothing but a delay. The fpga fills the >> endpoint as fast the the host can empty it. >> > > That doesn't make sense. I'd suspect a firmware problem. Is this an > FX2-based device? > > -- > Tim Roberts, timr@xxxxxxxxx > Providenza & Boekelheide, Inc. > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Libusb-devel mailing list > Libusb-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/libusb-devel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Next Message by Date:

OS X Libusb Multithread safe ?

I seem to have an issue with Libusb not coping with simultaneous reads on OS X. I've got a device that basically requires that it have a thread that does a read with a long timeout to one end point, so that the user can signal back (by completing the read when a button is pressed), while normal read/write operations happen on other end points. If the read is not pending, the device has all sorts of internal 1-2 second delays that adversely affect the devices operation. Mostly this works fine, but if one of the normal ports reads times out rather than returning normally, Libusb crashes somewhere in the thread's pending read. This is with Libusb 0.1.12. I expect to get timeouts on some operations, since this is the only way of determining the end of a device determined length stream of data (the device returns a zero length read, but I don't think there's any way of recognizing this with Libusb, other than timing out). Has this been fixes somewhere, or does someone have an idea what needs fixing in the darwin part of Libusb ? thanks, Graeme Gill. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Previous Message by Thread:

gphoto2 on MacOSX with a Nikon Coolpix 5400 - libusb problem?

Hi list, I've got a problem with my digital camera on MacOSX. After gphoto2 closes the connection with the device, it cannot be found by the system anymore. Also the hub it has been connected to will need a reset. But all of this is true even without a hub. I've but captures of debugging output (USB_DEBUG set to 255) on my webserver at http:// www.tux4web.de/usb1.txt and http://tux4web.de/my-logfile.txt, the later being gphoto2's output. Everything works fine under Linux. I'd appreciate any idea how to get this working :-) Cheers Diedrich ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Next Message by Thread:

OS X Libusb Multithread safe ?

I seem to have an issue with Libusb not coping with simultaneous reads on OS X. I've got a device that basically requires that it have a thread that does a read with a long timeout to one end point, so that the user can signal back (by completing the read when a button is pressed), while normal read/write operations happen on other end points. If the read is not pending, the device has all sorts of internal 1-2 second delays that adversely affect the devices operation. Mostly this works fine, but if one of the normal ports reads times out rather than returning normally, Libusb crashes somewhere in the thread's pending read. This is with Libusb 0.1.12. I expect to get timeouts on some operations, since this is the only way of determining the end of a device determined length stream of data (the device returns a zero length read, but I don't think there's any way of recognizing this with Libusb, other than timing out). Has this been fixes somewhere, or does someone have an idea what needs fixing in the darwin part of Libusb ? thanks, Graeme Gill. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!