Add ability to blacklist devices

This commit is contained in:
pixl
2020-07-04 00:10:44 -04:00
parent 2654f319c6
commit ef84577b9c
5 changed files with 60 additions and 2 deletions
+6 -1
View File
@@ -40,10 +40,15 @@ DeviceFinder::~DeviceFinder()
this->devices_mutex.unlock();
}
///TODO: Unused return variable?
Device* DeviceFinder::insertNewDevice(const std::string &path, HIDPP::DeviceIndex index)
{
auto device = new Device(path, index);
device->init();
try
{
device->init();
}
catch(BlacklistedDevice& e) { return nullptr; }
this->devices_mutex.lock();
log_printf(INFO, "%s detected: device %d on %s", device->name.c_str(), index, path.c_str());