diff options
author | Bruno Randolf <br1@einfach.org> | 2019-01-05 18:27:58 +0000 |
---|---|---|
committer | Bruno Randolf <br1@einfach.org> | 2019-01-05 18:30:06 +0000 |
commit | 836adbb7b42a05f5b38cf5cc90b2377751e01f4d (patch) | |
tree | 7abfc7c161355fa2b4690651242d454af833937b | |
parent | Improved handling of connection counts dealing with latent disconnects on sta... (diff) | |
download | gobbledegook-836adbb7b42a05f5b38cf5cc90b2377751e01f4d.tar.gz gobbledegook-836adbb7b42a05f5b38cf5cc90b2377751e01f4d.tar.bz2 gobbledegook-836adbb7b42a05f5b38cf5cc90b2377751e01f4d.zip |
HciAdapter: Endian fixes
Keep code and dataSize before converting to network format, otherwise
we will use the network converted values on the host side later.
This fixes errors I have encountered on a MIPS platform.
Signed-off-by: Bruno Randolf <br1@einfach.org>
-rw-r--r-- | src/HciAdapter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/HciAdapter.cpp b/src/HciAdapter.cpp index eb1990f..9ab44d1 100644 --- a/src/HciAdapter.cpp +++ b/src/HciAdapter.cpp @@ -510,18 +510,21 @@ bool HciAdapter::sendCommand(HciHeader &request) return false; } + uint16_t code = request.code; + uint16_t dataSize = request.dataSize; + conditionalValue = -1; std::future<bool> fut = std::async(std::launch::async, [&]() mutable { - return waitForCommandResponse(request.code, kMaxEventWaitTimeMS); + return waitForCommandResponse(code, kMaxEventWaitTimeMS); }); // Prepare the request to be sent (endianness correction) request.toNetwork(); uint8_t *pRequest = reinterpret_cast<uint8_t *>(&request); - std::vector<uint8_t> requestPacket = std::vector<uint8_t>(pRequest, pRequest + sizeof(request) + request.dataSize); + std::vector<uint8_t> requestPacket = std::vector<uint8_t>(pRequest, pRequest + sizeof(request) + dataSize); if (!hciSocket.write(requestPacket)) { return false; |