MFC r261224:

Comply to the official LibUSB v1.0 API:
"It is legal to attempt to claim an already-claimed interface."
This commit is contained in:
Hans Petter Selasky 2014-02-04 08:59:42 +00:00
parent 7095274026
commit 09ce2dedde
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=261475

View File

@ -611,7 +611,6 @@ int
libusb_claim_interface(struct libusb20_device *pdev, int interface_number)
{
libusb_device *dev;
int err = 0;
dev = libusb_get_device(pdev);
if (dev == NULL)
@ -621,13 +620,10 @@ libusb_claim_interface(struct libusb20_device *pdev, int interface_number)
return (LIBUSB_ERROR_INVALID_PARAM);
CTX_LOCK(dev->ctx);
if (dev->claimed_interfaces & (1 << interface_number))
err = LIBUSB_ERROR_BUSY;
if (!err)
dev->claimed_interfaces |= (1 << interface_number);
dev->claimed_interfaces |= (1 << interface_number);
CTX_UNLOCK(dev->ctx);
return (err);
return (0);
}
int