summaryrefslogtreecommitdiffstats
path: root/lib/libusb
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2016-06-16 07:48:21 +0000
committerhselasky <hselasky@FreeBSD.org>2016-06-16 07:48:21 +0000
commitb6f4f4bfc4ec21b18e0d6695ca5c75c4a264d30f (patch)
tree0b7eee6de9c5cd375545558430e9c5486377db8f /lib/libusb
parent9e30632a5b009e8a41730c4dfcc7b1a9cb9dce99 (diff)
downloadFreeBSD-src-b6f4f4bfc4ec21b18e0d6695ca5c75c4a264d30f.zip
FreeBSD-src-b6f4f4bfc4ec21b18e0d6695ca5c75c4a264d30f.tar.gz
Implement libusb_get_version() and update libusb manual page.
Approved by: re (glebius) Requested by: swills MFC after: 1 week
Diffstat (limited to 'lib/libusb')
-rw-r--r--lib/libusb/Makefile1
-rw-r--r--lib/libusb/libusb.36
-rw-r--r--lib/libusb/libusb.h10
-rw-r--r--lib/libusb/libusb10.c16
4 files changed, 32 insertions, 1 deletions
diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
index fe54d2a..eb710e2 100644
--- a/lib/libusb/Makefile
+++ b/lib/libusb/Makefile
@@ -65,6 +65,7 @@ CFLAGS+= -I ../../sys
.endif
# LibUSB v1.0
+MLINKS += libusb.3 libusb_get_version.3
MLINKS += libusb.3 libusb_init.3
MLINKS += libusb.3 libusb_exit.3
MLINKS += libusb.3 libusb_strerror.3
diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3
index d00cb3f..03113c0 100644
--- a/lib/libusb/libusb.3
+++ b/lib/libusb/libusb.3
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 5, 2014
+.Dd June 16, 2016
.Dt LIBUSB 3
.Os
.Sh NAME
@@ -43,6 +43,10 @@ The
library contains interfaces for directly managing a usb device.
The current implementation supports v1.0 of the libusb API.
.Sh LIBRARY INITIALISATION AND DEINITIALISATION
+.Ft "const struct libusb_version *"
+.Fn libusb_get_version "void"
+This function returns version information about LibUSB.
+.Pp
.Ft int
.Fn libusb_init "libusb_context **ctx"
This function initialises libusb.
diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h
index ab20e92..a139a82 100644
--- a/lib/libusb/libusb.h
+++ b/lib/libusb/libusb.h
@@ -235,6 +235,15 @@ struct libusb_pollfd {
short events;
};
+struct libusb_version {
+ const uint16_t major;
+ const uint16_t minor;
+ const uint16_t micro;
+ const uint16_t nano;
+ const char *rc;
+ const char *describe;
+};
+
typedef struct libusb_context libusb_context;
typedef struct libusb_device libusb_device;
typedef struct libusb_device_handle libusb_device_handle;
@@ -384,6 +393,7 @@ typedef struct libusb_transfer {
/* Library initialisation */
void libusb_set_debug(libusb_context * ctx, int level);
+const struct libusb_version *libusb_get_version(void);
const char *libusb_strerror(int code);
const char *libusb_error_name(int code);
int libusb_init(libusb_context ** context);
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
index 1ccd630..20376f9 100644
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -69,6 +69,22 @@ static void libusb10_submit_transfer_sub(struct libusb20_device *, uint8_t);
/* Library initialisation / deinitialisation */
+static const struct libusb_version libusb_version = {
+ .major = 1,
+ .minor = 0,
+ .micro = 0,
+ .nano = 2016,
+ .rc = "",
+ .describe = "http://www.freebsd.org"
+};
+
+const struct libusb_version *
+libusb_get_version(void)
+{
+
+ return (&libusb_version);
+}
+
void
libusb_set_debug(libusb_context *ctx, int level)
{
OpenPOWER on IntegriCloud