mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 17:12:46 +00:00
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:
parent
7095274026
commit
09ce2dedde
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=261475
@ -611,7 +611,6 @@ int
|
|||||||
libusb_claim_interface(struct libusb20_device *pdev, int interface_number)
|
libusb_claim_interface(struct libusb20_device *pdev, int interface_number)
|
||||||
{
|
{
|
||||||
libusb_device *dev;
|
libusb_device *dev;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
dev = libusb_get_device(pdev);
|
dev = libusb_get_device(pdev);
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
@ -621,13 +620,10 @@ libusb_claim_interface(struct libusb20_device *pdev, int interface_number)
|
|||||||
return (LIBUSB_ERROR_INVALID_PARAM);
|
return (LIBUSB_ERROR_INVALID_PARAM);
|
||||||
|
|
||||||
CTX_LOCK(dev->ctx);
|
CTX_LOCK(dev->ctx);
|
||||||
if (dev->claimed_interfaces & (1 << interface_number))
|
dev->claimed_interfaces |= (1 << interface_number);
|
||||||
err = LIBUSB_ERROR_BUSY;
|
|
||||||
|
|
||||||
if (!err)
|
|
||||||
dev->claimed_interfaces |= (1 << interface_number);
|
|
||||||
CTX_UNLOCK(dev->ctx);
|
CTX_UNLOCK(dev->ctx);
|
||||||
return (err);
|
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user