diff options
author | Rainer Keller <Rainer.Keller@qt.io> | 2018-02-07 14:06:44 +0100 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2018-02-12 11:37:17 +0000 |
commit | ed41752642af8a698e293fbd8a81e54cd770c433 (patch) | |
tree | 9caf98ea4a217132ffc91573998ec40d207f6c52 /qdb/server/usb-host/usbconnection.cpp | |
parent | 202fbffe11c0656c257e44bc66a18d90bd295399 (diff) |
Make error conditions more clear
Change-Id: I5b27907883ecebd7572b3b7e400179a240199f8f
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'qdb/server/usb-host/usbconnection.cpp')
-rw-r--r-- | qdb/server/usb-host/usbconnection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/qdb/server/usb-host/usbconnection.cpp b/qdb/server/usb-host/usbconnection.cpp index 3c8f3e4..360208d 100644 --- a/qdb/server/usb-host/usbconnection.cpp +++ b/qdb/server/usb-host/usbconnection.cpp @@ -74,7 +74,7 @@ bool UsbConnection::open(OpenMode mode) libusb_config_descriptor *config; int ret = libusb_get_active_config_descriptor(m_device.pointer(), &config); - if (ret) { + if (ret != LIBUSB_SUCCESS) { qCWarning(usbC) << "Could not get config descriptor:" << libusb_error_name(ret); return false; } @@ -83,7 +83,7 @@ bool UsbConnection::open(OpenMode mode) }; ret = libusb_open(m_device.pointer(), &m_handle); - if (ret) { + if (ret != LIBUSB_SUCCESS) { if (ret == LIBUSB_ERROR_ACCESS) { qCWarning(usbC) << "Access to USB device was denied." << "Check the manual for setting up access to USB devices."; @@ -100,7 +100,7 @@ bool UsbConnection::open(OpenMode mode) } ret = libusb_claim_interface(m_handle, m_interfaceInfo.number); - if (ret) { + if (ret != LIBUSB_SUCCESS) { qCDebug(usbC) << "Could not claim interface:" << libusb_error_name(ret); return false; } @@ -131,7 +131,7 @@ qint64 UsbConnection::writeData(const char *data, qint64 maxSize) int transferred = 0; int ret = libusb_bulk_transfer(m_handle, m_interfaceInfo.outAddress, (unsigned char*)data, size, &transferred, 0); - if (ret) { + if (ret != LIBUSB_SUCCESS) { qCCritical(usbC) << "Could not write message header:" << libusb_error_name(ret); return -1; } @@ -141,7 +141,7 @@ qint64 UsbConnection::writeData(const char *data, qint64 maxSize) if (size < maxSize) { int rest = maxSize - size; int ret = libusb_bulk_transfer(m_handle, m_interfaceInfo.outAddress, (unsigned char*)data + size, rest, &transferred, 0); - if (ret) { + if (ret != LIBUSB_SUCCESS) { qCCritical(usbC) << "Could not write message payload:" << libusb_error_name(ret); return -1; } |