aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2015-02-21 03:38:07 +1100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2015-02-21 03:50:55 +1100
commitfae5f627a092ca3b3c79d0da050e6ff41c67f53f (patch)
tree63c00b9d69a8c74770a9946df01a5bbe483b7a1e
parente98281afb7d9cf7429339c2aaa45f80fc0ce1584 (diff)
downloadexternal_heimdall-fae5f627a092ca3b3c79d0da050e6ff41c67f53f.zip
external_heimdall-fae5f627a092ca3b3c79d0da050e6ff41c67f53f.tar.gz
external_heimdall-fae5f627a092ca3b3c79d0da050e6ff41c67f53f.tar.bz2
Implemented hack to make WinUSB play nice with empty receive transfers
-rw-r--r--heimdall/source/BridgeManager.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 1065795..b7bff3d 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -650,6 +650,14 @@ bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeou
int BridgeManager::ReceiveBulkTransfer(unsigned char *data, int length, int timeout, bool retry) const
{
+ if (data == nullptr)
+ {
+ // HACK: It seems WinUSB ignores us when we try to read with length zero.
+ static unsigned char dummyData;
+ data = &dummyData;
+ length = 1;
+ }
+
int dataTransferred;
int result = libusb_bulk_transfer(deviceHandle, inEndpoint, data, length, &dataTransferred, timeout);