Internal error message from usrp_prims.cc

Well, hacking the hack so the code compiles still gets me the internal
error message. Does anyone understand what this code is trying to do?
Can I just remove these tests? I’m trying to get the usrp code running
with the development version of libusb.

static struct usb_dev_handle *
usrp_open_interface (struct usb_device *dev, int interface, int
altinterface)
{
struct usb_dev_handle *udh = usb_open (dev);
if (udh == 0)
return 0;

if (dev != dev_handle_to_dev (udh)){
fprintf (stderr, “%s:%d: internal error!\n”, FILE, LINE);
abort ();
}

Philip

On Sat, Jul 12, 2008 at 09:36:27AM -0400, Philip B. wrote:

return 0;

if (dev != dev_handle_to_dev (udh)){
fprintf (stderr, “%s:%d: internal error!\n”, FILE, LINE);
abort ();
}

Philip

Hi Philip,

This code is checking (in a rather primitive way) if the structure is
laid out in the way that we think it’s laid out in. At least last
time I looked (> 1 yr ago), libusb didn’t install usbi.h (or something
like that). We need a way to retrieve the device handle give a
device. It’s stored in the opaque usb_dev_handle. Thus the kludge to
retrieve it. We also assume, some place else in the code, that the
file descriptor is stored in the first word of some opaque structure.

These kludges could be cleaned up if libusb either exported accessors
to fetch the values or installed usbi.h

Eric

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