discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] anyone else having trouble compiling fusb_linux.c


From: Larry Doolittle
Subject: Re: [Discuss-gnuradio] anyone else having trouble compiling fusb_linux.cc?
Date: Thu, 8 Sep 2005 11:04:33 -0700
User-agent: Mutt/1.5.10i

I asked -

> Something about debian sid broke compilation of fusb_linux.cc
> badly.  My guess is that something subtle but important changed
> about the kernel/user header boundary. [chop]
> I'm researching the problem now, but would appreciate any hints
> from people who have already seen this.  It works fine in debian
> sarge.

I have my code compiling, but it required major surgery.
I haven't tested its operation yet, but I'm optimistic.

The libusb folks maintain a libusb/linux.h that parallels
the kernel-space linux/usbdevice_fs.h, but is designed to
be used by user-space programs.  So I grabbed a copy of
that (and called it libusb_linux.h), and #include it instead.
Then I had to work around differences in name space.  My quick
hack added a half-dozen #defines to fusb_linux.cc.  A proper
renaming in fusb_linux.h and fusb_linux.cc would touch 61 lines.

Complete patch appended.  Comments?

      - Larry


--- /home/ldoolitt/cvs/usrp/host/lib/fusb_linux.cc      2005-09-08 
08:34:57.000000000 -0700
+++ fusb_linux.cc       2005-09-08 10:57:50.000000000 -0700
@@ -24,11 +24,20 @@
 #include "config.h"
 #endif
 
+#define usbdevfs_urb usb_urb
+#define USBDEVFS_URB_TYPE_BULK  USB_URB_TYPE_BULK
+#define USBDEVFS_SUBMITURB      IOCTL_USB_SUBMITURB
+#define USBDEVFS_DISCARDURB     IOCTL_USB_DISCARDURB
+#define USBDEVFS_REAPURB        IOCTL_USB_REAPURB
+#define USBDEVFS_REAPURBNDELAY  IOCTL_USB_REAPURBNDELAY
+
 #include <fusb_linux.h>
 #include <usb.h>               // libusb header
 #include <stdexcept>
 #include <linux/compiler.h>
-#include <linux/usbdevice_fs.h>        // interface to kernel portion of user 
mode usb driver
+// #include <linux/usbdevice_fs.h>     // interface to kernel portion of user 
mode usb driver
+#include <sys/types.h>
+#include "libusb_linux.h"
 #include <sys/ioctl.h>
 #include <assert.h>
 #include <string.h>
@@ -403,7 +412,7 @@
   }
 
   if (d_free_list.size () != (unsigned) d_nblocks)
-    fprintf (stderr, "d_free_list.size () = %d, d_nblocks = %d\n",
+    fprintf (stderr, "d_free_list.size () = %zd, d_nblocks = %d\n",
             d_free_list.size (), d_nblocks);
     
   assert (d_free_list.size () == (unsigned) d_nblocks);

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]