diff options
author | Aymeric Vincent <aymericvincent@free.fr> | 2019-02-28 22:38:21 +0100 |
---|---|---|
committer | Nathan Hjelm <hjelmn@me.com> | 2019-04-04 21:19:07 -0600 |
commit | 9501adff2455446aa6ce017525c9d747be67c115 (patch) | |
tree | 493760ed89dfab449fc77489f38b8e7da0995fb4 | |
parent | a0b5d27fa7f2bba11965e2b70533f925a5772808 (diff) | |
download | libusb-9501adff2455446aa6ce017525c9d747be67c115.tar.gz |
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>
-rw-r--r-- | libusb/os/netbsd_usb.c | 5 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 6 insertions, 1 deletions
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 @@ int 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 @@ netbsd_open(struct libusb_device_handle *handle) 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 |