USRP updated for fast USB access for Darwin/OSX

I finally finished off the second iteration of my fast USB code for
Darwin/OSX, tested it myself as well as had a few beta testers help
out, and it’s now been (thanks Eric!) incorporated into the USRP svn
repository. I checked out a fresh version this morning (May 2), and
everything compiles, installs, checks, and executes as desired for me
under X 10.4.6 on a Dual G4 @ 1.25 GHz w/ 1.75 GB DRAM.

For now, there is a “README_OSX” file in the …/usrp/host/lib/
directory which briefly comments on these changes. For now (again),
I would appreciate it if OSX users would check out their system’s
functionality with these changes; I highly recommend reading through
the README_OSX file and doing the tests it recommends. You don’t
have to “report back to me the results” of any tests unless you want
to (hint: on all systems I’ve tested, “41” is the magic number ;-).

These changes should work with LIBUSB versions 0.1.10a, 0.1.11, and
0.1.12 (the current release), but -please- report back to me if they
don’t compile for you for some reason. As LIBUSB is updated (with
release versions), I will keep the USRP/Darwin code updated as needed
to ensure functionality (hopefully in a timely manner).

Future Changes?

LIBUSB does not currently (0.1.12) offer true async bulk transfers
for Darwin. In order to allow the USRP to do these transfers, I
needed to write code which would work around LIBUSB’s limitations.
This means using LIBUSB functions and internals where necessary, much
like the USRP code does. My code, just like the USRP code, is
tightly integrated with LIBUSB (mine a little less tightly, but still
so), though I’ve tried to place all of the LIBUSB stuff in a separate
file (“darwin_libusb.h”) in order to make removing this dependence
easier in the future if the opportunity arises.

USB 2.0 throughput varies somewhat depending on your OS. Linux can
easily get > 32 Mega-Bytes/s (MBps) sustained bulk read or write.
Darwin can do 28-30 MBps (as I’ve implemented it, as recommended by
Apple). As far as I have tested, there is no way to improve the
throughput to 32+ MBps without moving into Darwin’s "port"s … a
kernel-level data transport method with a user/application layer for
USB-specific functions. Unfortunately, Apple’s documentation for
these "port"s is minimal; I have learned more from reading the Darwin
source code < > than by reading
Apple’s documents! Since I haven’t implemented these ports yet, I do
not know if they’ll provide the extra umph that Darwin needs, but
removing a layer of abstraction (CoreFoundation) can only improve

Unfortunately, in order to use Darwin’s ports, the USRP / USB
interface would need to be rewritten so that all USB calls go through
a common class (e.g. fusb). This common class would by default call
LIBUSB to do the work, but methods could be overridden if needed to
provide OS-specific functionality.

If anyone wants to tackle this issue, it would make a good project

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs