Your message dated Mon, 30 Dec 2019 22:19:19 +0000
with message-id <[email protected]>
and subject line Bug#947619: fixed in libusb-1.0 2:1.0.23-2
has caused the Debian Bug report #947619,
regarding libusb-1.0: backport upstream patches for Hurd/dummy support
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
947619: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947619
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: libusb-1.0
Version: 2:1.0.23-1
Severity: important
Tags: patch
User: [email protected]
Usertags: hurd

Hi,

currently libusb-1.0 carries a patch, gnu-hurd-stub.diff, to add a
"null" backend for Hurd. I recently took the task of creating a better
and more generic version of it, and submitted that upstream [1].
Surprisingly, this was quickly accepted and merged [2].
In addition to that, I submitted another fix [3] to fix an #include on
Hurd, and it was accepted and merged too [4].

As the null backend now "works" properly (the current Hurd stub makes
libusb_init() fail, and returns an error on device listing), the stress
test can be safely enabled too.

Attached there are all the needed patches (removing the changes to
libusb/version_nano.h, not needed), including the enablement of the
test. Of course, gnu-hurd-stub.diff must be dropped.

[1] https://github.com/libusb/libusb/pull/669
[2] 
https://github.com/libusb/libusb/commit/53572d7e5eee79266139399924c7491174be1670
[3] https://github.com/libusb/libusb/pull/670
[4] 
https://github.com/libusb/libusb/commit/1e9d26a753a741bfdb0769b4c895697d16edcc27

Thanks,
-- 
Pino
From 53572d7e5eee79266139399924c7491174be1670 Mon Sep 17 00:00:00 2001
From: Pino Toscano <[email protected]>
Date: Fri, 27 Dec 2019 18:41:28 +0100
Subject: [PATCH] Add Null POSIX backend

Add a simple null backend for POSIX platforms that reports no available
devices, and provides no capabilities. Make use of this new backend on
all the OSes without an existing backend, so libusb can be built even on
OSes without USB support.
---
 configure.ac          |  13 +++-
 libusb/Makefile.am    |   7 +-
 libusb/libusbi.h      |   2 +-
 libusb/os/null_usb.c  | 176 ++++++++++++++++++++++++++++++++++++++++++
 libusb/version_nano.h |   2 +-
 5 files changed, 196 insertions(+), 4 deletions(-)
 create mode 100644 libusb/os/null_usb.c

diff --git a/configure.ac b/configure.ac
index da8a158..ddde325 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,9 @@ case $host in
        threads=posix
        ;;
 *)
-       AC_MSG_ERROR([unsupported operating system $host])
+       AC_MSG_RESULT([Null])
+       backend="null"
+       threads="posix"
 esac
 
 case $backend in
@@ -186,6 +188,14 @@ haiku)
        AC_CHECK_HEADERS([poll.h])
        AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
        ;;
+null)
+       AC_DEFINE(OS_NULL, 1, [Null backend])
+       AC_SUBST(OS_NULL)
+       THREAD_CFLAGS="-pthread"
+       LIBS="-pthread"
+       AC_CHECK_HEADERS([poll.h])
+       AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
+       ;;
 esac
 
 AC_SUBST(LIBS)
@@ -197,6 +207,7 @@ AM_CONDITIONAL(OS_SUNOS, test "x$backend" = xsunos)
 AM_CONDITIONAL(OS_NETBSD, test "x$backend" = xnetbsd)
 AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
 AM_CONDITIONAL(OS_HAIKU, test "x$backend" = xhaiku)
+AM_CONDITIONAL(OS_NULL, test "x$backend" = xnull)
 AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
 AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = xyes)
 AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
index e4da62e..466b633 100644
--- a/libusb/Makefile.am
+++ b/libusb/Makefile.am
@@ -22,13 +22,14 @@ WINDOWS_USB_SRC = libusb-1.0.def libusb-1.0.rc \
 WINCE_USB_SRC = os/wince_usb.h os/wince_usb.c
 HAIKU_USB_SRC = os/haiku_usb.h os/haiku_usb_backend.cpp \
                os/haiku_usb_raw.h os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
+NULL_USB_SRC = os/null_usb.c
 
 EXTRA_DIST = $(POSIX_POLL_SRC) $(POSIX_THREADS_SRC) \
        $(WINDOWS_POLL_SRC) $(WINDOWS_THREADS_SRC) \
        $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) \
        $(OPENBSD_USB_SRC) $(NETBSD_USB_SRC) \
        $(WINDOWS_USB_SRC) $(WINCE_USB_SRC) \
-       $(HAIKU_USB_SRC) \
+       $(HAIKU_USB_SRC) $(NULL_USB_SRC) \
        os/linux_udev.c os/linux_netlink.c
 
 if OS_LINUX
@@ -64,6 +65,10 @@ libusb_haiku_la_SOURCES = $(HAIKU_USB_SRC)
 libusb_1_0_la_LIBADD = libusb_haiku.la
 endif
 
