diff options
author | Paul Nettle <nettle.paul@gmail.com> | 2017-09-03 08:15:12 -0500 |
---|---|---|
committer | Paul Nettle <nettle.paul@gmail.com> | 2017-09-03 08:15:12 -0500 |
commit | 23e46d2de44a3d49063e852a38b020e7407a78bc (patch) | |
tree | 7eca15bc1e93dc47d828dc9cef72f66515d287c5 /src/HciAdapter.cpp | |
parent | Cleaned up the logging a bit, improved server termination status returned fro... (diff) | |
download | gobbledegook-23e46d2de44a3d49063e852a38b020e7407a78bc.tar.gz gobbledegook-23e46d2de44a3d49063e852a38b020e7407a78bc.tar.bz2 gobbledegook-23e46d2de44a3d49063e852a38b020e7407a78bc.zip |
The GGK server names are no longer in Globals.h but are now configured by ggkStart() allowing an application to change them based on configuration rather than compilation. Power-off-disconnect errors hacked out of existence. A few log lines that were set to trace converted to debug log levels to reduce logspam.
Diffstat (limited to 'src/HciAdapter.cpp')
-rw-r--r-- | src/HciAdapter.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/HciAdapter.cpp b/src/HciAdapter.cpp index 6d99d69..9000709 100644 --- a/src/HciAdapter.cpp +++ b/src/HciAdapter.cpp @@ -344,10 +344,23 @@ bool HciAdapter::filterAndValidateEvents(uint16_t commandCode, std::vector<uint8 size_t dataLength = sizeof(Header) + pEvent->header.dataSize; if (dataLength > buffer.size()) { - Logger::error(SSTR << " + Not enough data for the current event"); + Logger::error(" + Not enough data for the current event"); return false; } + // !HACK! - If the device is connected, then powering off (Command Code 0x0005) returns a Device Disconnect Event (Event + // Code 0xC) rather than a Command Complete Event (0x1) like it should. + // + // We'll fake it here, converting that condition into a Command Complete Event (0x1). + if (commandCode == 0x0005 && pEvent->header.code == 0xC) + { + Logger::debug("!HACK! Converting invalid Disconect Event to Command Complete Event for power-off command"); + pEvent->header.code = 1; + buffer = {0x1, 0x0, 0x0, 0x0, 0x7, 0x0, 0x5, 0x0, 0x0, 0x2, 0x6, 0x0, 0x0}; + pEvent = reinterpret_cast<ResponseEvent *>(buffer.data()); + dataLength = sizeof(Header) + pEvent->header.dataSize; + } + // Check the event type if (pEvent->header.code < kMinEventType || pEvent->header.code > kMaxEventType) { |