Implement receiver HID++ connect/disconnect events

Many changes were made here but that was the biggest one.

There's currently a bug where std::system_error: Broken pipe is thrown
after launching the daemon with a receiver connector.

A workaround for this bug is to simply shake the mouse while starting
the daemon. I will investigate this soon.
This commit is contained in:
pixl
2020-06-21 05:33:33 -04:00
parent b05e525bbc
commit e40da5f0c0
24 changed files with 689 additions and 181 deletions
+4
View File
@@ -33,6 +33,7 @@ void DeviceManager::addDevice(std::string path)
if(isReceiver) {
log_printf(INFO, "Detected receiver at %s", path.c_str());
auto receiver = std::make_shared<Receiver>(path);
receiver->run();
_receivers.emplace(path, receiver);
} else {
/* TODO: Error check?
@@ -48,6 +49,9 @@ void DeviceManager::addDevice(std::string path)
} catch(hidpp10::Error &e) {
if(e.code() != hidpp10::Error::UnknownDevice)
throw;
else
log_printf(WARN, "HID++ 1.0 error while trying to initialize"
" %s: %s", path.c_str(), e.what());
} catch(hidpp::Device::InvalidDevice &e) { // Ignore
} catch(std::system_error &e) {
// This error should have been thrown previously