+if OS_NULL
+OS_SRC = $(NULL_USB_SRC)
+endif
+
 if OS_WINDOWS
 OS_SRC = $(WINDOWS_USB_SRC)
 
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index 0a677bd..4cb6141 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -575,7 +575,7 @@ int usbi_clear_event(struct libusb_context *ctx);
 
 /* Internal abstraction for poll (needs struct usbi_transfer on Windows) */
 #if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD) || 
defined(OS_NETBSD) ||\
-       defined(OS_HAIKU) || defined(OS_SUNOS)
+       defined(OS_HAIKU) || defined(OS_SUNOS) || defined(OS_NULL)
 #include <unistd.h>
 #include "os/poll_posix.h"
 #elif defined(OS_WINDOWS) || defined(OS_WINCE)
diff --git a/libusb/os/null_usb.c b/libusb/os/null_usb.c
new file mode 100644
index 0000000..97fa0b8
--- /dev/null
+++ b/libusb/os/null_usb.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright © 2019 Pino Toscano <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libusbi.h"
+
+static int
+null_get_device_list(struct libusb_context * ctx,
+       struct discovered_devs **discdevs)
+{
+       return LIBUSB_SUCCESS;
+}
+
+static int
+null_open(struct libusb_device_handle *handle)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static void
+null_close(struct libusb_device_handle *handle)
+{
+}
+
+static int
+null_get_device_descriptor(struct libusb_device *dev, unsigned char *buf,
+    int *host_endian)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_get_active_config_descriptor(struct libusb_device *dev,
+    unsigned char *buf, size_t len, int *host_endian)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
+    unsigned char *buf, size_t len, int *host_endian)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_set_configuration(struct libusb_device_handle *handle, int config)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_claim_interface(struct libusb_device_handle *handle, int iface)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_release_interface(struct libusb_device_handle *handle, int iface)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_set_interface_altsetting(struct libusb_device_handle *handle, int iface,
+    int altsetting)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_reset_device(struct libusb_device_handle *handle)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_submit_transfer(struct usbi_transfer *itransfer)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_cancel_transfer(struct usbi_transfer *itransfer)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static void
+null_clear_transfer_priv(struct usbi_transfer *itransfer)
+{
+}
+
+static int
+null_handle_transfer_completion(struct usbi_transfer *itransfer)
+{
+       return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+
+static int
+null_clock_gettime(int clkid, struct timespec *tp)
+{
+       switch (clkid) {
+       case USBI_CLOCK_MONOTONIC:
+               return clock_gettime(CLOCK_REALTIME, tp);
+       case USBI_CLOCK_REALTIME:
+               return clock_gettime(CLOCK_REALTIME, tp);
+       default:
+               return LIBUSB_ERROR_INVALID_PARAM;
+       }
+}
+
+const struct usbi_os_backend usbi_backend = {
+       .name = "Null backend",
+       .caps = 0,
+       .init = NULL,
+       .exit = NULL,
+       .set_option = NULL,
+       .get_device_list = null_get_device_list,
+       .hotplug_poll = NULL,
+       .wrap_sys_device = NULL,
+       .open = null_open,
+       .close = null_close,
+       .get_device_descriptor = null_get_device_descriptor,
+       .get_active_config_descriptor = null_get_active_config_descriptor,
+       .get_config_descriptor = null_get_config_descriptor,
+       .get_config_descriptor_by_value = NULL,
+       .get_configuration = NULL,
+       .set_configuration = null_set_configuration,
+       .claim_interface = null_claim_interface,
+       .release_interface = null_release_interface,
+       .set_interface_altsetting = null_set_interface_altsetting,
+       .clear_halt = null_clear_halt,
+       .reset_device = null_reset_device,
+       .alloc_streams = NULL,
+       .free_streams = NULL,
+       .dev_mem_alloc = NULL,
+       .dev_mem_free = NULL,
+       .kernel_driver_active = NULL,
+       .detach_kernel_driver = NULL,
+       .attach_kernel_driver = NULL,
+       .destroy_device = NULL,
+       .submit_transfer = null_submit_transfer,
+       .cancel_transfer = null_cancel_transfer,
+       .clear_transfer_priv = null_clear_transfer_priv,
+       .handle_events = NULL,
+       .handle_transfer_completion = null_handle_transfer_completion,
+       .clock_gettime = null_clock_gettime,
+#ifdef USBI_TIMERFD_AVAILABLE
+       .get_timerfd_clockid = NULL,
+#endif
+       .context_priv_size = 0,
+       .device_priv_size = 0,
+       .device_handle_priv_size = 0,
+       .transfer_priv_size = 0,
+};
-- 
2.24.1

>From 1e9d26a753a741bfdb0769b4c895697d16edcc27 Mon Sep 17 00:00:00 2001
From: Pino Toscano <[email protected]>
Date: Fri, 27 Dec 2019 18:50:27 +0100
Subject: [PATCH] core: include sys/time.h on any GNU libc OS

GNU libc provides sys/time.h, so unconditionally include it when using
that libc.

Since sys/time.h is already included on a number of OSes, include it to
minimize the differences between OSes when using libusb. Arguably,
sources using functions from sys/time.h (such as gettimeofday) ought to
already include it on their own; OTOH, let's avoid making such issues
OS-specific.
---
 libusb/libusb.h       | 2 +-
 libusb/version_nano.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libusb/libusb.h b/libusb/libusb.h
index 8a6b0bf..d2535d0 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -54,7 +54,7 @@ typedef unsigned __int32  uint32_t;
 #include <sys/types.h>
 #endif
 
-#if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || 
defined(__HAIKU__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || 
defined(__HAIKU__) || defined(__GLIBC__)
 #include <sys/time.h>
 #endif
 
-- 
2.24.1

--- a/debian/rules
+++ b/debian/rules
@@ -41,11 +41,9 @@ override_dh_strip-arch:
        dh_strip -a --remaining-packages
 
 override_dh_auto_test-arch:
-ifeq (linux,$(DEB_HOST_ARCH_OS))
 ifneq (nocheck,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
        $(CURDIR)/build-deb/tests/stress
 endif
-endif
 
 
 #

--- End Message ---
--- Begin Message ---
Source: libusb-1.0
Source-Version: 2:1.0.23-2

We believe that the bug you reported is fixed in the latest version of
libusb-1.0, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Aurelien Jarno <[email protected]> (supplier of updated libusb-1.0 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 30 Dec 2019 22:55:13 +0100
Source: libusb-1.0
Architecture: source
Version: 2:1.0.23-2
Distribution: unstable
Urgency: medium
Maintainer: Aurelien Jarno <[email protected]>
Changed-By: Aurelien Jarno <[email protected]>
Closes: 947619
Changes:
 libusb-1.0 (2:1.0.23-2) unstable; urgency=medium
 .
   * Bump Standards-Version to 4.4.1 (no changes).
   * Drop patches/gnu-hurd-stub.diff and replace it by two upstream patch
     adding the Null POSIX backend (closes: #947619).
Checksums-Sha1:
 558762d1caaf7e575c1924877f0a2776c8ee1889 2140 libusb-1.0_1.0.23-2.dsc
 9b157fbaf7f0b89dce6ed5570042fb550e33011b 13632 
libusb-1.0_1.0.23-2.debian.tar.xz
 f6722c73e76454f0eee6afb9116281efe2fbc401 5615 
libusb-1.0_1.0.23-2_source.buildinfo
Checksums-Sha256:
 15e681a440c7bb7ddbd4714a3bdec2816eb1aaff02114695d23203c982e05559 2140 
libusb-1.0_1.0.23-2.dsc
 f03436b7b36fec20cfd8e893224db3af34df83eb2111bded847bf25f47498cb7 13632 
libusb-1.0_1.0.23-2.debian.tar.xz
 db846f854292cb0564b3cf68906f05e362d6faf4e4a406b5313214b05ccda087 5615 
libusb-1.0_1.0.23-2_source.buildinfo
Files:
 2c5c703dff62aa3ec24fb97c0f8074e0 2140 libs optional libusb-1.0_1.0.23-2.dsc
 6f174524e57522290d6f52133d60e99c 13632 libs optional 
libusb-1.0_1.0.23-2.debian.tar.xz
 329ce226ded390b9b25d47ce7a08352e 5615 libs optional 
libusb-1.0_1.0.23-2_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEUryGlb40+QrX1Ay4E4jA+JnoM2sFAl4KctgACgkQE4jA+Jno
M2u3Ew//fT/sUKL+H0Kr4Klv3oluYKKP4RuXDUb/sNpUD180miixCM1kDt9PMlw3
Djaaf9WO3b1F0pwnLpE49LhVt27r6+4aJtumHdgDzaZFcv2CCHYuJ+/3gO3oAOkI
CU/0/ko4U/kTJZsGeYhdJRAVMFobBQgtcGCdHgEgdCZzGshXEZQmjhBYgDlXMrDt
MfbDrA8thd9MWISM2fPTWwtA0XnThn75f+3yH/OaeYHuqA500JF6v13u2R//C9tH
xQjETta2zbZ7+k9vccv2lhvXvWM+Fq87axPaySoe0JYclN8nWNm/NUNeczpByX+s
H5Cjvt27/DoE3/rKvO7d+Qya/FF3Xq9MPt+lWqt/TLQ1MNL81tczGGx+YSLBY+m7
r1EZ1ghP0l8pc9CIr3sgjIDqMZeRrZIF+kRier37zaqQVkS57cCiDZXVzjqlqIPI
oCPVX4Hgoxf0B4N6RkOtiqvezTR9zWKNCoRan9Una/3hDRgyf/Y7K9mV7aUkojY5
K1e0OA+3QHWrPL45KAMfDy6RJGquItAVcYRKPy0OQ5d1yZ7sjMVMcjF2qIIrY/Qu
G3pWDP5KeLULud5YTbuAzxQWYTtBH+rIOolAmU5zGPzNwzj0A/UTWrJ1bCh91dP4
DCvIarGxDhIYgCG+RA8PwnyCqBbhN30DOdrC9mqaadMb0X91+Ds=
=sknC
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to