Commit Graph

17 Commits

Author SHA1 Message Date
June Tate-Gans
8e14f1f853 g13d: Clean up initialization order 2021-04-25 14:38:08 -05:00
June Tate-Gans
f289bdf850 g13d: Style fixes and remove an unused variable 2021-04-25 14:37:00 -05:00
June Tate-Gans
366e3c0f24 g13d: Remove an unused block of code
We don't actually do anything with an add operation in
G13_Device::_init_commands, so fix up the if block.
2021-04-25 14:36:07 -05:00
June Tate-Gans
cb916e4d24 g13d: Fix a comparison with signed vs. unsigned 2021-04-25 14:35:49 -05:00
June Tate-Gans
d910829930 g13d: More C++11 iteration and exit on no more managed devices
Since we start from udev/systemd these days, we should exit when we don't have
any more devices to manage, and let udev/systemd manage things when a new one is
connected.
2021-04-25 14:33:48 -05:00
June Tate-Gans
d391b647b6 g13d: Fix a bunch of initialization order errors
The initializers were in the wrong order.
2021-04-25 14:33:12 -05:00
June Tate-Gans
65ab987a87 g13d: Simplify G13_Action_Keys::act
Migrate to C++11 iteration and clean up the mess of code that this was
originally with a single call to send_event and a proper use of a ternary for
logging.
2021-04-25 14:32:24 -05:00
June Tate-Gans
bbb3104eaf g13d: Use C++11 iterator instead of a raw C loop
Signed vs. unsigned types throwing all kinds of errors.
2021-04-25 14:31:45 -05:00
June Tate-Gans
19faa21256 g13d: Fix horribly broken strncpy usage
The sizeof was actually using the size of the statically allocated name instead
of the size of the destination. In practice, it's not a problem, but still, it
should be fixed.
2021-04-25 14:30:46 -05:00
June Tate-Gans
ae055495cc g13d: Handle errors in writes
The original code was just throwing away error conditions for write calls to an
fd. Obviously this is bad, but really, we should probably be using an ostream
instead of a raw file handle here. For now, deal with the warning by checking
the result for errors, at least, and later we'll refactor to use ostream
properly.
2021-04-25 14:29:40 -05:00
June Tate-Gans
516423ae16 g13d: Run clang-format to clean things up a bit 2021-04-25 14:04:12 -05:00
June Tate-Gans
cf1caf7c7a g13d: Fix include path for config.h 2021-04-25 13:43:16 -05:00
June Tate-Gans
c7992d52b5 g13d: Reformat all the files using clang-format
This should help with maintainability.
2021-04-25 12:51:26 -05:00
June Tate-Gans
c32950bfcb g13d: Build with warnings and correct C++ standard 2021-04-25 12:45:25 -05:00
June Tate-Gans
e17abaddf2 g13d: Add a config header 2021-04-25 12:44:58 -05:00
June Tate-Gans
05c64f62ed cmake: Make install create /run/g13d
CMake still doesn't have a way to set mode and owner/group at install time
atomically, so we have to fall back and call install directly in a script.
2021-04-25 12:16:47 -05:00
June Tate-Gans
04cb5d9c12 build: Start migration to cmake
This preps us for proper system installs to distributions, finding depending
libraries, and allowing us to build the foundation for the GUI and support
tooling next.

The plan is to run g13d as a system daemon managed by systemd. We'll use the
system-wide input group to control access to the daemon.

  - Add a CMakeLists for etc so we can install the udev rules.
  - Move the src dir to g13d to disambiguate a bit.
  - Update the toplevel Makefile so we can still build the old way (for now).
2021-04-25 01:19:06 -05:00