mirror of
https://github.com/PixlOne/logiops.git
synced 2025-07-13 21:02:43 +08:00
Fix operation order
This commit is contained in:
parent
237fa5fbd3
commit
91aa0c1217
@ -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 {
|
||||
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user