#1 New libusb1 package replacing libusbx
Merged 3 years ago by benzea. Opened 3 years ago by benzea.
rpms/ benzea/libusb1 rawhide  into  rawhide

file modified
+1 -3
@@ -1,3 +1,1 @@ 

- libusb-1.0.8.tar.bz2

- /libusb-1.0.9-0.1.tar.bz2

- /libusb-1.0.9-rc1.tar.bz2

+ /libusb-1.0.24.tar.bz2

@@ -1,32 +0,0 @@ 

- From 1cc5b4a9fb984e83681ae5c797fa6b22bc20f809 Mon Sep 17 00:00:00 2001

- From: Ludovic Rousseau <ludovic.rousseau+github@gmail.com>

- Date: Fri, 16 Sep 2011 18:07:56 +0200

- Subject: [PATCH 01/40] Correctly handle LIBUSB_TRANSFER_OVERFLOW in

-  libusb_control_transfer()

- 

- sync.c: In function `libusb_control_transfer':

- sync.c:122: warning: enumeration value `LIBUSB_TRANSFER_OVERFLOW' not

- handled in switch

- 

- Fixes #120.

- ---

-  libusb/sync.c |    3 +++

-  1 file changed, 3 insertions(+)

- 

- diff --git a/libusb/sync.c b/libusb/sync.c

- index d50413b..8eed47b 100644

- --- a/libusb/sync.c

- +++ b/libusb/sync.c

- @@ -132,6 +132,9 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,

-  	case LIBUSB_TRANSFER_NO_DEVICE:

-  		r = LIBUSB_ERROR_NO_DEVICE;

-  		break;

- +	case LIBUSB_TRANSFER_OVERFLOW:

- +		r = LIBUSB_ERROR_OVERFLOW;

- +		break;

-  	default:

-  		usbi_warn(HANDLE_CTX(dev_handle),

-  			"unrecognised status code %d", transfer->status);

- -- 

- 1.7.9.3

- 

@@ -0,0 +1,60 @@ 

+ From c486d01297a366aae8dcd3f715d0bfd8b995949b Mon Sep 17 00:00:00 2001

+ From: Chris Dickens <christopher.a.dickens@gmail.com>

+ Date: Mon, 8 Feb 2021 09:27:20 -0800

+ Subject: [PATCH 1/2] linux_usbfs: Accept sysfs attributes not terminated with

+  newline

+ 

+ Benjamin Berg reports that some CI systems that simulate sysfs devices

+ are causing libusb to report errors because such systems are not

+ conforming to the sysfs pattern of terminating attribute values with a

+ newline character. Reduce the severity of encountering such

+ non-conforming attibute values from an error that prevents enumeration

+ to a warning message.

+ 

+ Closes #857

+ 

+ Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>

+ ---

+  libusb/os/linux_usbfs.c | 12 +++++++-----

+  libusb/version_nano.h   |  2 +-

+  2 files changed, 8 insertions(+), 6 deletions(-)

+ 

+ diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

+ index 4882c0f..ebf8cfe 100644

+ --- a/libusb/os/linux_usbfs.c

+ +++ b/libusb/os/linux_usbfs.c

