From 26611eaa494ed9e077b5b0e1f999f5ae377de958 Mon Sep 17 00:00:00 2001 From: Sebastian von Ohr Date: Tue, 28 Apr 2020 16:28:27 +0200 Subject: [PATCH] Windows: Translate ERROR_NO_SUCH_DEVICE to LIBUSB_TRANSFER_NO_DEVICE Windows SDK 10.0.18362.0 adds a new error code ERROR_NO_SUCH_DEVICE which is returned when the device is disconnected. Closes #721, Closes #722 Signed-off-by: Chris Dickens --- libusb/os/windows_common.c | 1 + libusb/os/windows_common.h | 5 +++++ libusb/version_nano.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c index d8f1e38..ccf20b2 100644 --- a/libusb/os/windows_common.c +++ b/libusb/os/windows_common.c @@ -430,6 +430,7 @@ static void windows_transfer_callback(const struct windows_backend *backend, break; case ERROR_FILE_NOT_FOUND: case ERROR_DEVICE_NOT_CONNECTED: + case ERROR_NO_SUCH_DEVICE: usbi_dbg("detected device removed"); status = LIBUSB_TRANSFER_NO_DEVICE; break; diff --git a/libusb/os/windows_common.h b/libusb/os/windows_common.h index 59891d4..00cdda3 100644 --- a/libusb/os/windows_common.h +++ b/libusb/os/windows_common.h @@ -135,6 +135,11 @@ typedef LONG USBD_STATUS; #define USBD_STATUS_CANCELED ((USBD_STATUS)0xC0010000L) #endif +// error code added with Windows SDK 10.0.18362 +#ifndef ERROR_NO_SUCH_DEVICE +#define ERROR_NO_SUCH_DEVICE 433L +#endif + /* Windows versions */ enum windows_version { WINDOWS_UNDEFINED, diff --git a/libusb/version_nano.h b/libusb/version_nano.h index bc9d93f..38dbc26 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11515 +#define LIBUSB_NANO 11516 -- 2.7.4