42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
$OpenBSD: patch-libusb_os_openbsd_usb_c,v 1.10 2020/08/05 13:59:36 tb Exp $
|
|
|
|
Export port number, fix github #314.
|
|
https://github.com/libusb/libusb/pull/764
|
|
|
|
Fix an OpenBSD backend bug where an existing open file descriptor is
|
|
overwritten if a libusb user attempts to open the same ugen(4) device
|
|
multiple times. This was observed with sane-backends and broke scanning.
|
|
https://github.com/libusb/libusb/pull/763
|
|
|
|
Index: libusb/os/openbsd_usb.c
|
|
--- libusb/os/openbsd_usb.c.orig
|
|
+++ libusb/os/openbsd_usb.c
|
|
@@ -183,6 +183,7 @@ obsd_get_device_list(struct libusb_context * ctx,
|
|
dev->bus_number = di.udi_bus;
|
|
dev->device_address = di.udi_addr;
|
|
dev->speed = di.udi_speed;
|
|
+ dev->port_number = di.udi_port;
|
|
|
|
dpriv = (struct device_priv *)dev->os_priv;
|
|
dpriv->fd = -1;
|
|
@@ -232,15 +233,17 @@ obsd_open(struct libusb_device_handle *handle)
|
|
char devnode[16];
|
|
|
|
if (dpriv->devname) {
|
|
+ int fd;
|
|
/*
|
|
* Only open ugen(4) attached devices read-write, all
|
|
* read-only operations are done through the bus node.
|
|
*/
|
|
snprintf(devnode, sizeof(devnode), DEVPATH "%s.00",
|
|
dpriv->devname);
|
|
- dpriv->fd = open(devnode, O_RDWR);
|
|
- if (dpriv->fd < 0)
|
|
+ fd = open(devnode, O_RDWR);
|
|
+ if (fd < 0)
|
|
return _errno_to_libusb(errno);
|
|
+ dpriv->fd = fd;
|
|
|
|
usbi_dbg("open %s: fd %d", devnode, dpriv->fd);
|
|
}
|