+ @@ -505,7 +505,7 @@ static int read_sysfs_attr(struct libusb_context *ctx,

+  	if (fd < 0)

+  		return fd;

+  

+ -	r = read(fd, buf, sizeof(buf));

+ +	r = read(fd, buf, sizeof(buf) - 1);

+  	if (r < 0) {

+  		r = errno;

+  		close(fd);

+ @@ -523,16 +523,18 @@ static int read_sysfs_attr(struct libusb_context *ctx,

+  		return 0;

+  	}

+  

+ -	/* The kernel does *not* NULL-terminate the string, but every attribute

+ +	/* The kernel does *not* NUL-terminate the string, but every attribute

+  	 * should be terminated with a newline character. */

+  	if (!isdigit(buf[0])) {

+  		usbi_err(ctx, "attribute %s doesn't have numeric value?", attr);

+  		return LIBUSB_ERROR_IO;

+  	} else if (buf[r - 1] != '\n') {

+ -		usbi_err(ctx, "attribute %s doesn't end with newline?", attr);

+ -		return LIBUSB_ERROR_IO;

+ +		usbi_warn(ctx, "attribute %s doesn't end with newline?", attr);

+ +	} else {

+ +		/* Remove the terminating newline character */

+ +		r--;

+  	}

+ -	buf[r - 1] = '\0';

+ +	buf[r] = '\0';

+  

+  	errno = 0;

+  	value = strtol(buf, &endptr, 10);

+ -- 

+ 2.29.2

+ 

@@ -0,0 +1,61 @@ 

+ From f6d2cb561402c3b6d3627c0eb89e009b503d9067 Mon Sep 17 00:00:00 2001

+ From: Chris Dickens <christopher.a.dickens@gmail.com>

+ Date: Sun, 13 Dec 2020 15:49:19 -0800

+ Subject: [PATCH] linux_usbfs: Fix parsing of descriptors for

+  multi-configuration devices

+ 

+ Commit e2be556bd2 ("linux_usbfs: Parse config descriptors during device

+ initialization") introduced a regression for devices with multiple

+ configurations. The logic that verifies the reported length of the

+ configuration descriptors failed to count the length of the

+ configuration descriptor itself and would truncate the actual length by

+ 9 bytes, leading to a parsing error for subsequent descriptors.

+ 

+ Closes #825

+ 

+ Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>

+ ---

+  libusb/os/linux_usbfs.c | 12 ++++++++----

+  libusb/version_nano.h   |  2 +-

+  2 files changed, 9 insertions(+), 5 deletions(-)

+ 

+ diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

+ index fb2ed53..4d2dc8d 100644

+ --- a/libusb/os/linux_usbfs.c

+ +++ b/libusb/os/linux_usbfs.c

+ @@ -641,7 +641,12 @@ static int seek_to_next_config(struct libusb_context *ctx,

+  	uint8_t *buffer, size_t len)

+  {

+  	struct usbi_descriptor_header *header;

+ -	int offset = 0;

+ +	int offset;

+ +

+ +	/* Start seeking past the config descriptor */

+ +	offset = LIBUSB_DT_CONFIG_SIZE;

+ +	buffer += LIBUSB_DT_CONFIG_SIZE;

+ +	len -= LIBUSB_DT_CONFIG_SIZE;

+  

+  	while (len > 0) {

+  		if (len < 2) {

+ @@ -718,7 +723,7 @@ static int parse_config_descriptors(struct libusb_device *dev)

+  		}

+  

+  		if (priv->sysfs_dir) {

+ -			 /*

+ +			/*

+  			 * In sysfs wTotalLength is ignored, instead the kernel returns a

+  			 * config descriptor with verified bLength fields, with descriptors

+  			 * with an invalid bLength removed.

+ @@ -727,8 +732,7 @@ static int parse_config_descriptors(struct libusb_device *dev)

+  			int offset;

+  

+  			if (num_configs > 1 && idx < num_configs - 1) {

+ -				offset = seek_to_next_config(ctx, buffer + LIBUSB_DT_CONFIG_SIZE,

+ -							     remaining - LIBUSB_DT_CONFIG_SIZE);

+ +				offset = seek_to_next_config(ctx, buffer, remaining);

+  				if (offset < 0)

+  					return offset;

+  				sysfs_config_len = (uint16_t)offset;

+ -- 

+ 2.29.2

+ 

@@ -1,37 +0,0 @@ 

- From 52508a86e26f0bc74b0a7a3b05ed08a29996b44c Mon Sep 17 00:00:00 2001

- From: Hans de Goede <hdegoede@redhat.com>

- Date: Mon, 20 Feb 2012 16:05:48 +0100

- Subject: [PATCH 1/6] linux: Fix cancel_transfer return value when cancelling

-  a multi-urb transfer

- 

- If we fail to cancel the last urb of a multi-urb transfer because it

- has already completed (errno == EINVAL on DISCARD_URB), then the entire

- transfer has already completed, so returning NOT_FOUND is consistent with what

- the documentation for libusb_cancel_transfer says.

- 

- But if we've successfully cancelled the last urb, and then another urb

- fails with errno == EINVAL, this means that we've still cancelled the

- transfer, as it has only *partially* completed.

- 

- Signed-off-by: Hans de Goede <hdegoede@redhat.com>

- ---

-  libusb/os/linux_usbfs.c |    3 ++-

-  1 file changed, 2 insertions(+), 1 deletion(-)

- 

- diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

- index 2b81189..099fc61 100644

- --- a/libusb/os/linux_usbfs.c

- +++ b/libusb/os/linux_usbfs.c

- @@ -1466,7 +1466,8 @@ static int discard_urbs(struct usbi_transfer *itransfer, int first, int last_plu

-  

-  		if (EINVAL == errno) {

-  			usbi_dbg("URB not found --> assuming ready to be reaped");

- -			ret = LIBUSB_ERROR_NOT_FOUND;

- +			if (i == (last_plus_one - 1))

- +				ret = LIBUSB_ERROR_NOT_FOUND;

-  		} else if (ENODEV == errno) {

-  			usbi_dbg("Device not found for URB --> assuming ready to be reaped");

-  			ret = LIBUSB_ERROR_NO_DEVICE;

- -- 

- 1.7.9.3

- 

@@ -0,0 +1,220 @@ 

+ From f38f09da98acc63966b65b72029b1f7f81166bef Mon Sep 17 00:00:00 2001

+ From: Chris Dickens <christopher.a.dickens@gmail.com>

+ Date: Mon, 8 Feb 2021 11:56:13 -0800

+ Subject: [PATCH 2/2] linux_usbfs: Gracefully handle buggy devices with a

+  configuration 0

+ 

+ The USB spec states that a configuration value of 0 is reserved and is

+ used to indicate the device in not configured (e.g. is in the address

+ state). Unfortunately some devices do exist that violate this and use 0

+ as the bConfigurationValue of the configuration descriptor.

+ 

+ Improve how the Linux backend handles such non-conformant devices by

+ adding special handling around the configuration value 0. Most devices

+ will not require this special handling, but for those that do there is

+ no way to distinguish between the device being unconfigured and using

+ configuration 0.

+ 

+ Closes #850

+ 

+ Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>

+ ---

+  libusb/os/linux_usbfs.c | 94 ++++++++++++++++++++++++++---------------

+  libusb/version_nano.h   |  2 +-

+  2 files changed, 60 insertions(+), 36 deletions(-)

+ 

+ diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

+ index ebf8cfe..3a1894c 100644

+ --- a/libusb/os/linux_usbfs.c

+ +++ b/libusb/os/linux_usbfs.c

+ @@ -128,7 +128,7 @@ struct linux_device_priv {

+  	void *descriptors;

+  	size_t descriptors_len;

+  	struct config_descriptor *config_descriptors;

+ -	uint8_t active_config; /* cache val for !sysfs_available  */

+ +	int active_config; /* cache val for !sysfs_available  */

+  };

+  

+  struct linux_device_handle_priv {

+ @@ -169,6 +169,21 @@ struct linux_transfer_priv {

+  	int iso_packet_offset;

+  };

+  

+ +static int dev_has_config0(struct libusb_device *dev)

+ +{

+ +	struct linux_device_priv *priv = usbi_get_device_priv(dev);

+ +	struct config_descriptor *config;

+ +	uint8_t idx;

+ +

+ +	for (idx = 0; idx < dev->device_descriptor.bNumConfigurations; idx++) {

+ +		config = &priv->config_descriptors[idx];

+ +		if (config->desc->bConfigurationValue == 0)

+ +			return 1;

+ +	}

+ +

+ +	return 0;

+ +}

+ +

+  static int get_usbfs_fd(struct libusb_device *dev, mode_t mode, int silent)

+  {

+  	struct libusb_context *ctx = DEVICE_CTX(dev);

+ @@ -574,22 +589,12 @@ static int sysfs_scan_device(struct libusb_context *ctx, const char *devname)

+  }

+  

+  /* read the bConfigurationValue for a device */

+ -static int sysfs_get_active_config(struct libusb_device *dev, uint8_t *config)

+ +static int sysfs_get_active_config(struct libusb_device *dev, int *config)

+  {

+  	struct linux_device_priv *priv = usbi_get_device_priv(dev);

+ -	int ret, tmp;

+ -

+ -	ret = read_sysfs_attr(DEVICE_CTX(dev), priv->sysfs_dir, "bConfigurationValue",

+ -			      UINT8_MAX, &tmp);

+ -	if (ret < 0)

+ -		return ret;

+  

+ -	if (tmp == -1)

+ -		tmp = 0;	/* unconfigured */

+ -

+ -	*config = (uint8_t)tmp;

+ -

+ -	return 0;

+ +	return read_sysfs_attr(DEVICE_CTX(dev), priv->sysfs_dir, "bConfigurationValue",

+ +			UINT8_MAX, config);

+  }

+  

+  int linux_get_device_address(struct libusb_context *ctx, int detached,

+ @@ -765,6 +770,9 @@ static int parse_config_descriptors(struct libusb_device *dev)

+  			}

+  		}

+  

+ +		if (config_desc->bConfigurationValue == 0)

+ +			usbi_warn(ctx, "device has configuration 0");

+ +

+  		priv->config_descriptors[idx].desc = config_desc;

+  		priv->config_descriptors[idx].actual_len = config_len;

+  

+ @@ -798,7 +806,7 @@ static int op_get_active_config_descriptor(struct libusb_device *dev,

+  {

+  	struct linux_device_priv *priv = usbi_get_device_priv(dev);

+  	void *config_desc;

+ -	uint8_t active_config;

+ +	int active_config;

+  	int r;

+  

+  	if (priv->sysfs_dir) {

+ @@ -810,12 +818,12 @@ static int op_get_active_config_descriptor(struct libusb_device *dev,

+  		active_config = priv->active_config;

+  	}

+  

+ -	if (active_config == 0) {

+ +	if (active_config == -1) {

+  		usbi_err(DEVICE_CTX(dev), "device unconfigured");

+  		return LIBUSB_ERROR_NOT_FOUND;

+  	}

+  

+ -	r = op_get_config_descriptor_by_value(dev, active_config, &config_desc);

+ +	r = op_get_config_descriptor_by_value(dev, (uint8_t)active_config, &config_desc);

+  	if (r < 0)

+  		return r;

+  

+ @@ -863,17 +871,26 @@ static int usbfs_get_active_config(struct libusb_device *dev, int fd)

+  

+  		/* we hit this error path frequently with buggy devices :( */

+  		usbi_warn(DEVICE_CTX(dev), "get configuration failed, errno=%d", errno);

+ +

+ +		/* assume the current configuration is the first one if we have

+ +		 * the configuration descriptors, otherwise treat the device

+ +		 * as unconfigured. */

+ +		if (priv->config_descriptors)

+ +			priv->active_config = (int)priv->config_descriptors[0].desc->bConfigurationValue;

+ +		else

+ +			priv->active_config = -1;

+  	} else if (active_config == 0) {

+ -		/* some buggy devices have a configuration 0, but we're

+ -		 * reaching into the corner of a corner case here, so let's

+ -		 * not support buggy devices in these circumstances.

+ -		 * stick to the specs: a configuration value of 0 means

+ -		 * unconfigured. */

+ -		usbi_warn(DEVICE_CTX(dev), "active cfg 0? assuming unconfigured device");

+ +		if (dev_has_config0(dev)) {

+ +			/* some buggy devices have a configuration 0, but we're

+ +			 * reaching into the corner of a corner case here. */

+ +			priv->active_config = 0;

+ +		} else {

+ +			priv->active_config = -1;

+ +		}

+ +	} else {

+ +		priv->active_config = (int)active_config;

+  	}

+  

+ -	priv->active_config = active_config;

+ -

+  	return LIBUSB_SUCCESS;

+  }

+  

+ @@ -1004,9 +1021,9 @@ static int initialize_device(struct libusb_device *dev, uint8_t busnum,

+  		usbi_warn(ctx, "Missing rw usbfs access; cannot determine "

+  			       "active configuration descriptor");

+  		if (priv->config_descriptors)

+ -			priv->active_config = priv->config_descriptors[0].desc->bConfigurationValue;

+ +			priv->active_config = (int)priv->config_descriptors[0].desc->bConfigurationValue;

+  		else

+ -			priv->active_config = 0; /* No config dt */

+ +			priv->active_config = -1; /* No config dt */

+  

+  		return LIBUSB_SUCCESS;

+  	}

+ @@ -1428,22 +1445,27 @@ static int op_get_configuration(struct libusb_device_handle *handle,

+  	uint8_t *config)

+  {

+  	struct linux_device_priv *priv = usbi_get_device_priv(handle->dev);

+ +	int active_config;

+  	int r;

+  

+  	if (priv->sysfs_dir) {

+ -		r = sysfs_get_active_config(handle->dev, config);

+ +		r = sysfs_get_active_config(handle->dev, &active_config);

+  	} else {

+  		struct linux_device_handle_priv *hpriv = usbi_get_device_handle_priv(handle);

+  

+  		r = usbfs_get_active_config(handle->dev, hpriv->fd);

+  		if (r == LIBUSB_SUCCESS)

+ -			*config = priv->active_config;

+ +			active_config = priv->active_config;

+  	}

+  	if (r < 0)

+  		return r;

+  

+ -	if (*config == 0)

+ -		usbi_err(HANDLE_CTX(handle), "device unconfigured");

+ +	if (active_config == -1) {

+ +		usbi_warn(HANDLE_CTX(handle), "device unconfigured");

+ +		active_config = 0;

+ +	}

+ +

+ +	*config = (uint8_t)active_config;

+  

+  	return 0;

+  }

+ @@ -1467,11 +1489,13 @@ static int op_set_configuration(struct libusb_device_handle *handle, int config)

+  		return LIBUSB_ERROR_OTHER;

+  	}

+  

+ -	if (config == -1)

+ -		config = 0;

+ +	/* if necessary, update our cached active config descriptor */

+ +	if (!priv->sysfs_dir) {

+ +		if (config == 0 && !dev_has_config0(handle->dev))

+ +			config = -1;

+  

+ -	/* update our cached active config descriptor */

+ -	priv->active_config = (uint8_t)config;

+ +		priv->active_config = config;

+ +	}

+  

+  	return LIBUSB_SUCCESS;

+  }

+ -- 

+ 2.29.2

+ 

@@ -1,46 +0,0 @@ 

- From e8c0b72bf8cc6d89c3546bbdbcc85b2c63086578 Mon Sep 17 00:00:00 2001

- From: Hans de Goede <hdegoede@redhat.com>

- Date: Mon, 20 Feb 2012 16:12:19 +0100

- Subject: [PATCH 2/6] Don't print errors when cancel_transfer fails with

-  NOT_FOUND

- 

- As stated in the documentation for libusb_cancel_transfer,

- LIBUSB_ERROR_NOT_FOUND is an expected return value for

- libusb_cancel_transfer (under certain circumstances) printing

- an error each time this happens therefor is undesirable.

- 

- More so because under Linux IOCTL_USBFS_DISCARDURB sets errno

- to EINVAL when the kernel could not find the urb in the kernels

- urbs in flight list. Which means that the urb has already completed

- at the host controller level, but it has not necessarily already

- been reaped. IOW under Linux libusb_cancel_transfer may yield a

- result of LIBUSB_ERROR_NOT_FOUND *before* the transfer's callback

- has been called! So there is no way for an application to avoid

- calling libusb_cancel_transfer on already completed transfers.

- 

- Signed-off-by: Hans de Goede <hdegoede@redhat.com>

- ---

-  libusb/io.c |    7 +++++--

-  1 file changed, 5 insertions(+), 2 deletions(-)

- 

- diff --git a/libusb/io.c b/libusb/io.c

- index bb6e275..9f46cf0 100644

- --- a/libusb/io.c

- +++ b/libusb/io.c

- @@ -1351,8 +1351,11 @@ int API_EXPORTED libusb_cancel_transfer(struct libusb_transfer *transfer)

-  	usbi_mutex_lock(&itransfer->lock);

-  	r = usbi_backend->cancel_transfer(itransfer);

-  	if (r < 0) {

- -		usbi_err(TRANSFER_CTX(transfer),

- -			"cancel transfer failed error %d", r);

- +		if (r != LIBUSB_ERROR_NOT_FOUND)

- +			usbi_err(TRANSFER_CTX(transfer),

- +				"cancel transfer failed error %d", r);

- +		else

- +			usbi_dbg("cancel transfer failed error %d", r);

-  

-  		if (r == LIBUSB_ERROR_NO_DEVICE)

-  			itransfer->flags |= USBI_TRANSFER_DEVICE_DISAPPEARED;

- -- 

- 1.7.9.3

- 

@@ -1,92 +0,0 @@ 

- From 3b6ed16cd2f098dd3920853d20940b3560c20ece Mon Sep 17 00:00:00 2001

- From: Hans de Goede <hdegoede@redhat.com>

- Date: Fri, 24 Feb 2012 10:24:00 +0100

- Subject: [PATCH 3/6] linux: Fix handling of urb status codes

- 

- During testing of my usbredir code I hit a case where EOVERFLOW was not handled

- in handle_control_completion. Instead of just fixing this one case I've audited

- (and fixed where necessary) all handle_foo_completion functions to know about

- all errors documented in linux/Documentation/usb/error-codes.txt.

- 

- Note that for handle_iso_completion this patch actually removes the handling

- of some codes, since these can never occur on an iso urb (they can only

- occur on the iso packets included in the urb, see the next patch in this

- series). Also in case an unknown status is encountered on an iso urb, this

- patch actually sets the urb's status to ERROR, rather then leaving it at

- completed.

- 

- Signed-off-by: Hans de Goede <hdegoede@redhat.com>

- ---

-  libusb/os/linux_usbfs.c |   17 ++++++++++++-----

-  1 file changed, 12 insertions(+), 5 deletions(-)

- 

- diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

- index 099fc61..36d37a4 100644

- --- a/libusb/os/linux_usbfs.c

- +++ b/libusb/os/linux_usbfs.c

- @@ -1952,6 +1952,7 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer,

-  	case -ENOENT: /* cancelled */

-  	case -ECONNRESET:

-  		break;

- +	case -ENODEV:

-  	case -ESHUTDOWN:

-  		usbi_dbg("device removed");

-  		tpriv->reap_status = LIBUSB_TRANSFER_NO_DEVICE;

- @@ -1970,6 +1971,8 @@ static int handle_bulk_completion(struct usbi_transfer *itransfer,

-  	case -ETIME:

-  	case -EPROTO:

-  	case -EILSEQ:

- +	case -ECOMM:

- +	case -ENOSR:

-  		usbi_dbg("low level error %d", urb->status);

-  		tpriv->reap_action = ERROR;

-  		goto cancel_remaining;

- @@ -2081,19 +2084,16 @@ static int handle_iso_completion(struct usbi_transfer *itransfer,

-  	case 0:

-  		break;

-  	case -ENOENT: /* cancelled */

- +	case -ECONNRESET:

-  		break;

-  	case -ESHUTDOWN:

-  		usbi_dbg("device removed");

-  		status = LIBUSB_TRANSFER_NO_DEVICE;

-  		break;

- -	case -ETIME:

- -	case -EPROTO:

- -	case -EILSEQ:

- -		usbi_dbg("low-level USB error %d", urb->status);

- -		break;

-  	default:

-  		usbi_warn(TRANSFER_CTX(transfer),

-  			"unrecognised urb status %d", urb->status);

- +		status = LIBUSB_TRANSFER_ERROR;

-  		break;

-  	}

-  

- @@ -2139,6 +2139,7 @@ static int handle_control_completion(struct usbi_transfer *itransfer,

-  	case -ENOENT: /* cancelled */

-  		status = LIBUSB_TRANSFER_CANCELLED;

-  		break;

- +	case -ENODEV:

-  	case -ESHUTDOWN:

-  		usbi_dbg("device removed");

-  		status = LIBUSB_TRANSFER_NO_DEVICE;

- @@ -2147,9 +2148,15 @@ static int handle_control_completion(struct usbi_transfer *itransfer,

-  		usbi_dbg("unsupported control request");

-  		status = LIBUSB_TRANSFER_STALL;

-  		break;

- +	case -EOVERFLOW:

- +		usbi_dbg("control overflow error");

- +		status = LIBUSB_TRANSFER_OVERFLOW;

- +		break;

-  	case -ETIME:

-  	case -EPROTO:

-  	case -EILSEQ:

- +	case -ECOMM:

- +	case -ENOSR:

-  		usbi_dbg("low-level bus error occurred");

-  		status = LIBUSB_TRANSFER_ERROR;

-  		break;

- -- 

- 1.7.9.3

- 

@@ -1,68 +0,0 @@ 

- From 4c3e7f9818c0d1d0462fde6f219da65fb102a434 Mon Sep 17 00:00:00 2001

- From: Hans de Goede <hdegoede@redhat.com>

- Date: Fri, 24 Feb 2012 11:15:30 +0100

- Subject: [PATCH 4/6] linux: Translate linux iso pkt status codes to libusb

-  transfer status codes

- 

- During testing of my usbredir code I hit a scenario where my libusb app

- was seeing EXDEV as status in the transfer's iso_packet_desc

- 

- This happened because we don't translate linux negative errno errors

- stored in iso pkts status to libusb transfer status codes at all! So this

- patch adds translation for this.

- 

- Signed-off-by: Hans de Goede <hdegoede@redhat.com>

- ---

-  libusb/os/linux_usbfs.c |   36 +++++++++++++++++++++++++++++++++++-

-  1 file changed, 35 insertions(+), 1 deletion(-)

- 

- diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c

- index 36d37a4..a7d8298 100644

- --- a/libusb/os/linux_usbfs.c

- +++ b/libusb/os/linux_usbfs.c

- @@ -2053,7 +2053,41 @@ static int handle_iso_completion(struct usbi_transfer *itransfer,

-  		struct usbfs_iso_packet_desc *urb_desc = &urb->iso_frame_desc[i];

-  		struct libusb_iso_packet_descriptor *lib_desc =

-  			&transfer->iso_packet_desc[tpriv->iso_packet_offset++];

- -		lib_desc->status = urb_desc->status;

- +		lib_desc->status = LIBUSB_TRANSFER_COMPLETED;

- +		switch (urb_desc->status) {

- +		case 0:

- +			break;

- +		case -ENOENT: /* cancelled */

- +		case -ECONNRESET:

- +			break;

- +		case -ENODEV:

- +		case -ESHUTDOWN:

- +			usbi_dbg("device removed");

- +			lib_desc->status = LIBUSB_TRANSFER_NO_DEVICE;

- +			break;

- +		case -EPIPE:

- +			usbi_dbg("detected endpoint stall");

- +			lib_desc->status = LIBUSB_TRANSFER_STALL;

- +			break;

- +		case -EOVERFLOW:

- +			usbi_dbg("overflow error");

- +			lib_desc->status = LIBUSB_TRANSFER_OVERFLOW;

- +			break;

- +		case -ETIME:

- +		case -EPROTO:

- +		case -EILSEQ:

- +		case -ECOMM:

- +		case -ENOSR:

- +		case -EXDEV:

- +			usbi_dbg("low-level USB error %d", urb_desc->status);

- +			lib_desc->status = LIBUSB_TRANSFER_ERROR;

- +			break;

- +		default:

- +			usbi_warn(TRANSFER_CTX(transfer),

- +				"unrecognised urb status %d", urb_desc->status);

- +			lib_desc->status = LIBUSB_TRANSFER_ERROR;

- +			break;

- +		}

-  		lib_desc->actual_length = urb_desc->actual_length;

-  	}

-  

- -- 

- 1.7.9.3

- 

file added
+6
@@ -0,0 +1,6 @@ 

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_testing

+ rules:

+   - !PassingTestCaseRule {test_case_name: dist.depcheck}

file modified
+95 -170
@@ -1,203 +1,128 @@ 

- Summary: A library which allows userspace access to USB devices

- Name: libusb1

- Version: 1.0.9

- Release: 0.6.rc1%{?dist}

- # This is a git snapshot of what will hopefully soon become 1.0.9, but

- # we need this now, to get things in place for:

- # http://fedoraproject.org/wiki/Features/UsbNetworkRedirection

- # To regenerate do:

- # git clone git://git.libusb.org/libusb.git

- # cd libusb

- # git checkout 1.0.9-rc1

- # ./autogen.sh

- # make dist

- # mv libusb-1.0.8.tar.bz2 libusb-1.0.9-rc1.tar.bz2

- Source0: libusb-1.0.9-rc1.tar.bz2

- #Source0: http://downloads.sourceforge.net/libusb/libusb-%{version}.tar.bz2

- 

- Patch1: 0001-Correctly-handle-LIBUSB_TRANSFER_OVERFLOW-in-libusb_.patch

- Patch2: 0002-linux-Fix-cancel_transfer-return-value-when-cancelli.patch

- Patch3: 0003-Don-t-print-errors-when-cancel_transfer-fails-with-N.patch

- Patch4: 0004-linux-Fix-handling-of-urb-status-codes.patch

- Patch5: 0005-linux-Translate-linux-iso-pkt-status-codes-to-libusb.patch

- 

- License: LGPLv2+

- Group: System Environment/Libraries

- URL: http://libusb.wiki.sourceforge.net/Libusb1.0

- BuildRequires: doxygen

+ Summary:        Library for accessing USB devices

+ Name:           libusb1

+ Version:        1.0.24

+ Release:        3%{?dist}

+ Source0:        https://github.com/libusb/libusb/releases/download/v%{version}/libusb-%{version}.tar.bz2

+ License:        LGPLv2+

+ URL:            http://libusb.info

+ BuildRequires:  systemd-devel doxygen libtool

+ BuildRequires:  make

+ BuildRequires:  gcc

+ # libusbx was removed in F34

+ Provides:       libusbx = %{version}-%{release}

+ Obsoletes:      libusbx < %{version}-%{release}

+ 

+ Patch001:       0001-linux_usbfs-Accept-sysfs-attributes-not-terminated-w.patch

+ Patch002:       0001-linux_usbfs-Fix-parsing-of-descriptors-for-multi-con.patch

+ Patch003:       0002-linux_usbfs-Gracefully-handle-buggy-devices-with-a-c.patch

  

  %description

- This package provides a way for applications to access USB devices. Note that

- this library is not compatible with the original libusb-0.1 series.

+ This package provides a way for applications to access USB devices.

  

- %package devel

- Summary: Development files for libusb

- Group: Development/Libraries

- Requires: %{name} = %{version}-%{release}

- Requires: %{name}-devel-doc = %{version}-%{release}

- Requires: pkgconfig

+ libusb is a library for USB device access from Linux, macOS,

+ Windows, OpenBSD/NetBSD, Haiku and Solaris userspace.

+ 

+ libusb is abstracted internally in such a way that it can hopefully

+ be ported to other operating systems.

+ 

+ %package        devel

+ Summary:        Development files for %{name}

+ Requires:       %{name}%{?_isa} = %{version}-%{release}

+ Provides:       libusbx-devel = %{version}-%{release}

+ Obsoletes:      libusbx-devel < %{version}-%{release}

+ 

+ %description    devel

+ The %{name}-devel package contains libraries and header files for

+ developing applications that use %{name}.

  

- %description devel

- This package contains the header files and libraries needed to develop

- applications that use libusb1.

  

  %package devel-doc

- Summary: Development files for libusb

- Group: Development/Libraries

- Requires: %{name}-devel = %{version}-%{release}

- BuildArch: noarch

+ Summary:        Development files for %{name}

+ Requires:       libusb1-devel = %{version}-%{release}

+ Provides:       libusbx-devel-doc = %{version}-%{release}

+ Obsoletes:      libusbx-devel-doc < %{version}-%{release}

+ BuildArch:      noarch

  

  %description devel-doc

- This package contains documentation needed to develop applications that

- use libusb1.

+ This package contains API documentation for %{name}.

+ 

+ 

+ %package        tests-examples

+ Summary:        Tests and examples for %{name}

+ # The fxload example is GPLv2+, the rest is LGPLv2+, like libusb itself.

+ License:        LGPLv2+ and GPLv2+

+ Requires:       %{name}%{?_isa} = %{version}-%{release}

+ Provides:       libusbx-tests-examples = %{version}-%{release}

+ Obsoletes:      libusbx-tests-examples < %{version}-%{release}

  

- %package static

- Summary: Static development files for libusb

- Group: Development/Libraries

- Requires: %{name}-devel = %{version}-%{release}

+ %description tests-examples

+ This package contains tests and examples for %{name}.

  

- %description static

- This package contains static libraries to develop applications that use libusb1.

  

  %prep

- %setup -q -n libusb-1.0.8

- %patch1 -p1

- %patch2 -p1

- %patch3 -p1

- %patch4 -p1

- %patch5 -p1

+ %autosetup -p1 -n libusb-%{version}

+ chmod -x examples/*.c

+ mkdir -p m4

+ 

  

  %build

- %configure --libdir=/%{_lib}

- make CFLAGS="$RPM_OPT_FLAGS"

+ %configure --disable-static --enable-examples-build

+ %{make_build}

  pushd doc

  make docs

  popd

+ pushd tests

+ make

+ popd

+ 

  

  %install

- make install DESTDIR=$RPM_BUILD_ROOT

- rm -f $RPM_BUILD_ROOT/%{_lib}/*.la

+ %{make_install}

+ mkdir -p $RPM_BUILD_ROOT%{_bindir}

+ install -m 755 tests/.libs/stress $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress

+ install -m 755 examples/.libs/testlibusb \

+     $RPM_BUILD_ROOT%{_bindir}/libusb-test-libusb

+ # Some examples are very device-specific / require specific hw and miss --help

+ # So we only install a subset of more generic / useful examples

+ for i in fxload listdevs xusb; do

+     install -m 755 examples/.libs/$i \

+         $RPM_BUILD_ROOT%{_bindir}/libusb-example-$i

+ done

+ rm $RPM_BUILD_ROOT%{_libdir}/*.la

  

- # Our snapshot reports itself as 1.0.8, change the pkg-config file version to

- # 1.0.9 so that configure checks by apps who need the new 1.0.9 succeed

- sed -i 's/1\.0\.8/1.0.9/' %{buildroot}/%{_lib}/pkgconfig/libusb-1.0.pc

  

- mkdir -p %{buildroot}%{_libdir}/pkgconfig

- mv %{buildroot}/%{_lib}/pkgconfig/* %{buildroot}%{_libdir}/pkgconfig/

+ %check

+ LD_LIBRARY_PATH=libusb/.libs ldd $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress

+ LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-stress

+ LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-test-libusb

+ LD_LIBRARY_PATH=libusb/.libs $RPM_BUILD_ROOT%{_bindir}/libusb-example-listdevs

  

- %post -p /sbin/ldconfig

- %postun -p /sbin/ldconfig

+ 

+ %ldconfig_scriptlets

  

  

  %files

- %defattr(-,root,root)

- %doc AUTHORS COPYING README NEWS ChangeLog

- /%{_lib}/*.so.*

+ %license COPYING

+ %doc AUTHORS README ChangeLog

+ %{_libdir}/*.so.*

  

  %files devel

- %defattr(-,root,root)

- %{_includedir}/*

- /%{_lib}/*.so

+ %{_includedir}/libusb-1.0

+ %{_libdir}/*.so

  %{_libdir}/pkgconfig/libusb-1.0.pc

  

  %files devel-doc

- %defattr(-,root,root)

- %doc doc/html examples/*.c

- 

- %files static

- %defattr(-,root,root)

- /%{_lib}/*.a

- 

- %changelog

- * Wed Mar 14 2012 Hans de Goede <hdegoede@redhat.com> - 1.0.9-0.6.rc1

- - One more small error handling fix

- 

- * Wed Mar 14 2012 Hans de Goede <hdegoede@redhat.com> - 1.0.9-0.5.rc1

- - Add some small error handling fixes

- 

- * Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.9-0.4.rc1

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

- 

- * Fri Sep 16 2011 Hans de Goede <hdegoede@redhat.com> - 1.0.9-0.3.rc1

- - Update to upstream 1.0.9-rc1 release

- 

- * Thu Aug 11 2011 Hans de Goede <hdegoede@redhat.com> - 1.0.9-0.2.git212ca37c

- - Report version in pkg-config file as 1.0.9

- 

- * Thu Jul 14 2011 Hans de Goede <hdegoede@redhat.com> - 1.0.9-0.1.git212ca37c

- - Update to a git snapshot which should be pretty close to the final 1.0.9

- - Many bugfixes

- - Needed for: http://fedoraproject.org/wiki/Features/UsbNetworkRedirection

- 

- * Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.8-7

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

- 

- * Wed Jan 26 2011 Jan Vcelak <jvcelak@redhat.com> 1.0.8-6

- - package config file has to be in /usr/lib/pkgconfig

+ %doc doc/api-1.0 examples/*.c

  

- * Tue Jan 25 2011 Jan Vcelak <jvcelak@redhat.com> 1.0.8-5

- - move libraries from /usr/lib to /lib (#519716)

+ %files tests-examples

+ %{_bindir}/libusb-example-fxload

+ %{_bindir}/libusb-example-listdevs

+ %{_bindir}/libusb-example-xusb

+ %{_bindir}/libusb-test-stress

+ %{_bindir}/libusb-test-libusb

  

- * Sun Nov 07 2010 Dan Horák <dan[at]danny.cz> - 1.0.8-4

- - drop the ExcludeArch as it's causing too many troubles

  

- * Wed Sep 29 2010 jkeating - 1.0.8-3

- - Rebuilt for gcc bug 634757

- 

- * Tue Sep 14 2010 Jan Vcelak <jvcelak@redhat.com> 1.0.8-2

- - USB access error messages are now handled by standard logging mechanism

-   instead of printing to stderr (#628356)

- 

- * Mon May 17 2010 Jindrich Novy <jnovy@redhat.com> 1.0.8-1

- - update to 1.0.8 (#592901)

- 

- * Fri Jan 22 2010 Jindrich Novy <jnovy@redhat.com> 1.0.6-2

- - put all doxygen and other docs to separate noarch subpackage to avoid

-   multiarch conflicts (#507980)

- 

- * Wed Dec 02 2009 Jindrich Novy <jnovy@redhat.com> 1.0.6-1

- - update to 1.0.6

- 

- * Mon Sep 28 2009 Jindrich Novy <jnovy@redhat.com> 1.0.3-1

- - update to 1.0.3

- 

- * Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-2

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

- 

- * Mon Jun 15 2009 Jindrich Novy <jnovy@redhat.com> 1.0.2-1

- - update to 1.0.2

- 

- * Wed May 13 2009 Jindrich Novy <jnovy@redhat.com> 1.0.1-1

- - update to 1.0.1

- 

- * Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

- 

- * Mon Dec 15 2008 - Bastien Nocera <bnocera@redhat.com> - 1.0.0-1

- - Update to 1.0.0

- 

- * Fri Nov 21 2008 - Bastien Nocera <bnocera@redhat.com> - 0.9.4-1

- - Update to 0.9.4

- 

- * Tue Sep 23 2008 Jindrich Novy <jnovy@redhat.com> 0.9.3-0.1

- - update to 0.9.3

- 

- * Sun Jul 06 2008 - Bastien Nocera <bnocera@redhat.com> - 0.9.1

- - Update to 0.9.1

- 

- * Mon May 26 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.4

- - update to official beta

- 

- * Thu May 23 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.3.gitbef33bb

- - update comment on how the tarball was created

- - use abbreviated git hash within package name to avoid conflicts

- - add to %%description that libusb1 is incompatible with libsub-0.1

- 

- * Thu May 22 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.2.gitbef33bb

- - add info on how the snapshot tarball was created

- 

- * Wed May 21 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.1.gitbef33bb

- - use proper version to denote it is a git snapshot

- 

- * Thu May 15 2008 Jindrich Novy <jnovy@redhat.com> 0.9.0-0.1

- - initial packaging

+ %changelog

+ * Tue Jan 19 18:47:55 CET 2021 Benjamin Berg <bberg@redhat.com> - 1.0.24-3

+ - New libusb1 package replacing libusbx

+   Resolves: #1918269 

\ No newline at end of file

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- 389dd12f7da1411aac2524c5de35e2f5  libusb-1.0.9-rc1.tar.bz2

+ SHA512 (libusb-1.0.24.tar.bz2) = 5aea36a530aaa15c6dd656d0ed3ce204522c9946d8d39ffbb290dab4a98cda388a2598da4995123d1032324056090bd429e702459626d3e8d7daeebc4e7ff3dc

file added
+6
@@ -0,0 +1,6 @@ 

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_testing

+ rules:

+   - !PassingTestCaseRule {test_case_name: dist.depcheck}

file added
+8
@@ -0,0 +1,8 @@ 

+ #!/bin/sh

+ 

+ set -e

+ 

+ ldd /usr/bin/libusb-test-stress

+ /usr/bin/libusb-test-stress

+ /usr/bin/libusb-test-libusb

+ /usr/bin/libusb-example-listdevs

file added
+17
@@ -0,0 +1,17 @@ 

+ ---

+ - hosts: localhost

+   roles:

+   - role: standard-test-source

+     tags:

+     - always

+     required_packages:

+     - git

+   - role: standard-test-basic

+     tags:

+     - atomic

+     - classic

+     tests:

+     - test:

+         dir: .

+         run: run.sh

+