From 5b66f6841828ddd3dd2e640be6b22ca4eeac384d Mon Sep 17 00:00:00 2001 From: Debenben <35615783+Debenben@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:48:32 +0100 Subject: [PATCH] Update BluetoothHciSocket.cpp Closes #60 --- src/BluetoothHciSocket.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BluetoothHciSocket.cpp b/src/BluetoothHciSocket.cpp index b951fe2..ab51be1 100644 --- a/src/BluetoothHciSocket.cpp +++ b/src/BluetoothHciSocket.cpp @@ -351,7 +351,13 @@ bool BluetoothHciSocket::isDevUp() void BluetoothHciSocket::setFilter(char *data, int length) { - if (setsockopt(this->_socket, SOL_HCI, HCI_FILTER, data, length) < 0) + struct hci_filter { + uint32_t type_mask; + uint32_t event_mask[2]; + uint16_t opcode; + } filter; + memcpy(&filter, data, length); + if (setsockopt(this->_socket, SOL_HCI, HCI_FILTER, &filter, sizeof(filter)) < 0) { this->emitErrnoError("setsockopt"); }