Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/logid/backend/hidpp10/ReceiverMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ void ReceiverMonitor::enumerate() {
}

void ReceiverMonitor::waitForDevice(hidpp::DeviceIndex index) {
const std::lock_guard lock(_wait_mutex);
if (!_waiters.count(index)) {
_waiters.emplace(index, _receiver->rawDevice()->addEventHandler(
{[index](const std::vector<uint8_t>& report) -> bool {
Expand Down Expand Up @@ -219,9 +218,8 @@ void ReceiverMonitor::_stopPair() {
void ReceiverMonitor::_addHandler(const hidpp::DeviceConnectionEvent& event, int tries) {
auto device_path = _receiver->devicePath();
try {
addDevice(event);
const std::lock_guard lock(_wait_mutex);
_waiters.erase(event.index);
addDevice(event);
} catch (DeviceNotReady& e) {
if (tries == max_tries) {
logPrintf(WARN, "Failed to add device %s:%d after %d tries."
Expand Down