logiops/src/logid/logid.cpp
2019-07-28 02:08:18 -04:00

45 lines
1.1 KiB
C++

#include <hidpp/SimpleDispatcher.h>
#include <hidpp/DispatcherThread.h>
#include <hidpp20/Device.h>
#include <hidpp20/Error.h>
#include <hidpp20/IReprogControls.h>
#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;
DeviceFinder* finder;
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;
}
// Scan devices, create listeners, handlers, etc.
finder = new DeviceFinder();
finder->run();
return EXIT_SUCCESS;
}