From fb0b8e88ef815ebff71fdab7ea8a528270a9de47 Mon Sep 17 00:00:00 2001 From: pixl Date: Fri, 19 Jun 2020 23:48:16 -0400 Subject: [PATCH] Clean up temporary code --- src/logid/DeviceManager.cpp | 3 --- src/logid/backend/hidpp/Device.cpp | 3 --- src/logid/backend/raw/RawDevice.cpp | 8 ++++++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/logid/DeviceManager.cpp b/src/logid/DeviceManager.cpp index e4fd9ca..58418d7 100644 --- a/src/logid/DeviceManager.cpp +++ b/src/logid/DeviceManager.cpp @@ -14,8 +14,6 @@ using namespace logid::backend; void DeviceManager::addDevice(std::string path) { - log_printf(DEBUG, "Scanning %s for devices.", path.c_str()); - bool defaultExists = true; bool isReceiver = false; try { @@ -36,7 +34,6 @@ void DeviceManager::addDevice(std::string path) log_printf(INFO, "Detected receiver at %s", path.c_str()); auto receiver = std::make_shared(path); _receivers.emplace(path, receiver); - // receiver->listen(); } else { /* TODO: Error check? * TODO: Can non-receivers only contain 1 device? diff --git a/src/logid/backend/hidpp/Device.cpp b/src/logid/backend/hidpp/Device.cpp index 4994aef..d6cbdc8 100644 --- a/src/logid/backend/hidpp/Device.cpp +++ b/src/logid/backend/hidpp/Device.cpp @@ -84,9 +84,6 @@ void Device::_init() Device::~Device() { raw_device->removeEventHandler("DEV_" + std::to_string(_index)); - ///TODO: tmp - raw_device->stopListener(); - raw_device.reset(); } void Device::addEventHandler(const std::string& nickname, const std::shared_ptr& handler) diff --git a/src/logid/backend/raw/RawDevice.cpp b/src/logid/backend/raw/RawDevice.cpp index d7b9b60..ca76cc9 100644 --- a/src/logid/backend/raw/RawDevice.cpp +++ b/src/logid/backend/raw/RawDevice.cpp @@ -270,6 +270,14 @@ void RawDevice::listen() this->handleEvent(report); } + // Listener is stopped, handle I/O queue + while(!write_queue.empty()) + { + auto task = write_queue.front(); + (*task)(); + write_queue.pop(); + } + continue_listen = false; }