diff options
author | veego <veego@pkgsrc.org> | 2002-03-03 15:22:28 +0000 |
---|---|---|
committer | veego <veego@pkgsrc.org> | 2002-03-03 15:22:28 +0000 |
commit | 8904212a03d528143ca39a6ab2abc8124d778851 (patch) | |
tree | d4a324c8077308882f9344ccce5e795feeccd682 /devel | |
parent | c33c399381e13ceb14d13283da8ed1726adf78da (diff) | |
download | pkgsrc-8904212a03d528143ca39a6ab2abc8124d778851.tar.gz |
Patch to build it on -current systems after the renaming in usb.h.
Use the same logic as in usbutil.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/libusb/patches/patch-ad | 119 |
1 files changed, 98 insertions, 21 deletions
diff --git a/devel/libusb/patches/patch-ad b/devel/libusb/patches/patch-ad index af34c2fa8e0..d0c08cf2d3f 100644 --- a/devel/libusb/patches/patch-ad +++ b/devel/libusb/patches/patch-ad @@ -1,32 +1,109 @@ -$NetBSD: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $ +$NetBSD: patch-ad,v 1.2 2002/03/03 15:22:28 veego Exp $ -=================================================================== -RCS file: /cvsroot/libusb/libusb/bsd.c,v -retrieving revision 1.11 -retrieving revision 1.12 -diff -u -r1.11 -r1.12 ---- bsd.c 2002/02/05 20:43:38 1.11 -+++ bsd.c 2002/02/16 18:56:51 1.12 -@@ -3,7 +3,7 @@ - * - * Derived from Linux version by Richard Tobin. - * -- * $Id: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $ -+ * $Id: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $ - * $Name: $ - * - * This library is covered by the LGPL, read LICENSE for details. -@@ -182,7 +182,12 @@ +--- bsd.c.orig Thu Feb 7 07:43:25 2002 ++++ bsd.c Sun Mar 3 14:59:58 2002 +@@ -37,6 +37,16 @@ + + #include <dev/usb/usb.h> + ++#ifndef USB_STACK_VERSION ++#define uai_interface_index interface_index ++#define uai_alt_no alt_no ++#define ucr_request request ++#define ucr_data data ++#define ucr_flags flags ++#define udi_addr addr ++#define udi_devnames devnames ++#endif ++ + #include "usbi.h" + #ifdef HAVE_CONFIG_H + #include "config.h" +@@ -151,8 +161,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) +@@ -182,6 +192,11 @@ #else snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->device->filename, ep); #endif -- fd = open(buf, mode); + /* Try to open it O_RDWR first for those devices which have in and out + * endpoints with the same address (eg 0x02 and 0x82) + */ + fd = open(buf, O_RDWR); + if (fd < 0 && errno == ENXIO) -+ fd = open(buf, mode); + fd = open(buf, mode); if (fd < 0) USB_ERROR_STR(fd, "can't open %s for bulk read: %s\n", - buf, strerror(errno)); +@@ -284,14 +299,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 +318,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,20 +336,20 @@ + 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]); ++ snprintf(buf, sizeof(buf) - 1, "/dev/%s.00", di.udi_devnames[0]); + #endif + + /* Don't re-add it if we were called multiple times */ +@@ -364,7 +379,7 @@ + * This seemed easier than having 2 variables... + */ + #if __NetBSD__ +- snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.devnames[0]); ++ snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.udi_devnames[0]); + #endif + + strncpy(dev->filename, buf, sizeof(dev->filename) - 1); |