summaryrefslogtreecommitdiffstats
path: root/heimdall
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-06 16:23:19 +0200
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-05-06 16:23:19 +0200
commit9b56396ba19617b70ebde5f5072ad8b401697e50 (patch)
treeabc5c6d188d4008f2fb3b3b0a0f2b1ff89a2c12d /heimdall
parentUpdated copyright notices to 2014 (diff)
downloadHeimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar.gz
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar.bz2
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar.lz
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar.xz
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.tar.zst
Heimdall-9b56396ba19617b70ebde5f5072ad8b401697e50.zip
Diffstat (limited to 'heimdall')
-rw-r--r--heimdall/source/BridgeManager.cpp94
-rw-r--r--heimdall/source/BridgeManager.h11
2 files changed, 1 insertions, 104 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 1559a70..44e3c0c 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -306,102 +306,10 @@ void BridgeManager::ReleaseDeviceInterface(void)
Interface::Print("\n");
}
-enum
-{
- kControlRequestSetLineCoding = 0x20,
- kControlRequestSetControlLineState = 0x22
-};
-
-
-enum
-{
- kLineCodingCharFormatZeroToOneStopBit = 0,
- kLineCodingCharFormatOneToOneAndAHalfStopBits = 1,
- kLineCodingCharFormatTwoToTwoAndAHalfStopBits = 2
-};
-
-enum
-{
- kParityTypeNone = 0,
- kParityTypeOdd = 1,
- kParityTypeEven = 2,
- kParityTypeMark = 3,
- kParityTypeSpace = 4
-};
-
-bool BridgeManager::SetControlLineState(unsigned short controlSignalFlags)
-{
- int result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, kControlRequestSetControlLineState, controlSignalFlags, 0, nullptr, 0, 1000);
-
- if (result != LIBUSB_SUCCESS)
- {
- if (verbose)
- Interface::PrintWarning("Control line state (signal flags: 0x%x) transfer failed. Result: %d\n", controlSignalFlags, result);
-
- return (false);
- }
- else
- {
- return (true);
- }
-}
-
-bool BridgeManager::SetControlLineCoding(LineCoding lineCoding)
-{
- unsigned char dataBuffer[7];
-
- dataBuffer[0] = lineCoding.dteRate & 0xFF;
- dataBuffer[1] = (lineCoding.dteRate >> 8) & 0xFF;
- dataBuffer[2] = (lineCoding.dteRate >> 16) & 0xFF;
- dataBuffer[3] = (lineCoding.dteRate >> 24) & 0xFF;
- dataBuffer[4] = lineCoding.charFormat;
- dataBuffer[5] = lineCoding.parityType;
- dataBuffer[6] = lineCoding.dataBits;
-
- int result = libusb_control_transfer(deviceHandle, LIBUSB_REQUEST_TYPE_CLASS, kControlRequestSetLineCoding, 0x0, 0, dataBuffer, 7, 1000);
-
- if (result != LIBUSB_SUCCESS)
- {
- if (verbose)
- Interface::PrintWarning("Setting control line coding failed. Result: %d\n", result);
-
- return (false);
- }
- else
- {
- return (true);
- }
-}
-
-enum
-{
- kLineStateControlSignalDtePresent = 1,
- kLineStateControlSignalCarrierControl = 1 << 1
-};
-
bool BridgeManager::InitialiseProtocol(void)
{
Interface::Print("Initialising protocol...\n");
- /*LineCoding lineCoding;
-
- lineCoding.dteRate = 115200;
- lineCoding.charFormat = kLineCodingCharFormatZeroToOneStopBit;
- lineCoding.parityType = kParityTypeNone;
- lineCoding.dataBits = 7;
-
- SetControlLineState(kLineStateControlSignalDtePresent | kLineStateControlSignalCarrierControl);
- SetControlLineCoding(lineCoding);
- SetControlLineState(kLineStateControlSignalDtePresent | kLineStateControlSignalCarrierControl);
- SetControlLineState(kLineStateControlSignalCarrierControl);
-
- lineCoding.dataBits = 8;
- SetControlLineCoding(lineCoding);
-
- SetControlLineState(kLineStateControlSignalCarrierControl);*/
-
- int dataTransferred = 0;
-
unsigned char dataBuffer[7];
// Send "ODIN"
@@ -417,7 +325,7 @@ bool BridgeManager::InitialiseProtocol(void)
memset(dataBuffer, 0, 7);
int retry = 0;
- dataTransferred = 0;
+ int dataTransferred = 0;
int result = libusb_bulk_transfer(deviceHandle, inEndpoint, dataBuffer, 7, &dataTransferred, 1000);
diff --git a/heimdall/source/BridgeManager.h b/heimdall/source/BridgeManager.h
index 04b03c3..9ebbdae 100644
--- a/heimdall/source/BridgeManager.h
+++ b/heimdall/source/BridgeManager.h
@@ -89,14 +89,6 @@ namespace Heimdall
Default = Error
};
- typedef struct
- {
- unsigned int dteRate;
- unsigned char charFormat;
- unsigned char parityType;
- unsigned char dataBits;
- } LineCoding;
-
private:
static const DeviceIdentifier supportedDevices[kSupportedDeviceCount];
@@ -133,9 +125,6 @@ namespace Heimdall
bool InitialiseProtocol(void);
- bool SetControlLineState(unsigned short controlSignalFlags);
- bool SetControlLineCoding(LineCoding lineCoding);
-
bool SendBulkTransfer(unsigned char *data, int length, int timeout = 3000, bool retry = true) const;
public: