Commit Graph

559 Commits (reverse-scroll)

Author SHA1 Message Date
nirenjan 2290900da6 Call tzset before computing timezone offset
POSIX.1-2004 requires that localtime() is required to behave as if
tzset() was called, but there is no such requirement imposed upon
localtime_r(). Therefore, we need to call tzset ourselves to ensure that
the timezone fields are updated.
2021-08-30 11:53:35 -07:00
nirenjan 91f378c4fc Apply configuration immediately when device is connected 2021-08-30 10:41:21 -07:00
nirenjan e0f6813028 Update translations 2021-08-30 10:33:20 -07:00
nirenjan 0899df60c2 Add signal handler to dump configuration to disk on SIGUSR1 2021-08-30 10:28:29 -07:00
nirenjan 76b1b99717 Make sure config file is closed after dumping configuration 2021-08-30 10:28:26 -07:00
nirenjan 38dfc7d7b0 Update translations to include new messages 2021-08-26 22:26:06 -07:00
nirenjan 1174f7f1c4 Bail out if there are changes after make distcheck 2021-08-26 22:22:39 -07:00
nirenjan a39945f461 Import inih library into source tree
Prior to this change, the user needed to install inih as a dependency,
either from the distribution repositories, or from source. On some
platforms (notably macOS), inih is not available prepackaged, and must
be installed by the user. This tends to cause needless friction.

This change imports the ini.c and ini.h files from the upstream inih
repository into the X52 source tree. This will allow us to build the
repository on any system with the original set of dependencies, and not
have to force the user to install packages themselves.
2021-08-26 22:16:38 -07:00
nirenjan 4c9ef85223 Squashed 'lib/pinelog/' changes from 27a5eab..0256807
0256807 Use strrchr only if the compiler supports __builtin_strrchr
204aade Use __builtin_strrchr to get file base name
aa0a554 Remove the use of config.h
8983bf8 Ignore test and benchmark programs

git-subtree-dir: lib/pinelog
git-subtree-split: 02568074170f0725196de4e52450db024cc39895
2021-08-25 14:22:04 -07:00
nirenjan 52d6920352 Merge commit '4c9ef85223ec6e638976eb279b82b9e9ea676b35' 2021-08-25 14:22:04 -07:00
nirenjan 5be91b6e50 Fix stringification of libx52_led_state
A missing comma at the end of the STRINGIFY line was causing builds with
clang to have segfaults with the default configuration. It turned out
that due to the missing comma, the N_("Unknown LED state %d") and
N_("off") parameters were getting merged into a single parameter by
clang, but interestingly, not by GCC.

As a result, when building with clang, the array is "on", "red",
"amber", "green" - note the missing "off" at the beginning of the array.
This causes clang generated builds to segfault when attemping to log a
trace message when configuring LED A (which defaults to green, and the
index of LIBX52_LED_STATE_GREEN exceeds the array bounds).
2021-08-25 14:09:28 -07:00
nirenjan ff10525028 Make inih a mandatory package.
AC_CHECK_HEADERS and AC_SEARCH_LIBS do not abort when the header or
library respectively are not found. Since inih is a hard requirement,
make sure that the action-if-not-found fields call AC_MSG_ERROR.

Fixes #32
2021-08-11 22:22:50 -07:00
nirenjan 874c46705a Add config save routines 2021-08-09 22:16:30 -07:00
nirenjan 3d15da385f Change the config macro definitions to use a type
This change changes the parser element in the CFG macros to be a "type"
element instead. This is handled in the config parser source, where the
macro definition appends `_parser` to the type field. This allows us to
(in the future) add a `_dump` function to dump the configuration to a
file.
2021-08-09 21:25:06 -07:00
nirenjan 2b664513a7 Add Install section to service file to allow enabling the service 2021-08-05 11:46:44 -07:00
nirenjan a09a8bee84 Enable INFO log level in systemd unit file 2021-08-05 10:43:13 -07:00
nirenjan e7af5df69b Use automake rules to install man pages 2021-08-05 10:35:31 -07:00
nirenjan 86960e7e20 Create the log and run directories for daemon to store files 2021-08-05 10:25:45 -07:00
nirenjan 0cf6f247be Add systemd unit file to start X52 daemon 2021-08-05 10:21:28 -07:00
nirenjan 7f5b5a2eaf Disable -Wpacked compiler flag
See issue #31. In systems with a newer version of libusb (1.0.24
onwards), GCC raises a warning that the packed attribute is unnecessary
for `libusb_control_setup`. This is not really a problem for libx52,
since it doesn't call libusb_control_setup directly, but since the
libx52 build framework treats all warnings as errors by default, it will
prevent the build from working.

This change removes the -Wpacked flag from AX_COMPILER_FLAGS, and this
should let the build pass without any issues.
2021-08-05 07:54:53 -07:00
nirenjan 65f4ec9659 Add PID file argument to documentation 2021-08-05 05:47:44 -07:00
nirenjan 0fae24b5d0 Allow x52d to daemonize
Prior to this change, x52d could only run in the foreground, regardless
of the value of the foreground flag. This change adds the standard
double-fork routine to daemonize the program.

This change also adds a PID file argument to x52d, which is used to
ensure that only one instance of the x52d daemon is running at any time.
2021-08-04 13:13:12 -07:00
nirenjan f5331cdef3 Use localtime_r instead of localtime 2021-08-03 13:04:46 -07:00
nirenjan e968656672 Fix Cflags and add libx52util.pc 2021-08-03 12:53:26 -07:00
nirenjan 446fec3b9f Add libx52io pkgconfig file 2021-08-03 12:50:09 -07:00
nirenjan f6cfc59cb6 Fix libx52 pkgconfig file 2021-08-03 12:42:15 -07:00
nirenjan dc72e43f1e Squashed 'lib/pinelog/' changes from bdee493..27a5eab
27a5eab Use localtime_r instead of localtime

git-subtree-dir: lib/pinelog
git-subtree-split: 27a5eab8b75c18d13ec0b69c01deaa82c996cf57
2021-08-03 11:26:06 -07:00
nirenjan d9c1c80163 Merge commit 'dc72e43f1e43a0149c48a684d3b5fd40441ef83c' 2021-08-03 11:26:06 -07:00
nirenjan 699f663df3 Use TEST_DEF as a function macro, instead of #if/#endif blocks 2021-08-02 10:35:37 -07:00
nirenjan 3efdce5abe Fix make distcheck 2021-08-01 23:56:37 -07:00
nirenjan 38917ed6e5 Add documentation for x52d 2021-08-01 23:47:24 -07:00
nirenjan 78e4f3334f Merge branch 'daemon' 2021-08-01 03:01:24 -07:00
nirenjan e358aa9688 Update ChangeLog.md 2021-08-01 03:00:21 -07:00
nirenjan 2cdf22b8c1 Remove dependency on faketime 2021-07-30 13:31:00 -07:00
nirenjan dbd683a98b Add vendor command test cases
This change adds test cases to validate the `raw` command in x52cli.
2021-07-30 12:02:02 -07:00
nirenjan 377aea90b5 Remove spurious test cases
Prior to this change, the tests file contained every test that was in
the original script based test suite. However, we don't need to test
every single scenario within libx52, since those are already handled in
the libx52 specific tests. This also causes a slow compilation, since
the tests are written as a series of macros, and the result is a 2000+
line file before preprocessing.

This change removes some of the spurious test cases, and simply checks
that the parameters passed to the corresponding libx52 function are as
expected for a few test cases.
2021-07-30 11:48:14 -07:00
nirenjan 9047485204 Include CLI tests file into distribution 2021-07-30 03:09:21 -07:00
nirenjan 23ff7c7202 Don't use TESTS when updating check_PROGRAMS 2021-07-30 03:04:12 -07:00
nirenjan 51913094cb Use cmocka to test CLI 2021-07-30 03:03:16 -07:00
nirenjan abdf47d721 Delete obsolete files 2021-07-29 23:55:07 -07:00
nirenjan ac68ee07e5 Use non-recursive Automake 2021-07-29 23:53:21 -07:00
nirenjan 23fa0daf4f Move evtest to top level 2021-07-29 22:26:15 -07:00
nirenjan a94b079cf5 Move x52test to top level 2021-07-29 22:14:48 -07:00
nirenjan 711e4385c1 Move x52cli to top level 2021-07-29 22:11:19 -07:00
nirenjan 3b2378a54b Move libusbx52 to top level 2021-07-29 21:57:19 -07:00
nirenjan 7f30863e5d Move libx52io to top level 2021-07-29 21:51:11 -07:00
nirenjan 34adeaec45 Move libx52util to top level 2021-07-29 21:47:07 -07:00
nirenjan e3bccd3ac3 Move libx52 to top level 2021-07-29 21:41:07 -07:00
nirenjan 0eeab91a8d Remove libx52 as a dependency of libx52util 2021-07-29 21:23:00 -07:00
nirenjan 8db1be2ba8 Squashed 'lib/pinelog/' changes from 321d9aa..bdee493
bdee493 Add preprocessor definition to disable traces
5b2686a Fix pinelog builds on MacOS
48bd049 Merge commit '9fa1a428a45eabff0122e199a687068f0e6280dd' into daemon
68d5aae Update README to include destructor attribute

git-subtree-dir: lib/pinelog
git-subtree-split: bdee493f0357eb0f3f6d4b792140de78999c828e
2021-07-27 17:02:49 -07:00