2019-07-17 05:53:51 +00:00
|
|
|
#include <hidpp/SimpleDispatcher.h>
|
|
|
|
#include <hidpp/DispatcherThread.h>
|
|
|
|
#include <hidpp20/Device.h>
|
|
|
|
#include <hidpp20/Error.h>
|
2019-07-22 23:47:09 +00:00
|
|
|
#include <hidpp20/IReprogControls.h>
|
2019-07-17 05:53:51 +00:00
|
|
|
#include <hidpp20/UnsupportedFeature.h>
|
|
|
|
#include <hid/DeviceMonitor.h>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "Device.h"
|
|
|
|
#include "Actions.h"
|
|
|
|
#include "Configuration.h"
|
|
|
|
#include "EvdevDevice.h"
|
|
|
|
#include "DeviceFinder.h"
|
|
|
|
|
|
|
|
#define evdev_name "logid"
|
|
|
|
|
|
|
|
LogLevel global_verbosity = DEBUG;
|
|
|
|
Configuration* global_config;
|
|
|
|
EvdevDevice* global_evdev;
|
2019-07-28 06:08:18 +00:00
|
|
|
DeviceFinder* finder;
|
2019-07-17 05:53:51 +00:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
// Read config
|
|
|
|
try { global_config = new Configuration("logid.cfg"); }
|
|
|
|
catch (std::exception &e) { return EXIT_FAILURE; }
|
|
|
|
|
|
|
|
//Create an evdev device called 'logid'
|
|
|
|
try { global_evdev = new EvdevDevice(evdev_name); }
|
|
|
|
catch(std::system_error& e)
|
|
|
|
{
|
|
|
|
log_printf(ERROR, "Could not create evdev device: %s", e.what());
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2019-07-28 06:08:18 +00:00
|
|
|
// Scan devices, create listeners, handlers, etc.
|
|
|
|
finder = new DeviceFinder();
|
|
|
|
finder->run();
|
2019-07-17 05:53:51 +00:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|