Remove, superseded by libusb-compat.
This commit is contained in:
parent
540e3a6b3d
commit
f6b5cb15fd
@ -1,34 +0,0 @@
|
||||
# $OpenBSD: Makefile,v 1.22 2011/01/25 21:04:16 jakemsr Exp $
|
||||
|
||||
COMMENT= USB access library
|
||||
|
||||
DISTNAME= libusb-0.1.12
|
||||
REVISION = 4
|
||||
SHARED_LIBS= usb 9.0 \
|
||||
usbpp 10.0
|
||||
MODGNU_SHARED_LIBS= usb '-export-dynamic' \
|
||||
usbpp '-export-dynamic'
|
||||
|
||||
CATEGORIES= devel
|
||||
|
||||
HOMEPAGE= http://libusb.sourceforge.net/
|
||||
|
||||
MAINTAINER= Peter Valchev <pvalchev@openbsd.org>
|
||||
|
||||
# LGPL
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libusb/}
|
||||
|
||||
WANTLIB += m stdc++
|
||||
|
||||
USE_LIBTOOL= Yes
|
||||
SEPARATE_BUILD= concurrent
|
||||
CONFIGURE_STYLE= gnu
|
||||
CONFIGURE_ARGS+= ${CONFIGURE_SHARED} \
|
||||
--disable-build-docs
|
||||
|
||||
.include <bsd.port.mk>
|
@ -1,5 +0,0 @@
|
||||
MD5 (libusb-0.1.12.tar.gz) = yvGCy8dWXawP1yFVkZZy5g==
|
||||
RMD160 (libusb-0.1.12.tar.gz) = Y4SN9xfgD/9nqzC6hqhUZjcNTo4=
|
||||
SHA1 (libusb-0.1.12.tar.gz) = WZpRaFkPZrxvH5oplXn9hQBhSAc=
|
||||
SHA256 (libusb-0.1.12.tar.gz) = N/b32d50GW61/Au+CuqbXJOd5/UArLo69v1kPztTi0Q=
|
||||
SIZE (libusb-0.1.12.tar.gz) = 389343
|
@ -1,26 +0,0 @@
|
||||
$OpenBSD: patch-Makefile_in,v 1.6 2006/11/15 18:34:13 pvalchev Exp $
|
||||
--- Makefile.in.orig Tue Nov 14 21:00:20 2006
|
||||
+++ Makefile.in Tue Nov 14 21:00:52 2006
|
||||
@@ -256,7 +256,7 @@ target_alias = @target_alias@
|
||||
# require automake 1.4
|
||||
# gnu strictness chokes on README being autogenerated
|
||||
AUTOMAKE_OPTIONS = 1.4 foreign
|
||||
-SUBDIRS = . tests doc
|
||||
+SUBDIRS = . doc
|
||||
AM_CFLAGS = -Werror $(AM_CFLAGS_EXT)
|
||||
configincludedir = $(pkglibdir)/include
|
||||
bin_SCRIPTS = libusb-config
|
||||
@@ -287,13 +287,11 @@ nodist_include_HEADERS = usb.h
|
||||
include_HEADERS = usbpp.h
|
||||
libusb_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
- -release $(LT_RELEASE) \
|
||||
-export-dynamic \
|
||||
$(LDADDS) $(PREBIND_FLAGS)
|
||||
|
||||
libusbpp_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
- -release $(LT_RELEASE) \
|
||||
-export-dynamic \
|
||||
$(LDADDS) -lusb $(PREBIND_FLAGSPP)
|
||||
|
@ -1,246 +0,0 @@
|
||||
$OpenBSD: patch-bsd_c,v 1.12 2011/01/25 21:04:16 jakemsr Exp $
|
||||
|
||||
usb_os_find_busses(): don't access to the bus. just say there
|
||||
is one.
|
||||
|
||||
usb_os_find_devices(): only ugen(4) are supported, so just probe
|
||||
/dev/ugen*.
|
||||
|
||||
|
||||
--- bsd.c.orig Fri Mar 3 18:52:46 2006
|
||||
+++ bsd.c Mon Jan 24 23:46:26 2011
|
||||
@@ -361,7 +361,7 @@ int usb_bulk_read(usb_dev_handle *dev, int ep, char *b
|
||||
int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size,
|
||||
int timeout)
|
||||
{
|
||||
- int fd, ret, sent = 0;
|
||||
+ int fd, ret;
|
||||
|
||||
/* Ensure the endpoint address is correct */
|
||||
ep &= ~USB_ENDPOINT_IN;
|
||||
@@ -383,8 +383,7 @@ int usb_interrupt_write(usb_dev_handle *dev, int ep, c
|
||||
USB_ERROR_STR(-errno, "error setting timeout: %s",
|
||||
strerror(errno));
|
||||
|
||||
- do {
|
||||
- ret = write(fd, bytes+sent, size-sent);
|
||||
+ ret = write(fd, bytes, size);
|
||||
if (ret < 0)
|
||||
#ifdef __FreeBSD_kernel__
|
||||
USB_ERROR_STR(-errno, "error writing to interrupt endpoint %s.%d: %s",
|
||||
@@ -394,16 +393,13 @@ int usb_interrupt_write(usb_dev_handle *dev, int ep, c
|
||||
dev->device->filename, UE_GET_ADDR(ep), strerror(errno));
|
||||
#endif
|
||||
|
||||
- sent += ret;
|
||||
- } while (ret > 0 && sent < size);
|
||||
-
|
||||
- return sent;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size,
|
||||
int timeout)
|
||||
{
|
||||
- int fd, ret, retrieved = 0, one = 1;
|
||||
+ int fd, ret, one = 1;
|
||||
|
||||
/* Ensure the endpoint address is correct */
|
||||
ep |= USB_ENDPOINT_IN;
|
||||
@@ -428,8 +424,7 @@ int usb_interrupt_read(usb_dev_handle *dev, int ep, ch
|
||||
if (ret < 0)
|
||||
USB_ERROR_STR(-errno, "error setting short xfer: %s", strerror(errno));
|
||||
|
||||
- do {
|
||||
- ret = read(fd, bytes+retrieved, size-retrieved);
|
||||
+ ret = read(fd, bytes, size);
|
||||
if (ret < 0)
|
||||
#ifdef __FreeBSD_kernel__
|
||||
USB_ERROR_STR(-errno, "error reading from interrupt endpoint %s.%d: %s",
|
||||
@@ -438,10 +433,7 @@ int usb_interrupt_read(usb_dev_handle *dev, int ep, ch
|
||||
USB_ERROR_STR(-errno, "error reading from interrupt endpoint %s.%02d: %s",
|
||||
dev->device->filename, UE_GET_ADDR(ep), strerror(errno));
|
||||
#endif
|
||||
- retrieved += ret;
|
||||
- } while (ret > 0 && retrieved < size);
|
||||
-
|
||||
- return retrieved;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
|
||||
@@ -477,45 +469,28 @@ int usb_control_msg(usb_dev_handle *dev, int requestty
|
||||
USB_ERROR_STR(-errno, "error sending control message: %s",
|
||||
strerror(errno));
|
||||
|
||||
- return UGETW(req.ucr_request.wLength);
|
||||
+ return req.ucr_actlen;
|
||||
}
|
||||
|
||||
int usb_os_find_busses(struct usb_bus **busses)
|
||||
{
|
||||
struct usb_bus *fbus = NULL;
|
||||
- int controller;
|
||||
- int fd;
|
||||
- char buf[20];
|
||||
+ struct usb_bus *bus;
|
||||
|
||||
- for (controller = 0; controller < MAX_CONTROLLERS; controller++) {
|
||||
- struct usb_bus *bus;
|
||||
+ /* just one bus that always exists. this is faked, so we don't have
|
||||
+ * to give access to the bus.
|
||||
+ */
|
||||
|
||||
- snprintf(buf, sizeof(buf) - 1, "/dev/usb%d", controller);
|
||||
- fd = open(buf, O_RDWR);
|
||||
- if (fd < 0) {
|
||||
- if (usb_debug >= 2)
|
||||
- if (errno != ENXIO && errno != ENOENT)
|
||||
- fprintf(stderr, "usb_os_find_busses: can't open %s: %s\n",
|
||||
- buf, strerror(errno));
|
||||
- continue;
|
||||
- }
|
||||
- close(fd);
|
||||
+ bus = malloc(sizeof(*bus));
|
||||
+ if (!bus)
|
||||
+ USB_ERROR(-ENOMEM);
|
||||
|
||||
- bus = malloc(sizeof(*bus));
|
||||
- if (!bus)
|
||||
- USB_ERROR(-ENOMEM);
|
||||
+ memset((void *)bus, 0, sizeof(*bus));
|
||||
|
||||
- memset((void *)bus, 0, sizeof(*bus));
|
||||
+ snprintf(bus->dirname, sizeof(bus->dirname), "/dev/usb");
|
||||
|
||||
- strncpy(bus->dirname, buf, sizeof(bus->dirname) - 1);
|
||||
- bus->dirname[sizeof(bus->dirname) - 1] = 0;
|
||||
+ LIST_ADD(fbus, bus);
|
||||
|
||||
- LIST_ADD(fbus, bus);
|
||||
-
|
||||
- if (usb_debug >= 2)
|
||||
- fprintf(stderr, "usb_os_find_busses: Found %s\n", bus->dirname);
|
||||
- }
|
||||
-
|
||||
*busses = fbus;
|
||||
|
||||
return 0;
|
||||
@@ -523,43 +498,27 @@ int usb_os_find_busses(struct usb_bus **busses)
|
||||
|
||||
int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices)
|
||||
{
|
||||
+ struct usb_device *dev;
|
||||
+ unsigned char device_desc[DEVICE_DESC_LENGTH];
|
||||
+ char devnode[USB_MAX_DEVNAMELEN];
|
||||
+ char devname[USB_MAX_DEVNAMELEN];
|
||||
struct usb_device *fdev = NULL;
|
||||
- int cfd, dfd;
|
||||
- int device;
|
||||
+ int fd, i;
|
||||
|
||||
- cfd = open(bus->dirname, O_RDONLY);
|
||||
- if (cfd < 0)
|
||||
- USB_ERROR_STR(-errno, "couldn't open(%s): %s", bus->dirname,
|
||||
- strerror(errno));
|
||||
+ /* USB_MAX_DEVICES is the max # of all devices per bus. this is
|
||||
+ * only for ugen(4) devices, but on all buses. is 32 enough?
|
||||
+ */
|
||||
+ for (i = 0; i < 32 /* USB_MAX_DEVICES */; i++) {
|
||||
+ snprintf(devname, sizeof(devname), "/dev/ugen%d", i);
|
||||
|
||||
- for (device = 1; device < USB_MAX_DEVICES; device++) {
|
||||
- struct usb_device_info di;
|
||||
- struct usb_device *dev;
|
||||
- unsigned char device_desc[DEVICE_DESC_LENGTH];
|
||||
- char buf[20];
|
||||
+ /* device control node */
|
||||
+ snprintf(devnode, sizeof(devnode), "%s.00", devname);
|
||||
|
||||
- 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.udi_devnames[0], "ugen", 4) != 0)
|
||||
- /* best not to play with things we don't understand */
|
||||
- continue;
|
||||
-
|
||||
-#ifdef __FreeBSD_kernel__
|
||||
- snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.udi_devnames[0]);
|
||||
-#else
|
||||
- snprintf(buf, sizeof(buf) - 1, "/dev/%s.00", di.udi_devnames[0]);
|
||||
-#endif
|
||||
-
|
||||
- /* Open its control endpoint */
|
||||
- dfd = open(buf, O_RDONLY);
|
||||
- if (dfd < 0) {
|
||||
+ fd = open(devnode, O_RDONLY);
|
||||
+ if (fd < 0) {
|
||||
if (usb_debug >= 2)
|
||||
fprintf(stderr, "usb_os_find_devices: couldn't open device %s: %s\n",
|
||||
- buf, strerror(errno));
|
||||
+ devname, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -571,21 +530,13 @@ int usb_os_find_devices(struct usb_bus *bus, struct us
|
||||
|
||||
dev->bus = bus;
|
||||
|
||||
- /* we need to report the device name as /dev/ugenx NOT /dev/ugenx.00
|
||||
- * This seemed easier than having 2 variables...
|
||||
- */
|
||||
-#if (__NetBSD__ || __OpenBSD__)
|
||||
- snprintf(buf, sizeof(buf) - 1, "/dev/%s", di.udi_devnames[0]);
|
||||
-#endif
|
||||
+ strlcpy(dev->filename, devname, sizeof(dev->filename));
|
||||
|
||||
- strncpy(dev->filename, buf, sizeof(dev->filename) - 1);
|
||||
- dev->filename[sizeof(dev->filename) - 1] = 0;
|
||||
-
|
||||
- if (ioctl(dfd, USB_GET_DEVICE_DESC, device_desc) < 0)
|
||||
+ if (ioctl(fd, USB_GET_DEVICE_DESC, device_desc) < 0)
|
||||
USB_ERROR_STR(-errno, "couldn't get device descriptor for %s: %s",
|
||||
- buf, strerror(errno));
|
||||
+ devname, strerror(errno));
|
||||
|
||||
- close(dfd);
|
||||
+ close(fd);
|
||||
|
||||
usb_parse_descriptor(device_desc, "bbwbbbbwwwbbbb", &dev->descriptor);
|
||||
|
||||
@@ -596,8 +547,6 @@ int usb_os_find_devices(struct usb_bus *bus, struct us
|
||||
dev->filename, bus->dirname);
|
||||
}
|
||||
|
||||
- close(cfd);
|
||||
-
|
||||
*devices = fdev;
|
||||
|
||||
return 0;
|
||||
@@ -623,9 +572,21 @@ int usb_resetep(usb_dev_handle *dev, unsigned int ep)
|
||||
|
||||
int usb_clear_halt(usb_dev_handle *dev, unsigned int ep)
|
||||
{
|
||||
- /* Not yet done, because I haven't needed it. */
|
||||
+ int ret;
|
||||
+ struct usb_ctl_request ctl_req;
|
||||
|
||||
- USB_ERROR_STR(-ENOSYS, "usb_clear_halt called, unimplemented on BSD");
|
||||
+ ctl_req.ucr_addr = 0; // Not used for this type of request
|
||||
+ ctl_req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
|
||||
+ ctl_req.ucr_request.bRequest = UR_CLEAR_FEATURE;
|
||||
+ USETW(ctl_req.ucr_request.wValue, UF_ENDPOINT_HALT);
|
||||
+ USETW(ctl_req.ucr_request.wIndex, ep);
|
||||
+ USETW(ctl_req.ucr_request.wLength, 0);
|
||||
+ ctl_req.ucr_flags = 0;
|
||||
+
|
||||
+ if ((ret = ioctl(dev->fd, USB_DO_REQUEST, &ctl_req)) < 0)
|
||||
+ USB_ERROR_STR(-errno, "clear_halt: failed for %d", ep);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int usb_reset(usb_dev_handle *dev)
|
@ -1,10 +0,0 @@
|
||||
$OpenBSD: patch-libusb-config_in,v 1.4 2006/11/15 18:34:13 pvalchev Exp $
|
||||
--- libusb-config.in.orig Tue Nov 14 21:01:48 2006
|
||||
+++ libusb-config.in Tue Nov 14 21:02:02 2006
|
||||
@@ -75,5 +75,5 @@ if test "$echo_cflags" = "yes"; then
|
||||
echo $includes
|
||||
fi
|
||||
if test "$echo_libs" = "yes"; then
|
||||
- echo -L@libdir@ -lusb @OSLIBS@
|
||||
+ echo -L@libdir@ -Wl,-R@libdir@ -lusb @OSLIBS@
|
||||
fi
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-usbpp_cpp,v 1.2 2006/11/15 18:34:13 pvalchev Exp $
|
||||
--- usbpp.cpp.orig Tue Nov 14 21:02:15 2006
|
||||
+++ usbpp.cpp Tue Nov 14 21:02:23 2006
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
|
@ -1,2 +0,0 @@
|
||||
libusb provides a library for application access to
|
||||
USB devices.
|
@ -1,3 +0,0 @@
|
||||
@comment $OpenBSD: PFRAG.shared,v 1.8 2005/12/24 15:04:18 bernd Exp $
|
||||
@lib lib/libusb.so.${LIBusb_VERSION}
|
||||
@lib lib/libusbpp.so.${LIBusbpp_VERSION}
|
@ -1,11 +0,0 @@
|
||||
@comment $OpenBSD: PLIST,v 1.4 2006/11/15 18:34:13 pvalchev Exp $
|
||||
%%SHARED%%
|
||||
bin/libusb-config
|
||||
include/usb.h
|
||||
include/usbpp.h
|
||||
lib/libusb.a
|
||||
lib/libusb.la
|
||||
lib/libusbpp.a
|
||||
lib/libusbpp.la
|
||||
lib/pkgconfig/
|
||||
lib/pkgconfig/libusb.pc
|
Loading…
x
Reference in New Issue
Block a user