summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2020-10-04 10:31:40 -0500
committerBe <be@mixxx.org>2020-10-04 10:31:40 -0500
commitdff0202ca7a15d4543c80de30836b2b27ce500be (patch)
tree284bc10cdcb9be98d2f88f5904949171a540c885
parent018f1e233a557142c2fd9739ff6053e006148812 (diff)
HidController: handle all possible return values from hidapi
-rw-r--r--src/controllers/hid/hidcontroller.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp
index 12f91cbc26..1b1ca2bec5 100644
--- a/src/controllers/hid/hidcontroller.cpp
+++ b/src/controllers/hid/hidcontroller.cpp
@@ -260,7 +260,9 @@ bool HidController::poll() {
unsigned char* pCurrentBuffer = m_pPollData[m_iPollingBufferIndex];
int bytesRead = hid_read(m_pHidDevice, pCurrentBuffer, kBufferSize);
- if (bytesRead == -1) {
+ if (bytesRead < 0) {
+ // -1 is the only error value according to hidapi documentation.
+ DEBUG_ASSERT(bytesRead == -1);
return false;
} else if (bytesRead == 0) {
return true;