summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2010-11-18 16:05:43 +0300
committerNikolai Kondrashov <spbnick@gmail.com>2010-11-18 16:05:43 +0300
commitfbe7a8bab9fbd0e7a9d00e5597ecb34166786a08 (patch)
tree97c8bd6bf09e074ffd12b9341e10959081e183b4
parent65c2e2a78aa4f26d2abcc12b500ee1b85b48abbe (diff)
downloadusbhid-dump-fbe7a8bab9fbd0e7a9d00e5597ecb34166786a08.tar.gz
Remove unneeded libusb_open_device_with_bus_dev
Remove now unneeded libusb_open_device_with_bus_dev, it is replaced with uhd_dev_list_open.
-rw-r--r--include/uhd/libusb.h6
-rw-r--r--lib/libusb.c72
2 files changed, 0 insertions, 78 deletions
diff --git a/include/uhd/libusb.h b/include/uhd/libusb.h
index fe33706..4334f2e 100644
--- a/include/uhd/libusb.h
+++ b/include/uhd/libusb.h
@@ -35,12 +35,6 @@ extern "C" {
extern const char *libusb_strerror(enum libusb_error err);
-extern enum libusb_error libusb_open_device_with_bus_dev(
- libusb_context *ctx,
- uint8_t bus_num,
- uint8_t dev_addr,
- libusb_device_handle **phandle);
-
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/lib/libusb.c b/lib/libusb.c
index 0d19336..4cacbfd 100644
--- a/lib/libusb.c
+++ b/lib/libusb.c
@@ -67,75 +67,3 @@ libusb_strerror(enum libusb_error err)
return "Unknown error code";
}
}
-
-
-enum libusb_error
-libusb_open_device_with_bus_dev(libusb_context *ctx,
- uint8_t bus_num,
- uint8_t dev_addr,
- libusb_device_handle **phandle)
-{
- enum libusb_error err = LIBUSB_ERROR_OTHER;
- libusb_device **list = NULL;
- ssize_t num;
- ssize_t idx;
- libusb_device *dev;
- libusb_device_handle *handle = NULL;
-
- /* Retrieve device list */
- num = libusb_get_device_list(ctx, &list);
- if (num == LIBUSB_ERROR_NO_MEM)
- {
- err = num;
- goto cleanup;
- }
-
- /* Find and open the device */
- for (idx = 0; idx < num; idx++)
- {
- dev = list[idx];
-
- if (libusb_get_bus_number(dev) == bus_num &&
- libusb_get_device_address(dev) == dev_addr)
- {
- err = libusb_open(dev, &handle);
- if (err != LIBUSB_SUCCESS)
- goto cleanup;
- break;
- }
- }
-
- /* Free the device list freeing unused devices */
- libusb_free_device_list(list, true);
- list = NULL;
-
- /* Check if the device is found */
- if (handle == NULL)
- {
- err = LIBUSB_ERROR_NO_DEVICE;
- goto cleanup;
- }
-
- /* Output the device handle */
- if (phandle != NULL)
- {
- *phandle = handle;
- handle = NULL;
- }
-
- err = LIBUSB_SUCCESS;
-
-cleanup:
-
- /* Free the device */
- if (handle != NULL)
- libusb_close(handle);
-
- /* Free device list along with devices */
- if (list != NULL)
- libusb_free_device_list(list, true);
-
- return err;
-}
-
-