Initialize the non-control endpoint fds in netbsd_open() Not all users of libusb use libusb_claim_interface(), and in that case, the NetBSD backend fails to open() the necessary /dev/ugenX.Y and will try to send ioctl()s to fd 0, which fortunately fails. This unbreaks e.g. openocd on NetBSD. Closes #539 Signed-off-by: Nathan Hjelm <hjelmn@me.com>
diff --git a/libusb/os/netbsd_usb.c b/libusb/os/netbsd_usb.c index d9c059a..79aeca9 100644 --- a/libusb/os/netbsd_usb.c +++ b/libusb/os/netbsd_usb.c
@@ -215,6 +215,8 @@ netbsd_open(struct libusb_device_handle *handle) { struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv; + struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv; + int i; dpriv->fd = open(dpriv->devnode, O_RDWR); if (dpriv->fd < 0) { @@ -223,6 +225,9 @@ return _errno_to_libusb(errno); } + for (i = 0; i < USB_MAX_ENDPOINTS; i++) + hpriv->endpoints[i] = -1; + usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd); return (LIBUSB_SUCCESS);
diff --git a/libusb/version_nano.h b/libusb/version_nano.h index dc15091..0d6bc45 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h
@@ -1 +1 @@ -#define LIBUSB_NANO 11348 +#define LIBUSB_NANO 11349