Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Mar 2002 09:47:18 -0700
From:      John Reynolds~ <jreynold@sedona.ch.intel.com>
To:        Alex <alex@matrixwide.com>
Cc:        <freebsd-stable@FreeBSD.ORG>
Subject:   Re: libusb-0.1.5 port compile problems
Message-ID:  <15494.18454.244848.263442@chlx169.ch.intel.com>
In-Reply-To: <Pine.BSO.4.33.0203052259430.436-100000@relic.matrixwide.com>
References:  <Pine.BSO.4.33.0203052259430.436-100000@relic.matrixwide.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[ On Tuesday, March 5, Alex wrote: ]
> 
> I can see how a few things have been renamed in sys/dev/usb/usb.h for the
> first few structures but I'm lost on the rest. Does anyone have a bsd.c
> that's already been fixed up so libusb will build?

Yes. I also sent out a 'mini heads up' to stable as I knew that libusb would
be broken for -stable as well. Unfortunately, Real Life(tm) has intruded its
ugly head again and I've had virtually no "geek time" to myself. My intent was
to get the code changed in libusb itself (using #ifdef's) though it makes the
code look a little ugly.

Another band-aid I was working on was making the libusb port "smart" so that
it applied a patch if osrel was high enough (Alfred kindly bumped osrel on
current and stable so I could determine if the system had the new structure
names). 

I don't see my free time "freeing up" in the near future, so I'm afraid that a
little hand-patching will be necessary for now. This patch out to at least
make libusb compile (I have *not* tested the resulting lib with my
applications yet). 

Directions: Put this entire patch into a new file called
"files/patch-libusb::bsd.c" within your ports/devel/libusb directory and then
the port makefiles should take care of the rest.

----------------------------- cut here ---------------------------------
--- bsd.orig    Sun Mar  3 09:58:41 2002
+++ bsd.c       Sun Mar  3 10:03:56 2002
@@ -151,8 +151,8 @@
   if (dev->interface < 0)
     USB_ERROR(-EINVAL);
 
-  intf.interface_index = dev->interface;
-  intf.alt_no = alternate;
+  intf.uai_interface_index = dev->interface;
+  intf.uai_alt_no = alternate;
 
   ret = ioctl(dev->fd, USB_SET_ALTINTERFACE, &intf);
   if (ret < 0)
@@ -284,14 +284,14 @@
     fprintf(stderr, "usb_control_msg: %d %d %d %d %p %d %d\n",
             requesttype, request, value, index, bytes, size, timeout);
 
-  req.request.bmRequestType = requesttype;
-  req.request.bRequest = request;
-  USETW(req.request.wValue, value);
-  USETW(req.request.wIndex, index);
-  USETW(req.request.wLength, size);
+  req.ucr_request.bmRequestType = requesttype;
+  req.ucr_request.bRequest = request;
+  USETW(req.ucr_request.wValue, value);
+  USETW(req.ucr_request.wIndex, index);
+  USETW(req.ucr_request.wLength, size);
 
-  req.data = bytes;
-  req.flags = 0;
+  req.ucr_data = bytes;
+  req.ucr_flags = 0;
 
   ret = ioctl(dev->fd, USB_SET_TIMEOUT, &timeout);
   if (ret < 0)
@@ -303,7 +303,7 @@
     USB_ERROR_STR(ret, "error sending control message: %s",
                   strerror(errno));
 
-  return UGETW(req.request.wLength);
+  return UGETW(req.ucr_request.wLength);
 }
 
 int usb_find_devices_on_bus(struct usb_bus *bus)
@@ -321,18 +321,18 @@
     struct usb_device *dev;
     char buf[20];
 
-    di.addr = device;
+    di.udi_addr = device;
     if (ioctl(cfd, USB_DEVICEINFO, &di) < 0)
       continue;
 
     /* There's a device; is it one we should mess with? */
 
-    if (strncmp(di.devnames[0], "ugen", 4) != 0)
+    if (strncmp(di.udi_devnames[0], "ugen", 4) != 0)
       /* best not to play with things we don't understand */
       continue;
 
 #if __FreeBSD__
-    snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.devnames[0]);
+    snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.udi_devnames[0]);
 #else
     snprintf(buf, sizeof(buf) - 1, "/dev/%s.00", di.devnames[0]);
 #endif
----------------------------- cut here ---------------------------------

-Jr

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|John Reynolds       Sr. Component Design Engineer - ICG/EID/Si Engineering |
|Intel Corporation   MS: CH6-210   Phone: 480-554-9092   pgr: 602-868-6512  |
|jreynold@sedona.ch.intel.com  http://www-aec.ch.intel.com/~jreynold/       |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15494.18454.244848.263442>