summaryrefslogtreecommitdiffstats
path: root/heimdall/source
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-31 04:05:02 +0200
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-31 04:09:33 +0200
commit7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a (patch)
treee93979d3945f78d07ae357ea97a2ad7ac2c2f045 /heimdall/source
parentFixed line endings in install-kext.sh (diff)
downloadHeimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar.gz
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar.bz2
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar.lz
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar.xz
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.tar.zst
Heimdall-7d6ddcd5d54e30e7437f0ba1aa4676224e68bf6a.zip
Diffstat (limited to '')
-rw-r--r--heimdall/source/BridgeManager.cpp16
-rw-r--r--heimdall/source/BridgeManager.h5
2 files changed, 13 insertions, 8 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index a2cba80..96c22fb 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -624,12 +624,12 @@ bool BridgeManager::EndSession(bool reboot) const
return (true);
}
-bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeout) const
+bool BridgeManager::SendBulkTransfer(unsigned char *data, int length, int timeout, bool retry) const
{
int dataTransferred;
int result = libusb_bulk_transfer(deviceHandle, outEndpoint, data, length, &dataTransferred, timeout);
- if (result != LIBUSB_SUCCESS)
+ if (result != LIBUSB_SUCCESS && retry)
{
static const int retryDelay = 250;
@@ -667,8 +667,10 @@ bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, int sendEmpt
if (sendEmptyTransferFlags & kSendEmptyTransferBefore)
{
- if (!SendBulkTransfer(nullptr, 0, timeout))
- return (false);
+ if (!SendBulkTransfer(nullptr, 0, kDefaultTimeoutSendEmptyTransfer, false) && verbose)
+ {
+ Interface::PrintWarning("Empty bulk transfer before sending packet failed. Continuing anyway...\n");
+ }
}
if (!SendBulkTransfer(packet->GetData(), packet->GetSize(), timeout))
@@ -676,8 +678,10 @@ bool BridgeManager::SendPacket(OutboundPacket *packet, int timeout, int sendEmpt
if (sendEmptyTransferFlags & kSendEmptyTransferAfter)
{
- if (!SendBulkTransfer(nullptr, 0, timeout))
- return (false);
+ if (!SendBulkTransfer(nullptr, 0, kDefaultTimeoutSendEmptyTransfer, false) && verbose)
+ {
+ Interface::PrintWarning("Empty bulk transfer after sending packet failed. Continuing anyway...\n");
+ }
}
return (true);
diff --git a/heimdall/source/BridgeManager.h b/heimdall/source/BridgeManager.h
index 7028003..e85dc87 100644
--- a/heimdall/source/BridgeManager.h
+++ b/heimdall/source/BridgeManager.h
@@ -81,7 +81,8 @@ namespace Heimdall
enum
{
kDefaultTimeoutSend = 3000,
- kDefaultTimeoutReceive = 3000
+ kDefaultTimeoutReceive = 3000,
+ kDefaultTimeoutSendEmptyTransfer = 100
};
enum class UsbLogLevel
@@ -139,7 +140,7 @@ namespace Heimdall
bool InitialiseProtocol(void);
- bool SendBulkTransfer(unsigned char *data, int length, int timeout) const;
+ bool SendBulkTransfer(unsigned char *data, int length, int timeout, bool retry = true) const;
public: