Commit Graph

325 Commits

Author SHA1 Message Date
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
70e77c2b3b udev: Actually set the right group
Forgot to set the group for the nodes to input so that the user can manage it if
needed.
2021-04-25 14:01:53 -05:00
June Tate-Gans
cf1caf7c7a g13d: Fix include path for config.h 2021-04-25 13:43:16 -05:00
June Tate-Gans
0cf69f92d2 clangformat: Indent case labels 2021-04-25 13:43:02 -05:00
June Tate-Gans
709f088d8c gitignore: Ignore GNU global tags 2021-04-25 13:42:46 -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
6ea11f3d58 cmake: Install udev and systemd services 2021-04-25 12:20:19 -05:00
June Tate-Gans
b04a8d6152 udev: Match attributes correctly and trigger systemd unit
This starts to make g13d more automatic. Instead of requiring manual
intervention or automatic starts on system start, this will allow udevd to
automatically trigger g13d when a g13 is plugged in.

There's still a bug in g13d where if the device falls off the USB chain g13d
won't exit, though, but this is a good start.
2021-04-25 12:18:07 -05:00
June Tate-Gans
eba5f77a88 g13d.service: Fix the fifo locations
Apparently /var/run is the old, deprecated pathname for /run these days.
2021-04-25 12:17:28 -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
8e8638d08f build: Remove the old Makefile
We need to double down on the cmake build system, so get rid of the old Makefile.
2021-04-25 11:57:52 -05:00
June Tate-Gans
fa82756f3d contrib: Rename to be more accurate 2021-04-25 01:24:02 -05:00
June Tate-Gans
fa73ed6212 udev: Fix the mode and group
The g13 should only be accessible by users in the input group to tighten up
security a bit.
2021-04-25 01:21:58 -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
June Tate-Gans
a8eda7a3c5 readme: Update the header a bit
This makes it clear what the origin of the source was, and what the intent for
it is.
2021-04-25 00:54:34 -05:00
June Tate-Gans
6e41bf4fa3 licensing: Add in the toplevel MIT license
The original source was under the public domain from "ecraven" off of github --
this places the entire tree under the MIT license. In terms of licensing, this
isn't much different from the public domain, except for the indemnity clauses.
2021-04-25 00:51:30 -05:00
June Tate-Gans
4f02eceeb1 warnings: Fix a bunch of warnings
This is in prep to turn on more warnings.

  - Stop using libusb_set_debug, according to the deprecation warning for
    libusb.
  - Return correctly in G13_Manager::run
  - Fix the ostream logging helper to return an ostream instead of just
    returning whatever the last expression was.
2021-04-25 00:37:26 -05:00
June Tate-Gans
b490dd9fff cleanups: Migrate source files to appropriate dirs and fix names
This cleans things up significantly in the source tree and makes this easier to
manage longer term. In the next few commits, we'll migrate the build to CMake in
prep for packaging support.

  - Move bindings into bindings
  - Move system configs and misc files into etc
  - Move LCD apps into contrib/
  - Move all source files into srcs
  - Rename helper extensions to match GNU extension naming, fix the #includes as
    well
  - Adjust Makefile to be less verbose and more programmatic
2021-04-25 00:34:49 -05:00
June Tate-Gans
713b4beefc readme: Cleanups and wrapping fixes
This wraps long lines and removes a bunch of trailing whitespace to make it a
bit more maintainable.
2021-04-24 23:55:58 -05:00
June Tate-Gans
9bf08d1d6d qol fixes: Update Makefile and add systemd unit
This removes the makefile packaging target, since it wasn't really all that
useful for distribution of the program. Additionally, this sets up an install
target to install g13d to the users' local directory.

This is kinda a hack -- really we should be installing g13d to $PREFIX/bin,
dropping a g13d unit somewhere, and then setting up appropriate permissions,
etc. It works for me, though.
2021-04-24 23:50:48 -05:00
James Fowler
815e0001cb Merge pull request #18 from james-fowler/master
oops... forgot a file
2016-01-20 13:38:14 -05:00
James Fowler
26b0e59281 oops... forgot a file 2016-01-20 13:37:00 -05:00
James Fowler
42f22de614 Merge pull request #15 from james-fowler/master
G13++ - and the kitchen sink...
2016-01-20 13:32:49 -05:00
James Fowler
3524fdca4c added log_level control, refactored G13_Device::command 2016-01-20 13:30:48 -05:00
James Fowler
d3349be24e cleanup logging 2015-12-15 15:48:16 -05:00
James Fowler
dfc3c4a6eb message for unrecognized stickzone operation 2015-12-14 12:43:23 -05:00
James Fowler
f11b2eafdd added "dump" diagnostic command, more cleanup 2015-12-14 12:35:56 -05:00
James Fowler
65cf67d8c4 more edits to README 2015-12-14 01:16:22 -05:00
James Fowler
50ccaad2a4 readme fix 2015-12-14 01:11:35 -05:00
James Fowler
de09481d5a more command line options 2015-12-14 01:09:10 -05:00
James Fowler
07ec242c5a finally starting to get somewhere with formatting the README 2015-12-13 23:18:05 -05:00
James Fowler
7de175dfa0 another shot at formatting the README 2015-12-13 23:08:12 -05:00
James Fowler
6f7a762705 rename README.org to README.md 2015-12-13 22:44:04 -05:00
James Fowler
f246161557 refactoring, code cleanup 2015-12-13 22:42:50 -05:00
James Fowler
cb5ce58ee6 fix extra space in stickzone command parse 2015-12-12 02:58:15 -05:00
James Fowler
309fca23e7 stick updates 2015-12-12 02:46:10 -05:00
James Fowler
ed009262c7 yet another format test 2015-12-12 02:17:45 -05:00
James Fowler
da3aa7378b more format tests 2015-12-12 02:14:28 -05:00
James Fowler
88b97436bd trying to figure out README formatting... 2015-12-12 02:12:24 -05:00
James Fowler
f6caefaf28 stickmode / stickzone, update docs 2015-12-12 02:01:18 -05:00
James Fowler
de9d4172cc enhanced stick control 2015-12-11 21:22:25 -05:00
James Fowler
64891c027d added .gitignore 2015-12-11 21:21:52 -05:00
James Fowler
f9d1833fd3 missing gcc_lcd.cc 2015-12-11 19:23:06 -05:00
James Fowler
68cad1e38f cleanup header files, refactoring some of the code into classes 2015-12-11 00:05:25 -05:00
James Fowler
3db5b08f35 extended key mapping, support for multi-key commands 2015-12-09 16:34:21 -05:00