Import libusb-compat-0.1.3.

A compatibility layer allowing applications written for libusb-0.1 to work
with libusb-1.0. libusb-compat-0.1 attempts to look, feel, smell and walk
like libusb-0.1.

ok jasper@
This commit is contained in:
ajacoutot 2011-11-13 13:49:50 +00:00
parent f37087ad7d
commit dc0f620fbc
8 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,39 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
COMMENT= libusb-0.1 compatibility layer for libusb1
DISTNAME= libusb-compat-0.1.3
EXTRACT_SUFX= .tar.bz2
SHARED_LIBS += usb 10.0 # 8.4
MODGNU_SHARED_LIBS= usb '-export-dynamic'
CATEGORIES= devel
HOMEPAGE= http://libusb.sourceforge.net/
# LGPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB += usb-1.0
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libusb/}
LIB_DEPENDS= devel/libusb1
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED}
MAKE_FLAGS= LIB=usb
.ifdef DEBUG
CONFIGURE_ARGS += --enable-debug-log \
--enable-examples-build
.endif
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (libusb-compat-0.1.3.tar.bz2) = VwrC6ghbgNH3Tdx8apPA6w==
RMD160 (libusb-compat-0.1.3.tar.bz2) = 0A4AuflzPvxD605EuEKYVA6JZpE=
SHA1 (libusb-compat-0.1.3.tar.bz2) = 1XENW8S2fFNE53lHW3YWjHzMXmk=
SHA256 (libusb-compat-0.1.3.tar.bz2) = pZCgO2GIAw7hyhoK9VaF/N4AXKgHuWOXD4Ob53YDHZQ=
SIZE (libusb-compat-0.1.3.tar.bz2) = 251218

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-libusb-config_in,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
--- libusb-config.in.orig Sat Nov 12 23:00:38 2011
+++ libusb-config.in Sat Nov 12 23:00:47 2011
@@ -77,5 +77,5 @@ if test "$echo_cflags" = "yes"; then
echo $includes
fi
if test "$echo_libs" = "yes"; then
- echo -L$libdir -lusb
+ echo -L$libdir -lusb -pthread
fi

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-libusb_core_c,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
--- libusb/core.c.orig Sat Nov 12 18:44:27 2011
+++ libusb/core.c Sat Nov 12 18:44:35 2011
@@ -29,6 +29,10 @@
#include "usb.h"
#include "usbi.h"
+#if !defined(ENODATA) && defined(ENOENT)
+#define ENODATA ENOENT
+#endif
+
static libusb_context *ctx = NULL;
static int usb_debug = 0;

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-libusb_pc_in,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
--- libusb.pc.in.orig Wed Jun 18 01:13:02 2008
+++ libusb.pc.in Sat Nov 12 23:17:16 2011
@@ -9,6 +9,6 @@ emulated_by=libusb-1.0
Name: libusb
Description: USB access library (libusb-1.0 compat wrapper)
Version: @LIBUSB01_VERSION@
-Libs: -L${libdir} -lusb
+Libs: -L${libdir} -lusb -pthread
Cflags: -I${includedir}

View File

@ -0,0 +1,27 @@
A compatibility layer allowing applications written for libusb-0.1 to work
with libusb-1.0. libusb-compat-0.1 attempts to look, feel, smell and walk
like libusb-0.1.
Known quirks/differences from libusb-0.1:
1. usb_resetep(), a previously deprecated function, is implemented as
equivalent to calling usb_clear_halt().
2. libusb-0.1 allowed you to open a device which you did not have
permission to do anything useful with (all I/O requests would
immediately fail). libusb-compat-0.1 does not allow you to open such
devices. You can still read descriptor info without opening a
device.
3. usb_device's "num_children" attribute is hardcoded to 0, and
"children" is hardcoded to NULL. Do you need this information in
your software? Let us know on the mailing list, and we'll add it.
4. Some libusb-0.1 users may have implemented I/O cancellation by
running transfers in their own threads and simply killing the thread
when they don't want to do the transfer any more. This is bad
programming practice for obvious reasons, and this lack of
functionality was one of the primary drivers for libusb-1.0
development. With libusb-1.0 or libusb-compat-0.1 backed by
libusb-1.0, forcefully killing threads in this way is likely to
cause all libusb I/O to halt. Instead, port your application to use
libusb-1.0's asynchronous transfer API, which supports transfer
cancellation.
5. Error codes returned on certain events may not exactly match the
error codes returned by libusb-0.1.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
@lib lib/libusb.so.${LIBusb_VERSION}

View File

@ -0,0 +1,10 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/11/13 13:49:50 ajacoutot Exp $
@conflict libusb-*
@pkgpath devel/libusb
%%SHARED%%
bin/libusb-config
include/usb.h
lib/libusb.a
lib/libusb.la
lib/pkgconfig/
lib/pkgconfig/libusb.pc