aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb20_compat01.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libusb/libusb20_compat01.c')
-rw-r--r--lib/libusb/libusb20_compat01.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/lib/libusb/libusb20_compat01.c b/lib/libusb/libusb20_compat01.c
index aae819c08026..f97ff4dc947c 100644
--- a/lib/libusb/libusb20_compat01.c
+++ b/lib/libusb/libusb20_compat01.c
@@ -99,26 +99,6 @@ struct usb_parse_state {
uint8_t preparse;
};
-static uint8_t
-usb_get_first_claimed_interface(usb_dev_handle * dev)
-{
- struct libusb20_device *pdev = (void *)dev;
- uint32_t x;
- uint8_t y;
-
- x = pdev->claimed_interfaces;
-
- for (y = 0; y != 32; y++) {
- if (x & (1 << y))
- break;
- }
-
- if (y == 32)
- y = 0xFF; /* dummy */
-
- return (y);
-}
-
static struct libusb20_transfer *
usb_get_transfer_by_ep_no(usb_dev_handle * dev, uint8_t ep_no)
{
@@ -746,12 +726,9 @@ usb_set_configuration(usb_dev_handle * udev, int bConfigurationValue)
int
usb_claim_interface(usb_dev_handle * dev, int interface)
{
- int err;
-
- err = libusb20_dev_claim_interface((void *)dev, interface);
+ struct libusb20_device *pdev = (void *)dev;
- if (err)
- return (-1);
+ pdev->claimed_interface = interface;
return (0);
}
@@ -759,23 +736,18 @@ usb_claim_interface(usb_dev_handle * dev, int interface)
int
usb_release_interface(usb_dev_handle * dev, int interface)
{
- int err;
-
- err = libusb20_dev_release_interface((void *)dev, interface);
-
- if (err)
- return (-1);
-
+ /* do nothing */
return (0);
}
int
usb_set_altinterface(usb_dev_handle * dev, int alternate)
{
+ struct libusb20_device *pdev = (void *)dev;
int err;
uint8_t iface;
- iface = usb_get_first_claimed_interface(dev);
+ iface = pdev->claimed_interface;
err = libusb20_dev_set_alt_index((void *)dev, iface, alternate);