diff options
author | Pete Batard <pete@akeo.ie> | 2011-11-18 17:19:16 +0000 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2011-11-18 17:19:16 +0000 |
commit | 4cc72d0cfbeb8105af49e9026b8e365c963a69da (patch) | |
tree | 06a40e094de139aa9cae882ed58d8fe8fef5514e | |
parent | 200fe7158aa6dda2940c6b6b7d4702a9173130a9 (diff) | |
download | libusb-4cc72d0cfbeb8105af49e9026b8e365c963a69da.tar.gz |
[core] amended previous commit and added libusb_strerror support
* typo fixes and race condition warning suggested by Alan Stern
-rw-r--r-- | libusb/core.c | 9 | ||||
-rw-r--r-- | libusb/libusb.h | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libusb/core.c b/libusb/core.c index d5aa095..8e56e92 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1574,6 +1574,9 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev, * to pass a negative value as the interface number, for composite devices that * have been split by the OS into multiple ones (MI_##), in which case the * interface associated with the Windows device is assumed. + * Note that this routine does not protect against races: Even if an interface + * is reported as available, there is a possibility that another driver may + * already be using it by the time the program tries to claim it. * \returns LIBUSB_SUCCESS if libusb can access the interface * \returns LIBUSB_ERROR_DETACHEABLE_DRIVER_IN_USE if a libusb incompatible * but detacheable driver is preventing access. See libusb_detach_kernel_driver. @@ -1862,6 +1865,12 @@ const char * LIBUSB_CALL libusb_strerror(enum libusb_error error_code) return "Insufficient memory"; case LIBUSB_ERROR_NOT_SUPPORTED: return "Operation not supported or unimplemented on this platform"; + case LIBUSB_ERROR_DETACHABLE_DRIVER_IN_USE: + return "An incompatible driver is in use. This driver can be detached on request"; + case LIBUSB_ERROR_NON_DETACHABLE_DRIVER_IN_USE: + return "An incompatible and non detachable driver is in use. This driver should be replaced to allow libusb access"; + case LIBUSB_ERROR_NO_DRIVER: + return "No driver is installed. A libusb compatible driver must be installed to allow access"; case LIBUSB_ERROR_OTHER: return "Other error"; } diff --git a/libusb/libusb.h b/libusb/libusb.h index 648f776..05c5069 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -762,10 +762,10 @@ enum libusb_error { // TODO: libusb_strerror /** A detacheable kernel driver is in use */ - LIBUSB_ERROR_DETACHEABLE_DRIVER_IN_USE = -13, + LIBUSB_ERROR_DETACHABLE_DRIVER_IN_USE = -13, /** A non-detacheable driver is in use */ - LIBUSB_ERROR_NON_DETACHEABLE_DRIVER_IN_USE = -14, + LIBUSB_ERROR_NON_DETACHABLE_DRIVER_IN_USE = -14, /** A driver has not been installed for this device (Windows) */ LIBUSB_ERROR_NO_DRIVER = -15, |