From 50dc946c3177f5006e4bd63eef4bf67331f59dea Mon Sep 17 00:00:00 2001 From: nirenjan Date: Wed, 14 Jul 2021 15:54:58 -0700 Subject: [PATCH 01/68] Squashed 'lib/pinelog/' content from commit b5457f4 git-subtree-dir: lib/pinelog git-subtree-split: b5457f405ecbbe676aea26001780a81426191176 --- .gitignore | 38 +++++ LICENSE | 21 +++ Makefile.am | 84 +++++++++++ README.md | 134 ++++++++++++++++++ autogen.sh | 3 + config.h.in | 67 +++++++++ configure.ac | 28 ++++ m4/ax_append_compile_flags.m4 | 46 ++++++ m4/ax_append_flag.m4 | 50 +++++++ m4/ax_append_link_flags.m4 | 44 ++++++ m4/ax_check_compile_flag.m4 | 53 +++++++ m4/ax_check_link_flag.m4 | 53 +++++++ m4/ax_compiler_flags.m4 | 158 +++++++++++++++++++++ m4/ax_compiler_flags_cflags.m4 | 161 +++++++++++++++++++++ m4/ax_compiler_flags_gir.m4 | 60 ++++++++ m4/ax_compiler_flags_ldflags.m4 | 111 +++++++++++++++ m4/ax_gcc_func_attribute.m4 | 242 ++++++++++++++++++++++++++++++++ m4/ax_require_defined.m4 | 37 +++++ pinelog.c | 208 +++++++++++++++++++++++++++ pinelog.h | 173 +++++++++++++++++++++++ test_pinelog.c | 194 +++++++++++++++++++++++++ 21 files changed, 1965 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Makefile.am create mode 100644 README.md create mode 100755 autogen.sh create mode 100644 config.h.in create mode 100644 configure.ac create mode 100644 m4/ax_append_compile_flags.m4 create mode 100644 m4/ax_append_flag.m4 create mode 100644 m4/ax_append_link_flags.m4 create mode 100644 m4/ax_check_compile_flag.m4 create mode 100644 m4/ax_check_link_flag.m4 create mode 100644 m4/ax_compiler_flags.m4 create mode 100644 m4/ax_compiler_flags_cflags.m4 create mode 100644 m4/ax_compiler_flags_gir.m4 create mode 100644 m4/ax_compiler_flags_ldflags.m4 create mode 100644 m4/ax_gcc_func_attribute.m4 create mode 100644 m4/ax_require_defined.m4 create mode 100644 pinelog.c create mode 100644 pinelog.h create mode 100644 test_pinelog.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cd4832 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Compiled object files +*.o + +# Generated objects (source, executables, tarballs, etc.) + +# Vim swap files +.*.swp + +# Autotools objects +.deps +.dirstamp +.libs +ar-lib +autom4te.cache +m4 +compile +config.* +!config.h.in +configure +depcomp +install-sh +libtool +ltmain.sh +missing +Makefile +Makefile.in +*.la +*.lo +*.m4 +stamp-h1 +tap-driver.sh +test-driver +*.log +*.trs +*.pc + +# Build directory +/build/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ff3c685 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Nirenjan Krishnan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..ba23573 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,84 @@ +# Top level Automake for pinelog +# +# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) +# +# SPDX-License-Identifier: MIT + +ACLOCAL_AMFLAGS = -I m4 + +# Extra files that need to be in the distribution +EXTRA_DIST = \ + LICENSE \ + README.md \ + pinelog.h + +noinst_LTLIBRARIES = libpinelog.la + +# pinelog logging library +libpinelog_la_SOURCES = pinelog.c +libpinelog_la_CFLAGS = @PINELOG_CFLAGS@ $(WARN_CFLAGS) -I $(top_builddir) +libpinelog_la_LDFLAGS = $(WARN_LDFLAGS) + +test_SRCFILES = test_pinelog.c $(libpinelog_la_SOURCES) +test_CFLAGS = \ + -DPINELOG_FATAL_STR='"F"' \ + -DPINELOG_ERROR_STR='"E"' \ + -DPINELOG_WARNING_STR='"W"' \ + -DPINELOG_INFO_STR='"I"' \ + -DPINELOG_DEBUG_STR='"D"' \ + -DPINELOG_TRACE_STR='"T"' \ + -DPINELOG_DEFAULT_LEVEL=PINELOG_LVL_TRACE \ + -DPINELOG_DEFAULT_STREAM=stderr \ + -DPINELOG_TEST -I $(top_builddir) + +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh +TESTS = \ + test_ts_lvl_tr \ + test_ts_lvl_notr \ + test_ts_nolvl_tr \ + test_ts_nolvl_notr \ + test_nots_lvl_tr \ + test_nots_lvl_notr \ + test_nots_nolvl_tr \ + test_nots_nolvl_notr + +check_PROGRAMS = $(TESTS) +test_ts_lvl_tr_SOURCES = $(test_SRCFILES) +test_ts_lvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1 +test_ts_lvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +test_ts_lvl_notr_SOURCES = $(test_SRCFILES) +test_ts_lvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=0 +test_ts_lvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +test_ts_nolvl_tr_SOURCES = $(test_SRCFILES) +test_ts_nolvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=1 +test_ts_nolvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +test_ts_nolvl_notr_SOURCES = $(test_SRCFILES) +test_ts_nolvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=0 +test_ts_nolvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +test_nots_lvl_tr_SOURCES = $(test_SRCFILES) +test_nots_lvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1 +test_nots_lvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +test_nots_lvl_notr_SOURCES = $(test_SRCFILES) +test_nots_lvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=0 +test_nots_lvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +test_nots_nolvl_tr_SOURCES = $(test_SRCFILES) +test_nots_nolvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=1 +test_nots_nolvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +test_nots_nolvl_notr_SOURCES = $(test_SRCFILES) +test_nots_nolvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=0 +test_nots_nolvl_notr_LDFLAGS = $(WARN_LDFLAGS) diff --git a/README.md b/README.md new file mode 100644 index 0000000..01923d6 --- /dev/null +++ b/README.md @@ -0,0 +1,134 @@ +Pinelog - a lightweight logging API +=================================== + +Pinelog is a lightweight logging API for C programs that's designed to be +included in your program source code. Parameters for Pinelog are configured at +build time by means of preprocessor flags. + +# Usage +## Logging macros + +Pinelog uses `printf` style formatting, using the following list of macros. The +macro indicates the level at which the message is logged. + +* `PINELOG_FATAL` +* `PINELOG_ERROR` +* `PINELOG_WARN` +* `PINELOG_INFO` +* `PINELOG_DEBUG` +* `PINELOG_TRACE` + +**Note:** `PINELOG_FATAL` is used when the program encounters a fatal condition +and needs to abort. This will log the fatal message and terminate the program +with an exit code of 1. + +### Example + +```C +PINELOG_INFO("configuration file %s not found, using defaults", config_file); +``` + +## Logging levels + +The default logging level is `ERROR`, and this can be controlled by the +preprocessor flag `PINELOG_DEFAULT_LEVEL`. + +The program can control the level at which messages can be logged at runtime, +by using the `pinelog_set_level` function. This function takes in the level +definition, which is one of the following, in increasing order of priority. + +* `PINELOG_LVL_TRACE` +* `PINELOG_LVL_DEBUG` +* `PINELOG_LVL_INFO` +* `PINELOG_LVL_WARNING` +* `PINELOG_LVL_ERROR` +* `PINELOG_LVL_FATAL` +* `PINELOG_LVL_NONE` + +Setting the level to a given priority suppresses all log messages of lower +priority, i.e., if the level is set to `PINELOG_LVL_ERROR`, messages at +`WARNING` level and below will be suppressed, but `ERROR` and `FATAL` messages +will be logged. + +**Note:** `PINELOG_LVL_NONE` suppresses all log messages, but `PINELOG_FATAL` +will still terminate the program, even though nothing is logged. + +### Example + +```C +pinelog_set_level(PINELOG_LVL_WARNING); +``` + +``` +-DPINELOG_DEFAULT_LEVEL=PINELOG_LVL_WARNING +``` + +## Output redirection + +Pinelog defaults to writing the log messages to standard output, and this can +be controlled by the preprocessor flag `PINELOG_DEFAULT_STREAM`. + +However, the application can redirect log messages at runtime to a different +`FILE *` stream, or to a file by using one of the following two methods: + +```C +FILE *out = fopen("/run/app.fifo", "w"); +pinelog_set_output_stream(out); +pinelog_set_output_file("/var/log/app.log"); +``` + +``` +-DPINELOG_DEFAULT_STREAM=stderr +``` + +## Logging format + +Pinelog uses an opinionated logging format that is fixed as follows. Fields +within `[]` are optional and controlled by build time flags. + + [2021-07-14 11:08:04 ][ERROR: ][./test_pinelog.c:108 ]formatted message. + +The program can be controlled by the following preprocessor flags, all of which +default to `0` (disabled). Set the flag to `1` to enable it. + +* `PINELOG_SHOW_DATE` - Display the ISO 8601 date and time when the message is + logged. +* `PINELOG_SHOW_LEVEL` - Display the level at which the message is logged. +* `PINELOG_SHOW_BACKTRACE` - Display the file and line where the message is + logged. + +Set these flags by using the `-D` compiler argument, .e.g. +`-DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_DATE=1` + +### Level strings + +The application can control the level strings displayed by means of preprocessor +flags, if the application wishes to display the log messages in a language other +than English. This can be achieved by means of the following preprocessor +definitions. + +* `PINELOG_FATAL_STR` +* `PINELOG_ERROR_STR` +* `PINELOG_WARNING_STR` +* `PINELOG_INFO_STR` +* `PINELOG_DEBUG_STR` +* `PINELOG_TRACE_STR` + +### Example + +``` +-DPINELOG_ERROR_STR=\"E\" -DPINELOG_FATAL_STR=\"F\" +``` + +# Integrating Pinelog + +Pinelog is intended to be integrated into your application source tree, either +by means of including the sources directly, or by including the repository as +a Git submodule or subtree. + +The default build of Pinelog uses an autotools generated `config.h` file, which +includes checks for the following GCC attributes. If you don't care about these, +then either create a dummy config.h which includes the macros +`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR` and `HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the +`AX_GCC_FUNC_ATTRIBUTE` macro to check for the `constructor` and `format` +attributes in your application's `configure.ac` file. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..e10d140 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh -x + +autoreconf --install diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..392d9b0 --- /dev/null +++ b/config.h.in @@ -0,0 +1,67 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if the system has the `constructor' function attribute */ +#undef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR + +/* Define to 1 if the system has the `format' function attribute */ +#undef HAVE_FUNC_ATTRIBUTE_FORMAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..133e102 --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +# Autoconf settings for pinelog +# +# Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) +# +# SPDX-License-Identifier: MIT + +AC_INIT([pinelog], [1.0.0], [nirenjan@nirenjan.org]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) +AC_REQUIRE_AUX_FILE([tap-driver.sh]) +AC_PROG_CC +AC_PROG_CC_STDC +AC_PROG_AWK +AM_PROG_AR +LT_INIT +PKG_PROG_PKG_CONFIG +PKG_INSTALLDIR +AX_COMPILER_FLAGS +AX_GCC_FUNC_ATTRIBUTE([constructor]) +AX_GCC_FUNC_ATTRIBUTE([format]) + +AC_SUBST([PINELOG_CFLAGS]) + +# Configuration headers +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4 new file mode 100644 index 0000000..9c85635 --- /dev/null +++ b/m4/ax_append_compile_flags.m4 @@ -0,0 +1,46 @@ +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4 new file mode 100644 index 0000000..dd6d8b6 --- /dev/null +++ b/m4/ax_append_flag.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4 new file mode 100644 index 0000000..99b9fa5 --- /dev/null +++ b/m4/ax_append_link_flags.m4 @@ -0,0 +1,44 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the linker works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is +# used. During the check the flag is always added to the linker's flags. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. +# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AC_DEFUN([AX_APPEND_LINK_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4]) +done +])dnl AX_APPEND_LINK_FLAGS diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 0000000..bd753b3 --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 0000000..03a30ce --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,53 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/m4/ax_compiler_flags.m4 b/m4/ax_compiler_flags.m4 new file mode 100644 index 0000000..ddb0456 --- /dev/null +++ b/m4/ax_compiler_flags.m4 @@ -0,0 +1,158 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED]) +# +# DESCRIPTION +# +# Check for the presence of an --enable-compile-warnings option to +# configure, defaulting to "error" in normal operation, or "yes" if +# IS-RELEASE is equal to "yes". Return the value in the variable +# $ax_enable_compile_warnings. +# +# Depending on the value of --enable-compile-warnings, different compiler +# warnings are checked to see if they work with the current compiler and, +# if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE. This +# allows a consistent set of baseline compiler warnings to be used across +# a code base, irrespective of any warnings enabled locally by individual +# developers. By standardising the warnings used by all developers of a +# project, the project can commit to a zero-warnings policy, using -Werror +# to prevent compilation if new warnings are introduced. This makes +# catching bugs which are flagged by warnings a lot easier. +# +# By providing a consistent --enable-compile-warnings argument across all +# projects using this macro, continuous integration systems can easily be +# configured the same for all projects. Automated systems or build +# systems aimed at beginners may want to pass the --disable-Werror +# argument to unconditionally prevent warnings being fatal. +# +# --enable-compile-warnings can take the values: +# +# * no: Base compiler warnings only; not even -Wall. +# * yes: The above, plus a broad range of useful warnings. +# * error: The above, plus -Werror so that all warnings are fatal. +# Use --disable-Werror to override this and disable fatal +# warnings. +# +# The set of base and enabled flags can be augmented using the +# EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and +# appended to the output variable if --enable-compile-warnings is not +# "no". Flags should not be disabled using these arguments, as the entire +# point of AX_COMPILER_FLAGS is to enforce a consistent set of useful +# compiler warnings on code, using warnings which have been chosen for low +# false positive rates. If a compiler emits false positives for a +# warning, a #pragma should be used in the code to disable the warning +# locally. See: +# +# https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas +# +# The EXTRA-* variables should only be used to supply extra warning flags, +# and not general purpose compiler flags, as they are controlled by +# configure options such as --disable-Werror. +# +# IS-RELEASE can be used to disable -Werror when making a release, which +# is useful for those hairy moments when you just want to get the release +# done as quickly as possible. Set it to "yes" to disable -Werror. By +# default, it uses the value of $ax_is_release, so if you are using the +# AX_IS_RELEASE macro, there is no need to pass this parameter. For +# example: +# +# AX_IS_RELEASE([git-directory]) +# AX_COMPILER_FLAGS() +# +# CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults +# to WARN_LDFLAGS. Both variables are AC_SUBST-ed by this macro, but must +# be manually added to the CFLAGS and LDFLAGS variables for each target in +# the code base. +# +# If C++ language support is enabled with AC_PROG_CXX, which must occur +# before this macro in configure.ac, warning flags for the C++ compiler +# are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the +# CXXFLAGS variables for each target in the code base. EXTRA-*-CFLAGS can +# be used to augment the base and enabled flags. +# +# Warning flags for g-ir-scanner (from GObject Introspection) are +# AC_SUBST-ed as WARN_SCANNERFLAGS. This variable must be manually added +# to the SCANNERFLAGS variable for each GIR target in the code base. If +# extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR +# macro must be invoked manually. +# +# AX_COMPILER_FLAGS may add support for other tools in future, in addition +# to the compiler and linker. No extra EXTRA-* variables will be added +# for those tools, and all extra support will still use the single +# --enable-compile-warnings configure option. For finer grained control +# over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS, +# AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools. +# +# The UNUSED variables date from a previous version of this macro, and are +# automatically appended to the preceding non-UNUSED variable. They should +# be left empty in new uses of the macro. +# +# LICENSE +# +# Copyright (c) 2014, 2015 Philip Withnall +# Copyright (c) 2015 David King +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 14 + +# _AX_COMPILER_FLAGS_LANG([LANGNAME]) +m4_defun([_AX_COMPILER_FLAGS_LANG], +[m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [], + [m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl + AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl +]) + +AC_DEFUN([AX_COMPILER_FLAGS],[ + # C support is enabled by default. + _AX_COMPILER_FLAGS_LANG([C]) + # Only enable C++ support if AC_PROG_CXX is called. The redefinition of + # AC_PROG_CXX is so that a fatal error is emitted if this macro is called + # before AC_PROG_CXX, which would otherwise cause no C++ warnings to be + # checked. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AX_COMPILER_FLAGS_LANG([CXX])], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])]) + AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS]) + + # Default value for IS-RELEASE is $ax_is_release + ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],, + [$ax_is_release], + [$3]))) + + AC_ARG_ENABLE([compile-warnings], + AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@], + [Enable compiler warnings and errors]),, + [AS_IF([test "$ax_compiler_flags_is_release" = "yes"], + [enable_compile_warnings="yes"], + [enable_compile_warnings="error"])]) + AC_ARG_ENABLE([Werror], + AS_HELP_STRING([--disable-Werror], + [Unconditionally make all compiler warnings non-fatal]),, + [enable_Werror=maybe]) + + # Return the user's chosen warning level + AS_IF([test "$enable_Werror" = "no" -a \ + "$enable_compile_warnings" = "error"],[ + enable_compile_warnings="yes" + ]) + + ax_enable_compile_warnings=$enable_compile_warnings + + AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release], + [$4],[$5 $6 $7 $8]) + m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled], + [AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS], + [$ax_compiler_flags_is_release], + [$4],[$5 $6 $7 $8])]) + AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release], + [$9],[$10 $11 $12 $13]) + AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release]) +])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4 new file mode 100644 index 0000000..916f918 --- /dev/null +++ b/m4/ax_compiler_flags_cflags.m4 @@ -0,0 +1,161 @@ +# ============================================================================= +# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html +# ============================================================================= +# +# SYNOPSIS +# +# AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) +# +# DESCRIPTION +# +# Add warning flags for the C compiler to VARIABLE, which defaults to +# WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be +# manually added to the CFLAGS variable for each target in the code base. +# +# This macro depends on the environment set up by AX_COMPILER_FLAGS. +# Specifically, it uses the value of $ax_enable_compile_warnings to decide +# which flags to enable. +# +# LICENSE +# +# Copyright (c) 2014, 2015 Philip Withnall +# Copyright (c) 2017, 2018 Reini Urban +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 17 + +AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ + AC_REQUIRE([AC_PROG_SED]) + AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) + AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) + AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) + + # Variable names + m4_define([ax_warn_cflags_variable], + [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))]) + + AC_LANG_PUSH([C]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ + [#ifndef __cplusplus + #error "no C++" + #endif]])], + [ax_compiler_cxx=yes;], + [ax_compiler_cxx=no;]) + + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad + # flags, otherwise they are always appended to the warn_cflags variable, and + # Clang warns on them for every compilation unit. + # If this is passed to GCC, it will explode, so the flag must be enabled + # conditionally. + AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ + ax_compiler_flags_test="-Werror=unknown-warning-option" + ],[ + ax_compiler_flags_test="" + ]) + + # Check that -Wno-suggest-attribute=format is supported + AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[ + ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" + ],[ + ax_compiler_no_suggest_attribute_flags="" + ]) + + # Base flags + AX_APPEND_COMPILE_FLAGS([ dnl + -fno-strict-aliasing dnl + $3 dnl + ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + + AS_IF([test "$ax_enable_compile_warnings" != "no"],[ + if test "$ax_compiler_cxx" = "no" ; then + # C-only flags. Warn in C++ + AX_APPEND_COMPILE_FLAGS([ dnl + -Wnested-externs dnl + -Wmissing-prototypes dnl + -Wstrict-prototypes dnl + -Wdeclaration-after-statement dnl + -Wimplicit-function-declaration dnl + -Wold-style-definition dnl + -Wjump-misses-init dnl + ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + fi + + # "yes" flags + AX_APPEND_COMPILE_FLAGS([ dnl + -Wall dnl + -Wextra dnl + -Wundef dnl + -Wwrite-strings dnl + -Wpointer-arith dnl + -Wmissing-declarations dnl + -Wredundant-decls dnl + -Wno-unused-parameter dnl + -Wno-missing-field-initializers dnl + -Wformat=2 dnl + -Wcast-align dnl + -Wformat-nonliteral dnl + -Wformat-security dnl + -Wsign-compare dnl + -Wstrict-aliasing dnl + -Wshadow dnl + -Winline dnl + -Wpacked dnl + -Wmissing-format-attribute dnl + -Wmissing-noreturn dnl + -Winit-self dnl + -Wredundant-decls dnl + -Wmissing-include-dirs dnl + -Wunused-but-set-variable dnl + -Warray-bounds dnl + -Wreturn-type dnl + -Wswitch-enum dnl + -Wswitch-default dnl + -Wduplicated-cond dnl + -Wduplicated-branches dnl + -Wlogical-op dnl + -Wrestrict dnl + -Wnull-dereference dnl + -Wdouble-promotion dnl + $4 dnl + $5 dnl + $6 dnl + $7 dnl + ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + ]) + AS_IF([test "$ax_enable_compile_warnings" = "error"],[ + # "error" flags; -Werror has to be appended unconditionally because + # it's not possible to test for + # + # suggest-attribute=format is disabled because it gives too many false + # positives + AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable) + + AX_APPEND_COMPILE_FLAGS([ dnl + [$ax_compiler_no_suggest_attribute_flags] dnl + ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) + ]) + + # In the flags below, when disabling specific flags, always add *both* + # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) + # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, + # which effectively turns that flag back on again as an error. + for flag in $ax_warn_cflags_variable; do + AS_CASE([$flag], + [-Wno-*=*],[], + [-Wno-*],[ + AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], + ax_warn_cflags_variable, + [$ax_compiler_flags_test]) + ]) + done + + AC_LANG_POP([C]) + + # Substitute the variables + AC_SUBST(ax_warn_cflags_variable) +])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_compiler_flags_gir.m4 b/m4/ax_compiler_flags_gir.m4 new file mode 100644 index 0000000..5b4924a --- /dev/null +++ b/m4/ax_compiler_flags_gir.m4 @@ -0,0 +1,60 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) +# +# DESCRIPTION +# +# Add warning flags for the g-ir-scanner (from GObject Introspection) to +# VARIABLE, which defaults to WARN_SCANNERFLAGS. VARIABLE is AC_SUBST-ed +# by this macro, but must be manually added to the SCANNERFLAGS variable +# for each GIR target in the code base. +# +# This macro depends on the environment set up by AX_COMPILER_FLAGS. +# Specifically, it uses the value of $ax_enable_compile_warnings to decide +# which flags to enable. +# +# LICENSE +# +# Copyright (c) 2015 Philip Withnall +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AC_DEFUN([AX_COMPILER_FLAGS_GIR],[ + AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) + + # Variable names + m4_define([ax_warn_scannerflags_variable], + [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))]) + + # Base flags + AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable) + + AS_IF([test "$ax_enable_compile_warnings" != "no"],[ + # "yes" flags + AX_APPEND_FLAG([ dnl + --warn-all dnl + $4 dnl + $5 dnl + $6 dnl + $7 dnl + ],ax_warn_scannerflags_variable) + ]) + AS_IF([test "$ax_enable_compile_warnings" = "error"],[ + # "error" flags + AX_APPEND_FLAG([ dnl + --warn-error dnl + ],ax_warn_scannerflags_variable) + ]) + + # Substitute the variables + AC_SUBST(ax_warn_scannerflags_variable) +])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4 new file mode 100644 index 0000000..976d119 --- /dev/null +++ b/m4/ax_compiler_flags_ldflags.m4 @@ -0,0 +1,111 @@ +# ============================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html +# ============================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) +# +# DESCRIPTION +# +# Add warning flags for the linker to VARIABLE, which defaults to +# WARN_LDFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be +# manually added to the LDFLAGS variable for each target in the code base. +# +# This macro depends on the environment set up by AX_COMPILER_FLAGS. +# Specifically, it uses the value of $ax_enable_compile_warnings to decide +# which flags to enable. +# +# LICENSE +# +# Copyright (c) 2014, 2015 Philip Withnall +# Copyright (c) 2017, 2018 Reini Urban +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 + +AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ + AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) + AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) + AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) + AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) + + # Variable names + m4_define([ax_warn_ldflags_variable], + [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))]) + + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad + # flags, otherwise they are always appended to the warn_ldflags variable, + # and Clang warns on them for every compilation unit. + # If this is passed to GCC, it will explode, so the flag must be enabled + # conditionally. + AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ + ax_compiler_flags_test="-Werror=unknown-warning-option" + ],[ + ax_compiler_flags_test="" + ]) + + AX_CHECK_LINK_FLAG([-Wl,--as-needed], [ + AX_APPEND_LINK_FLAGS([-Wl,--as-needed], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,relro], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,relro], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,now], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,now], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [ + AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack], + [AM_LDFLAGS],[$ax_compiler_flags_test]) + ]) + # textonly, retpolineplt not yet + + # macOS and cygwin linker do not have --as-needed + AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [ + ax_compiler_flags_as_needed_option="-Wl,--no-as-needed" + ], [ + ax_compiler_flags_as_needed_option="" + ]) + + # macOS linker speaks with a different accent + ax_compiler_flags_fatal_warnings_option="" + AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [ + ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings" + ]) + AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [ + ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings" + ]) + + # Base flags + AX_APPEND_LINK_FLAGS([ dnl + $ax_compiler_flags_as_needed_option dnl + $3 dnl + ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) + + AS_IF([test "$ax_enable_compile_warnings" != "no"],[ + # "yes" flags + AX_APPEND_LINK_FLAGS([$4 $5 $6 $7], + ax_warn_ldflags_variable, + [$ax_compiler_flags_test]) + ]) + AS_IF([test "$ax_enable_compile_warnings" = "error"],[ + # "error" flags; -Werror has to be appended unconditionally because + # it's not possible to test for + # + # suggest-attribute=format is disabled because it gives too many false + # positives + AX_APPEND_LINK_FLAGS([ dnl + $ax_compiler_flags_fatal_warnings_option dnl + ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) + ]) + + # Substitute the variables + AC_SUBST(ax_warn_ldflags_variable) +])dnl AX_COMPILER_FLAGS diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000..fa4e089 --- /dev/null +++ b/m4/ax_gcc_func_attribute.m4 @@ -0,0 +1,242 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. +# +# The macro caches its result in the ax_cv_have_func_attribute_ +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_format +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 13 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [gnu_format], [ + int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([grep -- -Wattributes conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4 new file mode 100644 index 0000000..17c3eab --- /dev/null +++ b/m4/ax_require_defined.m4 @@ -0,0 +1,37 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED diff --git a/pinelog.c b/pinelog.c new file mode 100644 index 0000000..1c793c5 --- /dev/null +++ b/pinelog.c @@ -0,0 +1,208 @@ +/* + * Pinelog lightweight logging library + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: MIT + */ + +#include "config.h" +#include +#include +#include +#include + +#include "pinelog.h" + +/********************************************************************** + * Configure defaults + *********************************************************************/ +#ifndef PINELOG_DEFAULT_STREAM +#define PINELOG_DEFAULT_STREAM stdout +#endif + +#ifndef PINELOG_DEFAULT_LEVEL +#define PINELOG_DEFAULT_LEVEL PINELOG_LVL_ERROR +#endif + +/********************************************************************** + * Configure logging parameters + *********************************************************************/ +#ifndef PINELOG_SHOW_DATE +#define PINELOG_SHOW_DATE 0 +#endif + +#ifndef PINELOG_SHOW_LEVEL +#define PINELOG_SHOW_LEVEL 0 +#endif + +#ifndef PINELOG_SHOW_BACKTRACE +#define PINELOG_SHOW_BACKTRACE 0 +#endif + +/********************************************************************** + * Configure level strings + *********************************************************************/ +#ifndef PINELOG_FATAL_STR +#define PINELOG_FATAL_STR "FATAL" +#endif + +#ifndef PINELOG_ERROR_STR +#define PINELOG_ERROR_STR "ERROR" +#endif + +#ifndef PINELOG_WARNING_STR +#define PINELOG_WARNING_STR "WARNING" +#endif + +#ifndef PINELOG_INFO_STR +#define PINELOG_INFO_STR "INFO" +#endif + +#ifndef PINELOG_DEBUG_STR +#define PINELOG_DEBUG_STR "DEBUG" +#endif + +#ifndef PINELOG_TRACE_STR +#define PINELOG_TRACE_STR "TRACE" +#endif + +/********************************************************************** + * Global variables + *********************************************************************/ + +/** Stream buffer */ +static FILE *output_stream = NULL; + +/** Default logging level */ +static int log_level = PINELOG_DEFAULT_LEVEL; + +/* Initialize defaults */ +#if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR +__attribute__((constructor)) +#endif +void pinelog_set_defaults(void) +{ + output_stream = PINELOG_DEFAULT_STREAM; + log_level = PINELOG_DEFAULT_LEVEL; +} + +int pinelog_set_output_stream(FILE *stream) +{ + if (stream == NULL) { + return EINVAL; + } + + /* If current output stream is not stdout or stderr, then close it */ + if (output_stream != stdout && output_stream != stderr) { + fclose(output_stream); + } + + setlinebuf(stream); + output_stream = stream; + return 0; +} + +#ifdef PINELOG_TEST +FILE * pinelog_get_output_stream(void) +{ + return output_stream; +} +#endif + +int pinelog_set_output_file(const char *file) +{ + FILE *stream; + if (file == NULL) { + return EINVAL; + } + + errno = 0; + stream = fopen(file, "w"); + if (stream == NULL) { + return errno; + } + + return pinelog_set_output_stream(stream); +} + +int pinelog_get_level(void) +{ + return log_level; +} + +int pinelog_set_level(int level) +{ + if (level < PINELOG_LVL_NONE || level > PINELOG_LVL_TRACE) { + return EINVAL; + } + + log_level = level; + return 0; +} + +/********************************************************************** + * Log the message to the output stream + *********************************************************************/ +void pinelog_log_message(int level, const char *file, int line, const char *fmt, ...) +{ + va_list ap; + + /* Don't log anything if the level is not severe enough */ + if (level > log_level || level < 0) { + return; + } + + /* Cap the log level */ + if (level > PINELOG_LVL_TRACE) { + level = PINELOG_LVL_TRACE; + } + + #if !HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR + /* + * Validate and set output stream. Only necessary if the compiler doesn't + * support the constructor attribute + */ + if (output_stream == NULL) { + output_stream = PINELOG_DEFAULT_STREAM; + } + #endif + + #if PINELOG_SHOW_DATE + do { + time_t t; + struct tm *tmp; + char date_string[30]; + t = time(NULL); + tmp = localtime(&t); + strftime(date_string, sizeof(date_string), "%F %T ", tmp); + fputs(date_string, output_stream); + } while (0); + #endif + + #if PINELOG_SHOW_LEVEL + do { + static const char *level_strings[] = { + PINELOG_FATAL_STR, + PINELOG_ERROR_STR, + PINELOG_WARNING_STR, + PINELOG_INFO_STR, + PINELOG_DEBUG_STR, + PINELOG_TRACE_STR, + }; + + fputs(level_strings[level], output_stream); + fputs(": ", output_stream); + } while (0); + #endif + + #if PINELOG_SHOW_BACKTRACE + fprintf(output_stream, "%s:%d ", file, line); + #endif + + va_start(ap, fmt); + vfprintf(output_stream, fmt, ap); + va_end(ap); + // Append a trailing newline to flush the log message + fputs("\n", output_stream); +} diff --git a/pinelog.h b/pinelog.h new file mode 100644 index 0000000..0020ad9 --- /dev/null +++ b/pinelog.h @@ -0,0 +1,173 @@ +/* + * Pinelog lightweight logging library + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: MIT + */ + +/** + * @file logging.h + * @brief Logging utility library + * + * This file contains the prototypes for the pinelog logging library + * used by any programs that need to log messages. + * + * @author Nirenjan Krishnan (nirenjan@nirenjan.org) + */ +#ifndef LOGGING_H +#define LOGGING_H + +#include "config.h" +#include +#ifndef PINELOG_TEST +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Logging levels + * + * The log levels indicate the lowest severity level that will actually be + * logged to the logging framework. + */ +enum { + /** No messages will be logged */ + PINELOG_LVL_NONE = -1, + + /** Only fatal messages will be logged */ + PINELOG_LVL_FATAL, + + /** Error messages. This is the default log level */ + PINELOG_LVL_ERROR, + + /** Warning messages */ + PINELOG_LVL_WARNING, + + /** Informational messages */ + PINELOG_LVL_INFO, + + /** Debug messages */ + PINELOG_LVL_DEBUG, + + /** Trace messages */ + PINELOG_LVL_TRACE, +}; + +/** + * @brief Set the default log level and output stream + */ +void pinelog_set_defaults(void); + +#ifdef PINELOG_TEST +/** + * @brief Get the pointer to the output stream. Only used in test harness. + * + * @returns FILE pointer to output stream + */ +FILE * pinelog_get_output_stream(void); +#endif + +/** + * @brief Set the output stream. Must be a FILE pointer. + * + * @param[in] stream Pointer to the output stream + * + * @returns 0 on success, EINVAL if the pointer is not valid. + */ +int pinelog_set_output_stream(FILE *stream); + +/** + * @brief Set the output file. + * + * @param[in] file Filename to write to + * + * @returns 0 on success, EINVAL if the filename pointer is not valid, other + * error if the file could not be opened for writing. + */ +int pinelog_set_output_file(const char *file); + +/** + * @brief Set the logging level + * + * @param[in] level Level to filter + * + * @returns 0 on success, EINVAL if the level is not valid + */ +int pinelog_set_level(int level); + +/** + * @brief Get the logging level + * + * @returns the configured logging level + */ +int pinelog_get_level(void); + +/** + * @brief Log a message to the logger + * + * This is the actual function that logs the message. The application should + * never need to call this directly, but instead, should always use the + * \code PINELOG_* macros. + * + * @param[in] level Level to log the message at + * @param[in] fmt Format string + * + * @returns None + */ +#if HAVE_FUNC_ATTRIBUTE_FORMAT +__attribute__((format(printf, 4, 5))) +#endif + +void pinelog_log_message(int level, const char *file, int line, const char *fmt, ...); + +// Test harness will redefine pinelog_exit +#ifndef PINELOG_TEST +#define pinelog_exit exit +#endif + +#define PINELOG_FATAL(fmt, ...) do { \ + if (PINELOG_LVL_FATAL <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_FATAL, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ + pinelog_exit(1); \ +} while (0) + +#define PINELOG_ERROR(fmt, ...) do { \ + if (PINELOG_LVL_ERROR <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_ERROR, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ +} while (0) + +#define PINELOG_WARN(fmt, ...) do { \ + if (PINELOG_LVL_WARNING <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_WARNING, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ +} while(0) + +#define PINELOG_INFO(fmt, ...) do { \ + if (PINELOG_LVL_INFO <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_INFO, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ +} while(0) + +#define PINELOG_DEBUG(fmt, ...) do { \ + if (PINELOG_LVL_DEBUG <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_DEBUG, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ +} while(0) + +#define PINELOG_TRACE(fmt, ...) do { \ + if (PINELOG_LVL_TRACE <= pinelog_get_level()) { \ + pinelog_log_message(PINELOG_LVL_TRACE, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif // !defined LOGGING_H diff --git a/test_pinelog.c b/test_pinelog.c new file mode 100644 index 0000000..dd568a8 --- /dev/null +++ b/test_pinelog.c @@ -0,0 +1,194 @@ +/* + * Pinelog lightweight logging library - test harness + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: MIT + */ + +#include "pinelog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/********************************************************************** + * Global variables + *********************************************************************/ +// Test ID (of current test case) +static unsigned int test_id; + +// Observed output stream +static FILE *observed_stream_w; +static FILE *observed_stream_r; + +// Temporary pipe for observed data +static char observed_fifo[NAME_MAX]; + +// Buffer for expected output +static char expected_output[1024]; +static size_t expected_len; + +static void test_case(const char *desc, bool test) +{ + test_id++; + if (test) { + printf("ok %u %s\n", test_id, desc); + } else { + printf("not ok %u %s\n", test_id, desc); + } +} + +static void pinelog_exit(int status) +{ + fprintf(observed_stream_w, "EXIT(%d)\n", status); + expected_len += snprintf(&expected_output[expected_len], + sizeof(expected_output) - expected_len, + "EXIT(%d)\n", status); +} + +static void dump_data(const char *type, size_t len, char *data) +{ + char *line; + printf("# %s (%lu bytes):\n", type, len); + line = strtok(data, "\n"); + while (line != NULL) { + printf("#\t%s\n", line); + line = strtok(NULL, "\n"); + } + printf("\n"); +} + +static void test_setup(int level, int filter, const char *file, int line, const char *fmt, ...) +{ + va_list ap; + + expected_len = 0; + memset(expected_output, 0, sizeof(expected_output)); + + if (level <= filter) { + if (PINELOG_SHOW_DATE) { + time_t t; + struct tm *tmp; + + t = time(NULL); + tmp = localtime(&t); + expected_len += strftime(&expected_output[expected_len], + sizeof(expected_output) - expected_len, + "%F %T ", tmp); + } + + if (PINELOG_SHOW_LEVEL) { + const char * level_string[] = { + PINELOG_FATAL_STR, + PINELOG_ERROR_STR, + PINELOG_WARNING_STR, + PINELOG_INFO_STR, + PINELOG_DEBUG_STR, + PINELOG_TRACE_STR, + }; + expected_len += snprintf(&expected_output[expected_len], + sizeof(expected_output) - expected_len, + "%s: ", level_string[level]); + } + + if (PINELOG_SHOW_BACKTRACE) { + expected_len += snprintf(&expected_output[expected_len], + sizeof(expected_output) - expected_len, + "%s:%d ", file, line); + } + + va_start(ap, fmt); + expected_len += vsnprintf(&expected_output[expected_len], + sizeof(expected_output) - expected_len, + fmt, ap); + va_end(ap); + expected_output[expected_len] = '\n'; + expected_len++; + } +} + +static void test_teardown(const char *desc) +{ + // Compare the output + static char observed[1024]; + size_t observed_len; + int result; + + observed_len = fread(observed, 1, sizeof(observed), observed_stream_r); + + result = ((expected_len == observed_len) && + (memcmp(expected_output, observed, expected_len) == 0)); + test_case(desc, result); + if (!result) { + dump_data("expected", expected_len, expected_output); + dump_data("observed", observed_len, observed); + } +} + +static void verify_defaults(void) +{ + test_case("Get default output stream", + pinelog_get_output_stream() == PINELOG_DEFAULT_STREAM); + test_case("Get default logging level", + pinelog_get_level() == PINELOG_DEFAULT_LEVEL); +} + +#define PINELOG_WARNING PINELOG_WARN + +#define TEST_LOG(lvl, filter, fmt, ...) do { \ + test_setup(PINELOG_LVL_ ## lvl, PINELOG_LVL_ ## filter, \ + __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + PINELOG_ ## lvl (fmt, ##__VA_ARGS__); \ + test_teardown("Log " #lvl " filter " #filter); \ +} while(0) + +#define TEST(filter, fmt, ...) do { \ + pinelog_set_level(PINELOG_LVL_ ## filter); \ + TEST_LOG(TRACE, filter, fmt, ##__VA_ARGS__); \ + TEST_LOG(DEBUG, filter, fmt, ##__VA_ARGS__); \ + TEST_LOG(INFO, filter, fmt, ##__VA_ARGS__); \ + TEST_LOG(WARNING, filter, fmt, ##__VA_ARGS__); \ + TEST_LOG(ERROR, filter, fmt, ##__VA_ARGS__); \ + TEST_LOG(FATAL, filter, fmt, ##__VA_ARGS__); \ +} while (0) + +int main(int argc, char **argv) +{ + int fifo_fd_r, fifo_fd_w; + snprintf(observed_fifo, sizeof(observed_fifo), "%s.fifo", argv[0]); + mkfifo(observed_fifo, 0777); + + fifo_fd_r = open(observed_fifo, O_RDONLY | O_NONBLOCK); + fifo_fd_w = open(observed_fifo, O_WRONLY | O_NONBLOCK); + observed_stream_r = fdopen(fifo_fd_r, "r"); + observed_stream_w = fdopen(fifo_fd_w, "w"); + + verify_defaults(); + + pinelog_set_output_stream(observed_stream_w); + TEST(TRACE, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(DEBUG, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(INFO, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(WARNING, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(ERROR, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(FATAL, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + TEST(NONE, "testing %s... %d, %f, %u", "testing", -1, 0.0, 1); + + printf("1..%u\n", test_id); + + fclose(observed_stream_w); + fclose(observed_stream_r); + close(fifo_fd_w); + close(fifo_fd_r); + unlink(observed_fifo); + + return 0; +} From 4b1d524d39c57a8c9d40d4ef244e1d119c79860a Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 10:33:52 -0700 Subject: [PATCH 02/68] Integrate pinelog into autotools build framework --- ChangeLog.md | 1 + configure.ac | 6 + lib/Makefile.am | 2 +- m4/ax_gcc_func_attribute.m4 | 242 ++++++++++++++++++++++++++++++++++++ 4 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 m4/ax_gcc_func_attribute.m4 diff --git a/ChangeLog.md b/ChangeLog.md index 7d563da..5643023 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,6 +8,7 @@ The format is based upon [Keep a Changelog]. ### Added - IO library to read and parse events from a supported joystick. - Event test utility which displays the events similar to evtest. +- Import pinelog library for daemon logging. ### Changed - Linux kernel driver to correctly handle the X52/X52 Pro. This is not required diff --git a/configure.ac b/configure.ac index f78f977..2586e0b 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,8 @@ PKG_PROG_PKG_CONFIG PKG_INSTALLDIR AX_COMPILER_FLAGS AC_CANONICAL_HOST +AX_GCC_FUNC_ATTRIBUTE([constructor]) +AX_GCC_FUNC_ATTRIBUTE([format]) AC_MSG_NOTICE([Detected host OS is ${host_os}]) build_linux=no @@ -41,6 +43,9 @@ AC_SUBST([LIBUSB_CFLAGS]) AC_SUBST([LIBUSB_LDFLAGS]) AC_SUBST([LIBUSB_LIBS]) +# Pinelog configuration +AC_SUBST([PINELOG_CFLAGS], [-DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1]) + AC_SUBST([X52_PKG_VERSION], [0.1]) AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"]) @@ -112,6 +117,7 @@ AC_CONFIG_FILES([ po/Makefile.in lib/libusbx52/Makefile lib/libx52util/Makefile lib/libx52io/Makefile + lib/pinelog/Makefile udev/Makefile udev/60-saitek-x52-x52pro.rules utils/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index e6c3dca..592e83f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = libx52 libx52util libusbx52 libx52io +SUBDIRS = libx52 libx52util libusbx52 libx52io pinelog diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000..fa4e089 --- /dev/null +++ b/m4/ax_gcc_func_attribute.m4 @@ -0,0 +1,242 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. +# +# The macro caches its result in the ax_cv_have_func_attribute_ +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_format +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 13 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [gnu_format], [ + int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([grep -- -Wattributes conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) From f82c31a6eb5a830ed9f8ba44213bb76435c717a6 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 13:52:46 -0700 Subject: [PATCH 03/68] Add support for including inih configuration parser library --- .github/scripts/install-dependencies-macos.sh | 1 + .github/scripts/install-dependencies-ubuntu.sh | 1 + INSTALL.md | 7 ++++--- configure.ac | 11 ++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/scripts/install-dependencies-macos.sh b/.github/scripts/install-dependencies-macos.sh index 3f13107..d3784af 100755 --- a/.github/scripts/install-dependencies-macos.sh +++ b/.github/scripts/install-dependencies-macos.sh @@ -9,6 +9,7 @@ brew install \ gettext \ libusb \ hidapi \ + inih \ doxygen \ rsync \ cmocka diff --git a/.github/scripts/install-dependencies-ubuntu.sh b/.github/scripts/install-dependencies-ubuntu.sh index c0f6c08..487d56d 100755 --- a/.github/scripts/install-dependencies-ubuntu.sh +++ b/.github/scripts/install-dependencies-ubuntu.sh @@ -11,6 +11,7 @@ sudo apt-get install -y \ autopoint \ libusb-1.0-0-dev \ libhidapi-dev \ + libinih-dev \ libevdev-dev \ doxygen \ rsync \ diff --git a/INSTALL.md b/INSTALL.md index cafa640..4ade22c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -18,6 +18,7 @@ Build has been tested on the following operating systems (x86-64 only): * autopoint * gettext * hidapi +* inih * libtool * libusb-1.0 + headers * pkg-config @@ -27,9 +28,9 @@ Build has been tested on the following operating systems (x86-64 only): | Platform | Install instructions | | -------- | -------------------- | -| Ubuntu | `sudo apt-get install automake autoconf gettext autopoint libhidapi-dev libtool libusb-1.0-0-dev pkg-config python3` | -| MacOS + Homebrew | `brew install automake autoconf gettext hidapi libtool libusb pkg-config python3` | -| Arch Linux | `pacman -S base-devel libusb hidapi python` | +| Ubuntu | `sudo apt-get install automake autoconf gettext autopoint libhidapi-dev libinih-dev libtool libusb-1.0-0-dev pkg-config python3` | +| MacOS + Homebrew | `brew install automake autoconf gettext hidapi inih libtool libusb pkg-config python3` | +| Arch Linux | `pacman -S base-devel libusb hidapi inih python` | ## Optional Packages diff --git a/configure.ac b/configure.ac index 2586e0b..eaa309b 100644 --- a/configure.ac +++ b/configure.ac @@ -43,10 +43,15 @@ AC_SUBST([LIBUSB_CFLAGS]) AC_SUBST([LIBUSB_LDFLAGS]) AC_SUBST([LIBUSB_LIBS]) -# Pinelog configuration -AC_SUBST([PINELOG_CFLAGS], [-DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1]) +# Check for libinih +AX_PKG_CHECK_MODULES([INIH], [inih]) +AC_SUBST([INIH_CFLAGS]) +AC_SUBST([INIH_LDFLAGS]) +AC_SUBST([INIH_LIBS]) + +# Pinelog configuration +AC_SUBST([PINELOG_CFLAGS], ["-DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1"]) -AC_SUBST([X52_PKG_VERSION], [0.1]) AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"]) # Check for hidapi. This uses a different pkg-config file on Linux vs other From fc8e7b6b95a0c0da6933a0ce764b278375a6acca Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 15:47:39 -0700 Subject: [PATCH 04/68] Add new generated files to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9bea998..58dd4c4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,11 @@ a.out utils/cli/x52cli* utils/test/x52test* +utils/evtest/x52evtest* lib/libx52util/util_char_map.c util/x52charmapgen* lib/libusbx52/x52test* +udev/*.rules x52pro-linux-*.tar.gz # Module files From cbe7f00a5a4ff28fee273a5a75c1462f641e73ab Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 15:53:56 -0700 Subject: [PATCH 05/68] Add daemon framework This change adds the daemon configuration parser and command line argument parser. This also adds the associated strings to the translation files, and integrates the daemon into the existing autotools build framework. --- .gitignore | 1 + ChangeLog.md | 1 + Makefile.am | 2 +- configure.ac | 3 +- daemon/Makefile.am | 34 ++++ daemon/x52d.conf | 80 +++++++++ daemon/x52d_config.c | 42 +++++ daemon/x52d_config.def | 70 ++++++++ daemon/x52d_config.h | 52 ++++++ daemon/x52d_config_parser.c | 323 ++++++++++++++++++++++++++++++++++++ daemon/x52d_const.h | 21 +++ daemon/x52d_main.c | 131 +++++++++++++++ po/POTFILES.in | 4 + po/x52pro-linux.pot | 60 ++++++- po/xx_PL.po | 66 +++++++- 15 files changed, 884 insertions(+), 6 deletions(-) create mode 100644 daemon/Makefile.am create mode 100644 daemon/x52d.conf create mode 100644 daemon/x52d_config.c create mode 100644 daemon/x52d_config.def create mode 100644 daemon/x52d_config.h create mode 100644 daemon/x52d_config_parser.c create mode 100644 daemon/x52d_const.h create mode 100644 daemon/x52d_main.c diff --git a/.gitignore b/.gitignore index 58dd4c4..7e72371 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ lib/libx52util/util_char_map.c util/x52charmapgen* lib/libusbx52/x52test* udev/*.rules +daemon/x52d* x52pro-linux-*.tar.gz # Module files diff --git a/ChangeLog.md b/ChangeLog.md index 5643023..a71d937 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,7 @@ The format is based upon [Keep a Changelog]. - IO library to read and parse events from a supported joystick. - Event test utility which displays the events similar to evtest. - Import pinelog library for daemon logging. +- Daemon to control and update the X52 joystick. ### Changed - Linux kernel driver to correctly handle the X52/X52 Pro. This is not required diff --git a/Makefile.am b/Makefile.am index 2d85255..10b78fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) lib utils tests udev +SUBDIRS = $(po_SUBDIRS) lib utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index eaa309b..48e2942 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ AM_CONDITIONAL([LINUX], [test "x${build_linux}" = "xyes"]) # Internationalization AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION(0.18) +AM_GNU_GETTEXT_VERSION(0.19) AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" == "xyes"]) # Check for libusb-1.0 @@ -129,6 +129,7 @@ AC_CONFIG_FILES([ po/Makefile.in utils/cli/Makefile utils/test/Makefile utils/evtest/Makefile + daemon/Makefile tests/Makefile ]) AC_OUTPUT diff --git a/daemon/Makefile.am b/daemon/Makefile.am new file mode 100644 index 0000000..45047da --- /dev/null +++ b/daemon/Makefile.am @@ -0,0 +1,34 @@ +# Automake for x52d +# +# Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) +# +# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + +ACLOCAL_AMFLAGS = -I m4 + +bin_PROGRAMS = x52d + +# Service daemon that manages the X52 device +x52d_SOURCES = \ + x52d_main.c x52d_config_parser.c x52d_config.c + +x52d_CFLAGS = \ + -I $(top_srcdir) \ + -I $(top_srcdir)/lib/libx52io \ + -I $(top_srcdir)/lib/libx52 \ + -I $(top_srcdir)/lib/libx52util \ + -I $(top_srcdir)/lib/pinelog \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLOCALEDIR=\"$(localedir)\" \ + -DLOGDIR=\"$(localstatedir)/log\" \ + -DRUNDIR=\"$(runstatedir)\" \ + @INIH_CFLAGS@ $(WARN_CFLAGS) + +x52d_LDFLAGS = @INIH_LIBS@ $(WARN_LDFLAGS) +x52d_LDADD = ../lib/pinelog/libpinelog.la + +EXTRA_DIST = \ + x52d_config.def \ + x52d_config.h \ + x52d_const.h \ + x52d.conf diff --git a/daemon/x52d.conf b/daemon/x52d.conf new file mode 100644 index 0000000..f6d3bd0 --- /dev/null +++ b/daemon/x52d.conf @@ -0,0 +1,80 @@ +####################################################################### +# X52 Daemon Configuration +###################################################################### + +# The settings below are the defaults. Note that the section and key +# strings are case insensitive, but the values are not necessarily so, +# especially for those referring to paths or timezone names. + +###################################################################### +# Clock Settings +###################################################################### +[Clock] + +# Enabled controls whether the clock is enabled or not. Set this to no to +# disable the clock update. Keep in mind that if the clock was originally +# enabled on the X52, then disabling it here won't make the clock disappear on +# the MFD. You will need to unplug and reattach the X52 to make the clock +# disappear +Enabled=yes + +# PrimaryIsLocal controls whether the primary clock displays local time or UTC. +# Set this to yes to display local time, no for UTC. +PrimaryIsLocal=yes + +# Secondary controls the timezone of the secondary clock. Use the standard +# timezone name as defined by the Olson time database. +Secondary=UTC + +# Tertiary controls the timezone of the tertiary clock. Use the standard +# timezone name as defined by the Olson time database. +Tertiary=UTC + +###################################################################### +# LED Settings - only applicable to X52Pro +###################################################################### +[LED] + +# The LED settings map a color code or state to the corresponding LED. +Fire=on +Throttle=on +A=green +B=green +D=green +E=green +T1=green +T2=green +T3=green +POV=green +Clutch=green + +###################################################################### +# Brightness Settings +###################################################################### +[Brightness] + +# The brightness settings map the brightness value to the LEDs/MFD. +MFD=128 +LED=128 + +###################################################################### +# Profiles - only valid on Linux +###################################################################### +[Profiles] + +# Directory is the location of the folder containing the individual profiles. +Directory=/etc/x52d/profiles.d + +# ClutchEnabled determines if the clutch button is treated specially +ClutchEnabled=no + +# ClutchLatched controls if the clutch button (if enabled) is a latched button +# (press once to enter clutch mode, press again to exit clutch mode), or must +# be held down to remain in clutch mode. +ClutchLatched=no + +################## +#X52 Input Servic# +#Version 0.2.2 # +#OS: Linux # +################## diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c new file mode 100644 index 0000000..b27246c --- /dev/null +++ b/daemon/x52d_config.c @@ -0,0 +1,42 @@ +/* + * Saitek X52 Pro MFD & LED driver - Configuration parser + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include "pinelog.h" +#include "x52d_config.h" +#include "x52d_const.h" + +static struct x52d_config x52d_config; + +void x52d_config_load(const char *cfg_file) +{ + int rc; + + if (cfg_file == NULL) { + cfg_file = X52D_SYS_CFG_FILE; + } + + rc = x52d_config_set_defaults(&x52d_config); + if (rc != 0) { + PINELOG_FATAL(_("Error %d setting configuration defaults: %s"), + rc, strerror(rc)); + } + + rc = x52d_config_load_file(&x52d_config, cfg_file); + if (rc != 0) { + exit(EXIT_FAILURE); + } + + // Apply overrides + rc = x52d_config_apply_overrides(&x52d_config); + x52d_config_clear_overrides(); + if (rc != 0) { + exit(EXIT_FAILURE); + } +} + diff --git a/daemon/x52d_config.def b/daemon/x52d_config.def new file mode 100644 index 0000000..37deb19 --- /dev/null +++ b/daemon/x52d_config.def @@ -0,0 +1,70 @@ +/********************************************************************** + * X52 Daemon Configuration + *********************************************************************/ + +// The settings below are the defaults. Note that the section and key +// strings are case insensitive, but the values are not necessarily so, +// especially for those referring to paths or timezone names. + +/* CFG(section, key, name, parser, default) */ +/********************************************************************** + * Clock Settings + *********************************************************************/ + +// Enabled controls whether the clock is enabled or not. Set this to no to +// disable the clock update. Keep in mind that if the clock was originally +// enabled on the X52, then disabling it here won't make the clock disappear +// on the MFD. You will need to unplug and reattach the X52 to make the +// clock disappear +CFG(Clock, Enabled, clock_enabled, bool_parser, true) + +// PrimaryIsLocal controls whether the primary clock displays local time or UTC. +// Set this to yes to display local time, no for UTC. +CFG(Clock, PrimaryIsLocal, primary_clock_local, bool_parser, true) + +// Secondary controls the timezone of the secondary clock. Use the standard +// timezone name as defined by the Olson time database. +CFG(Clock, Secondary, clock_2_tz, string_parser, UTC) + +// Tertiary controls the timezone of the tertiary clock. Use the standard +// timezone name as defined by the Olson time database. +CFG(Clock, Tertiary, clock_3_tz, string_parser, UTC) + +/********************************************************************** + * LED Settings - only applicable to X52Pro + *********************************************************************/ +// The LED settings map a color code or state to the corresponding LED. +CFG(LED, Fire, leds[LIBX52_LED_FIRE], led_parser, on) +CFG(LED, Throttle, leds[LIBX52_LED_THROTTLE], led_parser, on) +CFG(LED, A, leds[LIBX52_LED_A], led_parser, green) +CFG(LED, B, leds[LIBX52_LED_B], led_parser, green) +CFG(LED, D, leds[LIBX52_LED_D], led_parser, green) +CFG(LED, E, leds[LIBX52_LED_E], led_parser, green) +CFG(LED, T1, leds[LIBX52_LED_T1], led_parser, green) +CFG(LED, T2, leds[LIBX52_LED_T2], led_parser, green) +CFG(LED, T3, leds[LIBX52_LED_T3], led_parser, green) +CFG(LED, POV, leds[LIBX52_LED_POV], led_parser, green) +CFG(LED, Clutch, leds[LIBX52_LED_CLUTCH], led_parser, green) + +/********************************************************************** + * Brightness Settings + *********************************************************************/ +// The brightness settings map the brightness value to the LEDs/MFD. +CFG(Brightness, MFD, brightness[0], int_parser, 128) +CFG(Brightness, LED, brightness[1], int_parser, 128) + +/********************************************************************** + * Profiles - only valid on Linux + *********************************************************************/ +// Directory is the location of the folder containing the individual profiles. +CFG(Profiles, Directory, profiles_dir, string_parser, /etc/x52d/profiles.d) + +// ClutchEnabled determines if the clutch button is treated specially +CFG(Profiles, ClutchEnabled, clutch_enabled, bool_parser, false) + +// ClutchLatched controls if the clutch button (if enabled) is a latched button +// (press once to enter clutch mode, press again to exit clutch mode), or must +// be held down to remain in clutch mode. +CFG(Profiles, ClutchLatched, clutch_latched, bool_parser, false) + +#undef CFG diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h new file mode 100644 index 0000000..0987c3f --- /dev/null +++ b/daemon/x52d_config.h @@ -0,0 +1,52 @@ +/* + * Saitek X52 Pro MFD & LED driver - Configuration parser header + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#ifndef X52D_CONFIG_H +#define X52D_CONFIG_H + +#include +#include +#include +#include "libx52.h" + +/** + * @brief Configuration structure + * + * Keep this in sync with the sample configuration + */ +struct x52d_config { + bool clock_enabled; + bool primary_clock_local; + char clock_2_tz[NAME_MAX]; + char clock_3_tz[NAME_MAX]; + + // Since we don't have a _MAX identifier for libx52_led_id, hardcode + // the length in the following declaration. + libx52_led_state leds[21]; + + uint16_t brightness[2]; + + bool clutch_enabled; + bool clutch_latched; + + char profiles_dir[NAME_MAX]; +}; + +int x52d_config_set_defaults(struct x52d_config *cfg); + +int x52d_config_load_file(struct x52d_config *cfg, const char *cfg_file); + +int x52d_config_save_override(const char *override_str); + +int x52d_config_apply_overrides(struct x52d_config *cfg); + +void x52d_config_clear_overrides(void); + +void x52d_config_load(const char *cfg_file); + +#endif // !defined X52D_CONFIG_H diff --git a/daemon/x52d_config_parser.c b/daemon/x52d_config_parser.c new file mode 100644 index 0000000..2b2b4da --- /dev/null +++ b/daemon/x52d_config_parser.c @@ -0,0 +1,323 @@ +/* + * Saitek X52 Pro MFD & LED driver - Configuration parser + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include + +#include "ini.h" +#include "pinelog.h" +#include "x52d_config.h" +#include "x52d_const.h" + +/* Parser function typedef */ +typedef int (*parser_fn)(struct x52d_config *, size_t, const char *); + +// Check if the parameters are all valid +#define CHECK_PARAMS() do { if (cfg == NULL || value == NULL) { return EINVAL; } } while(0) + +// Create a pointer "name" of type "type", which stores the pointer to the +// corresponding element within the config struct. +#define CONFIG_PTR(type, name) type name = (type)((uintptr_t)cfg + offset) + +static int bool_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(bool *, config); + CHECK_PARAMS(); + + if (!strcasecmp(value, "yes") || !strcasecmp(value, "true")) { + *config = true; + } else if (!strcasecmp(value, "no") || !strcasecmp(value, "false")) { + *config = false; + } else { + return EINVAL; + } + + return 0; +} + +static int string_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(char *, config); + CHECK_PARAMS(); + + /* String parameters are all NAME_MAX len */ + strncpy(config, value, NAME_MAX-1); + config[NAME_MAX-1] = '\0'; + + return 0; +} + +static int int_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(int *, config); + char *endptr; + int retval; + + CHECK_PARAMS(); + + errno = 0; + retval = strtol(value, &endptr, 0); + if (errno != 0) { + return errno; + } + + *config = retval; + return 0; +} + +static int led_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(libx52_led_state *, config); + CHECK_PARAMS(); + + #define MATCH_STATE(val) if (!strcasecmp(value, #val)) { *config = LIBX52_LED_STATE_ ## val ; } + MATCH_STATE(OFF) + else MATCH_STATE(ON) + else MATCH_STATE(RED) + else MATCH_STATE(AMBER) + else MATCH_STATE(GREEN) + else return EINVAL; + #undef MATCH_STATE + + return 0; +} + +/* Map for config->param */ +#define CFG(section, key, name, parser, def) {#section, #key, parser, offsetof(struct x52d_config, name)}, +const struct config_map { + const char *section; + const char *key; + parser_fn parser; + size_t offset; +} config_map[] = { + #include "x52d_config.def" + + // Terminating entry + {NULL, NULL, NULL, 0} +}; + +static int process_config_kv(void *user, const char *section, const char *key, const char *value) +{ + int i; + int rc = 0; + bool found = false; + struct x52d_config *cfg = (struct x52d_config*)user; + + for (i = 0; config_map[i].key != NULL; i++) { + rc = 0; + if (!strcasecmp(config_map[i].key, key) && + !strcasecmp(config_map[i].section, section)) { + found = true; + PINELOG_TRACE("Setting '%s.%s'='%s'", + config_map[i].section, config_map[i].key, value); + rc = config_map[i].parser(cfg, config_map[i].offset, value); + break; + } + } + + if (!found) { + // Print error message, but continue + PINELOG_INFO(_("Ignoring unknown key '%s.%s'"), section, key); + } + + return rc; +} + +/** + * @brief Set configuration defaults + * + * @param[in] cfg Pointer to config struct + * + * @returns 0 on success, non-zero error code on failure + */ +int x52d_config_set_defaults(struct x52d_config *cfg) { + int rc; + + if (cfg == NULL) { + return EINVAL; + } + + PINELOG_TRACE("Setting configuration defaults"); + #define CFG(section, key, name, parser, def) \ + rc = process_config_kv(cfg, #section, #key, #def); \ + if (rc != 0) { \ + return rc; \ + } + #include "x52d_config.def" + + return 0; +} + +int x52d_config_load_file(struct x52d_config *cfg, const char *cfg_file) +{ + int rc; + if (cfg == NULL || cfg_file == NULL) { + return EINVAL; + } + + PINELOG_TRACE("Loading configuration from file %s", cfg_file); + rc = ini_parse(cfg_file, process_config_kv, cfg); + if (rc < 0) { + PINELOG_ERROR(_("Failed processing configuration file %s - code %d"), + cfg_file, rc); + return EIO; + } + + return 0; +} + +struct x52d_config_override { + char *section; + char *key; + char *value; + struct x52d_config_override *next; +}; + +static struct x52d_config_override *override_head; +static struct x52d_config_override *override_tail; + +int x52d_config_save_override(const char *override_str) +{ + // Parse override string of the form section.key=value + struct x52d_config_override *override; + char *string = NULL; + char *free_ptr = NULL; + char *ptr; + int rc; + + PINELOG_TRACE("Allocating memory (%lu bytes) for override structure", sizeof(*override)); + override = calloc(1, sizeof(*override)); + if (override == NULL) { + PINELOG_ERROR(_("Failed to allocate memory for override structure")); + rc = ENOMEM; + goto cleanup; + } + + errno = 0; + PINELOG_TRACE("Duplicating override string"); + string = strdup(override_str); + if (string == NULL) { + PINELOG_ERROR(_("Failed to allocate memory for override string")); + rc = errno; + goto cleanup; + } + free_ptr = string; + + override->section = string; + // Ensure that the string is of the form ([^.]+\.[^=]+=.*) + ptr = strchr(string, '.'); + if (ptr == NULL || ptr == string) { + // No section found + PINELOG_ERROR(_("No section found in override string '%s'"), string); + rc = EINVAL; + goto cleanup; + } + // Reset the . to NUL + *ptr = '\0'; + ptr++; + PINELOG_TRACE("Splitting override string to '%s' and '%s'", string, ptr); + string = ptr; + + override->key = string; + ptr = strchr(string, '='); + if (ptr == NULL || ptr == string) { + // No key found + PINELOG_ERROR(_("No key found in override string '%s'"), string); + rc = EINVAL; + goto cleanup; + } + // Reset the = to NUL + *ptr = '\0'; + ptr++; + PINELOG_TRACE("Splitting override string to '%s' and '%s'", string, ptr); + + if (*ptr == '\0') { + // No value found + PINELOG_ERROR(_("No value found in override string '%s'"), string); + rc = EINVAL; + goto cleanup; + } + + override->value = ptr; + + // Add the override to the linked list + if (override_tail != NULL) { + PINELOG_TRACE("Linking override to list tail"); + override_tail->next = override; + } + PINELOG_TRACE("Setting list tail to override"); + override_tail = override; + + if (override_head == NULL) { + PINELOG_TRACE("Setting list head to override"); + override_head = override; + } + + return 0; + +cleanup: + if (free_ptr != NULL) { + free(free_ptr); + } + if (override != NULL) { + free(override); + } + return rc; +} + +int x52d_config_apply_overrides(struct x52d_config *cfg) +{ + int rc; + struct x52d_config_override *tmp = override_head; + + if (cfg == NULL) { + return EINVAL; + } + + while (tmp != NULL) { + PINELOG_TRACE("Processing override '%s.%s=%s'", + tmp->section, + tmp->key, + tmp->value); + rc = process_config_kv(cfg, + tmp->section, + tmp->key, + tmp->value); + if (rc != 0) { + PINELOG_ERROR(_("Error processing override '%s.%s=%s'"), + tmp->section, + tmp->key, + tmp->value); + return rc; + } + tmp = tmp->next; + } + + return 0; +} + +void x52d_config_clear_overrides(void) +{ + struct x52d_config_override *tmp; + while (override_head != NULL) { + tmp = override_head; + override_head = override_head->next; + PINELOG_TRACE("Freeing override '%s.%s=%s'", + tmp->section, + tmp->key, + tmp->value); + free(tmp); + } + + override_tail = NULL; +} diff --git a/daemon/x52d_const.h b/daemon/x52d_const.h new file mode 100644 index 0000000..a77785f --- /dev/null +++ b/daemon/x52d_const.h @@ -0,0 +1,21 @@ +/* + * Saitek X52 Pro MFD & LED driver - Application constants + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#ifndef X52D_CONST_H +#define X52D_CONST_H + +#define X52D_APP_NAME "x52d" + +#define X52D_LOG_FILE LOGDIR "/" X52D_APP_NAME ".log" + +#define X52D_SYS_CFG_FILE SYSCONFDIR "/" X52D_APP_NAME "/" X52D_APP_NAME ".conf" + +#include "gettext.h" +#define _(x) gettext(x) + +#endif // !defined X52D_CONST_H diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c new file mode 100644 index 0000000..c5c0f58 --- /dev/null +++ b/daemon/x52d_main.c @@ -0,0 +1,131 @@ +/* + * Saitek X52 Pro MFD & LED driver - Service daemon + * * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include +#include +#include +#include + +#include "x52d_const.h" +#include "x52d_config.h" +#include "pinelog.h" + +static void set_log_file(bool foreground, const char *log_file) +{ + int rc = 0; + if (log_file != NULL) { + rc = pinelog_set_output_file(log_file); + } else { + if (foreground) { + rc = pinelog_set_output_stream(stdout); + } else { + rc = pinelog_set_output_file(X52D_LOG_FILE); + } + } + + if (rc != 0) { + fprintf(stderr, _("Error %d setting log file: %s\n"), rc, strerror(rc)); + exit(EXIT_FAILURE); + } +} + +static void usage(int exit_code) +{ + fprintf(stderr, + _("Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n"), + X52D_APP_NAME); + exit(exit_code); +} + +int main(int argc, char **argv) +{ + int verbosity = 0; + bool quiet = false; + bool foreground = false; + char *log_file = NULL; + char *conf_file = NULL; + int opt; + + /* Initialize gettext */ + #if ENABLE_NLS + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + #endif + + /* Set system defaults */ + pinelog_set_level(PINELOG_LVL_WARNING); + + /* + * Parse command line arguments + * + * -f run in foreground + * -c path to config file + * -o option overrides + * -v verbose logging + * -q silent behavior + * -l path to log file + */ + while ((opt = getopt(argc, argv, "fvql:o:c:h")) != -1) { + switch (opt) { + case 'f': + foreground = true; + break; + + case 'v': + if (!quiet) { + if (verbosity <= PINELOG_LVL_TRACE) { + verbosity++; + pinelog_set_level(pinelog_get_level() + 1); + } + } + break; + + case 'q': + quiet = true; + pinelog_set_level(PINELOG_LVL_ERROR); + break; + + case 'l': + log_file = optarg; + break; + + case 'o': + if (x52d_config_save_override(optarg)) { + fprintf(stderr, + _("Unable to parse configuration override '%s'\n"), + optarg); + exit(EXIT_FAILURE); + } + break; + + case 'c': + conf_file = optarg; + break; + + case 'h': + usage(EXIT_SUCCESS); + break; + + default: + usage(EXIT_FAILURE); + break; + } + } + + printf("Foreground = %s\n", foreground ? "true" : "false"); + printf("Quiet = %s\n", quiet ? "true" : "false"); + printf("Verbosity = %d\n", verbosity); + printf("Log file = %s\n", log_file); + printf("Config file = %s\n", conf_file); + + set_log_file(foreground, log_file); + x52d_config_load(conf_file); + + return 0; +} diff --git a/po/POTFILES.in b/po/POTFILES.in index 847dc15..987e9d8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,3 +10,7 @@ utils/test/x52_test_clock.c utils/test/x52_test_common.h utils/test/x52_test_led.c utils/test/x52_test_mfd.c + +daemon/x52d_main.c +daemon/x52d_config.c +daemon/x52d_config_parser.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 46ac85d..1231cb8 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2020-07-16 04:24-0700\n" +"POT-Creation-Date: 2021-07-15 15:08-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -369,3 +369,61 @@ msgstr "" #: utils/test/x52_test_mfd.c:96 msgid "OK" msgstr "" + +#: daemon/x52d_main.c:32 +#, c-format +msgid "Error %d setting log file: %s\n" +msgstr "" + +#: daemon/x52d_main.c:40 +#, c-format +msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" +msgstr "" + +#: daemon/x52d_main.c:101 +#, c-format +msgid "Unable to parse configuration override '%s'\n" +msgstr "" + +#: daemon/x52d_config.c:26 +#, c-format +msgid "Error %d setting configuration defaults: %s" +msgstr "" + +#: daemon/x52d_config_parser.c:130 +#, c-format +msgid "Ignoring unknown key '%s.%s'" +msgstr "" + +#: daemon/x52d_config_parser.c:171 +#, c-format +msgid "Failed processing configuration file %s - code %d" +msgstr "" + +#: daemon/x52d_config_parser.c:201 +msgid "Failed to allocate memory for override structure" +msgstr "" + +#: daemon/x52d_config_parser.c:210 +msgid "Failed to allocate memory for override string" +msgstr "" + +#: daemon/x52d_config_parser.c:221 +#, c-format +msgid "No section found in override string '%s'" +msgstr "" + +#: daemon/x52d_config_parser.c:235 +#, c-format +msgid "No key found in override string '%s'" +msgstr "" + +#: daemon/x52d_config_parser.c:246 +#, c-format +msgid "No value found in override string '%s'" +msgstr "" + +#: daemon/x52d_config_parser.c:297 +#, c-format +msgid "Error processing override '%s.%s=%s'" +msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 0f3d893..e3fcb6d 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2020-07-16 04:24-0700\n" -"PO-Revision-Date: 2020-07-13 18:05-0700\n" +"POT-Creation-Date: 2021-07-15 15:08-0700\n" +"PO-Revision-Date: 2021-07-15 15:09-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.3.1\n" +"X-Generator: Poedit 3.0\n" #: lib/libx52/x52_strerror.c:25 lib/libx52io/io_strings.c:104 msgid "Success" @@ -412,3 +412,63 @@ msgstr "Estingtay aracterchay 0x%02x..." #: utils/test/x52_test_mfd.c:96 msgid "OK" msgstr "OKay" + +#: daemon/x52d_main.c:32 +#, c-format +msgid "Error %d setting log file: %s\n" +msgstr "Erroray %d ettingsay oglay ilefay: %s\n" + +#: daemon/x52d_main.c:40 +#, c-format +msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" +msgstr "" +"Usageay: %s [-f] [-v] [-q] [-l oglay-ilefay] [-o overrideay] [-c onfigcay-" +"ilefay]\n" + +#: daemon/x52d_main.c:101 +#, c-format +msgid "Unable to parse configuration override '%s'\n" +msgstr "Unableay otay arsepay onfigurationcay overrideay '%s'\n" + +#: daemon/x52d_config.c:26 +#, c-format +msgid "Error %d setting configuration defaults: %s" +msgstr "Erroray %d ettingsay onfigurationcay efaultsday: %s" + +#: daemon/x52d_config_parser.c:130 +#, c-format +msgid "Ignoring unknown key '%s.%s'" +msgstr "Ignoringay unknownay eykay '%s.%s'" + +#: daemon/x52d_config_parser.c:171 +#, c-format +msgid "Failed processing configuration file %s - code %d" +msgstr "Ailedfay ocessingpray onfigurationcay ilefay %s - odecay %d" + +#: daemon/x52d_config_parser.c:201 +msgid "Failed to allocate memory for override structure" +msgstr "Ailedfay otay allocateay emorymay orfay overrideay ucturestray" + +#: daemon/x52d_config_parser.c:210 +msgid "Failed to allocate memory for override string" +msgstr "Ailedfay otay allocateay emorymay orfay overrideay ingstray" + +#: daemon/x52d_config_parser.c:221 +#, c-format +msgid "No section found in override string '%s'" +msgstr "Onay ectionsay oundfay inay overrideay ingstray '%s'" + +#: daemon/x52d_config_parser.c:235 +#, c-format +msgid "No key found in override string '%s'" +msgstr "Onay eykay oundfay inay overrideay ingstray '%s'" + +#: daemon/x52d_config_parser.c:246 +#, c-format +msgid "No value found in override string '%s'" +msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'" + +#: daemon/x52d_config_parser.c:297 +#, c-format +msgid "Error processing override '%s.%s=%s'" +msgstr "Erroray ocessingpray overriday '%s.%s=%s'" From 19859b79c5ba79433e0a5fe61fff7ea3754fcdf8 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 16:14:17 -0700 Subject: [PATCH 06/68] Disable Ubuntu 16.04 builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e171c59..1a361d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: - os: ['ubuntu-16.04', 'ubuntu-18.04', 'ubuntu-20.04', 'macos-latest'] + os: ['ubuntu-18.04', 'ubuntu-20.04', 'macos-latest'] cc: ['gcc', 'clang'] steps: From fa298455aaa4f5ffa974f01498be44f65d1bc598 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 17:43:51 -0700 Subject: [PATCH 07/68] Use PKG_CHECK_MODULES instead of AX_PKG_CHECK_MODULES --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 48e2942..29e5931 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,7 @@ AC_SUBST([LIBUSB_LDFLAGS]) AC_SUBST([LIBUSB_LIBS]) # Check for libinih -AX_PKG_CHECK_MODULES([INIH], [inih]) +PKG_CHECK_MODULES([INIH], [inih]) AC_SUBST([INIH_CFLAGS]) AC_SUBST([INIH_LDFLAGS]) AC_SUBST([INIH_LIBS]) @@ -57,7 +57,7 @@ AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"]) # Check for hidapi. This uses a different pkg-config file on Linux vs other # hosts, so check accordingly AM_COND_IF([LINUX], [hidapi_backend=hidapi-hidraw], [hidapi_backend=hidapi]) -AX_PKG_CHECK_MODULES([HIDAPI], [${hidapi_backend}]) +PKG_CHECK_MODULES([HIDAPI], [${hidapi_backend}]) AC_SUBST([HIDAPI_CFLAGS]) AC_SUBST([HIDAPI_LDFLAGS]) AC_SUBST([HIDAPI_LIBS]) From 738879f79f758a91b91cc229b79af70b25667992 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 17:44:08 -0700 Subject: [PATCH 08/68] Disable building for Ubuntu 18.04 libinih-dev on Bionic does not provide a .pc file, so PKG_CHECK_MODULES fails on this target. This commit disables the CI build on Bionic until we have a workaround. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a361d7..86c2582 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: - os: ['ubuntu-18.04', 'ubuntu-20.04', 'macos-latest'] + os: ['ubuntu-20.04', 'macos-latest'] cc: ['gcc', 'clang'] steps: From fc9bebbe5a8a81facf343dbb155d45f3d258d49e Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 17:57:51 -0700 Subject: [PATCH 09/68] Add noreturn attribute to fix compiler warnings --- configure.ac | 1 + daemon/x52d_main.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 29e5931..f4ce5e4 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,7 @@ AX_COMPILER_FLAGS AC_CANONICAL_HOST AX_GCC_FUNC_ATTRIBUTE([constructor]) AX_GCC_FUNC_ATTRIBUTE([format]) +AX_GCC_FUNC_ATTRIBUTE([noreturn]) AC_MSG_NOTICE([Detected host OS is ${host_os}]) build_linux=no diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index c5c0f58..595de2c 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -34,6 +34,9 @@ static void set_log_file(bool foreground, const char *log_file) } } +#if HAVE_FUNC_ATTRIBUTE_NORETURN +__attribute__((noreturn)) +#endif static void usage(int exit_code) { fprintf(stderr, From e32f83648568f1be5ba2a0ca6eb23ae4daaa9ed4 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 18:31:01 -0700 Subject: [PATCH 10/68] Fix format-literal error in clang --- lib/pinelog/test_pinelog.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/pinelog/test_pinelog.c b/lib/pinelog/test_pinelog.c index dd568a8..8977367 100644 --- a/lib/pinelog/test_pinelog.c +++ b/lib/pinelog/test_pinelog.c @@ -66,10 +66,8 @@ static void dump_data(const char *type, size_t len, char *data) printf("\n"); } -static void test_setup(int level, int filter, const char *file, int line, const char *fmt, ...) +static int test_setup(int level, int filter, const char *file, int line) { - va_list ap; - expected_len = 0; memset(expected_output, 0, sizeof(expected_output)); @@ -105,14 +103,10 @@ static void test_setup(int level, int filter, const char *file, int line, const "%s:%d ", file, line); } - va_start(ap, fmt); - expected_len += vsnprintf(&expected_output[expected_len], - sizeof(expected_output) - expected_len, - fmt, ap); - va_end(ap); - expected_output[expected_len] = '\n'; - expected_len++; + return 1; } + + return 0; } static void test_teardown(const char *desc) @@ -144,8 +138,11 @@ static void verify_defaults(void) #define PINELOG_WARNING PINELOG_WARN #define TEST_LOG(lvl, filter, fmt, ...) do { \ - test_setup(PINELOG_LVL_ ## lvl, PINELOG_LVL_ ## filter, \ - __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + if (test_setup(PINELOG_LVL_ ## lvl, PINELOG_LVL_ ## filter, \ + __FILE__, __LINE__)) \ + expected_len += snprintf(&expected_output[expected_len], \ + sizeof(expected_output) - expected_len, \ + fmt "\n", ##__VA_ARGS__); \ PINELOG_ ## lvl (fmt, ##__VA_ARGS__); \ test_teardown("Log " #lvl " filter " #filter); \ } while(0) From 8545e28d094a62d0506663b53463b3010afcef9c Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 19:31:46 -0700 Subject: [PATCH 11/68] Build and install inih manually on macOS --- .github/scripts/install-dependencies-macos.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/scripts/install-dependencies-macos.sh b/.github/scripts/install-dependencies-macos.sh index d3784af..7fcbcc8 100755 --- a/.github/scripts/install-dependencies-macos.sh +++ b/.github/scripts/install-dependencies-macos.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # Install dependencies to build and test on Ubuntu runners brew install \ autoconf \ @@ -9,9 +9,17 @@ brew install \ gettext \ libusb \ hidapi \ - inih \ doxygen \ rsync \ + meson \ cmocka +# inih cannot be installed via Homebrew, install it manually +INIH_VER=r53 +curl -LO https://github.com/benhoyt/inih/archive/refs/tags/${INIH_VER}.tar.gz +tar xvf ${INIH_VER}.tar.gz +cd inih-${INIH_VER} +meson build +meson install -C build + exit 0 From 81002444d7a00503e9f730cceafe79de16076c77 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 21:51:01 -0700 Subject: [PATCH 12/68] Add LTLIBINTL to enable i18n --- daemon/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 45047da..3b1b846 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -25,7 +25,7 @@ x52d_CFLAGS = \ @INIH_CFLAGS@ $(WARN_CFLAGS) x52d_LDFLAGS = @INIH_LIBS@ $(WARN_LDFLAGS) -x52d_LDADD = ../lib/pinelog/libpinelog.la +x52d_LDADD = ../lib/pinelog/libpinelog.la @LTLIBINTL@ EXTRA_DIST = \ x52d_config.def \ From 2ce9ff2280c2ba9b6b95af9a01a416747ab5165e Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 22:00:14 -0700 Subject: [PATCH 13/68] Disable AX_PKG_CHECK_MODULES on optional modules --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f4ce5e4..60f3307 100644 --- a/configure.ac +++ b/configure.ac @@ -77,7 +77,7 @@ AC_MSG_CHECKING([final decision IS_MAKE_DISTCHECK (running "make distcheck"?)]) AM_COND_IF([IS_MAKE_DISTCHECK], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) # udev support -AX_PKG_CHECK_MODULES([UDEV], [udev], [], [have_udev=yes], [have_udev=no]) +PKG_CHECK_MODULES([UDEV], [udev], [], [have_udev=yes], [have_udev=no]) AM_CONDITIONAL([HAVE_UDEV], [test "x$have_udev" = xyes]) AC_ARG_WITH([udevrulesdir], AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]), @@ -99,7 +99,7 @@ AM_COND_IF([HAVE_DOXYGEN], [AC_MSG_WARN(["Doxygen not found; continuing without doxygen support"])]) # cmocka unit tests -AX_PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1], [], [have_cmocka=yes], [have_cmocka=no]) +PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1], [], [have_cmocka=yes], [have_cmocka=no]) AM_CONDITIONAL([HAVE_CMOCKA], [test "x$have_cmocka" = xyes]) AM_COND_IF([HAVE_CMOCKA], [], [AC_MSG_WARN(["cmocka not found; disabling unit test build"])]) From 5a283672c4ad50db99e1a5b9e97d9410a637a4af Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 15 Jul 2021 22:20:40 -0700 Subject: [PATCH 14/68] Update instructions to install inih on Arch and MacOS [skip ci] --- INSTALL.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 4ade22c..6737ef5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -18,7 +18,7 @@ Build has been tested on the following operating systems (x86-64 only): * autopoint * gettext * hidapi -* inih +* [inih](https://github.com/benhoyt/inih) * libtool * libusb-1.0 + headers * pkg-config @@ -29,8 +29,15 @@ Build has been tested on the following operating systems (x86-64 only): | Platform | Install instructions | | -------- | -------------------- | | Ubuntu | `sudo apt-get install automake autoconf gettext autopoint libhidapi-dev libinih-dev libtool libusb-1.0-0-dev pkg-config python3` | -| MacOS + Homebrew | `brew install automake autoconf gettext hidapi inih libtool libusb pkg-config python3` | -| Arch Linux | `pacman -S base-devel libusb hidapi inih python` | +| MacOS + Homebrew | `brew install automake autoconf gettext hidapi libtool libusb meson pkg-config python3` | +| Arch Linux | `pacman -S base-devel libusb hidapi libinih python` | + +On MacOS, `inih` is not available as a Homebrew formula. You need to build and +install it manually using the following steps: + +* Download and extract inih from Github +* From the inih source directory, run `meson build`, then run `meson install -C + build`. ## Optional Packages From ab946b4a1ac394bdc8f2c0c6513ac3d093e33e84 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 16 Jul 2021 00:28:30 -0700 Subject: [PATCH 15/68] Add device manager implementation --- .gitignore | 1 + daemon/Makefile.am | 11 +++- daemon/x52d_device.c | 151 +++++++++++++++++++++++++++++++++++++++++++ daemon/x52d_device.h | 33 ++++++++++ daemon/x52d_main.c | 3 +- po/POTFILES.in | 1 + po/x52pro-linux.pot | 28 ++++++-- po/xx_PL.po | 28 ++++++-- 8 files changed, 244 insertions(+), 12 deletions(-) create mode 100644 daemon/x52d_device.c create mode 100644 daemon/x52d_device.h diff --git a/.gitignore b/.gitignore index 7e72371..1c51b6b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ util/x52charmapgen* lib/libusbx52/x52test* udev/*.rules daemon/x52d* +!daemon/x52d_*.* x52pro-linux-*.tar.gz # Module files diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 3b1b846..8dc7987 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -10,7 +10,8 @@ bin_PROGRAMS = x52d # Service daemon that manages the X52 device x52d_SOURCES = \ - x52d_main.c x52d_config_parser.c x52d_config.c + x52d_main.c x52d_config_parser.c x52d_config.c \ + x52d_device.c x52d_CFLAGS = \ -I $(top_srcdir) \ @@ -22,13 +23,17 @@ x52d_CFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ -DLOGDIR=\"$(localstatedir)/log\" \ -DRUNDIR=\"$(runstatedir)\" \ - @INIH_CFLAGS@ $(WARN_CFLAGS) + @INIH_CFLAGS@ @X52_INCLUDE@ $(WARN_CFLAGS) x52d_LDFLAGS = @INIH_LIBS@ $(WARN_LDFLAGS) -x52d_LDADD = ../lib/pinelog/libpinelog.la @LTLIBINTL@ +x52d_LDADD = \ + ../lib/pinelog/libpinelog.la \ + ../lib/libx52/libx52.la \ + @LTLIBINTL@ EXTRA_DIST = \ x52d_config.def \ x52d_config.h \ x52d_const.h \ + x52d_device.h \ x52d.conf diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c new file mode 100644 index 0000000..36cbf1a --- /dev/null +++ b/daemon/x52d_device.c @@ -0,0 +1,151 @@ +/* + * Saitek X52 Pro MFD & LED driver - Device manager + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include +#include + +#include "x52d_const.h" +#include "x52d_device.h" +#include "libx52.h" +#include "pinelog.h" + +/* + * Functions + * + * Thread method to scan and reconnect to the joystick if it has been + * disconnected/never connected. + * + * API wrappers to libx52 functions + */ + +static libx52_device *x52_dev; + +static pthread_mutex_t device_mutex = PTHREAD_MUTEX_INITIALIZER; + +#if 0 +static void *x52_dev_thread(void *param) +{ + int rc; + + // Check if the device is connected in a loop + for (;;) { + #define RECONNECT_DELAY 5 + sleep(RECONNECT_DELAY); + if (!libx52_is_connected(x52_dev)) { + PINELOG_TRACE("Attempting to connect to X52 device"); + rc = libx52_connect(x52_dev); + if (rc != LIBX52_SUCCESS) { + if (rc != LIBX52_ERROR_NO_DEVICE) { + PINELOG_ERROR(_("Error %d connecting to device: %s"), + rc, libx52_strerror(rc)); + } + } + } + } + + return NULL; +} +#endif + +void x52d_dev_init(void) +{ + int rc; + PINELOG_TRACE("Initializing libx52"); + rc = libx52_init(&x52_dev); + + if (rc != LIBX52_SUCCESS) { + PINELOG_FATAL(_("Failure %d initializing libx52: %s"), + rc, libx52_strerror(rc)); + } + + // TODO: Create and initialize the threads +} + +void x52d_dev_exit(void) +{ + // TODO: Shutdown any threads + + libx52_exit(x52_dev); +} + +#define WRAP_LIBX52(func) \ + int rc; \ + pthread_mutex_lock(&device_mutex); \ + rc = func; \ + pthread_mutex_unlock(&device_mutex); \ + if (rc != LIBX52_SUCCESS) { \ + PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ + rc, libx52_strerror(rc)); \ + } \ + return rc + +int x52d_dev_set_text(uint8_t line, const char *text, uint8_t length) +{ + WRAP_LIBX52(libx52_set_text(x52_dev, line, text, length)); +} +int x52d_dev_set_led_state(libx52_led_id led, libx52_led_state state) +{ + WRAP_LIBX52(libx52_set_led_state(x52_dev, led, state)); +} +int x52d_dev_set_clock(time_t time, int local) +{ + WRAP_LIBX52(libx52_set_clock(x52_dev, time, local)); +} +int x52d_dev_set_clock_timezone(libx52_clock_id clock, int offset) +{ + WRAP_LIBX52(libx52_set_clock_timezone(x52_dev, clock, offset)); +} +int x52d_dev_set_clock_format(libx52_clock_id clock, libx52_clock_format format) +{ + WRAP_LIBX52(libx52_set_clock_format(x52_dev, clock, format)); +} +int x52d_dev_set_time(uint8_t hour, uint8_t minute) +{ + WRAP_LIBX52(libx52_set_time(x52_dev, hour, minute)); +} +int x52d_dev_set_date(uint8_t dd, uint8_t mm, uint8_t yy) +{ + WRAP_LIBX52(libx52_set_date(x52_dev, dd, mm, yy)); +} +int x52d_dev_set_date_format(libx52_date_format format) +{ + WRAP_LIBX52(libx52_set_date_format(x52_dev, format)); +} +int x52d_dev_set_brightness(uint8_t mfd, uint16_t brightness) +{ + WRAP_LIBX52(libx52_set_brightness(x52_dev, mfd, brightness)); +} +int x52d_dev_set_shift(uint8_t state) +{ + WRAP_LIBX52(libx52_set_shift(x52_dev, state)); +} +int x52d_dev_set_blink(uint8_t state) +{ + WRAP_LIBX52(libx52_set_blink(x52_dev, state)); +} +int x52d_dev_update(void) +{ + int rc; + + pthread_mutex_lock(&device_mutex); + rc = libx52_update(x52_dev); + pthread_mutex_unlock(&device_mutex); + + if (rc != LIBX52_SUCCESS) { + if (rc == LIBX52_ERROR_NO_DEVICE) { + // TODO: Detach and spawn thread to reconnect + libx52_disconnect(x52_dev); + } else { + PINELOG_ERROR(_("Error %d when updating X52 device: %s"), + rc, libx52_strerror(rc)); + } + } + + return rc; +} diff --git a/daemon/x52d_device.h b/daemon/x52d_device.h new file mode 100644 index 0000000..e826675 --- /dev/null +++ b/daemon/x52d_device.h @@ -0,0 +1,33 @@ +/* + * Saitek X52 Pro MFD & LED driver - Device manager header + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#ifndef X52D_DEVICE_H +#define X52D_DEVICE_H + +#include "libx52.h" + +void x52d_dev_init(void); +void x52d_dev_exit(void); + +void x52d_dev_start_thread(void); + +/* Wrapper methods for libx52 calls */ +int x52d_dev_set_text(uint8_t line, const char *text, uint8_t length); +int x52d_dev_set_led_state(libx52_led_id led, libx52_led_state state); +int x52d_dev_set_clock(time_t time, int local); +int x52d_dev_set_clock_timezone(libx52_clock_id clock, int offset); +int x52d_dev_set_clock_format(libx52_clock_id clock, libx52_clock_format format); +int x52d_dev_set_time(uint8_t hour, uint8_t minute); +int x52d_dev_set_date(uint8_t dd, uint8_t mm, uint8_t yy); +int x52d_dev_set_date_format(libx52_date_format format); +int x52d_dev_set_brightness(uint8_t mfd, uint16_t brightness); +int x52d_dev_set_shift(uint8_t state); +int x52d_dev_set_blink(uint8_t state); +int x52d_dev_update(void); + +#endif // !defined X52D_DEVICE_H diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 595de2c..ec4308a 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -1,6 +1,7 @@ /* * Saitek X52 Pro MFD & LED driver - Service daemon - * * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) * * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 987e9d8..5819676 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,3 +14,4 @@ utils/test/x52_test_mfd.c daemon/x52d_main.c daemon/x52d_config.c daemon/x52d_config_parser.c +daemon/x52d_device.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 1231cb8..749d20e 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-15 15:08-0700\n" +"POT-Creation-Date: 2021-07-16 00:26-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -370,17 +370,17 @@ msgstr "" msgid "OK" msgstr "" -#: daemon/x52d_main.c:32 +#: daemon/x52d_main.c:33 #, c-format msgid "Error %d setting log file: %s\n" msgstr "" -#: daemon/x52d_main.c:40 +#: daemon/x52d_main.c:44 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" -#: daemon/x52d_main.c:101 +#: daemon/x52d_main.c:105 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "" @@ -427,3 +427,23 @@ msgstr "" #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "" + +#: daemon/x52d_device.c:45 +#, c-format +msgid "Error %d connecting to device: %s" +msgstr "" + +#: daemon/x52d_device.c:63 +#, c-format +msgid "Failure %d initializing libx52: %s" +msgstr "" + +#: daemon/x52d_device.c:83 +#, c-format +msgid "Error %d when updating X52 parameter: %s" +msgstr "" + +#: daemon/x52d_device.c:145 +#, c-format +msgid "Error %d when updating X52 device: %s" +msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index e3fcb6d..ee01b03 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-15 15:08-0700\n" +"POT-Creation-Date: 2021-07-16 00:26-0700\n" "PO-Revision-Date: 2021-07-15 15:09-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -413,19 +413,19 @@ msgstr "Estingtay aracterchay 0x%02x..." msgid "OK" msgstr "OKay" -#: daemon/x52d_main.c:32 +#: daemon/x52d_main.c:33 #, c-format msgid "Error %d setting log file: %s\n" msgstr "Erroray %d ettingsay oglay ilefay: %s\n" -#: daemon/x52d_main.c:40 +#: daemon/x52d_main.c:44 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" "Usageay: %s [-f] [-v] [-q] [-l oglay-ilefay] [-o overrideay] [-c onfigcay-" "ilefay]\n" -#: daemon/x52d_main.c:101 +#: daemon/x52d_main.c:105 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "Unableay otay arsepay onfigurationcay overrideay '%s'\n" @@ -472,3 +472,23 @@ msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'" #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "Erroray ocessingpray overriday '%s.%s=%s'" + +#: daemon/x52d_device.c:45 +#, c-format +msgid "Error %d connecting to device: %s" +msgstr "Erroray %d onnectingcay otay eviceday: %s" + +#: daemon/x52d_device.c:63 +#, c-format +msgid "Failure %d initializing libx52: %s" +msgstr "Ailurefay %d initializeay libx52: %s" + +#: daemon/x52d_device.c:83 +#, c-format +msgid "Error %d when updating X52 parameter: %s" +msgstr "Erroray %d enwhay updatingay X52 arameterpay: %s" + +#: daemon/x52d_device.c:145 +#, c-format +msgid "Error %d when updating X52 device: %s" +msgstr "Erroray %d enwhay updatingay X52 eviceday: %s" From 0d407d77fe892bebf4c0f700b21f984d0a3f99ee Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 16 Jul 2021 08:29:11 -0700 Subject: [PATCH 16/68] Add method to close output stream and reset to default --- lib/pinelog/configure.ac | 1 + lib/pinelog/pinelog.c | 17 +++++++++++++---- lib/pinelog/pinelog.h | 5 +++++ lib/pinelog/test_pinelog.c | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/pinelog/configure.ac b/lib/pinelog/configure.ac index 133e102..b9d83a7 100644 --- a/lib/pinelog/configure.ac +++ b/lib/pinelog/configure.ac @@ -17,6 +17,7 @@ PKG_PROG_PKG_CONFIG PKG_INSTALLDIR AX_COMPILER_FLAGS AX_GCC_FUNC_ATTRIBUTE([constructor]) +AX_GCC_FUNC_ATTRIBUTE([destructor]) AX_GCC_FUNC_ATTRIBUTE([format]) AC_SUBST([PINELOG_CFLAGS]) diff --git a/lib/pinelog/pinelog.c b/lib/pinelog/pinelog.c index 1c793c5..e2e7c42 100644 --- a/lib/pinelog/pinelog.c +++ b/lib/pinelog/pinelog.c @@ -87,16 +87,25 @@ void pinelog_set_defaults(void) log_level = PINELOG_DEFAULT_LEVEL; } +#if HAVE_FUNC_ATTRIBUTE_DESTRUCTOR +__attribute__((destructor)) +#endif +void pinelog_close_output_stream(void) +{ + /* If current output stream is not stdout or stderr, then close it */ + if (output_stream != NULL && output_stream != stdout && output_stream != stderr) { + fclose(output_stream); + } + output_stream = PINELOG_DEFAULT_STREAM; +} + int pinelog_set_output_stream(FILE *stream) { if (stream == NULL) { return EINVAL; } - /* If current output stream is not stdout or stderr, then close it */ - if (output_stream != stdout && output_stream != stderr) { - fclose(output_stream); - } + pinelog_close_output_stream(); setlinebuf(stream); output_stream = stream; diff --git a/lib/pinelog/pinelog.h b/lib/pinelog/pinelog.h index 0020ad9..dfd2b0c 100644 --- a/lib/pinelog/pinelog.h +++ b/lib/pinelog/pinelog.h @@ -62,6 +62,11 @@ enum { */ void pinelog_set_defaults(void); +/** + * @brief Close the output stream and terminate the logs + */ +void pinelog_close_output_stream(void); + #ifdef PINELOG_TEST /** * @brief Get the pointer to the output stream. Only used in test harness. diff --git a/lib/pinelog/test_pinelog.c b/lib/pinelog/test_pinelog.c index 8977367..0f59117 100644 --- a/lib/pinelog/test_pinelog.c +++ b/lib/pinelog/test_pinelog.c @@ -181,7 +181,7 @@ int main(int argc, char **argv) printf("1..%u\n", test_id); - fclose(observed_stream_w); + pinelog_close_output_stream(); fclose(observed_stream_r); close(fifo_fd_w); close(fifo_fd_r); From 27eb1230625bb22663635d59f486e3a2e8154bae Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 16 Jul 2021 08:33:22 -0700 Subject: [PATCH 17/68] Update README to include destructor attribute --- lib/pinelog/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pinelog/README.md b/lib/pinelog/README.md index 01923d6..c8423c2 100644 --- a/lib/pinelog/README.md +++ b/lib/pinelog/README.md @@ -129,6 +129,7 @@ a Git submodule or subtree. The default build of Pinelog uses an autotools generated `config.h` file, which includes checks for the following GCC attributes. If you don't care about these, then either create a dummy config.h which includes the macros -`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR` and `HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the -`AX_GCC_FUNC_ATTRIBUTE` macro to check for the `constructor` and `format` -attributes in your application's `configure.ac` file. +`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR`, `HAVE_FUNC_ATTRIBUTE_DESTRUCTOR` and +`HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the `AX_GCC_FUNC_ATTRIBUTE` macro to check +for the `constructor`, `destructor` and `format` attributes in your +application's `configure.ac` file. From 82c778c7de297c4302a90168bc2a066518f7cdf1 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 16 Jul 2021 16:25:43 -0700 Subject: [PATCH 18/68] Update configure.ac to handle the new pinelog method --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 60f3307..625745c 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,7 @@ PKG_INSTALLDIR AX_COMPILER_FLAGS AC_CANONICAL_HOST AX_GCC_FUNC_ATTRIBUTE([constructor]) +AX_GCC_FUNC_ATTRIBUTE([destructor]) AX_GCC_FUNC_ATTRIBUTE([format]) AX_GCC_FUNC_ATTRIBUTE([noreturn]) From 9fa1a428a45eabff0122e199a687068f0e6280dd Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 19 Jul 2021 09:50:42 -0700 Subject: [PATCH 19/68] Squashed 'lib/pinelog/' changes from b5457f4..321d9aa 321d9aa Add benchmark program to tests a6e789e Remove config.h.in - this is autogenerated a3eb2c0 Add method to close output stream and reset to default fb9b51a Fix format-literal error in clang git-subtree-dir: lib/pinelog git-subtree-split: 321d9aaa0eee4b4af4be52c228662c3d32c32ab6 --- .gitignore | 1 - Makefile.am | 52 ++++++++++++++++++++++++++++++- bench_pinelog.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ config.h.in | 67 ---------------------------------------- configure.ac | 1 + pinelog.c | 17 +++++++--- pinelog.h | 5 +++ test_pinelog.c | 23 ++++++-------- 8 files changed, 162 insertions(+), 86 deletions(-) create mode 100644 bench_pinelog.c delete mode 100644 config.h.in diff --git a/.gitignore b/.gitignore index 3cd4832..6166c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ autom4te.cache m4 compile config.* -!config.h.in configure depcomp install-sh diff --git a/Makefile.am b/Makefile.am index ba23573..2eea553 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,7 @@ libpinelog_la_CFLAGS = @PINELOG_CFLAGS@ $(WARN_CFLAGS) -I $(top_builddir) libpinelog_la_LDFLAGS = $(WARN_LDFLAGS) test_SRCFILES = test_pinelog.c $(libpinelog_la_SOURCES) +bench_SRCFILES = bench_pinelog.c $(libpinelog_la_SOURCES) test_CFLAGS = \ -DPINELOG_FATAL_STR='"F"' \ -DPINELOG_ERROR_STR='"E"' \ @@ -40,7 +41,15 @@ TESTS = \ test_nots_lvl_tr \ test_nots_lvl_notr \ test_nots_nolvl_tr \ - test_nots_nolvl_notr + test_nots_nolvl_notr \ + bench_ts_lvl_tr \ + bench_ts_lvl_notr \ + bench_ts_nolvl_tr \ + bench_ts_nolvl_notr \ + bench_nots_lvl_tr \ + bench_nots_lvl_notr \ + bench_nots_nolvl_tr \ + bench_nots_nolvl_notr check_PROGRAMS = $(TESTS) test_ts_lvl_tr_SOURCES = $(test_SRCFILES) @@ -82,3 +91,44 @@ test_nots_nolvl_notr_SOURCES = $(test_SRCFILES) test_nots_nolvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=0 test_nots_nolvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +bench_ts_lvl_tr_SOURCES = $(bench_SRCFILES) +bench_ts_lvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1 +bench_ts_lvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +bench_ts_lvl_notr_SOURCES = $(bench_SRCFILES) +bench_ts_lvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=0 +bench_ts_lvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +bench_ts_nolvl_tr_SOURCES = $(bench_SRCFILES) +bench_ts_nolvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=1 +bench_ts_nolvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +bench_ts_nolvl_notr_SOURCES = $(bench_SRCFILES) +bench_ts_nolvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=0 +bench_ts_nolvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +bench_nots_lvl_tr_SOURCES = $(bench_SRCFILES) +bench_nots_lvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1 +bench_nots_lvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +bench_nots_lvl_notr_SOURCES = $(bench_SRCFILES) +bench_nots_lvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=0 +bench_nots_lvl_notr_LDFLAGS = $(WARN_LDFLAGS) + +bench_nots_nolvl_tr_SOURCES = $(bench_SRCFILES) +bench_nots_nolvl_tr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=1 +bench_nots_nolvl_tr_LDFLAGS = $(WARN_LDFLAGS) + +bench_nots_nolvl_notr_SOURCES = $(bench_SRCFILES) +bench_nots_nolvl_notr_CFLAGS = $(WARN_CFLAGS) $(test_CFLAGS) \ + -DPINELOG_SHOW_DATE=0 -DPINELOG_SHOW_LEVEL=0 -DPINELOG_SHOW_BACKTRACE=0 +bench_nots_nolvl_notr_LDFLAGS = $(WARN_LDFLAGS) + diff --git a/bench_pinelog.c b/bench_pinelog.c new file mode 100644 index 0000000..e9d6b8b --- /dev/null +++ b/bench_pinelog.c @@ -0,0 +1,82 @@ +/* + * Pinelog lightweight logging library - test harness + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: MIT + */ + + +#define pinelog_exit(_) +#include "pinelog.h" + +#include +#include +#include + +#define BENCH_COUNT 100000 + +static void print_time_difference(const char *type, struct timespec *ts) +{ + struct timespec ret; + uint64_t timeper; + uint64_t tp_usec; + uint64_t tp_nsec; + + // ts is a pointer to a 2 element array, second is always later + ret.tv_sec = ts[1].tv_sec - ts[0].tv_sec; + ret.tv_nsec = ts[1].tv_nsec - ts[0].tv_nsec; + + if (ts[0].tv_nsec > ts[1].tv_nsec) { + ret.tv_nsec += 1000000000; + ret.tv_sec--; + } + + timeper = (ret.tv_sec * 1000000000 + ret.tv_nsec) / BENCH_COUNT; + tp_usec = timeper / 1000; + tp_nsec = timeper % 1000; + + printf("# %s %lu.%03lu\u03BCs/log (Total %lu.%09lds)\n", + type, tp_usec, tp_nsec, ret.tv_sec, ret.tv_nsec); +} + +int main(int argc, char **argv) +{ + struct timespec ts_wall[2]; + struct timespec ts_cpu[2]; + int i; + + /* Set up defaults */ + pinelog_set_level(PINELOG_LVL_ERROR); + pinelog_set_output_file("/dev/null"); + + printf("# Timing logging for %u iterations\n", BENCH_COUNT); + + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts_cpu[0]) < 0) { + perror("clock_gettime cputime 0"); + return 1; + } + if (clock_gettime(CLOCK_MONOTONIC, &ts_wall[0]) < 0) { + perror("clock_gettime monotonic 0"); + return 1; + } + + for (i = 0; i < BENCH_COUNT; i++) { + PINELOG_ERROR("Testing error log #%u of %u", i, BENCH_COUNT); + } + + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts_cpu[1]); + clock_gettime(CLOCK_MONOTONIC, &ts_wall[1]); + + // Add a test plan and to avoid the TAP harness from flagging this as a + // failed test. + puts("1..1"); + printf("ok 1 Benchmark pinelog %stimestamp, %slevel, %sbacktrace\n", + PINELOG_SHOW_DATE ? "": "no ", + PINELOG_SHOW_LEVEL ? "": "no ", + PINELOG_SHOW_BACKTRACE ? "": "no "); + print_time_difference("cpu time", ts_cpu); + print_time_difference("wall time", ts_wall); + + return 0; +} diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 392d9b0..0000000 --- a/config.h.in +++ /dev/null @@ -1,67 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if the system has the `constructor' function attribute */ -#undef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR - -/* Define to 1 if the system has the `format' function attribute */ -#undef HAVE_FUNC_ATTRIBUTE_FORMAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/configure.ac b/configure.ac index 133e102..b9d83a7 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,7 @@ PKG_PROG_PKG_CONFIG PKG_INSTALLDIR AX_COMPILER_FLAGS AX_GCC_FUNC_ATTRIBUTE([constructor]) +AX_GCC_FUNC_ATTRIBUTE([destructor]) AX_GCC_FUNC_ATTRIBUTE([format]) AC_SUBST([PINELOG_CFLAGS]) diff --git a/pinelog.c b/pinelog.c index 1c793c5..e2e7c42 100644 --- a/pinelog.c +++ b/pinelog.c @@ -87,16 +87,25 @@ void pinelog_set_defaults(void) log_level = PINELOG_DEFAULT_LEVEL; } +#if HAVE_FUNC_ATTRIBUTE_DESTRUCTOR +__attribute__((destructor)) +#endif +void pinelog_close_output_stream(void) +{ + /* If current output stream is not stdout or stderr, then close it */ + if (output_stream != NULL && output_stream != stdout && output_stream != stderr) { + fclose(output_stream); + } + output_stream = PINELOG_DEFAULT_STREAM; +} + int pinelog_set_output_stream(FILE *stream) { if (stream == NULL) { return EINVAL; } - /* If current output stream is not stdout or stderr, then close it */ - if (output_stream != stdout && output_stream != stderr) { - fclose(output_stream); - } + pinelog_close_output_stream(); setlinebuf(stream); output_stream = stream; diff --git a/pinelog.h b/pinelog.h index 0020ad9..dfd2b0c 100644 --- a/pinelog.h +++ b/pinelog.h @@ -62,6 +62,11 @@ enum { */ void pinelog_set_defaults(void); +/** + * @brief Close the output stream and terminate the logs + */ +void pinelog_close_output_stream(void); + #ifdef PINELOG_TEST /** * @brief Get the pointer to the output stream. Only used in test harness. diff --git a/test_pinelog.c b/test_pinelog.c index dd568a8..0f59117 100644 --- a/test_pinelog.c +++ b/test_pinelog.c @@ -66,10 +66,8 @@ static void dump_data(const char *type, size_t len, char *data) printf("\n"); } -static void test_setup(int level, int filter, const char *file, int line, const char *fmt, ...) +static int test_setup(int level, int filter, const char *file, int line) { - va_list ap; - expected_len = 0; memset(expected_output, 0, sizeof(expected_output)); @@ -105,14 +103,10 @@ static void test_setup(int level, int filter, const char *file, int line, const "%s:%d ", file, line); } - va_start(ap, fmt); - expected_len += vsnprintf(&expected_output[expected_len], - sizeof(expected_output) - expected_len, - fmt, ap); - va_end(ap); - expected_output[expected_len] = '\n'; - expected_len++; + return 1; } + + return 0; } static void test_teardown(const char *desc) @@ -144,8 +138,11 @@ static void verify_defaults(void) #define PINELOG_WARNING PINELOG_WARN #define TEST_LOG(lvl, filter, fmt, ...) do { \ - test_setup(PINELOG_LVL_ ## lvl, PINELOG_LVL_ ## filter, \ - __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + if (test_setup(PINELOG_LVL_ ## lvl, PINELOG_LVL_ ## filter, \ + __FILE__, __LINE__)) \ + expected_len += snprintf(&expected_output[expected_len], \ + sizeof(expected_output) - expected_len, \ + fmt "\n", ##__VA_ARGS__); \ PINELOG_ ## lvl (fmt, ##__VA_ARGS__); \ test_teardown("Log " #lvl " filter " #filter); \ } while(0) @@ -184,7 +181,7 @@ int main(int argc, char **argv) printf("1..%u\n", test_id); - fclose(observed_stream_w); + pinelog_close_output_stream(); fclose(observed_stream_r); close(fifo_fd_w); close(fifo_fd_r); From 1b598c2d7861a525616f095cf533579ba1a49f42 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 19 Jul 2021 11:09:41 -0700 Subject: [PATCH 20/68] Fix pkg-config check for inih and enable Ubuntu 18.04 builds --- .github/workflows/build.yml | 2 +- INSTALL.md | 4 ++-- configure.ac | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86c2582..1a361d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: - os: ['ubuntu-20.04', 'macos-latest'] + os: ['ubuntu-18.04', 'ubuntu-20.04', 'macos-latest'] cc: ['gcc', 'clang'] steps: diff --git a/INSTALL.md b/INSTALL.md index 6737ef5..6ac3844 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,12 +1,12 @@ Installation instructions for x52pro-linux ========================================== -[![Build Status](https://www.travis-ci.org/nirenjan/x52pro-linux.svg?branch=master)](https://www.travis-ci.org/nirenjan/x52pro-linux) +![Build Status](https://www.github.com/nirenjan/x52pro-linux/actions/workflows/build.yml/badge.svg) Build has been tested on the following operating systems (x86-64 only): -* Ubuntu 16.04 LTS * Ubuntu 18.04 LTS +* Ubuntu 20.04 LTS * OS X 10.13.6 # Prerequisites diff --git a/configure.ac b/configure.ac index 625745c..055be1c 100644 --- a/configure.ac +++ b/configure.ac @@ -46,7 +46,12 @@ AC_SUBST([LIBUSB_LDFLAGS]) AC_SUBST([LIBUSB_LIBS]) # Check for libinih -PKG_CHECK_MODULES([INIH], [inih]) +PKG_CHECK_MODULES([INIH], [inih], [], + [ + # Older versions of Ubuntu don't provide a .pc file + AC_CHECK_HEADERS([ini.h]) + AC_SEARCH_LIBS([ini_parse], [inih]) + ]) AC_SUBST([INIH_CFLAGS]) AC_SUBST([INIH_LDFLAGS]) AC_SUBST([INIH_LIBS]) From e54f6037d4a31d7dd55ab69a4bc457b749462e6d Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 19 Jul 2021 11:15:42 -0700 Subject: [PATCH 21/68] Fix pinelog builds on MacOS --- lib/pinelog/bench_pinelog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pinelog/bench_pinelog.c b/lib/pinelog/bench_pinelog.c index e9d6b8b..419f61b 100644 --- a/lib/pinelog/bench_pinelog.c +++ b/lib/pinelog/bench_pinelog.c @@ -12,6 +12,7 @@ #include #include +#include #include #define BENCH_COUNT 100000 @@ -36,7 +37,7 @@ static void print_time_difference(const char *type, struct timespec *ts) tp_usec = timeper / 1000; tp_nsec = timeper % 1000; - printf("# %s %lu.%03lu\u03BCs/log (Total %lu.%09lds)\n", + printf("# %s %"PRIu64".%03"PRIu64"\u03BCs/log (Total %lu.%09lds)\n", type, tp_usec, tp_nsec, ret.tv_sec, ret.tv_nsec); } From 98cc439f0552552e441d7cacfcb7a16993b406d1 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 19 Jul 2021 11:16:28 -0700 Subject: [PATCH 22/68] Remove build status badge from INSTALL.md [skip ci] --- INSTALL.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 6ac3844..04aed31 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,8 +1,6 @@ Installation instructions for x52pro-linux ========================================== -![Build Status](https://www.github.com/nirenjan/x52pro-linux/actions/workflows/build.yml/badge.svg) - Build has been tested on the following operating systems (x86-64 only): * Ubuntu 18.04 LTS From b81d89aad3b9c9cfa5d51f0e593529ea014ac45a Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 20 Jul 2021 01:17:18 -0700 Subject: [PATCH 23/68] Use relative links in Markdown [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bff9f94..34547ee 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ for your needs as it provides a graphical interface to control the MFD and LEDs. # Building and installing -See [INSTALL.md](https://github.com/nirenjan/x52pro-linux/blob/master/INSTALL.md) +See [INSTALL.md](INSTALL.md) From c9cb89f8333b2117698f4388945362ae81f91002 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 20 Jul 2021 01:38:19 -0700 Subject: [PATCH 24/68] Fix syntax of PKG_CHECK_MODULES Commit 2ce9ff22 replaced the calls to AX_PKG_CHECK_MODULES with PKG_CHECK_MODULES, but it was done blindly, since PKG_CHECK_MODULES takes a different number of arguments. As a result, even if the checks for cmocka and udev succeed, they are still disabled because the corresponding have_ variable is not set to 'yes'. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 055be1c..75895de 100644 --- a/configure.ac +++ b/configure.ac @@ -83,7 +83,7 @@ AC_MSG_CHECKING([final decision IS_MAKE_DISTCHECK (running "make distcheck"?)]) AM_COND_IF([IS_MAKE_DISTCHECK], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) # udev support -PKG_CHECK_MODULES([UDEV], [udev], [], [have_udev=yes], [have_udev=no]) +PKG_CHECK_MODULES([UDEV], [udev], [have_udev=yes], [have_udev=no]) AM_CONDITIONAL([HAVE_UDEV], [test "x$have_udev" = xyes]) AC_ARG_WITH([udevrulesdir], AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]), @@ -105,7 +105,7 @@ AM_COND_IF([HAVE_DOXYGEN], [AC_MSG_WARN(["Doxygen not found; continuing without doxygen support"])]) # cmocka unit tests -PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1], [], [have_cmocka=yes], [have_cmocka=no]) +PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1], [have_cmocka=yes], [have_cmocka=no]) AM_CONDITIONAL([HAVE_CMOCKA], [test "x$have_cmocka" = xyes]) AM_COND_IF([HAVE_CMOCKA], [], [AC_MSG_WARN(["cmocka not found; disabling unit test build"])]) From ac8bb6cdd91edd727e19a06732e231bfa10b62b7 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Wed, 21 Jul 2021 00:01:49 -0700 Subject: [PATCH 25/68] Add threads to find and update X52 device --- daemon/Makefile.am | 5 ++- daemon/x52d_device.c | 91 ++++++++++++++++++++++++++++++++++++-------- daemon/x52d_device.h | 2 - daemon/x52d_main.c | 10 +++++ 4 files changed, 89 insertions(+), 19 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 8dc7987..691f630 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -23,12 +23,13 @@ x52d_CFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ -DLOGDIR=\"$(localstatedir)/log\" \ -DRUNDIR=\"$(runstatedir)\" \ - @INIH_CFLAGS@ @X52_INCLUDE@ $(WARN_CFLAGS) + @INIH_CFLAGS@ @PTHREAD_CFLAGS@ $(WARN_CFLAGS) -x52d_LDFLAGS = @INIH_LIBS@ $(WARN_LDFLAGS) +x52d_LDFLAGS = @INIH_LIBS@ @PTHREAD_LIBS@ $(WARN_LDFLAGS) x52d_LDADD = \ ../lib/pinelog/libpinelog.la \ ../lib/libx52/libx52.la \ + ../lib/libx52io/libx52io.la \ @LTLIBINTL@ EXTRA_DIST = \ diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 36cbf1a..5c3f2c2 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -13,30 +13,34 @@ #include "x52d_const.h" #include "x52d_device.h" #include "libx52.h" +#include "libx52io.h" #include "pinelog.h" -/* - * Functions - * - * Thread method to scan and reconnect to the joystick if it has been - * disconnected/never connected. - * - * API wrappers to libx52 functions - */ - static libx52_device *x52_dev; static pthread_mutex_t device_mutex = PTHREAD_MUTEX_INITIALIZER; -#if 0 -static void *x52_dev_thread(void *param) +/* + * Device acquisition thread + * This is a thread that scans for and opens a supported X52 joystick. + */ +static pthread_t device_acq_thr; +static volatile bool device_acq_thr_enable; + +static void *x52_dev_acq(void *param) { int rc; + PINELOG_TRACE("Starting X52 device acquisition thread"); // Check if the device is connected in a loop for (;;) { #define RECONNECT_DELAY 5 - sleep(RECONNECT_DELAY); + if (!device_acq_thr_enable) { + PINELOG_TRACE("Device acquisition thread disabled. Checking again in %d seconds", RECONNECT_DELAY); + sleep(RECONNECT_DELAY); + continue; + } + if (!libx52_is_connected(x52_dev)) { PINELOG_TRACE("Attempting to connect to X52 device"); rc = libx52_connect(x52_dev); @@ -44,14 +48,50 @@ static void *x52_dev_thread(void *param) if (rc != LIBX52_ERROR_NO_DEVICE) { PINELOG_ERROR(_("Error %d connecting to device: %s"), rc, libx52_strerror(rc)); + } else { + PINELOG_TRACE("No compatible X52 device found"); } + PINELOG_TRACE("Sleeping for %d seconds before trying to acquire device again", RECONNECT_DELAY); + sleep(RECONNECT_DELAY); + } else { + PINELOG_TRACE("Found device, disabling acquisition thread"); + device_acq_thr_enable = false; } + } else { + PINELOG_TRACE("Device is connected, disable acquisition thread"); + device_acq_thr_enable = false; } + #undef RECONNECT_DELAY + } + + return NULL; +} + +/* + * Device update thread + * This is a thread that updates the joystick. + */ +static pthread_t device_upd_thr; +static volatile bool device_update_needed; + +static void *x52_dev_upd(void *param) +{ + PINELOG_TRACE("Starting X52 device update thread"); + // Check if the device needs to be updated in a loop + for (;;) { + #define UPDATE_CHECK_DELAY 50000 + if (!device_update_needed) { + PINELOG_TRACE("No update needed to the device. Checking again in %d ms", UPDATE_CHECK_DELAY/1000); + usleep(UPDATE_CHECK_DELAY); + continue; + } + + (void)x52d_dev_update(); + #undef UPDATE_CHECK_DELAY } return NULL; } -#endif void x52d_dev_init(void) { @@ -64,12 +104,25 @@ void x52d_dev_init(void) rc, libx52_strerror(rc)); } - // TODO: Create and initialize the threads + // Create and initialize the threads + pthread_create(&device_acq_thr, NULL, x52_dev_acq, NULL); + // With libx52.so.2.3.0, libx52_init will also attempt to connect to a + // supported joystick. Check if a device is already connected before + // enabling the device acquisition thread. + device_acq_thr_enable = !libx52_is_connected(x52_dev); + + pthread_create(&device_upd_thr, NULL, x52_dev_upd, NULL); + device_update_needed = false; } void x52d_dev_exit(void) { - // TODO: Shutdown any threads + // Shutdown any threads + PINELOG_TRACE("Shutting down device acquisition thread"); + pthread_cancel(device_acq_thr); + + PINELOG_TRACE("Shutting down device update thread"); + pthread_cancel(device_upd_thr); libx52_exit(x52_dev); } @@ -82,6 +135,8 @@ void x52d_dev_exit(void) if (rc != LIBX52_SUCCESS) { \ PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ rc, libx52_strerror(rc)); \ + } else { \ + device_update_needed = true; \ } \ return rc @@ -140,11 +195,17 @@ int x52d_dev_update(void) if (rc != LIBX52_SUCCESS) { if (rc == LIBX52_ERROR_NO_DEVICE) { // TODO: Detach and spawn thread to reconnect + PINELOG_TRACE("Disconnecting detached device"); libx52_disconnect(x52_dev); + + PINELOG_TRACE("Signaling device search thread"); + device_acq_thr_enable = true; } else { PINELOG_ERROR(_("Error %d when updating X52 device: %s"), rc, libx52_strerror(rc)); } + } else { + device_update_needed = false; } return rc; diff --git a/daemon/x52d_device.h b/daemon/x52d_device.h index e826675..e7f024c 100644 --- a/daemon/x52d_device.h +++ b/daemon/x52d_device.h @@ -14,8 +14,6 @@ void x52d_dev_init(void); void x52d_dev_exit(void); -void x52d_dev_start_thread(void); - /* Wrapper methods for libx52 calls */ int x52d_dev_set_text(uint8_t line, const char *text, uint8_t length); int x52d_dev_set_led_state(libx52_led_id led, libx52_led_state state); diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index ec4308a..24f4ab8 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -14,6 +14,7 @@ #include "x52d_const.h" #include "x52d_config.h" +#include "x52d_device.h" #include "pinelog.h" static void set_log_file(bool foreground, const char *log_file) @@ -131,5 +132,14 @@ int main(int argc, char **argv) set_log_file(foreground, log_file); x52d_config_load(conf_file); + // Start device threads + x52d_dev_init(); + + for(;;) { + // TODO: Replace with main event loop + // Let all threads run in background forever + sleep(600); + } + return 0; } From 50f77119ff5018de5752de3b2f6ddf28946a1391 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Wed, 21 Jul 2021 10:49:16 -0700 Subject: [PATCH 26/68] Add stub to apply configuration --- daemon/x52d_config.c | 12 ++++++++++++ daemon/x52d_config.h | 1 + daemon/x52d_main.c | 3 +++ 3 files changed, 16 insertions(+) diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index b27246c..4e35a91 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -40,3 +40,15 @@ void x52d_config_load(const char *cfg_file) } } +#define CFG(section, key, name, parser, def) \ +static void x52d_cfg_set_ ## section ## _ ## key(typeof(x52d_config . name) param) \ +{ \ + PINELOG_TRACE("Calling set " #section ":" #key); \ +} +#include "x52d_config.def" + +void x52d_config_apply(void) +{ + #define CFG(section, key, name, parser, def) x52d_cfg_set_ ## section ## _ ## key(x52d_config . name); + #include "x52d_config.def" +} diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index 0987c3f..ebcca2f 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -48,5 +48,6 @@ int x52d_config_apply_overrides(struct x52d_config *cfg); void x52d_config_clear_overrides(void); void x52d_config_load(const char *cfg_file); +void x52d_config_apply(void); #endif // !defined X52D_CONFIG_H diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 24f4ab8..5faa24f 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -135,6 +135,9 @@ int main(int argc, char **argv) // Start device threads x52d_dev_init(); + // Apply configuration + x52d_config_apply(); + for(;;) { // TODO: Replace with main event loop // Let all threads run in background forever From 3bca8da541c48ea2e29a53d3b0ca1f63a538b285 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 22 Jul 2021 15:12:37 -0700 Subject: [PATCH 27/68] Add check for typeof support in compiler --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 75895de..8a075af 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,7 @@ AX_GCC_FUNC_ATTRIBUTE([constructor]) AX_GCC_FUNC_ATTRIBUTE([destructor]) AX_GCC_FUNC_ATTRIBUTE([format]) AX_GCC_FUNC_ATTRIBUTE([noreturn]) +AC_C_TYPEOF AC_MSG_NOTICE([Detected host OS is ${host_os}]) build_linux=no From c45a84bd388f66140b1e87e48a89b19c3c8c9b1a Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 22 Jul 2021 15:56:12 -0700 Subject: [PATCH 28/68] Replace autogenerated stubs with extern functions This allows us to slowly replace the stubs with the real functions --- daemon/x52d_config.c | 33 ++++++++++++++++++++++++++------- daemon/x52d_config.h | 23 +++++++++++++++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index 4e35a91..06bfc4c 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -40,15 +40,34 @@ void x52d_config_load(const char *cfg_file) } } -#define CFG(section, key, name, parser, def) \ -static void x52d_cfg_set_ ## section ## _ ## key(typeof(x52d_config . name) param) \ -{ \ - PINELOG_TRACE("Calling set " #section ":" #key); \ -} -#include "x52d_config.def" +/* Callback stubs + * TODO: Remove the ones below when their implementation is complete + */ +void x52d_cfg_set_Clock_Enabled(bool param) { (void)param; } +void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) { (void)param; } +void x52d_cfg_set_Clock_Secondary(char* param) { (void)param; } +void x52d_cfg_set_Clock_Tertiary(char* param) { (void)param; } +void x52d_cfg_set_LED_Fire(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_Throttle(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_A(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_B(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_D(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_E(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_T1(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_T2(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_T3(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_POV(libx52_led_state param) { (void)param; } +void x52d_cfg_set_LED_Clutch(libx52_led_state param) { (void)param; } +void x52d_cfg_set_Brightness_MFD(uint16_t param) { (void)param; } +void x52d_cfg_set_Brightness_LED(uint16_t param) { (void)param; } +void x52d_cfg_set_Profiles_Directory(char* param) { (void)param; } +void x52d_cfg_set_Profiles_ClutchEnabled(bool param) { (void)param; } +void x52d_cfg_set_Profiles_ClutchLatched(bool param) { (void)param; } void x52d_config_apply(void) { - #define CFG(section, key, name, parser, def) x52d_cfg_set_ ## section ## _ ## key(x52d_config . name); + #define CFG(section, key, name, parser, def) \ + PINELOG_TRACE("Calling configuration callback for " #section "." #name); \ + x52d_cfg_set_ ## section ## _ ## key(x52d_config . name); #include "x52d_config.def" } diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index ebcca2f..d8fa072 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -37,6 +37,29 @@ struct x52d_config { char profiles_dir[NAME_MAX]; }; +/* Callback functions for configuration */ +// These functions are defined in the individual modules +void x52d_cfg_set_Clock_Enabled(bool param); +void x52d_cfg_set_Clock_PrimaryIsLocal(bool param); +void x52d_cfg_set_Clock_Secondary(char* param); +void x52d_cfg_set_Clock_Tertiary(char* param); +void x52d_cfg_set_LED_Fire(libx52_led_state param); +void x52d_cfg_set_LED_Throttle(libx52_led_state param); +void x52d_cfg_set_LED_A(libx52_led_state param); +void x52d_cfg_set_LED_B(libx52_led_state param); +void x52d_cfg_set_LED_D(libx52_led_state param); +void x52d_cfg_set_LED_E(libx52_led_state param); +void x52d_cfg_set_LED_T1(libx52_led_state param); +void x52d_cfg_set_LED_T2(libx52_led_state param); +void x52d_cfg_set_LED_T3(libx52_led_state param); +void x52d_cfg_set_LED_POV(libx52_led_state param); +void x52d_cfg_set_LED_Clutch(libx52_led_state param); +void x52d_cfg_set_Brightness_MFD(uint16_t param); +void x52d_cfg_set_Brightness_LED(uint16_t param); +void x52d_cfg_set_Profiles_Directory(char* param); +void x52d_cfg_set_Profiles_ClutchEnabled(bool param); +void x52d_cfg_set_Profiles_ClutchLatched(bool param); + int x52d_config_set_defaults(struct x52d_config *cfg); int x52d_config_load_file(struct x52d_config *cfg, const char *cfg_file); From 6175dcabe67466aeb79808bedac7aedcfd79e372 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 09:41:18 -0700 Subject: [PATCH 29/68] Remove trace logging in device update thread Having the trace log in there adds unnecessary logging for no real reason. It is better to disable the log here to help trace other portions of the daemon. --- daemon/x52d_device.c | 1 - 1 file changed, 1 deletion(-) diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 5c3f2c2..f20eddb 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -81,7 +81,6 @@ static void *x52_dev_upd(void *param) for (;;) { #define UPDATE_CHECK_DELAY 50000 if (!device_update_needed) { - PINELOG_TRACE("No update needed to the device. Checking again in %d ms", UPDATE_CHECK_DELAY/1000); usleep(UPDATE_CHECK_DELAY); continue; } From ae134807172ce96a6ad14e9bb3d611f856550772 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 09:43:02 -0700 Subject: [PATCH 30/68] Allow libx52 calls to return TRY_AGAIN Some libx52 APIs, notably the clock related ones, can return LIBX52_ERROR_TRY_AGAIN. This is not a real error, but it is useful information. It indicates to the application that there is no change applied to the internal state, and that it should wait until trying again. Given that the clock thread calls the libx52_set_clock method every second, treating the TRY_AGAIN state as a failure and logging it causes a lot of spurious noise in the logs. This change ensures that the API returns a real error before logging it. --- daemon/x52d_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index f20eddb..4c88508 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -132,8 +132,10 @@ void x52d_dev_exit(void) rc = func; \ pthread_mutex_unlock(&device_mutex); \ if (rc != LIBX52_SUCCESS) { \ - PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ - rc, libx52_strerror(rc)); \ + if (rc != LIBX52_ERROR_TRY_AGAIN) { \ + PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ + rc, libx52_strerror(rc)); \ + } \ } else { \ device_update_needed = true; \ } \ From 499cad666f0e4bc1c8868e6b4d7ce278982a6228 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 10:13:18 -0700 Subject: [PATCH 31/68] Add clock update functionality --- daemon/Makefile.am | 3 +- daemon/x52d_clock.c | 168 +++++++++++++++++++++++++++++++++++++++++++ daemon/x52d_clock.h | 15 ++++ daemon/x52d_config.c | 4 -- daemon/x52d_main.c | 2 + po/POTFILES.in | 1 + po/x52pro-linux.pot | 44 +++++++++--- po/xx_PL.po | 49 ++++++++++--- 8 files changed, 264 insertions(+), 22 deletions(-) create mode 100644 daemon/x52d_clock.c create mode 100644 daemon/x52d_clock.h diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 691f630..99caad5 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -11,7 +11,7 @@ bin_PROGRAMS = x52d # Service daemon that manages the X52 device x52d_SOURCES = \ x52d_main.c x52d_config_parser.c x52d_config.c \ - x52d_device.c + x52d_device.c x52d_clock.c x52d_CFLAGS = \ -I $(top_srcdir) \ @@ -33,6 +33,7 @@ x52d_LDADD = \ @LTLIBINTL@ EXTRA_DIST = \ + x52d_clock.h \ x52d_config.def \ x52d_config.h \ x52d_const.h \ diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c new file mode 100644 index 0000000..c67807e --- /dev/null +++ b/daemon/x52d_clock.c @@ -0,0 +1,168 @@ +/* + * Saitek X52 Pro MFD & LED driver - Clock manager + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include +#include +#include +#include +#include + +#include "pinelog.h" +#include "x52d_config.h" +#include "x52d_clock.h" +#include "x52d_const.h" +#include "x52d_device.h" + +static bool clock_enabled = false; +static int clock_primary_is_local = false; + +void x52d_cfg_set_Clock_Enabled(bool enabled) +{ + PINELOG_DEBUG(_("Setting clock enable to %s"), + enabled ? "on" : "off"); + clock_enabled = enabled; +} + +void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) +{ + PINELOG_DEBUG(_("Setting primary clock timezone to %s"), + param ? "local" : "UTC"); + clock_primary_is_local = !!param; +} + +static int get_tz_offset(const char *tz) +{ + char *orig_tz = NULL; + char *orig_tz_copy = NULL; + time_t t; + struct tm *timeval; + char *new_tz = NULL; + size_t new_tz_len; + int offset = 0; + + new_tz_len = strlen(tz) + 2; + new_tz = malloc(new_tz_len); + if (new_tz == NULL) { + PINELOG_WARN(_("Unable to allocate memory for timezone. Falling back to UTC")); + goto cleanup; + } + snprintf(new_tz, new_tz_len, ":%s", tz); + + orig_tz = getenv("TZ"); + if (orig_tz != NULL) { + /* TZ was set in the environment */ + orig_tz_copy = strdup(orig_tz); + if (orig_tz_copy == NULL) { + PINELOG_WARN(_("Unable to backup timezone environment. Falling back to UTC")); + goto cleanup; + } + } + + setenv("TZ", new_tz, true); + t = time(NULL); + timeval = localtime(&t); + if (timeval != NULL) { + #if HAVE_STRUCT_TM_TM_GMTOFF + /* If valid, then timeval.tm_gmtoff contains the offset in seconds east + * of GMT. Divide by 60 to get the offset in minutes east of GMT. + */ + offset = (int)(timeval->tm_gmtoff / 60); + #else + /* The compiler does not provide tm_gmtoff. Fallback to using the + * timezone variable, which is in seconds west of GMT. Divide by -60 to + * get the offset in minutes east of GMT. + * + * ============ + * XXX NOTE XXX + * ============ + * timezone is always the default (non-summer) timezone offset from GMT. + * Therefore, this may not be accurate during the summer time months + * for the region in question. + */ + offset = (int)(timezone / -60); + #endif + } + +cleanup: + if (orig_tz == NULL) { + unsetenv("TZ"); + } else { + setenv("TZ", orig_tz_copy, true); + free(orig_tz_copy); + } + + if (new_tz != NULL) { + free(new_tz); + } + + tzset(); + PINELOG_DEBUG("Offset for timezone '%s' is %d", tz, offset); + return offset; +} + +void x52d_cfg_set_Clock_Secondary(char* param) +{ + PINELOG_TRACE("Setting secondary clock timezone to %s", param); + x52d_dev_set_clock_timezone(LIBX52_CLOCK_2, get_tz_offset(param)); +} + +void x52d_cfg_set_Clock_Tertiary(char* param) +{ + PINELOG_TRACE("Setting tertiary clock timezone to %s", param); + x52d_dev_set_clock_timezone(LIBX52_CLOCK_3, get_tz_offset(param)); +} + +static pthread_t clock_thr; + +static void * x52_clock_thr(void *param) +{ + int rc; + + PINELOG_TRACE("Starting X52 clock thread"); + for (;;) { + time_t cur_time; + + sleep(1); + if (!clock_enabled) { + /* Clock thread is disabled, check again next time */ + continue; + } + + if (time(&cur_time) < 0) { + PINELOG_WARN(_("Error %d retrieving current time: %s"), + errno, strerror(errno)); + continue; + } + rc = x52d_dev_set_clock(cur_time, clock_primary_is_local); + if (rc == LIBX52_SUCCESS) { + // Device manager will update the clock, this is only for debugging + PINELOG_TRACE("Setting X52 clock to %ld", cur_time); + } + } + + return NULL; +} + +void x52d_clock_init(void) +{ + int rc; + + PINELOG_TRACE("Initializing clock manager"); + rc = pthread_create(&clock_thr, NULL, x52_clock_thr, NULL); + if (rc != 0) { + PINELOG_FATAL(_("Error %d initializing clock thread: %s"), + rc, strerror(rc)); + } +} + +void x52d_clock_exit(void) +{ + PINELOG_TRACE("Shutting down clock thread"); + pthread_cancel(clock_thr); +} diff --git a/daemon/x52d_clock.h b/daemon/x52d_clock.h new file mode 100644 index 0000000..3bfd631 --- /dev/null +++ b/daemon/x52d_clock.h @@ -0,0 +1,15 @@ +/* + * Saitek X52 Pro MFD & LED driver - Clock manager + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#ifndef X52D_CLOCK_H +#define X52D_CLOCK_H + +void x52d_clock_init(void); +void x52d_clock_exit(void); + +#endif // !defined X52D_CLOCK_H diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index 06bfc4c..72c4758 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -43,10 +43,6 @@ void x52d_config_load(const char *cfg_file) /* Callback stubs * TODO: Remove the ones below when their implementation is complete */ -void x52d_cfg_set_Clock_Enabled(bool param) { (void)param; } -void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) { (void)param; } -void x52d_cfg_set_Clock_Secondary(char* param) { (void)param; } -void x52d_cfg_set_Clock_Tertiary(char* param) { (void)param; } void x52d_cfg_set_LED_Fire(libx52_led_state param) { (void)param; } void x52d_cfg_set_LED_Throttle(libx52_led_state param) { (void)param; } void x52d_cfg_set_LED_A(libx52_led_state param) { (void)param; } diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 5faa24f..d2192a3 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -12,6 +12,7 @@ #include #include +#include "x52d_clock.h" #include "x52d_const.h" #include "x52d_config.h" #include "x52d_device.h" @@ -134,6 +135,7 @@ int main(int argc, char **argv) // Start device threads x52d_dev_init(); + x52d_clock_init(); // Apply configuration x52d_config_apply(); diff --git a/po/POTFILES.in b/po/POTFILES.in index 5819676..20b29c4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -12,6 +12,7 @@ utils/test/x52_test_led.c utils/test/x52_test_mfd.c daemon/x52d_main.c +daemon/x52d_clock.c daemon/x52d_config.c daemon/x52d_config_parser.c daemon/x52d_device.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 749d20e..2956086 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-16 00:26-0700\n" +"POT-Creation-Date: 2021-07-23 09:47-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -370,21 +370,49 @@ msgstr "" msgid "OK" msgstr "" -#: daemon/x52d_main.c:33 +#: daemon/x52d_main.c:35 #, c-format msgid "Error %d setting log file: %s\n" msgstr "" -#: daemon/x52d_main.c:44 +#: daemon/x52d_main.c:46 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" -#: daemon/x52d_main.c:105 +#: daemon/x52d_main.c:107 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "" +#: daemon/x52d_clock.c:27 +#, c-format +msgid "Setting clock enable to %s" +msgstr "" + +#: daemon/x52d_clock.c:34 +#, c-format +msgid "Setting primary clock timezone to %s" +msgstr "" + +#: daemon/x52d_clock.c:52 +msgid "Unable to allocate memory for timezone. Falling back to UTC" +msgstr "" + +#: daemon/x52d_clock.c:62 +msgid "Unable to backup timezone environment. Falling back to UTC" +msgstr "" + +#: daemon/x52d_clock.c:132 +#, c-format +msgid "Error %d retrieving current time: %s" +msgstr "" + +#: daemon/x52d_clock.c:153 +#, c-format +msgid "Error %d initializing clock thread: %s" +msgstr "" + #: daemon/x52d_config.c:26 #, c-format msgid "Error %d setting configuration defaults: %s" @@ -428,22 +456,22 @@ msgstr "" msgid "Error processing override '%s.%s=%s'" msgstr "" -#: daemon/x52d_device.c:45 +#: daemon/x52d_device.c:49 #, c-format msgid "Error %d connecting to device: %s" msgstr "" -#: daemon/x52d_device.c:63 +#: daemon/x52d_device.c:102 #, c-format msgid "Failure %d initializing libx52: %s" msgstr "" -#: daemon/x52d_device.c:83 +#: daemon/x52d_device.c:136 #, c-format msgid "Error %d when updating X52 parameter: %s" msgstr "" -#: daemon/x52d_device.c:145 +#: daemon/x52d_device.c:205 #, c-format msgid "Error %d when updating X52 device: %s" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index ee01b03..041f05c 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-16 00:26-0700\n" -"PO-Revision-Date: 2021-07-15 15:09-0700\n" +"POT-Creation-Date: 2021-07-23 09:47-0700\n" +"PO-Revision-Date: 2021-07-23 09:51-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" @@ -413,23 +413,54 @@ msgstr "Estingtay aracterchay 0x%02x..." msgid "OK" msgstr "OKay" -#: daemon/x52d_main.c:33 +#: daemon/x52d_main.c:35 #, c-format msgid "Error %d setting log file: %s\n" msgstr "Erroray %d ettingsay oglay ilefay: %s\n" -#: daemon/x52d_main.c:44 +#: daemon/x52d_main.c:46 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" "Usageay: %s [-f] [-v] [-q] [-l oglay-ilefay] [-o overrideay] [-c onfigcay-" "ilefay]\n" -#: daemon/x52d_main.c:105 +#: daemon/x52d_main.c:107 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "Unableay otay arsepay onfigurationcay overrideay '%s'\n" +#: daemon/x52d_clock.c:27 +#, c-format +msgid "Setting clock enable to %s" +msgstr "Ettingsay ockclay enableay otay %s" + +#: daemon/x52d_clock.c:34 +#, c-format +msgid "Setting primary clock timezone to %s" +msgstr "Ettingsay imarypray ockclay imezonetay otay %s" + +#: daemon/x52d_clock.c:52 +msgid "Unable to allocate memory for timezone. Falling back to UTC" +msgstr "" +"Unableay otay allocateay emorymay orfay imezonetay. Allingfay ackbay otay " +"UTCay" + +#: daemon/x52d_clock.c:62 +msgid "Unable to backup timezone environment. Falling back to UTC" +msgstr "" +"Unableay otay ackupbay imezonetay environmentay. Allingfay ackbay otay UTCay" + +#: daemon/x52d_clock.c:132 +#, c-format +msgid "Error %d retrieving current time: %s" +msgstr "Erroray %d etrievingray urrentcay imetay: %s" + +#: daemon/x52d_clock.c:153 +#, c-format +msgid "Error %d initializing clock thread: %s" +msgstr "Erroray %d initializingay ockclay eadthray: %s" + #: daemon/x52d_config.c:26 #, c-format msgid "Error %d setting configuration defaults: %s" @@ -473,22 +504,22 @@ msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'" msgid "Error processing override '%s.%s=%s'" msgstr "Erroray ocessingpray overriday '%s.%s=%s'" -#: daemon/x52d_device.c:45 +#: daemon/x52d_device.c:49 #, c-format msgid "Error %d connecting to device: %s" msgstr "Erroray %d onnectingcay otay eviceday: %s" -#: daemon/x52d_device.c:63 +#: daemon/x52d_device.c:102 #, c-format msgid "Failure %d initializing libx52: %s" msgstr "Ailurefay %d initializeay libx52: %s" -#: daemon/x52d_device.c:83 +#: daemon/x52d_device.c:136 #, c-format msgid "Error %d when updating X52 parameter: %s" msgstr "Erroray %d enwhay updatingay X52 arameterpay: %s" -#: daemon/x52d_device.c:145 +#: daemon/x52d_device.c:205 #, c-format msgid "Error %d when updating X52 device: %s" msgstr "Erroray %d enwhay updatingay X52 eviceday: %s" From 0fa638fa1622eb9839c053bd03ee72930bafe288 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 13:43:21 -0700 Subject: [PATCH 32/68] Add support for clock and date format --- daemon/x52d.conf | 17 +++++++++++++++++ daemon/x52d_clock.c | 33 +++++++++++++++++++++++++++++++++ daemon/x52d_config.def | 12 ++++++++++++ daemon/x52d_config.h | 10 ++++++++++ daemon/x52d_config_parser.c | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) diff --git a/daemon/x52d.conf b/daemon/x52d.conf index f6d3bd0..b62ae11 100644 --- a/daemon/x52d.conf +++ b/daemon/x52d.conf @@ -30,6 +30,23 @@ Secondary=UTC # timezone name as defined by the Olson time database. Tertiary=UTC +# PrimaryFormat controls the clock format of the primary clock. This is +# either 12hr or 24hr, and can be abbreviated to 12 or 24 +PrimaryFormat=12hr + +# SecondaryFormat controls the clock format of the secondary clock. This is +# either 12hr or 24hr, and can be abbreviated to 12 or 24 +SecondaryFormat=12hr + +# TertiaryFormat controls the clock format of the tertiary clock. This is +# either 12hr or 24hr, and can be abbreviated to 12 or 24 +TertiaryFormat=12hr + +# DateFormat controls the format of the date display. This can be one of +# ddmmyy, mmddyy or yymmdd. Alternate representations of these are +# dd-mm-yy, mm-dd-yy or yy-mm-dd respectively. +DateFormat=ddmmyy + ###################################################################### # LED Settings - only applicable to X52Pro ###################################################################### diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index c67807e..2433573 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -118,6 +118,39 @@ void x52d_cfg_set_Clock_Tertiary(char* param) x52d_dev_set_clock_timezone(LIBX52_CLOCK_3, get_tz_offset(param)); } +static void set_clock_format(const char *name, libx52_clock_id id, libx52_clock_format fmt) +{ + PINELOG_TRACE("Setting %s clock format to %s", name, + fmt == LIBX52_CLOCK_FORMAT_12HR ? "12 hour" : "24 hour"); + x52d_dev_set_clock_format(id, fmt); +} + +void x52d_cfg_set_Clock_FormatPrimary(libx52_clock_format fmt) +{ + set_clock_format("primary", LIBX52_CLOCK_1, fmt); +} + +void x52d_cfg_set_Clock_FormatSecondary(libx52_clock_format fmt) +{ + set_clock_format("secondary", LIBX52_CLOCK_2, fmt); +} + +void x52d_cfg_set_Clock_FormatTertiary(libx52_clock_format fmt) +{ + set_clock_format("tertiary", LIBX52_CLOCK_3, fmt); +} + +void x52d_cfg_set_Clock_DateFormat(libx52_date_format fmt) +{ + static const char *formats[] = { + "dd-mm-yy", + "mm-dd-yy", + "yy-mm-dd" + }; + PINELOG_TRACE("Setting date format to %s", formats[fmt]); + x52d_dev_set_date_format(fmt); +} + static pthread_t clock_thr; static void * x52_clock_thr(void *param) diff --git a/daemon/x52d_config.def b/daemon/x52d_config.def index 37deb19..8e221dc 100644 --- a/daemon/x52d_config.def +++ b/daemon/x52d_config.def @@ -30,6 +30,18 @@ CFG(Clock, Secondary, clock_2_tz, string_parser, UTC) // timezone name as defined by the Olson time database. CFG(Clock, Tertiary, clock_3_tz, string_parser, UTC) +// Clock format for the primary clock +CFG(Clock, FormatPrimary, clock_format[LIBX52_CLOCK_1], clock_format_parser, 12hr) + +// Clock format for the secondary clock +CFG(Clock, FormatSecondary, clock_format[LIBX52_CLOCK_2], clock_format_parser, 12hr) + +// Clock format for the tertiary clock +CFG(Clock, FormatTertiary, clock_format[LIBX52_CLOCK_3], clock_format_parser, 12hr) + +// Date format for the date display +CFG(Clock, DateFormat, date_format, date_format_parser, ddmmyy) + /********************************************************************** * LED Settings - only applicable to X52Pro *********************************************************************/ diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index d8fa072..416a72f 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -22,6 +22,12 @@ struct x52d_config { bool clock_enabled; bool primary_clock_local; + + // Since we don't have a _MAX identifier for libx52_clock_id, use + // the maximum clock ID + 1 as the length + libx52_clock_format clock_format[LIBX52_CLOCK_3 + 1]; + libx52_date_format date_format; + char clock_2_tz[NAME_MAX]; char clock_3_tz[NAME_MAX]; @@ -43,6 +49,10 @@ void x52d_cfg_set_Clock_Enabled(bool param); void x52d_cfg_set_Clock_PrimaryIsLocal(bool param); void x52d_cfg_set_Clock_Secondary(char* param); void x52d_cfg_set_Clock_Tertiary(char* param); +void x52d_cfg_set_Clock_FormatPrimary(libx52_clock_format param); +void x52d_cfg_set_Clock_FormatSecondary(libx52_clock_format param); +void x52d_cfg_set_Clock_FormatTertiary(libx52_clock_format param); +void x52d_cfg_set_Clock_DateFormat(libx52_date_format param); void x52d_cfg_set_LED_Fire(libx52_led_state param); void x52d_cfg_set_LED_Throttle(libx52_led_state param); void x52d_cfg_set_LED_A(libx52_led_state param); diff --git a/daemon/x52d_config_parser.c b/daemon/x52d_config_parser.c index 2b2b4da..1132e10 100644 --- a/daemon/x52d_config_parser.c +++ b/daemon/x52d_config_parser.c @@ -92,6 +92,40 @@ static int led_parser(struct x52d_config *cfg, size_t offset, const char *value) return 0; } +static int clock_format_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(libx52_clock_format *, config); + CHECK_PARAMS(); + + if (!strcasecmp(value, "12hr") || !strcasecmp(value, "12")) { + *config = LIBX52_CLOCK_FORMAT_12HR; + } else if (!strcasecmp(value, "24hr") || !strcasecmp(value, "24")) { + *config = LIBX52_CLOCK_FORMAT_24HR; + } else { + return EINVAL; + } + + return 0; +} + +static int date_format_parser(struct x52d_config *cfg, size_t offset, const char *value) +{ + CONFIG_PTR(libx52_date_format *, config); + CHECK_PARAMS(); + + if (!strcasecmp(value, "ddmmyy") || !strcasecmp(value, "dd-mm-yy")) { + *config = LIBX52_DATE_FORMAT_DDMMYY; + } else if (!strcasecmp(value, "mmddyy") || !strcasecmp(value, "mm-dd-yy")) { + *config = LIBX52_DATE_FORMAT_MMDDYY; + } else if (!strcasecmp(value, "yymmdd") || !strcasecmp(value, "yy-mm-dd")) { + *config = LIBX52_DATE_FORMAT_YYMMDD; + } else { + return EINVAL; + } + + return 0; +} + /* Map for config->param */ #define CFG(section, key, name, parser, def) {#section, #key, parser, offsetof(struct x52d_config, name)}, const struct config_map { From 88955418b85192973dfa107e97e3d9c338a0bdc8 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 14:23:11 -0700 Subject: [PATCH 33/68] Fix trace log to print section.key --- daemon/x52d_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index 72c4758..bc412cb 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -63,7 +63,7 @@ void x52d_cfg_set_Profiles_ClutchLatched(bool param) { (void)param; } void x52d_config_apply(void) { #define CFG(section, key, name, parser, def) \ - PINELOG_TRACE("Calling configuration callback for " #section "." #name); \ + PINELOG_TRACE("Calling configuration callback for " #section "." #key); \ x52d_cfg_set_ ## section ## _ ## key(x52d_config . name); #include "x52d_config.def" } From bd682cd5c7a5a37172aaf5d1695ead35f7a02ee9 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 14:24:22 -0700 Subject: [PATCH 34/68] Add LED state and brightness functionality --- daemon/Makefile.am | 2 +- daemon/x52d_config.c | 13 ------ daemon/x52d_led.c | 96 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 daemon/x52d_led.c diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 99caad5..31120c8 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -11,7 +11,7 @@ bin_PROGRAMS = x52d # Service daemon that manages the X52 device x52d_SOURCES = \ x52d_main.c x52d_config_parser.c x52d_config.c \ - x52d_device.c x52d_clock.c + x52d_device.c x52d_clock.c x52d_led.c x52d_CFLAGS = \ -I $(top_srcdir) \ diff --git a/daemon/x52d_config.c b/daemon/x52d_config.c index bc412cb..193e837 100644 --- a/daemon/x52d_config.c +++ b/daemon/x52d_config.c @@ -43,19 +43,6 @@ void x52d_config_load(const char *cfg_file) /* Callback stubs * TODO: Remove the ones below when their implementation is complete */ -void x52d_cfg_set_LED_Fire(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_Throttle(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_A(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_B(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_D(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_E(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_T1(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_T2(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_T3(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_POV(libx52_led_state param) { (void)param; } -void x52d_cfg_set_LED_Clutch(libx52_led_state param) { (void)param; } -void x52d_cfg_set_Brightness_MFD(uint16_t param) { (void)param; } -void x52d_cfg_set_Brightness_LED(uint16_t param) { (void)param; } void x52d_cfg_set_Profiles_Directory(char* param) { (void)param; } void x52d_cfg_set_Profiles_ClutchEnabled(bool param) { (void)param; } void x52d_cfg_set_Profiles_ClutchLatched(bool param) { (void)param; } diff --git a/daemon/x52d_led.c b/daemon/x52d_led.c new file mode 100644 index 0000000..cba170a --- /dev/null +++ b/daemon/x52d_led.c @@ -0,0 +1,96 @@ +/* + * Saitek X52 Pro MFD & LED driver - Clock manager + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include +#include +#include +#include +#include + +#include "pinelog.h" +#include "x52d_config.h" +#include "x52d_const.h" +#include "x52d_device.h" + +static const char *TRACE_led_states[] = { + "off", "on", "red", "amber", "green" +}; + +#define SET_LED_STATE(led, state) \ + PINELOG_TRACE("Setting LED " #led " state to %s", TRACE_led_states[state]); \ + x52d_dev_set_led_state(LIBX52_LED_ ## led, state); + +void x52d_cfg_set_LED_Fire(libx52_led_state state) +{ + SET_LED_STATE(FIRE, state); +} + +void x52d_cfg_set_LED_Throttle(libx52_led_state state) +{ + SET_LED_STATE(THROTTLE, state); +} + +void x52d_cfg_set_LED_A(libx52_led_state state) +{ + SET_LED_STATE(A, state); +} + +void x52d_cfg_set_LED_B(libx52_led_state state) +{ + SET_LED_STATE(B, state); +} + +void x52d_cfg_set_LED_D(libx52_led_state state) +{ + SET_LED_STATE(D, state); +} + +void x52d_cfg_set_LED_E(libx52_led_state state) +{ + SET_LED_STATE(E, state); +} + +void x52d_cfg_set_LED_T1(libx52_led_state state) +{ + SET_LED_STATE(T1, state); +} + +void x52d_cfg_set_LED_T2(libx52_led_state state) +{ + SET_LED_STATE(T2, state); +} + +void x52d_cfg_set_LED_T3(libx52_led_state state) +{ + SET_LED_STATE(T3, state); +} + +void x52d_cfg_set_LED_POV(libx52_led_state state) +{ + SET_LED_STATE(POV, state); +} + +void x52d_cfg_set_LED_Clutch(libx52_led_state state) +{ + SET_LED_STATE(CLUTCH, state); +} + +#define SET_BRIGHTNESS(mfd, brightness) \ + PINELOG_TRACE("Setting %s brightness to %u", mfd ? "MFD" : "LED", brightness); \ + x52d_dev_set_brightness(mfd, brightness); + +void x52d_cfg_set_Brightness_MFD(uint16_t brightness) +{ + SET_BRIGHTNESS(1, brightness); +} + +void x52d_cfg_set_Brightness_LED(uint16_t brightness) +{ + SET_BRIGHTNESS(0, brightness); +} From 2cecd1890af1a9fde64a742d236405ee53c5247c Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 14:31:14 -0700 Subject: [PATCH 35/68] Allow set_led_state calls to ignore unsupported feature --- daemon/x52d_device.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 4c88508..456a889 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -147,7 +147,14 @@ int x52d_dev_set_text(uint8_t line, const char *text, uint8_t length) } int x52d_dev_set_led_state(libx52_led_id led, libx52_led_state state) { - WRAP_LIBX52(libx52_set_led_state(x52_dev, led, state)); + if (libx52_check_feature(x52_dev, LIBX52_FEATURE_LED) != LIBX52_ERROR_NOT_SUPPORTED) { + WRAP_LIBX52(libx52_set_led_state(x52_dev, led, state)); + } + + // If the target device does not support setting individual LEDs, + // then ignore the set and let the caller think it succeeded. + PINELOG_TRACE("Ignoring set LED state call as the device does not support it"); + return LIBX52_SUCCESS; } int x52d_dev_set_clock(time_t time, int local) { @@ -195,7 +202,7 @@ int x52d_dev_update(void) if (rc != LIBX52_SUCCESS) { if (rc == LIBX52_ERROR_NO_DEVICE) { - // TODO: Detach and spawn thread to reconnect + // Detach and spawn thread to reconnect PINELOG_TRACE("Disconnecting detached device"); libx52_disconnect(x52_dev); From 9970a8edc4e4763fa11cf7136edcf573fe6904e9 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 23 Jul 2021 14:31:58 -0700 Subject: [PATCH 36/68] Fix key names for clock formats in default configuration file --- daemon/x52d.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/x52d.conf b/daemon/x52d.conf index b62ae11..b1f44ea 100644 --- a/daemon/x52d.conf +++ b/daemon/x52d.conf @@ -32,15 +32,15 @@ Tertiary=UTC # PrimaryFormat controls the clock format of the primary clock. This is # either 12hr or 24hr, and can be abbreviated to 12 or 24 -PrimaryFormat=12hr +FormatPrimary=12hr # SecondaryFormat controls the clock format of the secondary clock. This is # either 12hr or 24hr, and can be abbreviated to 12 or 24 -SecondaryFormat=12hr +FormatSecondary=12hr # TertiaryFormat controls the clock format of the tertiary clock. This is # either 12hr or 24hr, and can be abbreviated to 12 or 24 -TertiaryFormat=12hr +FormatTertiary=12hr # DateFormat controls the format of the date display. This can be one of # ddmmyy, mmddyy or yymmdd. Alternate representations of these are From 9941234bbe508a0dcb166d391256aba0d489ddbe Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sun, 25 Jul 2021 08:42:12 -0700 Subject: [PATCH 37/68] Replace printf with PINELOG_DEBUG in main --- daemon/x52d_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index d2192a3..a6e636d 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -124,11 +124,11 @@ int main(int argc, char **argv) } } - printf("Foreground = %s\n", foreground ? "true" : "false"); - printf("Quiet = %s\n", quiet ? "true" : "false"); - printf("Verbosity = %d\n", verbosity); - printf("Log file = %s\n", log_file); - printf("Config file = %s\n", conf_file); + PINELOG_DEBUG("Foreground = %s", foreground ? "true" : "false"); + PINELOG_DEBUG("Quiet = %s", quiet ? "true" : "false"); + PINELOG_DEBUG("Verbosity = %d", verbosity); + PINELOG_DEBUG("Log file = %s", log_file); + PINELOG_DEBUG("Config file = %s", conf_file); set_log_file(foreground, log_file); x52d_config_load(conf_file); From e4d1b6aff2260002f4e0c511f0ab023f3b7f6b4b Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sun, 25 Jul 2021 08:42:33 -0700 Subject: [PATCH 38/68] Add update thread enable flag Prior to this change, the update thread was only checking on device_update_needed. However, this causes an issue when calling any of the set methods where the update thread fires, fails to find a device, and signals the acquisition thread every 50 ms, since the update flag was never cleared. This change adds a thread enable flag for the update thread. The update thread will check that both the thread enable flag and the update needed flag are set before proceeding with the call to libx52_update. --- daemon/x52d_device.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 456a889..58e4808 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -26,6 +26,7 @@ static pthread_mutex_t device_mutex = PTHREAD_MUTEX_INITIALIZER; */ static pthread_t device_acq_thr; static volatile bool device_acq_thr_enable; +static volatile bool device_upd_thr_enable; static void *x52_dev_acq(void *param) { @@ -54,12 +55,14 @@ static void *x52_dev_acq(void *param) PINELOG_TRACE("Sleeping for %d seconds before trying to acquire device again", RECONNECT_DELAY); sleep(RECONNECT_DELAY); } else { - PINELOG_TRACE("Found device, disabling acquisition thread"); + PINELOG_TRACE("Found device, disabling acquisition thread, enable update thread"); device_acq_thr_enable = false; + device_upd_thr_enable = true; } } else { - PINELOG_TRACE("Device is connected, disable acquisition thread"); + PINELOG_TRACE("Device is connected, disable acquisition thread, enable update thread"); device_acq_thr_enable = false; + device_upd_thr_enable = true; } #undef RECONNECT_DELAY } @@ -79,8 +82,8 @@ static void *x52_dev_upd(void *param) PINELOG_TRACE("Starting X52 device update thread"); // Check if the device needs to be updated in a loop for (;;) { - #define UPDATE_CHECK_DELAY 50000 - if (!device_update_needed) { + #define UPDATE_CHECK_DELAY 50000 // Wait for this many useconds + if (!device_update_needed || !device_upd_thr_enable) { usleep(UPDATE_CHECK_DELAY); continue; } @@ -112,6 +115,7 @@ void x52d_dev_init(void) pthread_create(&device_upd_thr, NULL, x52_dev_upd, NULL); device_update_needed = false; + device_upd_thr_enable = libx52_is_connected(x52_dev); } void x52d_dev_exit(void) @@ -192,6 +196,7 @@ int x52d_dev_set_blink(uint8_t state) { WRAP_LIBX52(libx52_set_blink(x52_dev, state)); } + int x52d_dev_update(void) { int rc; @@ -206,6 +211,9 @@ int x52d_dev_update(void) PINELOG_TRACE("Disconnecting detached device"); libx52_disconnect(x52_dev); + PINELOG_TRACE("Disabling device update thread"); + device_upd_thr_enable = false; + PINELOG_TRACE("Signaling device search thread"); device_acq_thr_enable = true; } else { From e0d15961e008876ba06f087e5c1bd1c05a3e08a1 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sun, 25 Jul 2021 15:39:20 -0700 Subject: [PATCH 39/68] Add signal handlers to handle termination and reload --- daemon/x52d_main.c | 50 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index a6e636d..a6e56fa 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include "x52d_clock.h" #include "x52d_const.h" @@ -18,6 +20,19 @@ #include "x52d_device.h" #include "pinelog.h" +static volatile bool flag_quit; + +static void termination_handler(int signum) +{ + flag_quit = true; +} + +static volatile bool flag_reload; +static void reload_handler(int signum) +{ + flag_reload = true; +} + static void set_log_file(bool foreground, const char *log_file) { int rc = 0; @@ -37,6 +52,22 @@ static void set_log_file(bool foreground, const char *log_file) } } +static void listen_signal(int signum, void (*handler)(int)) +{ + struct sigaction action; + int rc; + + action.sa_handler = handler; + sigemptyset(&action.sa_mask); + action.sa_flags = 0; + + rc = sigaction(signum, &action, NULL); + if (rc < 0) { + PINELOG_FATAL(_("Error %d installing signal handler for signal %d: %s"), + errno, signum, strerror(errno)); + } +} + #if HAVE_FUNC_ATTRIBUTE_NORETURN __attribute__((noreturn)) #endif @@ -133,6 +164,12 @@ int main(int argc, char **argv) set_log_file(foreground, log_file); x52d_config_load(conf_file); + // Initialize signal handlers + listen_signal(SIGINT, termination_handler); + listen_signal(SIGTERM, termination_handler); + listen_signal(SIGQUIT, termination_handler); + listen_signal(SIGHUP, reload_handler); + // Start device threads x52d_dev_init(); x52d_clock_init(); @@ -140,11 +177,22 @@ int main(int argc, char **argv) // Apply configuration x52d_config_apply(); - for(;;) { + flag_quit = false; + while(!flag_quit) { // TODO: Replace with main event loop // Let all threads run in background forever sleep(600); + + /* Check if we need to reload configuration */ + if (flag_reload) { + PINELOG_TRACE("Reinitializing configuration"); + x52d_config_load(conf_file); + x52d_config_apply(); + flag_reload = false; + } } + PINELOG_INFO(_("Shutting down X52 daemon")); + return 0; } From 52232b1a14f58097979fa2e85ac19ae591ea76a2 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 26 Jul 2021 10:12:23 -0700 Subject: [PATCH 40/68] Stop device threads on daemon termination --- daemon/x52d_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index a6e56fa..ac8fff6 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -192,6 +192,9 @@ int main(int argc, char **argv) } } + // Stop device threads + x52d_clock_exit(); + x52d_dev_exit(); PINELOG_INFO(_("Shutting down X52 daemon")); return 0; From bd2dbbb9cc935be77452ad1cd454386e71952746 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 26 Jul 2021 10:30:29 -0700 Subject: [PATCH 41/68] Make thread startup and shutdown logs as INFO --- daemon/x52d_clock.c | 4 +-- daemon/x52d_device.c | 10 +++--- daemon/x52d_main.c | 10 +++--- po/x52pro-linux.pot | 77 +++++++++++++++++++++++++++++++---------- po/xx_PL.po | 81 +++++++++++++++++++++++++++++++++----------- 5 files changed, 132 insertions(+), 50 deletions(-) diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index 2433573..7de5499 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -157,7 +157,7 @@ static void * x52_clock_thr(void *param) { int rc; - PINELOG_TRACE("Starting X52 clock thread"); + PINELOG_INFO(_("Starting X52 clock manager thread")); for (;;) { time_t cur_time; @@ -196,6 +196,6 @@ void x52d_clock_init(void) void x52d_clock_exit(void) { - PINELOG_TRACE("Shutting down clock thread"); + PINELOG_INFO(_("Shutting down X52 clock manager thread")); pthread_cancel(clock_thr); } diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 58e4808..0ec4926 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -32,7 +32,7 @@ static void *x52_dev_acq(void *param) { int rc; - PINELOG_TRACE("Starting X52 device acquisition thread"); + PINELOG_INFO(_("Starting X52 device acquisition thread")); // Check if the device is connected in a loop for (;;) { #define RECONNECT_DELAY 5 @@ -79,7 +79,7 @@ static volatile bool device_update_needed; static void *x52_dev_upd(void *param) { - PINELOG_TRACE("Starting X52 device update thread"); + PINELOG_INFO(_("Starting X52 device update thread")); // Check if the device needs to be updated in a loop for (;;) { #define UPDATE_CHECK_DELAY 50000 // Wait for this many useconds @@ -98,7 +98,7 @@ static void *x52_dev_upd(void *param) void x52d_dev_init(void) { int rc; - PINELOG_TRACE("Initializing libx52"); + PINELOG_INFO(_("Initializing libx52")); rc = libx52_init(&x52_dev); if (rc != LIBX52_SUCCESS) { @@ -121,10 +121,10 @@ void x52d_dev_init(void) void x52d_dev_exit(void) { // Shutdown any threads - PINELOG_TRACE("Shutting down device acquisition thread"); + PINELOG_INFO(_("Shutting down X52 device acquisition thread")); pthread_cancel(device_acq_thr); - PINELOG_TRACE("Shutting down device update thread"); + PINELOG_INFO(_("Shutting down X52 device update thread")); pthread_cancel(device_upd_thr); libx52_exit(x52_dev); diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index ac8fff6..3c7e6a2 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -20,11 +20,11 @@ #include "x52d_device.h" #include "pinelog.h" -static volatile bool flag_quit; +static volatile int flag_quit; static void termination_handler(int signum) { - flag_quit = true; + flag_quit = signum; } static volatile bool flag_reload; @@ -63,7 +63,7 @@ static void listen_signal(int signum, void (*handler)(int)) rc = sigaction(signum, &action, NULL); if (rc < 0) { - PINELOG_FATAL(_("Error %d installing signal handler for signal %d: %s"), + PINELOG_FATAL(_("Error %d installing handler for signal %d: %s"), errno, signum, strerror(errno)); } } @@ -177,7 +177,7 @@ int main(int argc, char **argv) // Apply configuration x52d_config_apply(); - flag_quit = false; + flag_quit = 0; while(!flag_quit) { // TODO: Replace with main event loop // Let all threads run in background forever @@ -185,7 +185,7 @@ int main(int argc, char **argv) /* Check if we need to reload configuration */ if (flag_reload) { - PINELOG_TRACE("Reinitializing configuration"); + PINELOG_INFO(_("Reloading X52 configuration")); x52d_config_load(conf_file); x52d_config_apply(); flag_reload = false; diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 2956086..acdeb59 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-23 09:47-0700\n" +"POT-Creation-Date: 2021-07-26 10:20-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -370,21 +370,34 @@ msgstr "" msgid "OK" msgstr "" -#: daemon/x52d_main.c:35 +#: daemon/x52d_main.c:50 #, c-format msgid "Error %d setting log file: %s\n" msgstr "" -#: daemon/x52d_main.c:46 +#: daemon/x52d_main.c:66 +#, c-format +msgid "Error %d installing handler for signal %d: %s" +msgstr "" + +#: daemon/x52d_main.c:77 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" -#: daemon/x52d_main.c:107 +#: daemon/x52d_main.c:138 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "" +#: daemon/x52d_main.c:188 +msgid "Reloading X52 configuration" +msgstr "" + +#: daemon/x52d_main.c:198 +msgid "Shutting down X52 daemon" +msgstr "" + #: daemon/x52d_clock.c:27 #, c-format msgid "Setting clock enable to %s" @@ -403,75 +416,103 @@ msgstr "" msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" -#: daemon/x52d_clock.c:132 +#: daemon/x52d_clock.c:160 +msgid "Starting X52 clock manager thread" +msgstr "" + +#: daemon/x52d_clock.c:171 #, c-format msgid "Error %d retrieving current time: %s" msgstr "" -#: daemon/x52d_clock.c:153 +#: daemon/x52d_clock.c:192 #, c-format msgid "Error %d initializing clock thread: %s" msgstr "" +#: daemon/x52d_clock.c:199 +msgid "Shutting down X52 clock manager thread" +msgstr "" + #: daemon/x52d_config.c:26 #, c-format msgid "Error %d setting configuration defaults: %s" msgstr "" -#: daemon/x52d_config_parser.c:130 +#: daemon/x52d_config_parser.c:164 #, c-format msgid "Ignoring unknown key '%s.%s'" msgstr "" -#: daemon/x52d_config_parser.c:171 +#: daemon/x52d_config_parser.c:205 #, c-format msgid "Failed processing configuration file %s - code %d" msgstr "" -#: daemon/x52d_config_parser.c:201 +#: daemon/x52d_config_parser.c:235 msgid "Failed to allocate memory for override structure" msgstr "" -#: daemon/x52d_config_parser.c:210 +#: daemon/x52d_config_parser.c:244 msgid "Failed to allocate memory for override string" msgstr "" -#: daemon/x52d_config_parser.c:221 +#: daemon/x52d_config_parser.c:255 #, c-format msgid "No section found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:235 +#: daemon/x52d_config_parser.c:269 #, c-format msgid "No key found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:246 +#: daemon/x52d_config_parser.c:280 #, c-format msgid "No value found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:297 +#: daemon/x52d_config_parser.c:331 #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "" -#: daemon/x52d_device.c:49 +#: daemon/x52d_device.c:35 +msgid "Starting X52 device acquisition thread" +msgstr "" + +#: daemon/x52d_device.c:50 #, c-format msgid "Error %d connecting to device: %s" msgstr "" -#: daemon/x52d_device.c:102 +#: daemon/x52d_device.c:82 +msgid "Starting X52 device update thread" +msgstr "" + +#: daemon/x52d_device.c:101 +msgid "Initializing libx52" +msgstr "" + +#: daemon/x52d_device.c:105 #, c-format msgid "Failure %d initializing libx52: %s" msgstr "" -#: daemon/x52d_device.c:136 +#: daemon/x52d_device.c:124 +msgid "Shutting down X52 device acquisition thread" +msgstr "" + +#: daemon/x52d_device.c:127 +msgid "Shutting down X52 device update thread" +msgstr "" + +#: daemon/x52d_device.c:140 #, c-format msgid "Error %d when updating X52 parameter: %s" msgstr "" -#: daemon/x52d_device.c:205 +#: daemon/x52d_device.c:220 #, c-format msgid "Error %d when updating X52 device: %s" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 041f05c..fc00568 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-23 09:47-0700\n" -"PO-Revision-Date: 2021-07-23 09:51-0700\n" +"POT-Creation-Date: 2021-07-26 10:20-0700\n" +"PO-Revision-Date: 2021-07-26 10:27-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" @@ -47,7 +47,7 @@ msgstr "Inputay arameterpay outay ofay angeray" #: lib/libx52/x52_strerror.c:46 msgid "USB transaction failure" -msgstr "USBay ransactiontay ailurefay" +msgstr "USBay ansactiontray ailurefay" #: lib/libx52/x52_strerror.c:49 msgid "USB input/output error" @@ -413,23 +413,36 @@ msgstr "Estingtay aracterchay 0x%02x..." msgid "OK" msgstr "OKay" -#: daemon/x52d_main.c:35 +#: daemon/x52d_main.c:50 #, c-format msgid "Error %d setting log file: %s\n" msgstr "Erroray %d ettingsay oglay ilefay: %s\n" -#: daemon/x52d_main.c:46 +#: daemon/x52d_main.c:66 +#, c-format +msgid "Error %d installing handler for signal %d: %s" +msgstr "Erroray %d installingay andlerhay orfay ignalsay %d: %s" + +#: daemon/x52d_main.c:77 #, c-format msgid "Usage: %s [-f] [-v] [-q] [-l log-file] [-o override] [-c config-file]\n" msgstr "" "Usageay: %s [-f] [-v] [-q] [-l oglay-ilefay] [-o overrideay] [-c onfigcay-" "ilefay]\n" -#: daemon/x52d_main.c:107 +#: daemon/x52d_main.c:138 #, c-format msgid "Unable to parse configuration override '%s'\n" msgstr "Unableay otay arsepay onfigurationcay overrideay '%s'\n" +#: daemon/x52d_main.c:188 +msgid "Reloading X52 configuration" +msgstr "Eloadingray X52 onfigurationcay" + +#: daemon/x52d_main.c:198 +msgid "Shutting down X52 daemon" +msgstr "Uttingshay ownday X52 aemonday" + #: daemon/x52d_clock.c:27 #, c-format msgid "Setting clock enable to %s" @@ -451,75 +464,103 @@ msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" "Unableay otay ackupbay imezonetay environmentay. Allingfay ackbay otay UTCay" -#: daemon/x52d_clock.c:132 +#: daemon/x52d_clock.c:160 +msgid "Starting X52 clock manager thread" +msgstr "Artingstay X52 ockclay anagermay eadthray" + +#: daemon/x52d_clock.c:171 #, c-format msgid "Error %d retrieving current time: %s" msgstr "Erroray %d etrievingray urrentcay imetay: %s" -#: daemon/x52d_clock.c:153 +#: daemon/x52d_clock.c:192 #, c-format msgid "Error %d initializing clock thread: %s" msgstr "Erroray %d initializingay ockclay eadthray: %s" +#: daemon/x52d_clock.c:199 +msgid "Shutting down X52 clock manager thread" +msgstr "Uttingshay ownday X52 ockclay anagermay eadthray" + #: daemon/x52d_config.c:26 #, c-format msgid "Error %d setting configuration defaults: %s" msgstr "Erroray %d ettingsay onfigurationcay efaultsday: %s" -#: daemon/x52d_config_parser.c:130 +#: daemon/x52d_config_parser.c:164 #, c-format msgid "Ignoring unknown key '%s.%s'" msgstr "Ignoringay unknownay eykay '%s.%s'" -#: daemon/x52d_config_parser.c:171 +#: daemon/x52d_config_parser.c:205 #, c-format msgid "Failed processing configuration file %s - code %d" msgstr "Ailedfay ocessingpray onfigurationcay ilefay %s - odecay %d" -#: daemon/x52d_config_parser.c:201 +#: daemon/x52d_config_parser.c:235 msgid "Failed to allocate memory for override structure" msgstr "Ailedfay otay allocateay emorymay orfay overrideay ucturestray" -#: daemon/x52d_config_parser.c:210 +#: daemon/x52d_config_parser.c:244 msgid "Failed to allocate memory for override string" msgstr "Ailedfay otay allocateay emorymay orfay overrideay ingstray" -#: daemon/x52d_config_parser.c:221 +#: daemon/x52d_config_parser.c:255 #, c-format msgid "No section found in override string '%s'" msgstr "Onay ectionsay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:235 +#: daemon/x52d_config_parser.c:269 #, c-format msgid "No key found in override string '%s'" msgstr "Onay eykay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:246 +#: daemon/x52d_config_parser.c:280 #, c-format msgid "No value found in override string '%s'" msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:297 +#: daemon/x52d_config_parser.c:331 #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "Erroray ocessingpray overriday '%s.%s=%s'" -#: daemon/x52d_device.c:49 +#: daemon/x52d_device.c:35 +msgid "Starting X52 device acquisition thread" +msgstr "Artingstay X52 eviceday acquisitionay eadthray" + +#: daemon/x52d_device.c:50 #, c-format msgid "Error %d connecting to device: %s" msgstr "Erroray %d onnectingcay otay eviceday: %s" -#: daemon/x52d_device.c:102 +#: daemon/x52d_device.c:82 +msgid "Starting X52 device update thread" +msgstr "Artingstay X52 eviceday updateay eadthray" + +#: daemon/x52d_device.c:101 +msgid "Initializing libx52" +msgstr "Initializingay libx52" + +#: daemon/x52d_device.c:105 #, c-format msgid "Failure %d initializing libx52: %s" msgstr "Ailurefay %d initializeay libx52: %s" -#: daemon/x52d_device.c:136 +#: daemon/x52d_device.c:124 +msgid "Shutting down X52 device acquisition thread" +msgstr "Uttingshay ownday X52 eviceday acquisitionay eadthray" + +#: daemon/x52d_device.c:127 +msgid "Shutting down X52 device update thread" +msgstr "Uttingshay ownday X52 eviceday updateay eadthray" + +#: daemon/x52d_device.c:140 #, c-format msgid "Error %d when updating X52 parameter: %s" msgstr "Erroray %d enwhay updatingay X52 arameterpay: %s" -#: daemon/x52d_device.c:205 +#: daemon/x52d_device.c:220 #, c-format msgid "Error %d when updating X52 device: %s" msgstr "Erroray %d enwhay updatingay X52 eviceday: %s" From f422202ec884df2ae17e25dc2aabf0f6d1e3779f Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 26 Jul 2021 11:02:38 -0700 Subject: [PATCH 42/68] Update translations and logs for setting config parameters --- daemon/x52d_clock.c | 16 +++++----- daemon/x52d_main.c | 10 +++--- po/x52pro-linux.pot | 74 ++++++++++++++++++++++++++++++++++++++++++- po/xx_PL.po | 76 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 160 insertions(+), 16 deletions(-) diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index 7de5499..174cd00 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -25,14 +25,14 @@ static int clock_primary_is_local = false; void x52d_cfg_set_Clock_Enabled(bool enabled) { PINELOG_DEBUG(_("Setting clock enable to %s"), - enabled ? "on" : "off"); + enabled ? _("on") : _("off")); clock_enabled = enabled; } void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) { PINELOG_DEBUG(_("Setting primary clock timezone to %s"), - param ? "local" : "UTC"); + param ? _("local") : _("UTC")); clock_primary_is_local = !!param; } @@ -102,26 +102,26 @@ cleanup: } tzset(); - PINELOG_DEBUG("Offset for timezone '%s' is %d", tz, offset); + PINELOG_TRACE("Offset for timezone '%s' is %d", tz, offset); return offset; } void x52d_cfg_set_Clock_Secondary(char* param) { - PINELOG_TRACE("Setting secondary clock timezone to %s", param); + PINELOG_DEBUG(("Setting secondary clock timezone to %s"), param); x52d_dev_set_clock_timezone(LIBX52_CLOCK_2, get_tz_offset(param)); } void x52d_cfg_set_Clock_Tertiary(char* param) { - PINELOG_TRACE("Setting tertiary clock timezone to %s", param); + PINELOG_DEBUG(_("Setting tertiary clock timezone to %s"), param); x52d_dev_set_clock_timezone(LIBX52_CLOCK_3, get_tz_offset(param)); } static void set_clock_format(const char *name, libx52_clock_id id, libx52_clock_format fmt) { - PINELOG_TRACE("Setting %s clock format to %s", name, - fmt == LIBX52_CLOCK_FORMAT_12HR ? "12 hour" : "24 hour"); + PINELOG_DEBUG(_("Setting %s clock format to %s"), name, + fmt == LIBX52_CLOCK_FORMAT_12HR ? _("12 hour") : _("24 hour")); x52d_dev_set_clock_format(id, fmt); } @@ -147,7 +147,7 @@ void x52d_cfg_set_Clock_DateFormat(libx52_date_format fmt) "mm-dd-yy", "yy-mm-dd" }; - PINELOG_TRACE("Setting date format to %s", formats[fmt]); + PINELOG_DEBUG(_("Setting date format to %s"), formats[fmt]); x52d_dev_set_date_format(fmt); } diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 3c7e6a2..06a515d 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -155,11 +155,11 @@ int main(int argc, char **argv) } } - PINELOG_DEBUG("Foreground = %s", foreground ? "true" : "false"); - PINELOG_DEBUG("Quiet = %s", quiet ? "true" : "false"); - PINELOG_DEBUG("Verbosity = %d", verbosity); - PINELOG_DEBUG("Log file = %s", log_file); - PINELOG_DEBUG("Config file = %s", conf_file); + PINELOG_DEBUG(_("Foreground = %s"), foreground ? _("true") : _("false")); + PINELOG_DEBUG(_("Quiet = %s"), quiet ? _("true") : _("false")); + PINELOG_DEBUG(_("Verbosity = %d"), verbosity); + PINELOG_DEBUG(_("Log file = %s"), log_file); + PINELOG_DEBUG(_("Config file = %s"), conf_file); set_log_file(foreground, log_file); x52d_config_load(conf_file); diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index acdeb59..b230869 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-26 10:20-0700\n" +"POT-Creation-Date: 2021-07-26 11:01-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -390,6 +390,39 @@ msgstr "" msgid "Unable to parse configuration override '%s'\n" msgstr "" +#: daemon/x52d_main.c:158 +#, c-format +msgid "Foreground = %s" +msgstr "" + +#: daemon/x52d_main.c:158 daemon/x52d_main.c:159 +msgid "true" +msgstr "" + +#: daemon/x52d_main.c:158 daemon/x52d_main.c:159 +msgid "false" +msgstr "" + +#: daemon/x52d_main.c:159 +#, c-format +msgid "Quiet = %s" +msgstr "" + +#: daemon/x52d_main.c:160 +#, c-format +msgid "Verbosity = %d" +msgstr "" + +#: daemon/x52d_main.c:161 +#, c-format +msgid "Log file = %s" +msgstr "" + +#: daemon/x52d_main.c:162 +#, c-format +msgid "Config file = %s" +msgstr "" + #: daemon/x52d_main.c:188 msgid "Reloading X52 configuration" msgstr "" @@ -403,11 +436,27 @@ msgstr "" msgid "Setting clock enable to %s" msgstr "" +#: daemon/x52d_clock.c:28 +msgid "on" +msgstr "" + +#: daemon/x52d_clock.c:28 +msgid "off" +msgstr "" + #: daemon/x52d_clock.c:34 #, c-format msgid "Setting primary clock timezone to %s" msgstr "" +#: daemon/x52d_clock.c:35 +msgid "local" +msgstr "" + +#: daemon/x52d_clock.c:35 +msgid "UTC" +msgstr "" + #: daemon/x52d_clock.c:52 msgid "Unable to allocate memory for timezone. Falling back to UTC" msgstr "" @@ -416,6 +465,29 @@ msgstr "" msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" +#: daemon/x52d_clock.c:117 +#, c-format +msgid "Setting tertiary clock timezone to %s" +msgstr "" + +#: daemon/x52d_clock.c:123 +#, c-format +msgid "Setting %s clock format to %s" +msgstr "" + +#: daemon/x52d_clock.c:124 +msgid "12 hour" +msgstr "" + +#: daemon/x52d_clock.c:124 +msgid "24 hour" +msgstr "" + +#: daemon/x52d_clock.c:150 +#, c-format +msgid "Setting date format to %s" +msgstr "" + #: daemon/x52d_clock.c:160 msgid "Starting X52 clock manager thread" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index fc00568..5045bea 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-26 10:20-0700\n" -"PO-Revision-Date: 2021-07-26 10:27-0700\n" +"POT-Creation-Date: 2021-07-26 11:01-0700\n" +"PO-Revision-Date: 2021-07-26 11:00-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" @@ -435,6 +435,39 @@ msgstr "" msgid "Unable to parse configuration override '%s'\n" msgstr "Unableay otay arsepay onfigurationcay overrideay '%s'\n" +#: daemon/x52d_main.c:158 +#, c-format +msgid "Foreground = %s" +msgstr "Oregroundfay = %s" + +#: daemon/x52d_main.c:158 daemon/x52d_main.c:159 +msgid "true" +msgstr "uetray" + +#: daemon/x52d_main.c:158 daemon/x52d_main.c:159 +msgid "false" +msgstr "alsefay" + +#: daemon/x52d_main.c:159 +#, c-format +msgid "Quiet = %s" +msgstr "Uietqay = %s" + +#: daemon/x52d_main.c:160 +#, c-format +msgid "Verbosity = %d" +msgstr "Erbosityvay = %d" + +#: daemon/x52d_main.c:161 +#, c-format +msgid "Log file = %s" +msgstr "Oglay ilefay = %s" + +#: daemon/x52d_main.c:162 +#, c-format +msgid "Config file = %s" +msgstr "Onfigcay ilefay = %s" + #: daemon/x52d_main.c:188 msgid "Reloading X52 configuration" msgstr "Eloadingray X52 onfigurationcay" @@ -448,11 +481,27 @@ msgstr "Uttingshay ownday X52 aemonday" msgid "Setting clock enable to %s" msgstr "Ettingsay ockclay enableay otay %s" +#: daemon/x52d_clock.c:28 +msgid "on" +msgstr "onay" + +#: daemon/x52d_clock.c:28 +msgid "off" +msgstr "offay" + #: daemon/x52d_clock.c:34 #, c-format msgid "Setting primary clock timezone to %s" msgstr "Ettingsay imarypray ockclay imezonetay otay %s" +#: daemon/x52d_clock.c:35 +msgid "local" +msgstr "ocallay" + +#: daemon/x52d_clock.c:35 +msgid "UTC" +msgstr "UTCay" + #: daemon/x52d_clock.c:52 msgid "Unable to allocate memory for timezone. Falling back to UTC" msgstr "" @@ -464,6 +513,29 @@ msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" "Unableay otay ackupbay imezonetay environmentay. Allingfay ackbay otay UTCay" +#: daemon/x52d_clock.c:117 +#, c-format +msgid "Setting tertiary clock timezone to %s" +msgstr "Ettingsay ertiarytay ockclay imezonetay otay %s" + +#: daemon/x52d_clock.c:123 +#, c-format +msgid "Setting %s clock format to %s" +msgstr "Ettingsay %s ockclay ormatfay otay %s" + +#: daemon/x52d_clock.c:124 +msgid "12 hour" +msgstr "12 ourhay" + +#: daemon/x52d_clock.c:124 +msgid "24 hour" +msgstr "24 ourhay" + +#: daemon/x52d_clock.c:150 +#, c-format +msgid "Setting date format to %s" +msgstr "Ettingsay ateday ormatfay otay %s" + #: daemon/x52d_clock.c:160 msgid "Starting X52 clock manager thread" msgstr "Artingstay X52 ockclay anagermay eadthray" From 602071612d01e41562fa1cd5581a22ca30c1cebb Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 26 Jul 2021 17:07:11 -0700 Subject: [PATCH 43/68] Add DoxygenLayout.xml to distribution --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 10b78fe..94137ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,7 @@ EXTRA_DIST = \ ChangeLog.md \ CONTRIBUTING.md \ Doxyfile.in \ + DoxygenLayout.xml \ INSTALL.md \ LICENSE \ README.md \ From 77606ae9064505d3a7e5473382cb924f555fe077 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 01:35:31 -0700 Subject: [PATCH 44/68] Use lookup table to implement *_strerror --- lib/libx52/x52_strerror.c | 59 ++++++++++++++++----------------------- lib/libx52io/io_strings.c | 26 ++++++++--------- po/x52pro-linux.pot | 48 +++++++++++++++---------------- po/xx_PL.po | 48 +++++++++++++++---------------- 4 files changed, 85 insertions(+), 96 deletions(-) diff --git a/lib/libx52/x52_strerror.c b/lib/libx52/x52_strerror.c index 6cdbaa3..a193140 100644 --- a/lib/libx52/x52_strerror.c +++ b/lib/libx52/x52_strerror.c @@ -1,7 +1,7 @@ /* * Saitek X52 Pro MFD & LED driver * - * Copyright (C) 2012-2017 Nirenjan Krishnan (nirenjan@nirenjan.org) + * Copyright (C) 2012-2021 Nirenjan Krishnan (nirenjan@nirenjan.org) * * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 */ @@ -12,65 +12,54 @@ #include "libx52.h" #include "gettext.h" -/** For future use in i18n */ +#define N_(str) gettext_noop(str) #define _(str) dgettext(PACKAGE, str) /* Error buffer used for building custom error strings */ static char error_buffer[256]; +/* List of error strings */ +static const char *error_string[] = { + N_("Success"), + N_("Initialization failure"), + N_("Insufficient memory"), + N_("Invalid parameter"), + N_("Operation not supported"), + N_("Try again"), + N_("Input parameter out of range"), + N_("USB transaction failure"), + N_("USB input/output error"), + N_("Access denied"), + N_("No such device"), + N_("Entity not found"), + N_("Resource busy"), + N_("Operation timeout"), + N_("Overflow"), + N_("Pipe error"), + N_("System call interrupted"), +}; + const char * libx52_strerror(libx52_error_code error) { switch (error) { case LIBX52_SUCCESS: - return _("Success"); - case LIBX52_ERROR_INIT_FAILURE: - return _("Initialization failure"); - case LIBX52_ERROR_OUT_OF_MEMORY: - return _("Insufficient memory"); - case LIBX52_ERROR_INVALID_PARAM: - return _("Invalid parameter"); - case LIBX52_ERROR_NOT_SUPPORTED: - return _("Operation not supported"); - case LIBX52_ERROR_TRY_AGAIN: - return _("Try again"); - case LIBX52_ERROR_OUT_OF_RANGE: - return _("Input parameter out of range"); - case LIBX52_ERROR_USB_FAILURE: - return _("USB transaction failure"); - case LIBX52_ERROR_IO: - return _("USB input/output error"); - case LIBX52_ERROR_PERM: - return _("Access denied"); - case LIBX52_ERROR_NO_DEVICE: - return _("No such device"); - case LIBX52_ERROR_NOT_FOUND: - return _("Entity not found"); - case LIBX52_ERROR_BUSY: - return _("Resource busy"); - case LIBX52_ERROR_TIMEOUT: - return _("Operation timeout"); - case LIBX52_ERROR_OVERFLOW: - return _("Overflow"); - case LIBX52_ERROR_PIPE: - return _("Pipe error"); - case LIBX52_ERROR_INTERRUPTED: - return _("System call interrupted"); + return _(error_string[error]); default: snprintf(error_buffer, sizeof(error_buffer), diff --git a/lib/libx52io/io_strings.c b/lib/libx52io/io_strings.c index 4f3eaaa..794a704 100644 --- a/lib/libx52io/io_strings.c +++ b/lib/libx52io/io_strings.c @@ -95,31 +95,31 @@ const char * libx52io_button_to_str(libx52io_button button) /* Error buffer used for building custom error strings */ static char error_buffer[256]; +#define N_(str) gettext_noop(str) + +static const char *error_string[] = { + N_("Success"), + N_("Initialization failure"), + N_("No device"), + N_("Invalid arguments"), + N_("Connection failure"), + N_("I/O error"), + N_("Read timeout"), +}; + #define _(str) dgettext(PACKAGE, str) const char * libx52io_strerror(libx52io_error_code code) { switch (code) { case LIBX52IO_SUCCESS: - return _("Success"); - case LIBX52IO_ERROR_INIT_FAILURE: - return _("Initialization failure"); - case LIBX52IO_ERROR_NO_DEVICE: - return _("No device"); - case LIBX52IO_ERROR_INVALID: - return _("Invalid arguments"); - case LIBX52IO_ERROR_CONN: - return _("Connection failure"); - case LIBX52IO_ERROR_IO: - return _("I/O error"); - case LIBX52IO_ERROR_TIMEOUT: - return _("Read timeout"); + return _(error_string[code]); default: snprintf(error_buffer, sizeof(error_buffer), _("Unknown error %d"), code); diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index b230869..fd37347 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-26 11:01-0700\n" +"POT-Creation-Date: 2021-07-27 01:34-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,96 +17,96 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: lib/libx52/x52_strerror.c:25 lib/libx52io/io_strings.c:104 +#: lib/libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 msgid "Success" msgstr "" -#: lib/libx52/x52_strerror.c:28 lib/libx52io/io_strings.c:107 +#: lib/libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "" -#: lib/libx52/x52_strerror.c:31 +#: lib/libx52/x52_strerror.c:25 msgid "Insufficient memory" msgstr "" -#: lib/libx52/x52_strerror.c:34 +#: lib/libx52/x52_strerror.c:26 msgid "Invalid parameter" msgstr "" -#: lib/libx52/x52_strerror.c:37 +#: lib/libx52/x52_strerror.c:27 msgid "Operation not supported" msgstr "" -#: lib/libx52/x52_strerror.c:40 +#: lib/libx52/x52_strerror.c:28 msgid "Try again" msgstr "" -#: lib/libx52/x52_strerror.c:43 +#: lib/libx52/x52_strerror.c:29 msgid "Input parameter out of range" msgstr "" -#: lib/libx52/x52_strerror.c:46 +#: lib/libx52/x52_strerror.c:30 msgid "USB transaction failure" msgstr "" -#: lib/libx52/x52_strerror.c:49 +#: lib/libx52/x52_strerror.c:31 msgid "USB input/output error" msgstr "" -#: lib/libx52/x52_strerror.c:52 +#: lib/libx52/x52_strerror.c:32 msgid "Access denied" msgstr "" -#: lib/libx52/x52_strerror.c:55 +#: lib/libx52/x52_strerror.c:33 msgid "No such device" msgstr "" -#: lib/libx52/x52_strerror.c:58 +#: lib/libx52/x52_strerror.c:34 msgid "Entity not found" msgstr "" -#: lib/libx52/x52_strerror.c:61 +#: lib/libx52/x52_strerror.c:35 msgid "Resource busy" msgstr "" -#: lib/libx52/x52_strerror.c:64 +#: lib/libx52/x52_strerror.c:36 msgid "Operation timeout" msgstr "" -#: lib/libx52/x52_strerror.c:67 +#: lib/libx52/x52_strerror.c:37 msgid "Overflow" msgstr "" -#: lib/libx52/x52_strerror.c:70 +#: lib/libx52/x52_strerror.c:38 msgid "Pipe error" msgstr "" -#: lib/libx52/x52_strerror.c:73 +#: lib/libx52/x52_strerror.c:39 msgid "System call interrupted" msgstr "" -#: lib/libx52/x52_strerror.c:77 lib/libx52io/io_strings.c:125 +#: lib/libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "" -#: lib/libx52io/io_strings.c:110 +#: lib/libx52io/io_strings.c:103 msgid "No device" msgstr "" -#: lib/libx52io/io_strings.c:113 +#: lib/libx52io/io_strings.c:104 msgid "Invalid arguments" msgstr "" -#: lib/libx52io/io_strings.c:116 +#: lib/libx52io/io_strings.c:105 msgid "Connection failure" msgstr "" -#: lib/libx52io/io_strings.c:119 +#: lib/libx52io/io_strings.c:106 msgid "I/O error" msgstr "" -#: lib/libx52io/io_strings.c:122 +#: lib/libx52io/io_strings.c:107 msgid "Read timeout" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 5045bea..e685523 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-26 11:01-0700\n" +"POT-Creation-Date: 2021-07-27 01:34-0700\n" "PO-Revision-Date: 2021-07-26 11:00-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -17,96 +17,96 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" -#: lib/libx52/x52_strerror.c:25 lib/libx52io/io_strings.c:104 +#: lib/libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 msgid "Success" msgstr "Uccesssay" -#: lib/libx52/x52_strerror.c:28 lib/libx52io/io_strings.c:107 +#: lib/libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "Initializationay ailurefay" -#: lib/libx52/x52_strerror.c:31 +#: lib/libx52/x52_strerror.c:25 msgid "Insufficient memory" msgstr "Insufficientay emorymay" -#: lib/libx52/x52_strerror.c:34 +#: lib/libx52/x52_strerror.c:26 msgid "Invalid parameter" msgstr "Invaliday arameterpay" -#: lib/libx52/x52_strerror.c:37 +#: lib/libx52/x52_strerror.c:27 msgid "Operation not supported" msgstr "Operationay otnay upportedsay" -#: lib/libx52/x52_strerror.c:40 +#: lib/libx52/x52_strerror.c:28 msgid "Try again" msgstr "Ytray againay" -#: lib/libx52/x52_strerror.c:43 +#: lib/libx52/x52_strerror.c:29 msgid "Input parameter out of range" msgstr "Inputay arameterpay outay ofay angeray" -#: lib/libx52/x52_strerror.c:46 +#: lib/libx52/x52_strerror.c:30 msgid "USB transaction failure" msgstr "USBay ansactiontray ailurefay" -#: lib/libx52/x52_strerror.c:49 +#: lib/libx52/x52_strerror.c:31 msgid "USB input/output error" msgstr "USBay inputay/outputay erroray" -#: lib/libx52/x52_strerror.c:52 +#: lib/libx52/x52_strerror.c:32 msgid "Access denied" msgstr "Accessay eniedday" -#: lib/libx52/x52_strerror.c:55 +#: lib/libx52/x52_strerror.c:33 msgid "No such device" msgstr "Onay uchsay eviceday" -#: lib/libx52/x52_strerror.c:58 +#: lib/libx52/x52_strerror.c:34 msgid "Entity not found" msgstr "Entityay otnay oundfay" -#: lib/libx52/x52_strerror.c:61 +#: lib/libx52/x52_strerror.c:35 msgid "Resource busy" msgstr "Esourceray usybay" -#: lib/libx52/x52_strerror.c:64 +#: lib/libx52/x52_strerror.c:36 msgid "Operation timeout" msgstr "Operationay imeouttay" -#: lib/libx52/x52_strerror.c:67 +#: lib/libx52/x52_strerror.c:37 msgid "Overflow" msgstr "Overfloway" -#: lib/libx52/x52_strerror.c:70 +#: lib/libx52/x52_strerror.c:38 msgid "Pipe error" msgstr "Ipepay erroray" -#: lib/libx52/x52_strerror.c:73 +#: lib/libx52/x52_strerror.c:39 msgid "System call interrupted" msgstr "Ystemsay allcay interrupteday" -#: lib/libx52/x52_strerror.c:77 lib/libx52io/io_strings.c:125 +#: lib/libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "Unknownay erroray %d" -#: lib/libx52io/io_strings.c:110 +#: lib/libx52io/io_strings.c:103 msgid "No device" msgstr "Onay eviceday" -#: lib/libx52io/io_strings.c:113 +#: lib/libx52io/io_strings.c:104 msgid "Invalid arguments" msgstr "Invaliday argumentsay" -#: lib/libx52io/io_strings.c:116 +#: lib/libx52io/io_strings.c:105 msgid "Connection failure" msgstr "Onnectioncay ailurefay" -#: lib/libx52io/io_strings.c:119 +#: lib/libx52io/io_strings.c:106 msgid "I/O error" msgstr "I/O erroray" -#: lib/libx52io/io_strings.c:122 +#: lib/libx52io/io_strings.c:107 msgid "Read timeout" msgstr "Eadray imeouttay" From 018852a0120df96d76da910303cc330368f9e8fb Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 02:00:39 -0700 Subject: [PATCH 45/68] Add stringification functions to libx52 --- lib/libx52/Makefile.am | 6 +- lib/libx52/libx52.h | 60 ++++++++++++++++ lib/libx52/x52_stringify.c | 96 +++++++++++++++++++++++++ po/POTFILES.in | 1 + po/x52pro-linux.pot | 139 +++++++++++++++++++++++++++++++----- po/xx_PL.po | 141 ++++++++++++++++++++++++++++++++----- 6 files changed, 405 insertions(+), 38 deletions(-) create mode 100644 lib/libx52/x52_stringify.c diff --git a/lib/libx52/Makefile.am b/lib/libx52/Makefile.am index 01230d7..1d9e83e 100644 --- a/lib/libx52/Makefile.am +++ b/lib/libx52/Makefile.am @@ -12,11 +12,11 @@ lib_LTLIBRARIES = libx52.la # This library handles the USB communication between the host and the X52 # Libtool Version Info # See: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -libx52_v_CUR=5 -libx52_v_AGE=3 +libx52_v_CUR=6 +libx52_v_AGE=4 libx52_v_REV=0 libx52_la_SOURCES = x52_control.c x52_core.c x52_date_time.c x52_mfd_led.c \ - x52_strerror.c + x52_strerror.c x52_stringify.c libx52_la_CFLAGS = @LIBUSB_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" -I $(top_srcdir) $(WARN_CFLAGS) libx52_la_LDFLAGS = \ -export-symbols-regex '^libx52_' \ diff --git a/lib/libx52/libx52.h b/lib/libx52/libx52.h index 05c7060..0df2464 100644 --- a/lib/libx52/libx52.h +++ b/lib/libx52/libx52.h @@ -673,6 +673,16 @@ int libx52_vendor_command(libx52_device *x52, uint16_t index, uint16_t value); */ int libx52_check_feature(libx52_device *x52, libx52_feature feature); +/** @} */ + +/** + * @defgroup libx52str Stringification + * + * Translation APIs from enumerations to string, primarily for logging. + * + * @{ + */ + /** * @brief Return a string representation of the error code * @@ -683,6 +693,56 @@ int libx52_check_feature(libx52_device *x52, libx52_feature feature); */ const char * libx52_strerror(libx52_error_code error); +/** + * @brief Returns a string representation of the clock ID + * + * @param[in] id Clock ID + * + * @returns Pointer to a NULL terminated string describing the clock ID. + * Returned pointer must not be freed. + */ +const char * libx52_str_clock_id(libx52_clock_id id); + +/** + * @brief Returns a string representation of the clock format + * + * @param[in] format Clock format + * + * @returns Pointer to a NULL terminated string describing the clock format. + * Returned pointer must not be freed. + */ +const char * libx52_str_clock_format(libx52_clock_format format); + +/** + * @brief Returns a string representation of the date format + * + * @param[in] format Date format + * + * @returns Pointer to a NULL terminated string describing the date format. + * Returned pointer must not be freed. + */ +const char * libx52_str_date_format(libx52_date_format format); + +/** + * @brief Returns a string representation of the LED + * + * @param[in] id LED ID + * + * @returns Pointer to a NULL terminated string describing the LED. + * Returned pointer must not be freed. + */ +const char * libx52_str_led_id(libx52_led_id id); + +/** + * @brief Returns a string representation of the LED state + * + * @param[in] state LED state + * + * @returns Pointer to a NULL terminated string describing the LED state. + * Returned pointer must not be freed. + */ +const char * libx52_str_led_state(libx52_led_state state); + /** @} */ #ifdef __cplusplus diff --git a/lib/libx52/x52_stringify.c b/lib/libx52/x52_stringify.c new file mode 100644 index 0000000..f86dc9c --- /dev/null +++ b/lib/libx52/x52_stringify.c @@ -0,0 +1,96 @@ +/* + * Saitek X52 Pro MFD & LED driver - stringification + * + * Copyright (C) 2012-2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include "config.h" +#include + +#include "libx52.h" +#include "gettext.h" + +#define N_(str) gettext_noop(str) +#define _(str) dgettext(PACKAGE, str) + +#define STRINGIFY(name, max_id, errstr, ...) \ +const char * libx52_str_ ## name (libx52_ ## name param) { \ + static char invalid[256]; \ + static const char *desc[] = { __VA_ARGS__ }; \ + if (param >= 0 && param <= max_id) { \ + return _(desc[param]); \ + } \ + snprintf(invalid, sizeof(invalid), _(errstr), param); \ + return invalid; \ +} + +STRINGIFY(clock_id, LIBX52_CLOCK_3, N_("Unknown clock ID %d"), + N_("primary"), + N_("secondary"), + N_("tertiary"), +) + +STRINGIFY(clock_format, LIBX52_CLOCK_FORMAT_24HR, N_("Unknown clock format %d"), + N_("12 hour"), + N_("24 hour"), +) + +STRINGIFY(date_format, LIBX52_DATE_FORMAT_YYMMDD, N_("Unknown date format %d"), + N_("DD-MM-YY"), + N_("MM-DD-YY"), + N_("YY-MM-DD"), +) + +STRINGIFY(led_state, LIBX52_LED_STATE_GREEN, N_("Unknown LED state %d") + N_("off"), + N_("on"), + N_("red"), + N_("amber"), + N_("green"), +) + +const char * libx52_str_led_id(libx52_led_id id) +{ + static char invalid[256]; + + switch (id) { + case LIBX52_LED_FIRE: + return _("Fire"); + + case LIBX52_LED_A: + return _("A"); + + case LIBX52_LED_B: + return _("B"); + + case LIBX52_LED_D: + return _("D"); + + case LIBX52_LED_E: + return _("E"); + + case LIBX52_LED_T1: + return _("T1"); + + case LIBX52_LED_T2: + return _("T2"); + + case LIBX52_LED_T3: + return _("T3"); + + case LIBX52_LED_POV: + return _("POV"); + + case LIBX52_LED_CLUTCH: + return _("Clutch"); + + case LIBX52_LED_THROTTLE: + return _("Throttle"); + + default: + snprintf(invalid, sizeof(invalid), _("Unknown LED ID %d"), id); + return invalid; + } +} diff --git a/po/POTFILES.in b/po/POTFILES.in index 20b29c4..534f9f1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,6 @@ # List of source files which contain translatable strings. lib/libx52/x52_strerror.c +lib/libx52/x52_stringify.c lib/libx52io/io_strings.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index fd37347..08770e5 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 01:34-0700\n" +"POT-Creation-Date: 2021-07-27 01:56-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -90,6 +90,127 @@ msgstr "" msgid "Unknown error %d" msgstr "" +#: lib/libx52/x52_stringify.c:29 +#, c-format +msgid "Unknown clock ID %d" +msgstr "" + +#: lib/libx52/x52_stringify.c:30 +msgid "primary" +msgstr "" + +#: lib/libx52/x52_stringify.c:31 +msgid "secondary" +msgstr "" + +#: lib/libx52/x52_stringify.c:32 +msgid "tertiary" +msgstr "" + +#: lib/libx52/x52_stringify.c:35 +#, c-format +msgid "Unknown clock format %d" +msgstr "" + +#: lib/libx52/x52_stringify.c:36 daemon/x52d_clock.c:124 +msgid "12 hour" +msgstr "" + +#: lib/libx52/x52_stringify.c:37 daemon/x52d_clock.c:124 +msgid "24 hour" +msgstr "" + +#: lib/libx52/x52_stringify.c:40 +#, c-format +msgid "Unknown date format %d" +msgstr "" + +#: lib/libx52/x52_stringify.c:41 +msgid "DD-MM-YY" +msgstr "" + +#: lib/libx52/x52_stringify.c:42 +msgid "MM-DD-YY" +msgstr "" + +#: lib/libx52/x52_stringify.c:43 +msgid "YY-MM-DD" +msgstr "" + +#: lib/libx52/x52_stringify.c:46 +#, c-format +msgid "Unknown LED state %d" +msgstr "" + +#: lib/libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 +msgid "off" +msgstr "" + +#: lib/libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 +msgid "on" +msgstr "" + +#: lib/libx52/x52_stringify.c:49 +msgid "red" +msgstr "" + +#: lib/libx52/x52_stringify.c:50 +msgid "amber" +msgstr "" + +#: lib/libx52/x52_stringify.c:51 +msgid "green" +msgstr "" + +#: lib/libx52/x52_stringify.c:60 +msgid "Fire" +msgstr "" + +#: lib/libx52/x52_stringify.c:63 +msgid "A" +msgstr "" + +#: lib/libx52/x52_stringify.c:66 +msgid "B" +msgstr "" + +#: lib/libx52/x52_stringify.c:69 +msgid "D" +msgstr "" + +#: lib/libx52/x52_stringify.c:72 +msgid "E" +msgstr "" + +#: lib/libx52/x52_stringify.c:75 +msgid "T1" +msgstr "" + +#: lib/libx52/x52_stringify.c:78 +msgid "T2" +msgstr "" + +#: lib/libx52/x52_stringify.c:81 +msgid "T3" +msgstr "" + +#: lib/libx52/x52_stringify.c:84 +msgid "POV" +msgstr "" + +#: lib/libx52/x52_stringify.c:87 +msgid "Clutch" +msgstr "" + +#: lib/libx52/x52_stringify.c:90 +msgid "Throttle" +msgstr "" + +#: lib/libx52/x52_stringify.c:93 +#, c-format +msgid "Unknown LED ID %d" +msgstr "" + #: lib/libx52io/io_strings.c:103 msgid "No device" msgstr "" @@ -436,14 +557,6 @@ msgstr "" msgid "Setting clock enable to %s" msgstr "" -#: daemon/x52d_clock.c:28 -msgid "on" -msgstr "" - -#: daemon/x52d_clock.c:28 -msgid "off" -msgstr "" - #: daemon/x52d_clock.c:34 #, c-format msgid "Setting primary clock timezone to %s" @@ -475,14 +588,6 @@ msgstr "" msgid "Setting %s clock format to %s" msgstr "" -#: daemon/x52d_clock.c:124 -msgid "12 hour" -msgstr "" - -#: daemon/x52d_clock.c:124 -msgid "24 hour" -msgstr "" - #: daemon/x52d_clock.c:150 #, c-format msgid "Setting date format to %s" diff --git a/po/xx_PL.po b/po/xx_PL.po index e685523..ba964ef 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 01:34-0700\n" -"PO-Revision-Date: 2021-07-26 11:00-0700\n" +"POT-Creation-Date: 2021-07-27 01:56-0700\n" +"PO-Revision-Date: 2021-07-27 01:59-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" @@ -90,6 +90,127 @@ msgstr "Ystemsay allcay interrupteday" msgid "Unknown error %d" msgstr "Unknownay erroray %d" +#: lib/libx52/x52_stringify.c:29 +#, c-format +msgid "Unknown clock ID %d" +msgstr "Unknownay ockclay IDay %d" + +#: lib/libx52/x52_stringify.c:30 +msgid "primary" +msgstr "imarypray" + +#: lib/libx52/x52_stringify.c:31 +msgid "secondary" +msgstr "econdarysay" + +#: lib/libx52/x52_stringify.c:32 +msgid "tertiary" +msgstr "ertiarytay" + +#: lib/libx52/x52_stringify.c:35 +#, c-format +msgid "Unknown clock format %d" +msgstr "Unknownay ockclay ormatfay %d" + +#: lib/libx52/x52_stringify.c:36 daemon/x52d_clock.c:124 +msgid "12 hour" +msgstr "12 ourhay" + +#: lib/libx52/x52_stringify.c:37 daemon/x52d_clock.c:124 +msgid "24 hour" +msgstr "24 ourhay" + +#: lib/libx52/x52_stringify.c:40 +#, c-format +msgid "Unknown date format %d" +msgstr "Unknownay ateday ormatfay %d" + +#: lib/libx52/x52_stringify.c:41 +msgid "DD-MM-YY" +msgstr "DDay-MMay-YYay" + +#: lib/libx52/x52_stringify.c:42 +msgid "MM-DD-YY" +msgstr "MMay-DDay-YYay" + +#: lib/libx52/x52_stringify.c:43 +msgid "YY-MM-DD" +msgstr "YYay-MMay-DDay" + +#: lib/libx52/x52_stringify.c:46 +#, c-format +msgid "Unknown LED state %d" +msgstr "Unknownay EDLay atestay %d" + +#: lib/libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 +msgid "off" +msgstr "offay" + +#: lib/libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 +msgid "on" +msgstr "onay" + +#: lib/libx52/x52_stringify.c:49 +msgid "red" +msgstr "edray" + +#: lib/libx52/x52_stringify.c:50 +msgid "amber" +msgstr "amberay" + +#: lib/libx52/x52_stringify.c:51 +msgid "green" +msgstr "eengray" + +#: lib/libx52/x52_stringify.c:60 +msgid "Fire" +msgstr "Irefay" + +#: lib/libx52/x52_stringify.c:63 +msgid "A" +msgstr "Ay" + +#: lib/libx52/x52_stringify.c:66 +msgid "B" +msgstr "Bay" + +#: lib/libx52/x52_stringify.c:69 +msgid "D" +msgstr "Day" + +#: lib/libx52/x52_stringify.c:72 +msgid "E" +msgstr "Eay" + +#: lib/libx52/x52_stringify.c:75 +msgid "T1" +msgstr "Tay1" + +#: lib/libx52/x52_stringify.c:78 +msgid "T2" +msgstr "Tay2" + +#: lib/libx52/x52_stringify.c:81 +msgid "T3" +msgstr "Tay3" + +#: lib/libx52/x52_stringify.c:84 +msgid "POV" +msgstr "OVPay" + +#: lib/libx52/x52_stringify.c:87 +msgid "Clutch" +msgstr "Utchclay" + +#: lib/libx52/x52_stringify.c:90 +msgid "Throttle" +msgstr "Ottlethray" + +#: lib/libx52/x52_stringify.c:93 +#, c-format +msgid "Unknown LED ID %d" +msgstr "Unknownay EDLay IDay %d" + #: lib/libx52io/io_strings.c:103 msgid "No device" msgstr "Onay eviceday" @@ -481,14 +602,6 @@ msgstr "Uttingshay ownday X52 aemonday" msgid "Setting clock enable to %s" msgstr "Ettingsay ockclay enableay otay %s" -#: daemon/x52d_clock.c:28 -msgid "on" -msgstr "onay" - -#: daemon/x52d_clock.c:28 -msgid "off" -msgstr "offay" - #: daemon/x52d_clock.c:34 #, c-format msgid "Setting primary clock timezone to %s" @@ -523,14 +636,6 @@ msgstr "Ettingsay ertiarytay ockclay imezonetay otay %s" msgid "Setting %s clock format to %s" msgstr "Ettingsay %s ockclay ormatfay otay %s" -#: daemon/x52d_clock.c:124 -msgid "12 hour" -msgstr "12 ourhay" - -#: daemon/x52d_clock.c:124 -msgid "24 hour" -msgstr "24 ourhay" - #: daemon/x52d_clock.c:150 #, c-format msgid "Setting date format to %s" From d003e7f7c4ea8234a1a0189bc7ccba316923be05 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 02:13:59 -0700 Subject: [PATCH 46/68] Make daemon use libx52 stringification functions --- daemon/x52d_clock.c | 35 ++++++++++++++++++----------------- daemon/x52d_const.h | 1 + daemon/x52d_led.c | 8 +++----- po/x52pro-linux.pot | 35 +++++++++++++++-------------------- po/xx_PL.po | 39 +++++++++++++++++---------------------- 5 files changed, 54 insertions(+), 64 deletions(-) diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index 174cd00..42dd684 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -31,7 +31,8 @@ void x52d_cfg_set_Clock_Enabled(bool enabled) void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) { - PINELOG_DEBUG(_("Setting primary clock timezone to %s"), + PINELOG_DEBUG(_("Setting %s clock timezone to %s"), + libx52_str_clock_id(LIBX52_CLOCK_1), param ? _("local") : _("UTC")); clock_primary_is_local = !!param; } @@ -106,48 +107,48 @@ cleanup: return offset; } +static void set_clock_offset(libx52_clock_id id, const char *param) +{ + PINELOG_DEBUG(_("Setting %s clock timezone to %s"), + libx52_str_clock_id(id), param); + x52d_dev_set_clock_timezone(id, get_tz_offset(param)); +} + void x52d_cfg_set_Clock_Secondary(char* param) { - PINELOG_DEBUG(("Setting secondary clock timezone to %s"), param); - x52d_dev_set_clock_timezone(LIBX52_CLOCK_2, get_tz_offset(param)); + set_clock_offset(LIBX52_CLOCK_2, param); } void x52d_cfg_set_Clock_Tertiary(char* param) { - PINELOG_DEBUG(_("Setting tertiary clock timezone to %s"), param); - x52d_dev_set_clock_timezone(LIBX52_CLOCK_3, get_tz_offset(param)); + set_clock_offset(LIBX52_CLOCK_3, param); } -static void set_clock_format(const char *name, libx52_clock_id id, libx52_clock_format fmt) +static void set_clock_format(libx52_clock_id id, libx52_clock_format fmt) { - PINELOG_DEBUG(_("Setting %s clock format to %s"), name, - fmt == LIBX52_CLOCK_FORMAT_12HR ? _("12 hour") : _("24 hour")); + PINELOG_DEBUG(_("Setting %s clock format to %s"), + libx52_str_clock_id(id), libx52_str_clock_format(fmt)); x52d_dev_set_clock_format(id, fmt); } void x52d_cfg_set_Clock_FormatPrimary(libx52_clock_format fmt) { - set_clock_format("primary", LIBX52_CLOCK_1, fmt); + set_clock_format(LIBX52_CLOCK_1, fmt); } void x52d_cfg_set_Clock_FormatSecondary(libx52_clock_format fmt) { - set_clock_format("secondary", LIBX52_CLOCK_2, fmt); + set_clock_format(LIBX52_CLOCK_2, fmt); } void x52d_cfg_set_Clock_FormatTertiary(libx52_clock_format fmt) { - set_clock_format("tertiary", LIBX52_CLOCK_3, fmt); + set_clock_format(LIBX52_CLOCK_3, fmt); } void x52d_cfg_set_Clock_DateFormat(libx52_date_format fmt) { - static const char *formats[] = { - "dd-mm-yy", - "mm-dd-yy", - "yy-mm-dd" - }; - PINELOG_DEBUG(_("Setting date format to %s"), formats[fmt]); + PINELOG_DEBUG(_("Setting date format to %s"), libx52_str_date_format(fmt)); x52d_dev_set_date_format(fmt); } diff --git a/daemon/x52d_const.h b/daemon/x52d_const.h index a77785f..f7702e5 100644 --- a/daemon/x52d_const.h +++ b/daemon/x52d_const.h @@ -16,6 +16,7 @@ #define X52D_SYS_CFG_FILE SYSCONFDIR "/" X52D_APP_NAME "/" X52D_APP_NAME ".conf" #include "gettext.h" +#define N_(x) gettext_noop(x) #define _(x) gettext(x) #endif // !defined X52D_CONST_H diff --git a/daemon/x52d_led.c b/daemon/x52d_led.c index cba170a..2c01559 100644 --- a/daemon/x52d_led.c +++ b/daemon/x52d_led.c @@ -18,12 +18,10 @@ #include "x52d_const.h" #include "x52d_device.h" -static const char *TRACE_led_states[] = { - "off", "on", "red", "amber", "green" -}; - #define SET_LED_STATE(led, state) \ - PINELOG_TRACE("Setting LED " #led " state to %s", TRACE_led_states[state]); \ + PINELOG_TRACE("Setting LED %s state to %s", \ + libx52_str_led_id(LIBX52_LED_ ## led), \ + libx52_str_led_state(state)); \ x52d_dev_set_led_state(LIBX52_LED_ ## led, state); void x52d_cfg_set_LED_Fire(libx52_led_state state) diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 08770e5..a17510f 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 01:56-0700\n" +"POT-Creation-Date: 2021-07-27 02:07-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -112,11 +112,11 @@ msgstr "" msgid "Unknown clock format %d" msgstr "" -#: lib/libx52/x52_stringify.c:36 daemon/x52d_clock.c:124 +#: lib/libx52/x52_stringify.c:36 msgid "12 hour" msgstr "" -#: lib/libx52/x52_stringify.c:37 daemon/x52d_clock.c:124 +#: lib/libx52/x52_stringify.c:37 msgid "24 hour" msgstr "" @@ -557,57 +557,52 @@ msgstr "" msgid "Setting clock enable to %s" msgstr "" -#: daemon/x52d_clock.c:34 +#: daemon/x52d_clock.c:34 daemon/x52d_clock.c:112 #, c-format -msgid "Setting primary clock timezone to %s" +msgid "Setting %s clock timezone to %s" msgstr "" -#: daemon/x52d_clock.c:35 +#: daemon/x52d_clock.c:36 msgid "local" msgstr "" -#: daemon/x52d_clock.c:35 +#: daemon/x52d_clock.c:36 msgid "UTC" msgstr "" -#: daemon/x52d_clock.c:52 +#: daemon/x52d_clock.c:53 msgid "Unable to allocate memory for timezone. Falling back to UTC" msgstr "" -#: daemon/x52d_clock.c:62 +#: daemon/x52d_clock.c:63 msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" -#: daemon/x52d_clock.c:117 -#, c-format -msgid "Setting tertiary clock timezone to %s" -msgstr "" - -#: daemon/x52d_clock.c:123 +#: daemon/x52d_clock.c:129 #, c-format msgid "Setting %s clock format to %s" msgstr "" -#: daemon/x52d_clock.c:150 +#: daemon/x52d_clock.c:151 #, c-format msgid "Setting date format to %s" msgstr "" -#: daemon/x52d_clock.c:160 +#: daemon/x52d_clock.c:161 msgid "Starting X52 clock manager thread" msgstr "" -#: daemon/x52d_clock.c:171 +#: daemon/x52d_clock.c:172 #, c-format msgid "Error %d retrieving current time: %s" msgstr "" -#: daemon/x52d_clock.c:192 +#: daemon/x52d_clock.c:193 #, c-format msgid "Error %d initializing clock thread: %s" msgstr "" -#: daemon/x52d_clock.c:199 +#: daemon/x52d_clock.c:200 msgid "Shutting down X52 clock manager thread" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index ba964ef..cebd7a2 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 01:56-0700\n" -"PO-Revision-Date: 2021-07-27 01:59-0700\n" +"POT-Creation-Date: 2021-07-27 02:07-0700\n" +"PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" "Language: xx_PL\n" @@ -112,11 +112,11 @@ msgstr "ertiarytay" msgid "Unknown clock format %d" msgstr "Unknownay ockclay ormatfay %d" -#: lib/libx52/x52_stringify.c:36 daemon/x52d_clock.c:124 +#: lib/libx52/x52_stringify.c:36 msgid "12 hour" msgstr "12 ourhay" -#: lib/libx52/x52_stringify.c:37 daemon/x52d_clock.c:124 +#: lib/libx52/x52_stringify.c:37 msgid "24 hour" msgstr "24 ourhay" @@ -602,60 +602,55 @@ msgstr "Uttingshay ownday X52 aemonday" msgid "Setting clock enable to %s" msgstr "Ettingsay ockclay enableay otay %s" -#: daemon/x52d_clock.c:34 +#: daemon/x52d_clock.c:34 daemon/x52d_clock.c:112 #, c-format -msgid "Setting primary clock timezone to %s" -msgstr "Ettingsay imarypray ockclay imezonetay otay %s" +msgid "Setting %s clock timezone to %s" +msgstr "Ettingsay %s ockclay imezonetay otay %s" -#: daemon/x52d_clock.c:35 +#: daemon/x52d_clock.c:36 msgid "local" msgstr "ocallay" -#: daemon/x52d_clock.c:35 +#: daemon/x52d_clock.c:36 msgid "UTC" msgstr "UTCay" -#: daemon/x52d_clock.c:52 +#: daemon/x52d_clock.c:53 msgid "Unable to allocate memory for timezone. Falling back to UTC" msgstr "" "Unableay otay allocateay emorymay orfay imezonetay. Allingfay ackbay otay " "UTCay" -#: daemon/x52d_clock.c:62 +#: daemon/x52d_clock.c:63 msgid "Unable to backup timezone environment. Falling back to UTC" msgstr "" "Unableay otay ackupbay imezonetay environmentay. Allingfay ackbay otay UTCay" -#: daemon/x52d_clock.c:117 -#, c-format -msgid "Setting tertiary clock timezone to %s" -msgstr "Ettingsay ertiarytay ockclay imezonetay otay %s" - -#: daemon/x52d_clock.c:123 +#: daemon/x52d_clock.c:129 #, c-format msgid "Setting %s clock format to %s" msgstr "Ettingsay %s ockclay ormatfay otay %s" -#: daemon/x52d_clock.c:150 +#: daemon/x52d_clock.c:151 #, c-format msgid "Setting date format to %s" msgstr "Ettingsay ateday ormatfay otay %s" -#: daemon/x52d_clock.c:160 +#: daemon/x52d_clock.c:161 msgid "Starting X52 clock manager thread" msgstr "Artingstay X52 ockclay anagermay eadthray" -#: daemon/x52d_clock.c:171 +#: daemon/x52d_clock.c:172 #, c-format msgid "Error %d retrieving current time: %s" msgstr "Erroray %d etrievingray urrentcay imetay: %s" -#: daemon/x52d_clock.c:192 +#: daemon/x52d_clock.c:193 #, c-format msgid "Error %d initializing clock thread: %s" msgstr "Erroray %d initializingay ockclay eadthray: %s" -#: daemon/x52d_clock.c:199 +#: daemon/x52d_clock.c:200 msgid "Shutting down X52 clock manager thread" msgstr "Uttingshay ownday X52 ockclay anagermay eadthray" From 386174d2a465fb3a68d7fff7377a1e4a25898a7c Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 02:18:35 -0700 Subject: [PATCH 47/68] Update package version --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8a075af..97ad0ec 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ # Autoconf settings for x52pro-linux # -# Copyright (C) 2012-2020 Nirenjan Krishnan (nirenjan@nirenjan.org) +# Copyright (C) 2012-2021 Nirenjan Krishnan (nirenjan@nirenjan.org) # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -AC_INIT([x52pro-linux], [0.2.1], [nirenjan@gmail.com]) +AC_INIT([x52pro-linux], [0.2.2], [nirenjan@gmail.com]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) AC_REQUIRE_AUX_FILE([tap-driver.sh]) From 009fba01513b7c8de58069fa693c861aa0decf6d Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 02:26:32 -0700 Subject: [PATCH 48/68] Install x52d.conf to sysconfdir --- daemon/Makefile.am | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 31120c8..0f8cb7d 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -29,13 +29,14 @@ x52d_LDFLAGS = @INIH_LIBS@ @PTHREAD_LIBS@ $(WARN_LDFLAGS) x52d_LDADD = \ ../lib/pinelog/libpinelog.la \ ../lib/libx52/libx52.la \ - ../lib/libx52io/libx52io.la \ @LTLIBINTL@ +x52dconfdir = @sysconfdir@/x52d +x52dconf_DATA = x52d.conf + EXTRA_DIST = \ x52d_clock.h \ x52d_config.def \ x52d_config.h \ x52d_const.h \ - x52d_device.h \ - x52d.conf + x52d_device.h From 50906b0a9212e367fce68769b0ef928f9708d672 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 03:07:52 -0700 Subject: [PATCH 49/68] Ensure x52d.conf is included in the distribution tarball --- daemon/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 0f8cb7d..836d918 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -39,4 +39,5 @@ EXTRA_DIST = \ x52d_config.def \ x52d_config.h \ x52d_const.h \ - x52d_device.h + x52d_device.h \ + x52d.conf From 06b8d15dda28e2b8e0628ce5e731be1f4fed4cff Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 09:34:57 -0700 Subject: [PATCH 50/68] Make stringification function names similar to libx52io --- daemon/x52d_clock.c | 8 ++++---- daemon/x52d_led.c | 4 ++-- lib/libx52/libx52.h | 10 +++++----- lib/libx52/x52_stringify.c | 4 ++-- po/x52pro-linux.pot | 4 ++-- po/xx_PL.po | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/daemon/x52d_clock.c b/daemon/x52d_clock.c index 42dd684..0958502 100644 --- a/daemon/x52d_clock.c +++ b/daemon/x52d_clock.c @@ -32,7 +32,7 @@ void x52d_cfg_set_Clock_Enabled(bool enabled) void x52d_cfg_set_Clock_PrimaryIsLocal(bool param) { PINELOG_DEBUG(_("Setting %s clock timezone to %s"), - libx52_str_clock_id(LIBX52_CLOCK_1), + libx52_clock_id_to_str(LIBX52_CLOCK_1), param ? _("local") : _("UTC")); clock_primary_is_local = !!param; } @@ -110,7 +110,7 @@ cleanup: static void set_clock_offset(libx52_clock_id id, const char *param) { PINELOG_DEBUG(_("Setting %s clock timezone to %s"), - libx52_str_clock_id(id), param); + libx52_clock_id_to_str(id), param); x52d_dev_set_clock_timezone(id, get_tz_offset(param)); } @@ -127,7 +127,7 @@ void x52d_cfg_set_Clock_Tertiary(char* param) static void set_clock_format(libx52_clock_id id, libx52_clock_format fmt) { PINELOG_DEBUG(_("Setting %s clock format to %s"), - libx52_str_clock_id(id), libx52_str_clock_format(fmt)); + libx52_clock_id_to_str(id), libx52_clock_format_to_str(fmt)); x52d_dev_set_clock_format(id, fmt); } @@ -148,7 +148,7 @@ void x52d_cfg_set_Clock_FormatTertiary(libx52_clock_format fmt) void x52d_cfg_set_Clock_DateFormat(libx52_date_format fmt) { - PINELOG_DEBUG(_("Setting date format to %s"), libx52_str_date_format(fmt)); + PINELOG_DEBUG(_("Setting date format to %s"), libx52_date_format_to_str(fmt)); x52d_dev_set_date_format(fmt); } diff --git a/daemon/x52d_led.c b/daemon/x52d_led.c index 2c01559..f24729f 100644 --- a/daemon/x52d_led.c +++ b/daemon/x52d_led.c @@ -20,8 +20,8 @@ #define SET_LED_STATE(led, state) \ PINELOG_TRACE("Setting LED %s state to %s", \ - libx52_str_led_id(LIBX52_LED_ ## led), \ - libx52_str_led_state(state)); \ + libx52_led_id_to_str(LIBX52_LED_ ## led), \ + libx52_led_state_to_str(state)); \ x52d_dev_set_led_state(LIBX52_LED_ ## led, state); void x52d_cfg_set_LED_Fire(libx52_led_state state) diff --git a/lib/libx52/libx52.h b/lib/libx52/libx52.h index 0df2464..94e4b4a 100644 --- a/lib/libx52/libx52.h +++ b/lib/libx52/libx52.h @@ -701,7 +701,7 @@ const char * libx52_strerror(libx52_error_code error); * @returns Pointer to a NULL terminated string describing the clock ID. * Returned pointer must not be freed. */ -const char * libx52_str_clock_id(libx52_clock_id id); +const char * libx52_clock_id_to_str(libx52_clock_id id); /** * @brief Returns a string representation of the clock format @@ -711,7 +711,7 @@ const char * libx52_str_clock_id(libx52_clock_id id); * @returns Pointer to a NULL terminated string describing the clock format. * Returned pointer must not be freed. */ -const char * libx52_str_clock_format(libx52_clock_format format); +const char * libx52_clock_format_to_str(libx52_clock_format format); /** * @brief Returns a string representation of the date format @@ -721,7 +721,7 @@ const char * libx52_str_clock_format(libx52_clock_format format); * @returns Pointer to a NULL terminated string describing the date format. * Returned pointer must not be freed. */ -const char * libx52_str_date_format(libx52_date_format format); +const char * libx52_date_format_to_str(libx52_date_format format); /** * @brief Returns a string representation of the LED @@ -731,7 +731,7 @@ const char * libx52_str_date_format(libx52_date_format format); * @returns Pointer to a NULL terminated string describing the LED. * Returned pointer must not be freed. */ -const char * libx52_str_led_id(libx52_led_id id); +const char * libx52_led_id_to_str(libx52_led_id id); /** * @brief Returns a string representation of the LED state @@ -741,7 +741,7 @@ const char * libx52_str_led_id(libx52_led_id id); * @returns Pointer to a NULL terminated string describing the LED state. * Returned pointer must not be freed. */ -const char * libx52_str_led_state(libx52_led_state state); +const char * libx52_led_state_to_str(libx52_led_state state); /** @} */ diff --git a/lib/libx52/x52_stringify.c b/lib/libx52/x52_stringify.c index f86dc9c..3daad2c 100644 --- a/lib/libx52/x52_stringify.c +++ b/lib/libx52/x52_stringify.c @@ -16,7 +16,7 @@ #define _(str) dgettext(PACKAGE, str) #define STRINGIFY(name, max_id, errstr, ...) \ -const char * libx52_str_ ## name (libx52_ ## name param) { \ +const char * libx52_ ## name ## _to_str (libx52_ ## name param) { \ static char invalid[256]; \ static const char *desc[] = { __VA_ARGS__ }; \ if (param >= 0 && param <= max_id) { \ @@ -51,7 +51,7 @@ STRINGIFY(led_state, LIBX52_LED_STATE_GREEN, N_("Unknown LED state %d") N_("green"), ) -const char * libx52_str_led_id(libx52_led_id id) +const char * libx52_led_id_to_str(libx52_led_id id) { static char invalid[256]; diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index a17510f..88ebb76 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: x52pro-linux 0.2.1\n" +"Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 02:07-0700\n" +"POT-Creation-Date: 2021-07-27 09:34-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/xx_PL.po b/po/xx_PL.po index cebd7a2..ba3f63d 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 02:07-0700\n" +"POT-Creation-Date: 2021-07-27 09:34-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" From 8db1be2ba8dc66d3abf69a8360990c659bf28f16 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 27 Jul 2021 17:02:49 -0700 Subject: [PATCH 51/68] 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 --- README.md | 7 ++++--- bench_pinelog.c | 3 ++- pinelog.h | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01923d6..c8423c2 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ a Git submodule or subtree. The default build of Pinelog uses an autotools generated `config.h` file, which includes checks for the following GCC attributes. If you don't care about these, then either create a dummy config.h which includes the macros -`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR` and `HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the -`AX_GCC_FUNC_ATTRIBUTE` macro to check for the `constructor` and `format` -attributes in your application's `configure.ac` file. +`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR`, `HAVE_FUNC_ATTRIBUTE_DESTRUCTOR` and +`HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the `AX_GCC_FUNC_ATTRIBUTE` macro to check +for the `constructor`, `destructor` and `format` attributes in your +application's `configure.ac` file. diff --git a/bench_pinelog.c b/bench_pinelog.c index e9d6b8b..419f61b 100644 --- a/bench_pinelog.c +++ b/bench_pinelog.c @@ -12,6 +12,7 @@ #include #include +#include #include #define BENCH_COUNT 100000 @@ -36,7 +37,7 @@ static void print_time_difference(const char *type, struct timespec *ts) tp_usec = timeper / 1000; tp_nsec = timeper % 1000; - printf("# %s %lu.%03lu\u03BCs/log (Total %lu.%09lds)\n", + printf("# %s %"PRIu64".%03"PRIu64"\u03BCs/log (Total %lu.%09lds)\n", type, tp_usec, tp_nsec, ret.tv_sec, ret.tv_nsec); } diff --git a/pinelog.h b/pinelog.h index dfd2b0c..b061922 100644 --- a/pinelog.h +++ b/pinelog.h @@ -165,11 +165,16 @@ void pinelog_log_message(int level, const char *file, int line, const char *fmt, } \ } while(0) +/* PINELOG_DISABLE_TRACE allows all traces to be compiled out */ +#ifndef PINELOG_DISABLE_TRACE #define PINELOG_TRACE(fmt, ...) do { \ if (PINELOG_LVL_TRACE <= pinelog_get_level()) { \ pinelog_log_message(PINELOG_LVL_TRACE, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \ } \ } while(0) +#else +#define PINELOG_TRACE(fmt, ...) do { } while(0) +#endif #ifdef __cplusplus } From 0eeab91a8d6e065a3e18dec3ad363027a66775ac Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 21:23:00 -0700 Subject: [PATCH 52/68] Remove libx52 as a dependency of libx52util --- lib/libx52util/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libx52util/Makefile.am b/lib/libx52util/Makefile.am index 739eca2..e5ac484 100644 --- a/lib/libx52util/Makefile.am +++ b/lib/libx52util/Makefile.am @@ -14,7 +14,6 @@ nodist_libx52util_la_SOURCES = util_char_map.c libx52util_la_SOURCES = x52_char_map_lookup.c libx52util_la_CFLAGS = -I $(top_srcdir)/lib/libx52 $(WARN_CFLAGS) libx52util_la_LDFLAGS = -version-info 1:0:0 $(WARN_LDFLAGS) -libx52util_la_LIBADD = ../libx52/libx52.la # Header files that need to be copied x52includedir = $(includedir)/libx52 From e3bccd3ac35f4915c1a88e0ddfbab5e5ac502282 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 21:36:54 -0700 Subject: [PATCH 53/68] Move libx52 to top level --- Makefile.am | 2 +- configure.ac | 5 +- daemon/Makefile.am | 4 +- lib/Makefile.am | 2 +- lib/libusbx52/Makefile.am | 2 +- lib/libx52util/Makefile.am | 2 +- {lib/libx52 => libx52}/Makefile.am | 0 {lib/libx52 => libx52}/README.md | 0 {lib/libx52 => libx52}/doc/caveats.dox | 0 {lib/libx52 => libx52}/doc/integration.dox | 0 {lib/libx52 => libx52}/doc/main.dox | 0 {lib/libx52 => libx52}/libx52.h | 0 {lib/libx52 => libx52}/libx52.pc.in | 0 {lib/libx52 => libx52}/x52_commands.h | 0 {lib/libx52 => libx52}/x52_common.h | 0 {lib/libx52 => libx52}/x52_control.c | 0 {lib/libx52 => libx52}/x52_core.c | 0 {lib/libx52 => libx52}/x52_date_time.c | 0 {lib/libx52 => libx52}/x52_mfd_led.c | 0 {lib/libx52 => libx52}/x52_strerror.c | 0 {lib/libx52 => libx52}/x52_stringify.c | 0 {lib/libx52 => libx52}/x52_test_gen.py | 0 {lib/libx52 => libx52}/x52_tests.json | 0 po/POTFILES.in | 4 +- po/x52pro-linux.pot | 96 +++++++++++----------- po/xx_PL.po | 96 +++++++++++----------- utils/cli/Makefile.am | 4 +- utils/test/Makefile.am | 4 +- 28 files changed, 110 insertions(+), 111 deletions(-) rename {lib/libx52 => libx52}/Makefile.am (100%) rename {lib/libx52 => libx52}/README.md (100%) rename {lib/libx52 => libx52}/doc/caveats.dox (100%) rename {lib/libx52 => libx52}/doc/integration.dox (100%) rename {lib/libx52 => libx52}/doc/main.dox (100%) rename {lib/libx52 => libx52}/libx52.h (100%) rename {lib/libx52 => libx52}/libx52.pc.in (100%) rename {lib/libx52 => libx52}/x52_commands.h (100%) rename {lib/libx52 => libx52}/x52_common.h (100%) rename {lib/libx52 => libx52}/x52_control.c (100%) rename {lib/libx52 => libx52}/x52_core.c (100%) rename {lib/libx52 => libx52}/x52_date_time.c (100%) rename {lib/libx52 => libx52}/x52_mfd_led.c (100%) rename {lib/libx52 => libx52}/x52_strerror.c (100%) rename {lib/libx52 => libx52}/x52_stringify.c (100%) rename {lib/libx52 => libx52}/x52_test_gen.py (100%) rename {lib/libx52 => libx52}/x52_tests.json (100%) diff --git a/Makefile.am b/Makefile.am index 94137ed..437e828 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) lib utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 lib utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 97ad0ec..7d2ab79 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,6 @@ AC_SUBST([INIH_LIBS]) # Pinelog configuration AC_SUBST([PINELOG_CFLAGS], ["-DPINELOG_SHOW_DATE=1 -DPINELOG_SHOW_LEVEL=1 -DPINELOG_SHOW_BACKTRACE=1"]) -AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"]) # Check for hidapi. This uses a different pkg-config file on Linux vs other # hosts, so check accordingly @@ -125,8 +124,8 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ po/Makefile.in Makefile lib/Makefile - lib/libx52/Makefile - lib/libx52/libx52.pc + libx52/Makefile + libx52/libx52.pc lib/libusbx52/Makefile lib/libx52util/Makefile lib/libx52io/Makefile diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 836d918..a6638c4 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -16,7 +16,7 @@ x52d_SOURCES = \ x52d_CFLAGS = \ -I $(top_srcdir) \ -I $(top_srcdir)/lib/libx52io \ - -I $(top_srcdir)/lib/libx52 \ + -I $(top_srcdir)/libx52 \ -I $(top_srcdir)/lib/libx52util \ -I $(top_srcdir)/lib/pinelog \ -DSYSCONFDIR=\"$(sysconfdir)\" \ @@ -28,7 +28,7 @@ x52d_CFLAGS = \ x52d_LDFLAGS = @INIH_LIBS@ @PTHREAD_LIBS@ $(WARN_LDFLAGS) x52d_LDADD = \ ../lib/pinelog/libpinelog.la \ - ../lib/libx52/libx52.la \ + ../libx52/libx52.la \ @LTLIBINTL@ x52dconfdir = @sysconfdir@/x52d diff --git a/lib/Makefile.am b/lib/Makefile.am index 592e83f..bcc95fe 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = libx52 libx52util libusbx52 libx52io pinelog +SUBDIRS = libx52util libusbx52 libx52io pinelog diff --git a/lib/libusbx52/Makefile.am b/lib/libusbx52/Makefile.am index 6b0b4e1..4fdb6f7 100644 --- a/lib/libusbx52/Makefile.am +++ b/lib/libusbx52/Makefile.am @@ -26,7 +26,7 @@ x52test_create_device_list_CFLAGS = @LIBUSB_CFLAGS@ $(WARN_CFLAGS) x52test_create_device_list_LDFLAGS = $(WARN_LDFLAGS) x52test_log_actions_SOURCES = util/log_actions.c $(libusbx52_la_SOURCES) -x52test_log_actions_CFLAGS = @X52_INCLUDE@ @LIBUSB_CFLAGS@ $(WARN_CFLAGS) +x52test_log_actions_CFLAGS = -I $(top_srcdir)/libx52 @LIBUSB_CFLAGS@ $(WARN_CFLAGS) x52test_log_actions_LDFLAGS = $(WARN_LDFLAGS) EXTRA_DIST = README.md libusbx52.h diff --git a/lib/libx52util/Makefile.am b/lib/libx52util/Makefile.am index e5ac484..63d9bf2 100644 --- a/lib/libx52util/Makefile.am +++ b/lib/libx52util/Makefile.am @@ -12,7 +12,7 @@ lib_LTLIBRARIES = libx52util.la # This library provides extra utilities for ease of use nodist_libx52util_la_SOURCES = util_char_map.c libx52util_la_SOURCES = x52_char_map_lookup.c -libx52util_la_CFLAGS = -I $(top_srcdir)/lib/libx52 $(WARN_CFLAGS) +libx52util_la_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) libx52util_la_LDFLAGS = -version-info 1:0:0 $(WARN_LDFLAGS) # Header files that need to be copied diff --git a/lib/libx52/Makefile.am b/libx52/Makefile.am similarity index 100% rename from lib/libx52/Makefile.am rename to libx52/Makefile.am diff --git a/lib/libx52/README.md b/libx52/README.md similarity index 100% rename from lib/libx52/README.md rename to libx52/README.md diff --git a/lib/libx52/doc/caveats.dox b/libx52/doc/caveats.dox similarity index 100% rename from lib/libx52/doc/caveats.dox rename to libx52/doc/caveats.dox diff --git a/lib/libx52/doc/integration.dox b/libx52/doc/integration.dox similarity index 100% rename from lib/libx52/doc/integration.dox rename to libx52/doc/integration.dox diff --git a/lib/libx52/doc/main.dox b/libx52/doc/main.dox similarity index 100% rename from lib/libx52/doc/main.dox rename to libx52/doc/main.dox diff --git a/lib/libx52/libx52.h b/libx52/libx52.h similarity index 100% rename from lib/libx52/libx52.h rename to libx52/libx52.h diff --git a/lib/libx52/libx52.pc.in b/libx52/libx52.pc.in similarity index 100% rename from lib/libx52/libx52.pc.in rename to libx52/libx52.pc.in diff --git a/lib/libx52/x52_commands.h b/libx52/x52_commands.h similarity index 100% rename from lib/libx52/x52_commands.h rename to libx52/x52_commands.h diff --git a/lib/libx52/x52_common.h b/libx52/x52_common.h similarity index 100% rename from lib/libx52/x52_common.h rename to libx52/x52_common.h diff --git a/lib/libx52/x52_control.c b/libx52/x52_control.c similarity index 100% rename from lib/libx52/x52_control.c rename to libx52/x52_control.c diff --git a/lib/libx52/x52_core.c b/libx52/x52_core.c similarity index 100% rename from lib/libx52/x52_core.c rename to libx52/x52_core.c diff --git a/lib/libx52/x52_date_time.c b/libx52/x52_date_time.c similarity index 100% rename from lib/libx52/x52_date_time.c rename to libx52/x52_date_time.c diff --git a/lib/libx52/x52_mfd_led.c b/libx52/x52_mfd_led.c similarity index 100% rename from lib/libx52/x52_mfd_led.c rename to libx52/x52_mfd_led.c diff --git a/lib/libx52/x52_strerror.c b/libx52/x52_strerror.c similarity index 100% rename from lib/libx52/x52_strerror.c rename to libx52/x52_strerror.c diff --git a/lib/libx52/x52_stringify.c b/libx52/x52_stringify.c similarity index 100% rename from lib/libx52/x52_stringify.c rename to libx52/x52_stringify.c diff --git a/lib/libx52/x52_test_gen.py b/libx52/x52_test_gen.py similarity index 100% rename from lib/libx52/x52_test_gen.py rename to libx52/x52_test_gen.py diff --git a/lib/libx52/x52_tests.json b/libx52/x52_tests.json similarity index 100% rename from lib/libx52/x52_tests.json rename to libx52/x52_tests.json diff --git a/po/POTFILES.in b/po/POTFILES.in index 534f9f1..a1a0dad 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ # List of source files which contain translatable strings. -lib/libx52/x52_strerror.c -lib/libx52/x52_stringify.c +libx52/x52_strerror.c +libx52/x52_stringify.c lib/libx52io/io_strings.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 88ebb76..d0c1964 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 09:34-0700\n" +"POT-Creation-Date: 2021-07-29 21:40-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,196 +17,196 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: lib/libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 +#: libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 msgid "Success" msgstr "" -#: lib/libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 +#: libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "" -#: lib/libx52/x52_strerror.c:25 +#: libx52/x52_strerror.c:25 msgid "Insufficient memory" msgstr "" -#: lib/libx52/x52_strerror.c:26 +#: libx52/x52_strerror.c:26 msgid "Invalid parameter" msgstr "" -#: lib/libx52/x52_strerror.c:27 +#: libx52/x52_strerror.c:27 msgid "Operation not supported" msgstr "" -#: lib/libx52/x52_strerror.c:28 +#: libx52/x52_strerror.c:28 msgid "Try again" msgstr "" -#: lib/libx52/x52_strerror.c:29 +#: libx52/x52_strerror.c:29 msgid "Input parameter out of range" msgstr "" -#: lib/libx52/x52_strerror.c:30 +#: libx52/x52_strerror.c:30 msgid "USB transaction failure" msgstr "" -#: lib/libx52/x52_strerror.c:31 +#: libx52/x52_strerror.c:31 msgid "USB input/output error" msgstr "" -#: lib/libx52/x52_strerror.c:32 +#: libx52/x52_strerror.c:32 msgid "Access denied" msgstr "" -#: lib/libx52/x52_strerror.c:33 +#: libx52/x52_strerror.c:33 msgid "No such device" msgstr "" -#: lib/libx52/x52_strerror.c:34 +#: libx52/x52_strerror.c:34 msgid "Entity not found" msgstr "" -#: lib/libx52/x52_strerror.c:35 +#: libx52/x52_strerror.c:35 msgid "Resource busy" msgstr "" -#: lib/libx52/x52_strerror.c:36 +#: libx52/x52_strerror.c:36 msgid "Operation timeout" msgstr "" -#: lib/libx52/x52_strerror.c:37 +#: libx52/x52_strerror.c:37 msgid "Overflow" msgstr "" -#: lib/libx52/x52_strerror.c:38 +#: libx52/x52_strerror.c:38 msgid "Pipe error" msgstr "" -#: lib/libx52/x52_strerror.c:39 +#: libx52/x52_strerror.c:39 msgid "System call interrupted" msgstr "" -#: lib/libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 +#: libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "" -#: lib/libx52/x52_stringify.c:29 +#: libx52/x52_stringify.c:29 #, c-format msgid "Unknown clock ID %d" msgstr "" -#: lib/libx52/x52_stringify.c:30 +#: libx52/x52_stringify.c:30 msgid "primary" msgstr "" -#: lib/libx52/x52_stringify.c:31 +#: libx52/x52_stringify.c:31 msgid "secondary" msgstr "" -#: lib/libx52/x52_stringify.c:32 +#: libx52/x52_stringify.c:32 msgid "tertiary" msgstr "" -#: lib/libx52/x52_stringify.c:35 +#: libx52/x52_stringify.c:35 #, c-format msgid "Unknown clock format %d" msgstr "" -#: lib/libx52/x52_stringify.c:36 +#: libx52/x52_stringify.c:36 msgid "12 hour" msgstr "" -#: lib/libx52/x52_stringify.c:37 +#: libx52/x52_stringify.c:37 msgid "24 hour" msgstr "" -#: lib/libx52/x52_stringify.c:40 +#: libx52/x52_stringify.c:40 #, c-format msgid "Unknown date format %d" msgstr "" -#: lib/libx52/x52_stringify.c:41 +#: libx52/x52_stringify.c:41 msgid "DD-MM-YY" msgstr "" -#: lib/libx52/x52_stringify.c:42 +#: libx52/x52_stringify.c:42 msgid "MM-DD-YY" msgstr "" -#: lib/libx52/x52_stringify.c:43 +#: libx52/x52_stringify.c:43 msgid "YY-MM-DD" msgstr "" -#: lib/libx52/x52_stringify.c:46 +#: libx52/x52_stringify.c:46 #, c-format msgid "Unknown LED state %d" msgstr "" -#: lib/libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 +#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 msgid "off" msgstr "" -#: lib/libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 +#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 msgid "on" msgstr "" -#: lib/libx52/x52_stringify.c:49 +#: libx52/x52_stringify.c:49 msgid "red" msgstr "" -#: lib/libx52/x52_stringify.c:50 +#: libx52/x52_stringify.c:50 msgid "amber" msgstr "" -#: lib/libx52/x52_stringify.c:51 +#: libx52/x52_stringify.c:51 msgid "green" msgstr "" -#: lib/libx52/x52_stringify.c:60 +#: libx52/x52_stringify.c:60 msgid "Fire" msgstr "" -#: lib/libx52/x52_stringify.c:63 +#: libx52/x52_stringify.c:63 msgid "A" msgstr "" -#: lib/libx52/x52_stringify.c:66 +#: libx52/x52_stringify.c:66 msgid "B" msgstr "" -#: lib/libx52/x52_stringify.c:69 +#: libx52/x52_stringify.c:69 msgid "D" msgstr "" -#: lib/libx52/x52_stringify.c:72 +#: libx52/x52_stringify.c:72 msgid "E" msgstr "" -#: lib/libx52/x52_stringify.c:75 +#: libx52/x52_stringify.c:75 msgid "T1" msgstr "" -#: lib/libx52/x52_stringify.c:78 +#: libx52/x52_stringify.c:78 msgid "T2" msgstr "" -#: lib/libx52/x52_stringify.c:81 +#: libx52/x52_stringify.c:81 msgid "T3" msgstr "" -#: lib/libx52/x52_stringify.c:84 +#: libx52/x52_stringify.c:84 msgid "POV" msgstr "" -#: lib/libx52/x52_stringify.c:87 +#: libx52/x52_stringify.c:87 msgid "Clutch" msgstr "" -#: lib/libx52/x52_stringify.c:90 +#: libx52/x52_stringify.c:90 msgid "Throttle" msgstr "" -#: lib/libx52/x52_stringify.c:93 +#: libx52/x52_stringify.c:93 #, c-format msgid "Unknown LED ID %d" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index ba3f63d..08b4759 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-27 09:34-0700\n" +"POT-Creation-Date: 2021-07-29 21:40-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -17,196 +17,196 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" -#: lib/libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 +#: libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 msgid "Success" msgstr "Uccesssay" -#: lib/libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 +#: libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "Initializationay ailurefay" -#: lib/libx52/x52_strerror.c:25 +#: libx52/x52_strerror.c:25 msgid "Insufficient memory" msgstr "Insufficientay emorymay" -#: lib/libx52/x52_strerror.c:26 +#: libx52/x52_strerror.c:26 msgid "Invalid parameter" msgstr "Invaliday arameterpay" -#: lib/libx52/x52_strerror.c:27 +#: libx52/x52_strerror.c:27 msgid "Operation not supported" msgstr "Operationay otnay upportedsay" -#: lib/libx52/x52_strerror.c:28 +#: libx52/x52_strerror.c:28 msgid "Try again" msgstr "Ytray againay" -#: lib/libx52/x52_strerror.c:29 +#: libx52/x52_strerror.c:29 msgid "Input parameter out of range" msgstr "Inputay arameterpay outay ofay angeray" -#: lib/libx52/x52_strerror.c:30 +#: libx52/x52_strerror.c:30 msgid "USB transaction failure" msgstr "USBay ansactiontray ailurefay" -#: lib/libx52/x52_strerror.c:31 +#: libx52/x52_strerror.c:31 msgid "USB input/output error" msgstr "USBay inputay/outputay erroray" -#: lib/libx52/x52_strerror.c:32 +#: libx52/x52_strerror.c:32 msgid "Access denied" msgstr "Accessay eniedday" -#: lib/libx52/x52_strerror.c:33 +#: libx52/x52_strerror.c:33 msgid "No such device" msgstr "Onay uchsay eviceday" -#: lib/libx52/x52_strerror.c:34 +#: libx52/x52_strerror.c:34 msgid "Entity not found" msgstr "Entityay otnay oundfay" -#: lib/libx52/x52_strerror.c:35 +#: libx52/x52_strerror.c:35 msgid "Resource busy" msgstr "Esourceray usybay" -#: lib/libx52/x52_strerror.c:36 +#: libx52/x52_strerror.c:36 msgid "Operation timeout" msgstr "Operationay imeouttay" -#: lib/libx52/x52_strerror.c:37 +#: libx52/x52_strerror.c:37 msgid "Overflow" msgstr "Overfloway" -#: lib/libx52/x52_strerror.c:38 +#: libx52/x52_strerror.c:38 msgid "Pipe error" msgstr "Ipepay erroray" -#: lib/libx52/x52_strerror.c:39 +#: libx52/x52_strerror.c:39 msgid "System call interrupted" msgstr "Ystemsay allcay interrupteday" -#: lib/libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 +#: libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "Unknownay erroray %d" -#: lib/libx52/x52_stringify.c:29 +#: libx52/x52_stringify.c:29 #, c-format msgid "Unknown clock ID %d" msgstr "Unknownay ockclay IDay %d" -#: lib/libx52/x52_stringify.c:30 +#: libx52/x52_stringify.c:30 msgid "primary" msgstr "imarypray" -#: lib/libx52/x52_stringify.c:31 +#: libx52/x52_stringify.c:31 msgid "secondary" msgstr "econdarysay" -#: lib/libx52/x52_stringify.c:32 +#: libx52/x52_stringify.c:32 msgid "tertiary" msgstr "ertiarytay" -#: lib/libx52/x52_stringify.c:35 +#: libx52/x52_stringify.c:35 #, c-format msgid "Unknown clock format %d" msgstr "Unknownay ockclay ormatfay %d" -#: lib/libx52/x52_stringify.c:36 +#: libx52/x52_stringify.c:36 msgid "12 hour" msgstr "12 ourhay" -#: lib/libx52/x52_stringify.c:37 +#: libx52/x52_stringify.c:37 msgid "24 hour" msgstr "24 ourhay" -#: lib/libx52/x52_stringify.c:40 +#: libx52/x52_stringify.c:40 #, c-format msgid "Unknown date format %d" msgstr "Unknownay ateday ormatfay %d" -#: lib/libx52/x52_stringify.c:41 +#: libx52/x52_stringify.c:41 msgid "DD-MM-YY" msgstr "DDay-MMay-YYay" -#: lib/libx52/x52_stringify.c:42 +#: libx52/x52_stringify.c:42 msgid "MM-DD-YY" msgstr "MMay-DDay-YYay" -#: lib/libx52/x52_stringify.c:43 +#: libx52/x52_stringify.c:43 msgid "YY-MM-DD" msgstr "YYay-MMay-DDay" -#: lib/libx52/x52_stringify.c:46 +#: libx52/x52_stringify.c:46 #, c-format msgid "Unknown LED state %d" msgstr "Unknownay EDLay atestay %d" -#: lib/libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 +#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:28 msgid "off" msgstr "offay" -#: lib/libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 +#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:28 msgid "on" msgstr "onay" -#: lib/libx52/x52_stringify.c:49 +#: libx52/x52_stringify.c:49 msgid "red" msgstr "edray" -#: lib/libx52/x52_stringify.c:50 +#: libx52/x52_stringify.c:50 msgid "amber" msgstr "amberay" -#: lib/libx52/x52_stringify.c:51 +#: libx52/x52_stringify.c:51 msgid "green" msgstr "eengray" -#: lib/libx52/x52_stringify.c:60 +#: libx52/x52_stringify.c:60 msgid "Fire" msgstr "Irefay" -#: lib/libx52/x52_stringify.c:63 +#: libx52/x52_stringify.c:63 msgid "A" msgstr "Ay" -#: lib/libx52/x52_stringify.c:66 +#: libx52/x52_stringify.c:66 msgid "B" msgstr "Bay" -#: lib/libx52/x52_stringify.c:69 +#: libx52/x52_stringify.c:69 msgid "D" msgstr "Day" -#: lib/libx52/x52_stringify.c:72 +#: libx52/x52_stringify.c:72 msgid "E" msgstr "Eay" -#: lib/libx52/x52_stringify.c:75 +#: libx52/x52_stringify.c:75 msgid "T1" msgstr "Tay1" -#: lib/libx52/x52_stringify.c:78 +#: libx52/x52_stringify.c:78 msgid "T2" msgstr "Tay2" -#: lib/libx52/x52_stringify.c:81 +#: libx52/x52_stringify.c:81 msgid "T3" msgstr "Tay3" -#: lib/libx52/x52_stringify.c:84 +#: libx52/x52_stringify.c:84 msgid "POV" msgstr "OVPay" -#: lib/libx52/x52_stringify.c:87 +#: libx52/x52_stringify.c:87 msgid "Clutch" msgstr "Utchclay" -#: lib/libx52/x52_stringify.c:90 +#: libx52/x52_stringify.c:90 msgid "Throttle" msgstr "Ottlethray" -#: lib/libx52/x52_stringify.c:93 +#: libx52/x52_stringify.c:93 #, c-format msgid "Unknown LED ID %d" msgstr "Unknownay EDLay IDay %d" diff --git a/utils/cli/Makefile.am b/utils/cli/Makefile.am index 9a47c61..17439ea 100644 --- a/utils/cli/Makefile.am +++ b/utils/cli/Makefile.am @@ -10,6 +10,6 @@ bin_PROGRAMS = x52cli # Command line utility that front ends the core library x52cli_SOURCES = x52_cli.c -x52cli_CFLAGS = @X52_INCLUDE@ $(WARN_CFLAGS) +x52cli_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) x52cli_LDFLAGS = $(WARN_LDFLAGS) -x52cli_LDADD = ../../lib/libx52/libx52.la +x52cli_LDADD = ../../libx52/libx52.la diff --git a/utils/test/Makefile.am b/utils/test/Makefile.am index a8c1e9c..d93be98 100644 --- a/utils/test/Makefile.am +++ b/utils/test/Makefile.am @@ -10,9 +10,9 @@ bin_PROGRAMS = x52test # Test utility that exercises all the library functions x52test_SOURCES = x52_test.c x52_test_mfd.c x52_test_led.c x52_test_clock.c -x52test_CFLAGS = @X52_INCLUDE@ -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) +x52test_CFLAGS = -I $(top_srcdir)/libx52 -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52test_LDFLAGS = $(WARN_LDFLAGS) -x52test_LDADD = ../../lib/libx52/libx52.la +x52test_LDADD = ../../libx52/libx52.la # Extra files that need to be in the distribution EXTRA_DIST = x52_test_common.h From 34adeaec456f1cca4fd0ec0eee7984822451aa43 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 21:47:07 -0700 Subject: [PATCH 54/68] Move libx52util to top level --- Makefile.am | 2 +- configure.ac | 2 +- daemon/Makefile.am | 2 +- lib/Makefile.am | 2 +- {lib/libx52util => libx52util}/Makefile.am | 0 {lib/libx52util => libx52util}/libx52util.h | 0 {lib/libx52util => libx52util}/x52_char_map.cfg | 0 {lib/libx52util => libx52util}/x52_char_map.h | 0 {lib/libx52util => libx52util}/x52_char_map_gen.py | 0 {lib/libx52util => libx52util}/x52_char_map_lookup.c | 0 10 files changed, 4 insertions(+), 4 deletions(-) rename {lib/libx52util => libx52util}/Makefile.am (100%) rename {lib/libx52util => libx52util}/libx52util.h (100%) rename {lib/libx52util => libx52util}/x52_char_map.cfg (100%) rename {lib/libx52util => libx52util}/x52_char_map.h (100%) rename {lib/libx52util => libx52util}/x52_char_map_gen.py (100%) rename {lib/libx52util => libx52util}/x52_char_map_lookup.c (100%) diff --git a/Makefile.am b/Makefile.am index 437e828..8d4a990 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 lib utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util lib utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 7d2ab79..72caabe 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_CONFIG_FILES([ po/Makefile.in libx52/Makefile libx52/libx52.pc lib/libusbx52/Makefile - lib/libx52util/Makefile + libx52util/Makefile lib/libx52io/Makefile lib/pinelog/Makefile udev/Makefile diff --git a/daemon/Makefile.am b/daemon/Makefile.am index a6638c4..ed5b30d 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -17,7 +17,7 @@ x52d_CFLAGS = \ -I $(top_srcdir) \ -I $(top_srcdir)/lib/libx52io \ -I $(top_srcdir)/libx52 \ - -I $(top_srcdir)/lib/libx52util \ + -I $(top_srcdir)/libx52util \ -I $(top_srcdir)/lib/pinelog \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLOCALEDIR=\"$(localedir)\" \ diff --git a/lib/Makefile.am b/lib/Makefile.am index bcc95fe..2e6e4d5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = libx52util libusbx52 libx52io pinelog +SUBDIRS = libusbx52 libx52io pinelog diff --git a/lib/libx52util/Makefile.am b/libx52util/Makefile.am similarity index 100% rename from lib/libx52util/Makefile.am rename to libx52util/Makefile.am diff --git a/lib/libx52util/libx52util.h b/libx52util/libx52util.h similarity index 100% rename from lib/libx52util/libx52util.h rename to libx52util/libx52util.h diff --git a/lib/libx52util/x52_char_map.cfg b/libx52util/x52_char_map.cfg similarity index 100% rename from lib/libx52util/x52_char_map.cfg rename to libx52util/x52_char_map.cfg diff --git a/lib/libx52util/x52_char_map.h b/libx52util/x52_char_map.h similarity index 100% rename from lib/libx52util/x52_char_map.h rename to libx52util/x52_char_map.h diff --git a/lib/libx52util/x52_char_map_gen.py b/libx52util/x52_char_map_gen.py similarity index 100% rename from lib/libx52util/x52_char_map_gen.py rename to libx52util/x52_char_map_gen.py diff --git a/lib/libx52util/x52_char_map_lookup.c b/libx52util/x52_char_map_lookup.c similarity index 100% rename from lib/libx52util/x52_char_map_lookup.c rename to libx52util/x52_char_map_lookup.c From 7f30863e5da9de104f202a430b542623dbe0110e Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 21:51:11 -0700 Subject: [PATCH 55/68] Move libx52io to top level --- Makefile.am | 2 +- configure.ac | 2 +- daemon/Makefile.am | 2 +- lib/Makefile.am | 2 +- {lib/libx52io => libx52io}/Makefile.am | 0 {lib/libx52io => libx52io}/io_axis.c | 0 {lib/libx52io => libx52io}/io_common.h | 0 {lib/libx52io => libx52io}/io_core.c | 0 {lib/libx52io => libx52io}/io_device.c | 0 {lib/libx52io => libx52io}/io_parser.c | 0 {lib/libx52io => libx52io}/io_strings.c | 0 {lib/libx52io => libx52io}/libx52io.h | 0 {lib/libx52io => libx52io}/test_axis.c | 0 {lib/libx52io => libx52io}/test_parser.c | 0 {lib/libx52io => libx52io}/test_parser_tests.c | 0 po/POTFILES.in | 2 +- po/x52pro-linux.pot | 18 +++++++++--------- po/xx_PL.po | 18 +++++++++--------- utils/evtest/Makefile.am | 4 ++-- 19 files changed, 25 insertions(+), 25 deletions(-) rename {lib/libx52io => libx52io}/Makefile.am (100%) rename {lib/libx52io => libx52io}/io_axis.c (100%) rename {lib/libx52io => libx52io}/io_common.h (100%) rename {lib/libx52io => libx52io}/io_core.c (100%) rename {lib/libx52io => libx52io}/io_device.c (100%) rename {lib/libx52io => libx52io}/io_parser.c (100%) rename {lib/libx52io => libx52io}/io_strings.c (100%) rename {lib/libx52io => libx52io}/libx52io.h (100%) rename {lib/libx52io => libx52io}/test_axis.c (100%) rename {lib/libx52io => libx52io}/test_parser.c (100%) rename {lib/libx52io => libx52io}/test_parser_tests.c (100%) diff --git a/Makefile.am b/Makefile.am index 8d4a990..cc29bee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util lib utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io lib utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 72caabe..4037f6d 100644 --- a/configure.ac +++ b/configure.ac @@ -128,7 +128,7 @@ AC_CONFIG_FILES([ po/Makefile.in libx52/libx52.pc lib/libusbx52/Makefile libx52util/Makefile - lib/libx52io/Makefile + libx52io/Makefile lib/pinelog/Makefile udev/Makefile udev/60-saitek-x52-x52pro.rules diff --git a/daemon/Makefile.am b/daemon/Makefile.am index ed5b30d..f26358c 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -15,7 +15,7 @@ x52d_SOURCES = \ x52d_CFLAGS = \ -I $(top_srcdir) \ - -I $(top_srcdir)/lib/libx52io \ + -I $(top_srcdir)/libx52io \ -I $(top_srcdir)/libx52 \ -I $(top_srcdir)/libx52util \ -I $(top_srcdir)/lib/pinelog \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 2e6e4d5..4cb87c4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = libusbx52 libx52io pinelog +SUBDIRS = libusbx52 pinelog diff --git a/lib/libx52io/Makefile.am b/libx52io/Makefile.am similarity index 100% rename from lib/libx52io/Makefile.am rename to libx52io/Makefile.am diff --git a/lib/libx52io/io_axis.c b/libx52io/io_axis.c similarity index 100% rename from lib/libx52io/io_axis.c rename to libx52io/io_axis.c diff --git a/lib/libx52io/io_common.h b/libx52io/io_common.h similarity index 100% rename from lib/libx52io/io_common.h rename to libx52io/io_common.h diff --git a/lib/libx52io/io_core.c b/libx52io/io_core.c similarity index 100% rename from lib/libx52io/io_core.c rename to libx52io/io_core.c diff --git a/lib/libx52io/io_device.c b/libx52io/io_device.c similarity index 100% rename from lib/libx52io/io_device.c rename to libx52io/io_device.c diff --git a/lib/libx52io/io_parser.c b/libx52io/io_parser.c similarity index 100% rename from lib/libx52io/io_parser.c rename to libx52io/io_parser.c diff --git a/lib/libx52io/io_strings.c b/libx52io/io_strings.c similarity index 100% rename from lib/libx52io/io_strings.c rename to libx52io/io_strings.c diff --git a/lib/libx52io/libx52io.h b/libx52io/libx52io.h similarity index 100% rename from lib/libx52io/libx52io.h rename to libx52io/libx52io.h diff --git a/lib/libx52io/test_axis.c b/libx52io/test_axis.c similarity index 100% rename from lib/libx52io/test_axis.c rename to libx52io/test_axis.c diff --git a/lib/libx52io/test_parser.c b/libx52io/test_parser.c similarity index 100% rename from lib/libx52io/test_parser.c rename to libx52io/test_parser.c diff --git a/lib/libx52io/test_parser_tests.c b/libx52io/test_parser_tests.c similarity index 100% rename from lib/libx52io/test_parser_tests.c rename to libx52io/test_parser_tests.c diff --git a/po/POTFILES.in b/po/POTFILES.in index a1a0dad..b67b980 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,7 +2,7 @@ libx52/x52_strerror.c libx52/x52_stringify.c -lib/libx52io/io_strings.c +libx52io/io_strings.c utils/evtest/ev_test.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index d0c1964..e88fb33 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 21:40-0700\n" +"POT-Creation-Date: 2021-07-29 21:50-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,11 +17,11 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 +#: libx52/x52_strerror.c:23 libx52io/io_strings.c:101 msgid "Success" msgstr "" -#: libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 +#: libx52/x52_strerror.c:24 libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "" @@ -85,7 +85,7 @@ msgstr "" msgid "System call interrupted" msgstr "" -#: libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 +#: libx52/x52_strerror.c:66 libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "" @@ -211,23 +211,23 @@ msgstr "" msgid "Unknown LED ID %d" msgstr "" -#: lib/libx52io/io_strings.c:103 +#: libx52io/io_strings.c:103 msgid "No device" msgstr "" -#: lib/libx52io/io_strings.c:104 +#: libx52io/io_strings.c:104 msgid "Invalid arguments" msgstr "" -#: lib/libx52io/io_strings.c:105 +#: libx52io/io_strings.c:105 msgid "Connection failure" msgstr "" -#: lib/libx52io/io_strings.c:106 +#: libx52io/io_strings.c:106 msgid "I/O error" msgstr "" -#: lib/libx52io/io_strings.c:107 +#: libx52io/io_strings.c:107 msgid "Read timeout" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 08b4759..12121dc 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 21:40-0700\n" +"POT-Creation-Date: 2021-07-29 21:50-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -17,11 +17,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" -#: libx52/x52_strerror.c:23 lib/libx52io/io_strings.c:101 +#: libx52/x52_strerror.c:23 libx52io/io_strings.c:101 msgid "Success" msgstr "Uccesssay" -#: libx52/x52_strerror.c:24 lib/libx52io/io_strings.c:102 +#: libx52/x52_strerror.c:24 libx52io/io_strings.c:102 msgid "Initialization failure" msgstr "Initializationay ailurefay" @@ -85,7 +85,7 @@ msgstr "Ipepay erroray" msgid "System call interrupted" msgstr "Ystemsay allcay interrupteday" -#: libx52/x52_strerror.c:66 lib/libx52io/io_strings.c:125 +#: libx52/x52_strerror.c:66 libx52io/io_strings.c:125 #, c-format msgid "Unknown error %d" msgstr "Unknownay erroray %d" @@ -211,23 +211,23 @@ msgstr "Ottlethray" msgid "Unknown LED ID %d" msgstr "Unknownay EDLay IDay %d" -#: lib/libx52io/io_strings.c:103 +#: libx52io/io_strings.c:103 msgid "No device" msgstr "Onay eviceday" -#: lib/libx52io/io_strings.c:104 +#: libx52io/io_strings.c:104 msgid "Invalid arguments" msgstr "Invaliday argumentsay" -#: lib/libx52io/io_strings.c:105 +#: libx52io/io_strings.c:105 msgid "Connection failure" msgstr "Onnectioncay ailurefay" -#: lib/libx52io/io_strings.c:106 +#: libx52io/io_strings.c:106 msgid "I/O error" msgstr "I/O erroray" -#: lib/libx52io/io_strings.c:107 +#: libx52io/io_strings.c:107 msgid "Read timeout" msgstr "Eadray imeouttay" diff --git a/utils/evtest/Makefile.am b/utils/evtest/Makefile.am index b676c05..dc62cbc 100644 --- a/utils/evtest/Makefile.am +++ b/utils/evtest/Makefile.am @@ -10,6 +10,6 @@ bin_PROGRAMS = x52evtest # Event test utility that works similarly to the Linux evtest x52evtest_SOURCES = ev_test.c -x52evtest_CFLAGS = -I $(top_srcdir)/lib/libx52io -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) +x52evtest_CFLAGS = -I $(top_srcdir)/libx52io -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52evtest_LDFLAGS = $(WARN_LDFLAGS) -x52evtest_LDADD = ../../lib/libx52io/libx52io.la +x52evtest_LDADD = ../../libx52io/libx52io.la From 3b2378a54be9d8e08668a6f20912520d96ae811d Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 21:57:19 -0700 Subject: [PATCH 56/68] Move libusbx52 to top level --- Makefile.am | 2 +- configure.ac | 2 +- lib/Makefile.am | 2 +- {lib/libusbx52 => libusbx52}/Makefile.am | 0 {lib/libusbx52 => libusbx52}/README.md | 0 {lib/libusbx52 => libusbx52}/fopen_env.c | 0 {lib/libusbx52 => libusbx52}/libusbx52.h | 0 {lib/libusbx52 => libusbx52}/usb_x52_stub.c | 0 {lib/libusbx52 => libusbx52}/util/create_device_list.c | 0 {lib/libusbx52 => libusbx52}/util/log_actions.c | 0 10 files changed, 3 insertions(+), 3 deletions(-) rename {lib/libusbx52 => libusbx52}/Makefile.am (100%) rename {lib/libusbx52 => libusbx52}/README.md (100%) rename {lib/libusbx52 => libusbx52}/fopen_env.c (100%) rename {lib/libusbx52 => libusbx52}/libusbx52.h (100%) rename {lib/libusbx52 => libusbx52}/usb_x52_stub.c (100%) rename {lib/libusbx52 => libusbx52}/util/create_device_list.c (100%) rename {lib/libusbx52 => libusbx52}/util/log_actions.c (100%) diff --git a/Makefile.am b/Makefile.am index cc29bee..1e6671a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io lib utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 4037f6d..f7c5bac 100644 --- a/configure.ac +++ b/configure.ac @@ -126,7 +126,7 @@ AC_CONFIG_FILES([ po/Makefile.in lib/Makefile libx52/Makefile libx52/libx52.pc - lib/libusbx52/Makefile + libusbx52/Makefile libx52util/Makefile libx52io/Makefile lib/pinelog/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index 4cb87c4..e067e74 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = libusbx52 pinelog +SUBDIRS = pinelog diff --git a/lib/libusbx52/Makefile.am b/libusbx52/Makefile.am similarity index 100% rename from lib/libusbx52/Makefile.am rename to libusbx52/Makefile.am diff --git a/lib/libusbx52/README.md b/libusbx52/README.md similarity index 100% rename from lib/libusbx52/README.md rename to libusbx52/README.md diff --git a/lib/libusbx52/fopen_env.c b/libusbx52/fopen_env.c similarity index 100% rename from lib/libusbx52/fopen_env.c rename to libusbx52/fopen_env.c diff --git a/lib/libusbx52/libusbx52.h b/libusbx52/libusbx52.h similarity index 100% rename from lib/libusbx52/libusbx52.h rename to libusbx52/libusbx52.h diff --git a/lib/libusbx52/usb_x52_stub.c b/libusbx52/usb_x52_stub.c similarity index 100% rename from lib/libusbx52/usb_x52_stub.c rename to libusbx52/usb_x52_stub.c diff --git a/lib/libusbx52/util/create_device_list.c b/libusbx52/util/create_device_list.c similarity index 100% rename from lib/libusbx52/util/create_device_list.c rename to libusbx52/util/create_device_list.c diff --git a/lib/libusbx52/util/log_actions.c b/libusbx52/util/log_actions.c similarity index 100% rename from lib/libusbx52/util/log_actions.c rename to libusbx52/util/log_actions.c From 711e4385c1d16c9ff0d36d46ffc53befd8167053 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 22:11:19 -0700 Subject: [PATCH 57/68] Move x52cli to top level --- Makefile.am | 2 +- configure.ac | 2 +- tests/common_infra.sh | 2 +- utils/Makefile.am | 2 +- {utils/cli => x52cli}/Makefile.am | 2 +- {utils/cli => x52cli}/x52_cli.c | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename {utils/cli => x52cli}/Makefile.am (90%) rename {utils/cli => x52cli}/x52_cli.c (100%) diff --git a/Makefile.am b/Makefile.am index 1e6671a..5b07837 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index f7c5bac..400b237 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,7 @@ AC_CONFIG_FILES([ po/Makefile.in udev/Makefile udev/60-saitek-x52-x52pro.rules utils/Makefile - utils/cli/Makefile + x52cli/Makefile utils/test/Makefile utils/evtest/Makefile daemon/Makefile diff --git a/tests/common_infra.sh b/tests/common_infra.sh index 80c0e57..8158d13 100644 --- a/tests/common_infra.sh +++ b/tests/common_infra.sh @@ -79,7 +79,7 @@ find_programs() fi # Find the X52cli script - X52CLI=$(find .. -path '*/cli/x52cli' -perm -+x) + X52CLI=$(find .. -path '*/x52cli/x52cli' -perm -+x) if [[ -z "$X52CLI" ]] then diff --git a/utils/Makefile.am b/utils/Makefile.am index 964f28e..e481390 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = cli test evtest +SUBDIRS = test evtest diff --git a/utils/cli/Makefile.am b/x52cli/Makefile.am similarity index 90% rename from utils/cli/Makefile.am rename to x52cli/Makefile.am index 17439ea..5117f13 100644 --- a/utils/cli/Makefile.am +++ b/x52cli/Makefile.am @@ -12,4 +12,4 @@ bin_PROGRAMS = x52cli x52cli_SOURCES = x52_cli.c x52cli_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) x52cli_LDFLAGS = $(WARN_LDFLAGS) -x52cli_LDADD = ../../libx52/libx52.la +x52cli_LDADD = ../libx52/libx52.la diff --git a/utils/cli/x52_cli.c b/x52cli/x52_cli.c similarity index 100% rename from utils/cli/x52_cli.c rename to x52cli/x52_cli.c From a94b079cf546bf230a8c7488386c1d7aba2b5d1e Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 22:14:48 -0700 Subject: [PATCH 58/68] Move x52test to top level --- Makefile.am | 2 +- configure.ac | 2 +- po/POTFILES.in | 10 +-- po/x52pro-linux.pot | 96 +++++++++++------------ po/xx_PL.po | 96 +++++++++++------------ utils/Makefile.am | 2 +- {utils/test => x52test}/Makefile.am | 2 +- {utils/test => x52test}/x52_test.c | 0 {utils/test => x52test}/x52_test_clock.c | 0 {utils/test => x52test}/x52_test_common.h | 0 {utils/test => x52test}/x52_test_led.c | 0 {utils/test => x52test}/x52_test_mfd.c | 0 12 files changed, 105 insertions(+), 105 deletions(-) rename {utils/test => x52test}/Makefile.am (93%) rename {utils/test => x52test}/x52_test.c (100%) rename {utils/test => x52test}/x52_test_clock.c (100%) rename {utils/test => x52test}/x52_test_common.h (100%) rename {utils/test => x52test}/x52_test_led.c (100%) rename {utils/test => x52test}/x52_test_mfd.c (100%) diff --git a/Makefile.am b/Makefile.am index 5b07837..e16d81d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli x52test utils daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 400b237..5ae55d9 100644 --- a/configure.ac +++ b/configure.ac @@ -134,7 +134,7 @@ AC_CONFIG_FILES([ po/Makefile.in udev/60-saitek-x52-x52pro.rules utils/Makefile x52cli/Makefile - utils/test/Makefile + x52test/Makefile utils/evtest/Makefile daemon/Makefile tests/Makefile diff --git a/po/POTFILES.in b/po/POTFILES.in index b67b980..6b4d5cc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,11 +6,11 @@ libx52io/io_strings.c utils/evtest/ev_test.c -utils/test/x52_test.c -utils/test/x52_test_clock.c -utils/test/x52_test_common.h -utils/test/x52_test_led.c -utils/test/x52_test_mfd.c +x52test/x52_test.c +x52test/x52_test_clock.c +x52test/x52_test_common.h +x52test/x52_test_led.c +x52test/x52_test_mfd.c daemon/x52d_main.c daemon/x52d_clock.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index e88fb33..86d4b23 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 21:50-0700\n" +"POT-Creation-Date: 2021-07-29 22:12-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -255,239 +255,239 @@ msgstr "" msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "" -#: utils/test/x52_test.c:97 +#: x52test/x52_test.c:97 msgid "Test brightness scale (~ 1m)" msgstr "" -#: utils/test/x52_test.c:98 +#: x52test/x52_test.c:98 msgid "Test LED states (~ 45s)" msgstr "" -#: utils/test/x52_test.c:99 +#: x52test/x52_test.c:99 msgid "Test MFD string display (~ 30s)" msgstr "" -#: utils/test/x52_test.c:100 +#: x52test/x52_test.c:100 msgid "Test MFD displays all characters (~ 2m 15s)" msgstr "" -#: utils/test/x52_test.c:101 +#: x52test/x52_test.c:101 msgid "Test the blink and shift commands (< 10s)" msgstr "" -#: utils/test/x52_test.c:102 +#: x52test/x52_test.c:102 msgid "Test the clock commands (~1m)" msgstr "" -#: utils/test/x52_test.c:126 +#: x52test/x52_test.c:126 msgid "" "x52test is a suite of tests to write to the X52 Pro device\n" "and test the extra functionality available in the LEDs and MFD\n" msgstr "" -#: utils/test/x52_test.c:130 +#: x52test/x52_test.c:130 msgid "These tests take roughly 6 minutes to run" msgstr "" -#: utils/test/x52_test.c:132 +#: x52test/x52_test.c:132 msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime" msgstr "" -#: utils/test/x52_test.c:138 +#: x52test/x52_test.c:138 #, c-format msgid "Unable to initialize X52 library: %s\n" msgstr "" -#: utils/test/x52_test.c:153 +#: x52test/x52_test.c:153 msgid "All tests completed successfully" msgstr "" -#: utils/test/x52_test.c:155 +#: x52test/x52_test.c:155 #, c-format msgid "Got error %s\n" msgstr "" -#: utils/test/x52_test.c:157 +#: x52test/x52_test.c:157 #, c-format msgid "Received %s signal, quitting...\n" msgstr "" -#: utils/test/x52_test.c:176 +#: x52test/x52_test.c:176 msgid "" "These are the available tests with a description and\n" "approximate runtime. Not specifying any tests will run\n" "all the tests\n" msgstr "" -#: utils/test/x52_test.c:180 +#: x52test/x52_test.c:180 msgid "List of tests:" msgstr "" -#: utils/test/x52_test.c:230 +#: x52test/x52_test.c:230 #, c-format msgid "" "Usage: %s [list of tests]\n" "\n" msgstr "" -#: utils/test/x52_test.c:244 +#: x52test/x52_test.c:244 #, c-format msgid "" "Unrecognized test identifier: %s\n" "\n" msgstr "" -#: utils/test/x52_test.c:257 +#: x52test/x52_test.c:257 msgid "Not running any tests" msgstr "" -#: utils/test/x52_test_clock.c:32 +#: x52test/x52_test_clock.c:32 msgid "Clock" msgstr "" -#: utils/test/x52_test_clock.c:33 +#: x52test/x52_test_clock.c:33 msgid "This tests the clock display" msgstr "" -#: utils/test/x52_test_clock.c:38 +#: x52test/x52_test_clock.c:38 msgid "" "\n" "Testing clock time minute display for 90 minutes" msgstr "" -#: utils/test/x52_test_clock.c:44 +#: x52test/x52_test_clock.c:44 msgid "" "\n" "Testing clock time hour display for 36 hours, 12 hour mode" msgstr "" -#: utils/test/x52_test_clock.c:47 +#: x52test/x52_test_clock.c:47 msgid "" "\n" "Testing clock time hour display for 36 hours, 24 hour mode" msgstr "" -#: utils/test/x52_test_clock.c:52 +#: x52test/x52_test_clock.c:52 msgid "" "\n" "Testing clock date display for 31 days, dd-mm-yy" msgstr "" -#: utils/test/x52_test_clock.c:56 +#: x52test/x52_test_clock.c:56 msgid "" "\n" "Testing clock date display for 31 days, mm-dd-yy" msgstr "" -#: utils/test/x52_test_clock.c:60 +#: x52test/x52_test_clock.c:60 msgid "" "\n" "Testing clock date display for 31 days, yy-mm-dd" msgstr "" -#: utils/test/x52_test_common.h:26 +#: x52test/x52_test_common.h:26 #, c-format msgid "" "\n" "%s(%s) failed with %d(%s)\n" msgstr "" -#: utils/test/x52_test_common.h:32 +#: x52test/x52_test_common.h:32 #, c-format msgid "" "\n" "update failed with %d(%s)\n" msgstr "" -#: utils/test/x52_test_led.c:19 +#: x52test/x52_test_led.c:19 #, c-format msgid "LED %s - %s\n" msgstr "" -#: utils/test/x52_test_led.c:25 utils/test/x52_test_led.c:32 +#: x52test/x52_test_led.c:25 x52test/x52_test_led.c:32 #, c-format msgid "" "\n" "Testing LED %s\n" msgstr "" -#: utils/test/x52_test_led.c:42 +#: x52test/x52_test_led.c:42 msgid "LEDs" msgstr "" -#: utils/test/x52_test_led.c:48 +#: x52test/x52_test_led.c:48 msgid "Skipping LED tests since the device does not support LED control" msgstr "" -#: utils/test/x52_test_led.c:55 +#: x52test/x52_test_led.c:55 msgid "This cycles the LEDs through all possible states" msgstr "" -#: utils/test/x52_test_led.c:73 +#: x52test/x52_test_led.c:73 #, c-format msgid "" "\n" "Testing %s\n" msgstr "" -#: utils/test/x52_test_led.c:84 +#: x52test/x52_test_led.c:84 msgid "Blink & Shift" msgstr "" -#: utils/test/x52_test_led.c:85 +#: x52test/x52_test_led.c:85 msgid "This tests the blink indicator and shift functionality" msgstr "" -#: utils/test/x52_test_mfd.c:24 +#: x52test/x52_test_mfd.c:24 msgid "Brightness" msgstr "" -#: utils/test/x52_test_mfd.c:26 +#: x52test/x52_test_mfd.c:26 msgid "This test cycles through the MFD and LED brightness scales" msgstr "" -#: utils/test/x52_test_mfd.c:29 +#: x52test/x52_test_mfd.c:29 msgid "" "\n" "MFD: " msgstr "" -#: utils/test/x52_test_mfd.c:36 +#: x52test/x52_test_mfd.c:36 msgid "" "\n" "LED: " msgstr "" -#: utils/test/x52_test_mfd.c:55 +#: x52test/x52_test_mfd.c:55 msgid "MFD text" msgstr "" -#: utils/test/x52_test_mfd.c:56 +#: x52test/x52_test_mfd.c:56 msgid "This test tests the character displays of the MFD\n" msgstr "" -#: utils/test/x52_test_mfd.c:60 +#: x52test/x52_test_mfd.c:60 #, c-format msgid "Writing characters %s\n" msgstr "" -#: utils/test/x52_test_mfd.c:82 +#: x52test/x52_test_mfd.c:82 msgid "MFD display" msgstr "" -#: utils/test/x52_test_mfd.c:83 +#: x52test/x52_test_mfd.c:83 msgid "" "This test checks if the display elements can display all characters\n" "You should see the display cycling through each character, with every\n" "cell displaying the same character\n" msgstr "" -#: utils/test/x52_test_mfd.c:88 +#: x52test/x52_test_mfd.c:88 #, c-format msgid "Testing character 0x%02x..." msgstr "" -#: utils/test/x52_test_mfd.c:96 +#: x52test/x52_test_mfd.c:96 msgid "OK" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 12121dc..714021a 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 21:50-0700\n" +"POT-Creation-Date: 2021-07-29 22:12-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -255,31 +255,31 @@ msgstr "Estingtay (interruptay otay exitay)\n" msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "Eventay @ %ld.%06ld: %s, aluevay %d\n" -#: utils/test/x52_test.c:97 +#: x52test/x52_test.c:97 msgid "Test brightness scale (~ 1m)" msgstr "Esttay ightnessbray alescay (~ 1m)" -#: utils/test/x52_test.c:98 +#: x52test/x52_test.c:98 msgid "Test LED states (~ 45s)" msgstr "Esstay EDLay atesstay (~ 45s)" -#: utils/test/x52_test.c:99 +#: x52test/x52_test.c:99 msgid "Test MFD string display (~ 30s)" msgstr "Esttay MFDay ingstray isplayday (~ 30s)" -#: utils/test/x52_test.c:100 +#: x52test/x52_test.c:100 msgid "Test MFD displays all characters (~ 2m 15s)" msgstr "Esttay MFDay isplaysday allay aracterschay (~ 2m 15s)" -#: utils/test/x52_test.c:101 +#: x52test/x52_test.c:101 msgid "Test the blink and shift commands (< 10s)" msgstr "Esttay ethay inkblay anday iftshay ommandscay (< 10s)" -#: utils/test/x52_test.c:102 +#: x52test/x52_test.c:102 msgid "Test the clock commands (~1m)" msgstr "Esttay ethay ockclay ommandscay (~1m)" -#: utils/test/x52_test.c:126 +#: x52test/x52_test.c:126 msgid "" "x52test is a suite of tests to write to the X52 Pro device\n" "and test the extra functionality available in the LEDs and MFD\n" @@ -288,36 +288,36 @@ msgstr "" "X52 Pro eviceday anday esttay ethay extray unctionalityfay\n" "availableay inay ethay EDsLay anday FDMay\n" -#: utils/test/x52_test.c:130 +#: x52test/x52_test.c:130 msgid "These tests take roughly 6 minutes to run" msgstr "Esethay eststay aketay oughlyray 6 inutesmay otay unray" -#: utils/test/x52_test.c:132 +#: x52test/x52_test.c:132 msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime" msgstr "" "Esspray Enteray otay eginbay ethay eststay, esspray Ctrl-C otay abortay " "anytimeay" -#: utils/test/x52_test.c:138 +#: x52test/x52_test.c:138 #, c-format msgid "Unable to initialize X52 library: %s\n" msgstr "Unableay otay initializeay X52 ibrarylay: %s\n" -#: utils/test/x52_test.c:153 +#: x52test/x52_test.c:153 msgid "All tests completed successfully" msgstr "Allay eststay ompletedcay uccessfullysay" -#: utils/test/x52_test.c:155 +#: x52test/x52_test.c:155 #, c-format msgid "Got error %s\n" msgstr "Otgay erroray %s\n" -#: utils/test/x52_test.c:157 +#: x52test/x52_test.c:157 #, c-format msgid "Received %s signal, quitting...\n" msgstr "Eceivedray %s ignalsay, uittingqay...\n" -#: utils/test/x52_test.c:176 +#: x52test/x52_test.c:176 msgid "" "These are the available tests with a description and\n" "approximate runtime. Not specifying any tests will run\n" @@ -328,18 +328,18 @@ msgstr "" "ecifyingspay anyay eststay illway unray allay ethay\n" "eststay\n" -#: utils/test/x52_test.c:180 +#: x52test/x52_test.c:180 msgid "List of tests:" msgstr "Istlay ofay eststay:" -#: utils/test/x52_test.c:230 +#: x52test/x52_test.c:230 #, c-format msgid "" "Usage: %s [list of tests]\n" "\n" msgstr "Usageay: %s [istlay ofay eststay]\n" -#: utils/test/x52_test.c:244 +#: x52test/x52_test.c:244 #, c-format msgid "" "Unrecognized test identifier: %s\n" @@ -348,19 +348,19 @@ msgstr "" "Unrecognizeday esttay identifieray: %s\n" "\n" -#: utils/test/x52_test.c:257 +#: x52test/x52_test.c:257 msgid "Not running any tests" msgstr "Otnay unningray anyay eststay" -#: utils/test/x52_test_clock.c:32 +#: x52test/x52_test_clock.c:32 msgid "Clock" msgstr "Ockclay" -#: utils/test/x52_test_clock.c:33 +#: x52test/x52_test_clock.c:33 msgid "This tests the clock display" msgstr "Isthay eststay ethay ockclay isplayday" -#: utils/test/x52_test_clock.c:38 +#: x52test/x52_test_clock.c:38 msgid "" "\n" "Testing clock time minute display for 90 minutes" @@ -368,7 +368,7 @@ msgstr "" "\n" "Estingtay ockclay imetay inutemay isplayday orfay 90 inutesmay" -#: utils/test/x52_test_clock.c:44 +#: x52test/x52_test_clock.c:44 msgid "" "\n" "Testing clock time hour display for 36 hours, 12 hour mode" @@ -376,7 +376,7 @@ msgstr "" "\n" "Estingtay ockclay imetay ourhay isplayday orfay 36 ourshay, 12 ourhay odemay" -#: utils/test/x52_test_clock.c:47 +#: x52test/x52_test_clock.c:47 msgid "" "\n" "Testing clock time hour display for 36 hours, 24 hour mode" @@ -384,7 +384,7 @@ msgstr "" "\n" "Estingtay ockclay imetay ourhay isplayday orfay 36 ourshay, 24 ourhay odemay" -#: utils/test/x52_test_clock.c:52 +#: x52test/x52_test_clock.c:52 msgid "" "\n" "Testing clock date display for 31 days, dd-mm-yy" @@ -392,7 +392,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, dd-mm-yy" -#: utils/test/x52_test_clock.c:56 +#: x52test/x52_test_clock.c:56 msgid "" "\n" "Testing clock date display for 31 days, mm-dd-yy" @@ -400,7 +400,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, mm-dd-yy" -#: utils/test/x52_test_clock.c:60 +#: x52test/x52_test_clock.c:60 msgid "" "\n" "Testing clock date display for 31 days, yy-mm-dd" @@ -408,7 +408,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, yy-mm-dd" -#: utils/test/x52_test_common.h:26 +#: x52test/x52_test_common.h:26 #, c-format msgid "" "\n" @@ -417,7 +417,7 @@ msgstr "" "\n" "%s(%s) ailedfay ithway %d(%s)\n" -#: utils/test/x52_test_common.h:32 +#: x52test/x52_test_common.h:32 #, c-format msgid "" "\n" @@ -426,12 +426,12 @@ msgstr "" "\n" "updateay ailedfay ithway %d(%s)\n" -#: utils/test/x52_test_led.c:19 +#: x52test/x52_test_led.c:19 #, c-format msgid "LED %s - %s\n" msgstr "EDLay %s - %s\n" -#: utils/test/x52_test_led.c:25 utils/test/x52_test_led.c:32 +#: x52test/x52_test_led.c:25 x52test/x52_test_led.c:32 #, c-format msgid "" "\n" @@ -440,21 +440,21 @@ msgstr "" "\n" "Estingtay EDLay %s\n" -#: utils/test/x52_test_led.c:42 +#: x52test/x52_test_led.c:42 msgid "LEDs" msgstr "EDsLay" -#: utils/test/x52_test_led.c:48 +#: x52test/x52_test_led.c:48 msgid "Skipping LED tests since the device does not support LED control" msgstr "" "Ippingskay EDLay eststay incesay ethay eviceday oesday otnay\n" "upportsay EDLay ontrolcay" -#: utils/test/x52_test_led.c:55 +#: x52test/x52_test_led.c:55 msgid "This cycles the LEDs through all possible states" msgstr "Isthay yclescay ethay EDsLay oughthray allay ossiblepay tatessay" -#: utils/test/x52_test_led.c:73 +#: x52test/x52_test_led.c:73 #, c-format msgid "" "\n" @@ -463,25 +463,25 @@ msgstr "" "\n" "Estingtay %s\n" -#: utils/test/x52_test_led.c:84 +#: x52test/x52_test_led.c:84 msgid "Blink & Shift" msgstr "Inkblay & Iftshay" -#: utils/test/x52_test_led.c:85 +#: x52test/x52_test_led.c:85 msgid "This tests the blink indicator and shift functionality" msgstr "Isthay eststay ethay inkblay indicatoray anday iftshay unctionalityfay" -#: utils/test/x52_test_mfd.c:24 +#: x52test/x52_test_mfd.c:24 msgid "Brightness" msgstr "Ightnessbray" -#: utils/test/x52_test_mfd.c:26 +#: x52test/x52_test_mfd.c:26 msgid "This test cycles through the MFD and LED brightness scales" msgstr "" "Isthay esttay yclescay oughthray ethay FDMay anday EDLay ightnessbray " "alesscay" -#: utils/test/x52_test_mfd.c:29 +#: x52test/x52_test_mfd.c:29 msgid "" "\n" "MFD: " @@ -489,7 +489,7 @@ msgstr "" "\n" "FDMay: " -#: utils/test/x52_test_mfd.c:36 +#: x52test/x52_test_mfd.c:36 msgid "" "\n" "LED: " @@ -497,24 +497,24 @@ msgstr "" "\n" "EDLay: " -#: utils/test/x52_test_mfd.c:55 +#: x52test/x52_test_mfd.c:55 msgid "MFD text" msgstr "FDMay exttay" -#: utils/test/x52_test_mfd.c:56 +#: x52test/x52_test_mfd.c:56 msgid "This test tests the character displays of the MFD\n" msgstr "Isthay esttay eststay ethay aracterchay isplaysday ofay the FDMay\n" -#: utils/test/x52_test_mfd.c:60 +#: x52test/x52_test_mfd.c:60 #, c-format msgid "Writing characters %s\n" msgstr "Itingwray aracterschay %s\n" -#: utils/test/x52_test_mfd.c:82 +#: x52test/x52_test_mfd.c:82 msgid "MFD display" msgstr "FDMay isplayday" -#: utils/test/x52_test_mfd.c:83 +#: x52test/x52_test_mfd.c:83 msgid "" "This test checks if the display elements can display all characters\n" "You should see the display cycling through each character, with every\n" @@ -525,12 +525,12 @@ msgstr "" "oughthray eachay aracterchay, ithway everyay ellcay isplayingday ethay\n" "amesay aracterchay\n" -#: utils/test/x52_test_mfd.c:88 +#: x52test/x52_test_mfd.c:88 #, c-format msgid "Testing character 0x%02x..." msgstr "Estingtay aracterchay 0x%02x..." -#: utils/test/x52_test_mfd.c:96 +#: x52test/x52_test_mfd.c:96 msgid "OK" msgstr "OKay" diff --git a/utils/Makefile.am b/utils/Makefile.am index e481390..50202dc 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -4,5 +4,5 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -SUBDIRS = test evtest +SUBDIRS = evtest diff --git a/utils/test/Makefile.am b/x52test/Makefile.am similarity index 93% rename from utils/test/Makefile.am rename to x52test/Makefile.am index d93be98..a11f409 100644 --- a/utils/test/Makefile.am +++ b/x52test/Makefile.am @@ -12,7 +12,7 @@ bin_PROGRAMS = x52test x52test_SOURCES = x52_test.c x52_test_mfd.c x52_test_led.c x52_test_clock.c x52test_CFLAGS = -I $(top_srcdir)/libx52 -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52test_LDFLAGS = $(WARN_LDFLAGS) -x52test_LDADD = ../../libx52/libx52.la +x52test_LDADD = ../libx52/libx52.la # Extra files that need to be in the distribution EXTRA_DIST = x52_test_common.h diff --git a/utils/test/x52_test.c b/x52test/x52_test.c similarity index 100% rename from utils/test/x52_test.c rename to x52test/x52_test.c diff --git a/utils/test/x52_test_clock.c b/x52test/x52_test_clock.c similarity index 100% rename from utils/test/x52_test_clock.c rename to x52test/x52_test_clock.c diff --git a/utils/test/x52_test_common.h b/x52test/x52_test_common.h similarity index 100% rename from utils/test/x52_test_common.h rename to x52test/x52_test_common.h diff --git a/utils/test/x52_test_led.c b/x52test/x52_test_led.c similarity index 100% rename from utils/test/x52_test_led.c rename to x52test/x52_test_led.c diff --git a/utils/test/x52_test_mfd.c b/x52test/x52_test_mfd.c similarity index 100% rename from utils/test/x52_test_mfd.c rename to x52test/x52_test_mfd.c From 23fa0daf4fd72dc11282b1e36395e22789a99693 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 22:26:15 -0700 Subject: [PATCH 59/68] Move evtest to top level --- Makefile.am | 2 +- configure.ac | 3 +-- {utils/evtest => evtest}/Makefile.am | 2 +- {utils/evtest => evtest}/ev_test.c | 0 po/POTFILES.in | 2 +- po/x52pro-linux.pot | 12 ++++++------ po/xx_PL.po | 12 ++++++------ utils/Makefile.am | 8 -------- 8 files changed, 16 insertions(+), 25 deletions(-) rename {utils/evtest => evtest}/Makefile.am (90%) rename {utils/evtest => evtest}/ev_test.c (100%) delete mode 100644 utils/Makefile.am diff --git a/Makefile.am b/Makefile.am index e16d81d..3f2a154 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ if USE_NLS po_SUBDIRS = po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli x52test utils daemon tests udev +SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli x52test evtest daemon tests udev # Extra files that need to be in the distribution EXTRA_DIST = \ diff --git a/configure.ac b/configure.ac index 5ae55d9..fe8ab2a 100644 --- a/configure.ac +++ b/configure.ac @@ -132,10 +132,9 @@ AC_CONFIG_FILES([ po/Makefile.in lib/pinelog/Makefile udev/Makefile udev/60-saitek-x52-x52pro.rules - utils/Makefile x52cli/Makefile x52test/Makefile - utils/evtest/Makefile + evtest/Makefile daemon/Makefile tests/Makefile ]) diff --git a/utils/evtest/Makefile.am b/evtest/Makefile.am similarity index 90% rename from utils/evtest/Makefile.am rename to evtest/Makefile.am index dc62cbc..40df5ec 100644 --- a/utils/evtest/Makefile.am +++ b/evtest/Makefile.am @@ -12,4 +12,4 @@ bin_PROGRAMS = x52evtest x52evtest_SOURCES = ev_test.c x52evtest_CFLAGS = -I $(top_srcdir)/libx52io -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52evtest_LDFLAGS = $(WARN_LDFLAGS) -x52evtest_LDADD = ../../libx52io/libx52io.la +x52evtest_LDADD = ../libx52io/libx52io.la diff --git a/utils/evtest/ev_test.c b/evtest/ev_test.c similarity index 100% rename from utils/evtest/ev_test.c rename to evtest/ev_test.c diff --git a/po/POTFILES.in b/po/POTFILES.in index 6b4d5cc..9bab045 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,7 +4,7 @@ libx52/x52_stringify.c libx52io/io_strings.c -utils/evtest/ev_test.c +evtest/ev_test.c x52test/x52_test.c x52test/x52_test_clock.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 86d4b23..208fccf 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 22:12-0700\n" +"POT-Creation-Date: 2021-07-29 22:25-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -231,26 +231,26 @@ msgstr "" msgid "Read timeout" msgstr "" -#: utils/evtest/ev_test.c:109 +#: evtest/ev_test.c:109 #, c-format msgid "Device ID: vendor 0x%04x product 0x%04x version 0x%04x\n" msgstr "" -#: utils/evtest/ev_test.c:113 +#: evtest/ev_test.c:113 #, c-format msgid "Device name: \"%s %s\"\n" msgstr "" -#: utils/evtest/ev_test.c:116 +#: evtest/ev_test.c:116 #, c-format msgid "Serial number: \"%s\"\n" msgstr "" -#: utils/evtest/ev_test.c:117 +#: evtest/ev_test.c:117 msgid "Testing (interrupt to exit)\n" msgstr "" -#: utils/evtest/ev_test.c:157 utils/evtest/ev_test.c:165 +#: evtest/ev_test.c:157 evtest/ev_test.c:165 #, c-format msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 714021a..1b21b52 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 22:12-0700\n" +"POT-Creation-Date: 2021-07-29 22:25-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -231,26 +231,26 @@ msgstr "I/O erroray" msgid "Read timeout" msgstr "Eadray imeouttay" -#: utils/evtest/ev_test.c:109 +#: evtest/ev_test.c:109 #, c-format msgid "Device ID: vendor 0x%04x product 0x%04x version 0x%04x\n" msgstr "Eviceday IDay: endorvay 0x%04x oductpray 0x%04x ersionvay 0x%04x\n" -#: utils/evtest/ev_test.c:113 +#: evtest/ev_test.c:113 #, c-format msgid "Device name: \"%s %s\"\n" msgstr "Eviceday amenay: \"%s %s\"\n" -#: utils/evtest/ev_test.c:116 +#: evtest/ev_test.c:116 #, c-format msgid "Serial number: \"%s\"\n" msgstr "Erialsay umbernay: \"%s\"\n" -#: utils/evtest/ev_test.c:117 +#: evtest/ev_test.c:117 msgid "Testing (interrupt to exit)\n" msgstr "Estingtay (interruptay otay exitay)\n" -#: utils/evtest/ev_test.c:157 utils/evtest/ev_test.c:165 +#: evtest/ev_test.c:157 evtest/ev_test.c:165 #, c-format msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "Eventay @ %ld.%06ld: %s, aluevay %d\n" diff --git a/utils/Makefile.am b/utils/Makefile.am deleted file mode 100644 index 50202dc..0000000 --- a/utils/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -# Top level Automake for utilities -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -SUBDIRS = evtest - From ac68ee07e5a1c5115e103ca0673a963969f48861 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 23:53:21 -0700 Subject: [PATCH 60/68] Use non-recursive Automake --- Makefile.am | 66 +++++++++---- cli/Makefile.am | 25 +++++ .../cli_test_brightness | 2 +- tests/x52cli/test_clock => cli/cli_test_clock | 2 +- .../test_indicator => cli/cli_test_indicator | 2 +- tests/x52cli/test_leds => cli/cli_test_leds | 2 +- tests/x52cli/test_mfd => cli/cli_test_mfd | 2 +- .../test_timezone => cli/cli_test_timezone | 2 +- {tests => cli}/common_infra.sh | 6 +- {x52cli => cli}/x52_cli.c | 0 configure.ac | 10 -- daemon/Makefile.am | 33 +++---- evtest/Makefile.am | 8 +- {x52test => joytest}/Makefile.am | 14 +-- {x52test => joytest}/x52_test.c | 0 {x52test => joytest}/x52_test_clock.c | 0 {x52test => joytest}/x52_test_common.h | 0 {x52test => joytest}/x52_test_led.c | 0 {x52test => joytest}/x52_test_mfd.c | 0 libusbx52/Makefile.am | 25 ++--- libx52/Makefile.am | 50 +++++----- libx52io/Makefile.am | 28 +++--- libx52util/Makefile.am | 33 +++---- po/POTFILES.in | 10 +- po/x52pro-linux.pot | 96 +++++++++---------- po/xx_PL.po | 96 +++++++++---------- udev/Makefile.am | 5 +- x52cli/Makefile.am | 15 --- 28 files changed, 285 insertions(+), 247 deletions(-) create mode 100644 cli/Makefile.am rename tests/x52cli/test_brightness => cli/cli_test_brightness (94%) rename tests/x52cli/test_clock => cli/cli_test_clock (99%) rename tests/x52cli/test_indicator => cli/cli_test_indicator (94%) rename tests/x52cli/test_leds => cli/cli_test_leds (97%) rename tests/x52cli/test_mfd => cli/cli_test_mfd (97%) rename tests/x52cli/test_timezone => cli/cli_test_timezone (97%) rename {tests => cli}/common_infra.sh (95%) rename {x52cli => cli}/x52_cli.c (100%) rename {x52test => joytest}/Makefile.am (66%) rename {x52test => joytest}/x52_test.c (100%) rename {x52test => joytest}/x52_test_clock.c (100%) rename {x52test => joytest}/x52_test_common.h (100%) rename {x52test => joytest}/x52_test_led.c (100%) rename {x52test => joytest}/x52_test_mfd.c (100%) delete mode 100644 x52cli/Makefile.am diff --git a/Makefile.am b/Makefile.am index 3f2a154..964852c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,29 +6,44 @@ ACLOCAL_AMFLAGS = -I m4 +# Build any support libraries first +SUBDIRS = lib + if USE_NLS -po_SUBDIRS = po +SUBDIRS += po endif -SUBDIRS = $(po_SUBDIRS) libx52 libx52util libx52io libusbx52 lib x52cli x52test evtest daemon tests udev +####################################################################### +# Defaults +####################################################################### +bin_PROGRAMS = +check_PROGRAMS = +lib_LTLIBRARIES = +check_LTLIBRARIES = +pkgconfig_DATA = +TESTS = +EXTRA_DIST = +CLEANFILES = -# Extra files that need to be in the distribution -EXTRA_DIST = \ - ABOUT-NLS \ - AUTHORS \ - ChangeLog.md \ - CONTRIBUTING.md \ - Doxyfile.in \ - DoxygenLayout.xml \ - INSTALL.md \ - LICENSE \ - README.md \ - config.rpath \ - gettext.h \ - usb-ids.h \ - po/README.md +x52includedir = $(includedir)/libx52 +x52include_HEADERS = +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh + +include libx52/Makefile.am +include libx52util/Makefile.am +include libx52io/Makefile.am +include libusbx52/Makefile.am + +include cli/Makefile.am +include joytest/Makefile.am +include evtest/Makefile.am +include daemon/Makefile.am +include udev/Makefile.am + +####################################################################### # Doxygen support +####################################################################### if HAVE_DOXYGEN DXGEN = $(DXGEN_@AM_V@) DXGEN_ = $(DXGEN_@AM_DEFAULT_V@) @@ -54,3 +69,20 @@ uninstall-local: rm -rf $(DESTDIR)$(mandir)/man1/x52cli.1 endif + +# Extra files that need to be in the distribution +EXTRA_DIST += \ + ABOUT-NLS \ + AUTHORS \ + ChangeLog.md \ + CONTRIBUTING.md \ + Doxyfile.in \ + DoxygenLayout.xml \ + INSTALL.md \ + LICENSE \ + README.md \ + config.rpath \ + gettext.h \ + usb-ids.h \ + po/README.md + diff --git a/cli/Makefile.am b/cli/Makefile.am new file mode 100644 index 0000000..90726e8 --- /dev/null +++ b/cli/Makefile.am @@ -0,0 +1,25 @@ +# Automake for x52cli +# +# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) +# +# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + +bin_PROGRAMS += x52cli + +# Command line utility that front ends the core library +x52cli_SOURCES = cli/x52_cli.c +x52cli_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) +x52cli_LDFLAGS = $(WARN_LDFLAGS) +x52cli_LDADD = libx52.la + +# TODO: Automake doesn't recognize these tests as scripts, and looks for +# C sources. We need to replace these tests with a CMocka test suite +CLI_TESTS = \ + cli/cli_test_leds \ + cli/cli_test_brightness \ + cli/cli_test_indicator \ + cli/cli_test_mfd \ + cli/cli_test_clock \ + cli/cli_test_timezone + +EXTRA_DIST += cli/common_infra.sh $(CLI_TESTS) diff --git a/tests/x52cli/test_brightness b/cli/cli_test_brightness similarity index 94% rename from tests/x52cli/test_brightness rename to cli/cli_test_brightness index b2d279f..c45d9ff 100755 --- a/tests/x52cli/test_brightness +++ b/cli/cli_test_brightness @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh TEST_SUITE_ID="libx52 MFD & LED brightness tests" diff --git a/tests/x52cli/test_clock b/cli/cli_test_clock similarity index 99% rename from tests/x52cli/test_clock rename to cli/cli_test_clock index def836d..abcb9a9 100755 --- a/tests/x52cli/test_clock +++ b/cli/cli_test_clock @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh TEST_SUITE_ID="libx52 clock tests" diff --git a/tests/x52cli/test_indicator b/cli/cli_test_indicator similarity index 94% rename from tests/x52cli/test_indicator rename to cli/cli_test_indicator index 8b4dcbb..3ee2ff0 100755 --- a/tests/x52cli/test_indicator +++ b/cli/cli_test_indicator @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh TEST_SUITE_ID="libx52 indicator tests (blink & shift)" diff --git a/tests/x52cli/test_leds b/cli/cli_test_leds similarity index 97% rename from tests/x52cli/test_leds rename to cli/cli_test_leds index 569410c..d89f532 100755 --- a/tests/x52cli/test_leds +++ b/cli/cli_test_leds @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh TEST_SUITE_ID="libx52 LED state tests" diff --git a/tests/x52cli/test_mfd b/cli/cli_test_mfd similarity index 97% rename from tests/x52cli/test_mfd rename to cli/cli_test_mfd index 0784080..a1d56ff 100755 --- a/tests/x52cli/test_mfd +++ b/cli/cli_test_mfd @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh TEST_SUITE_ID="libx52 MFD text tests" diff --git a/tests/x52cli/test_timezone b/cli/cli_test_timezone similarity index 97% rename from tests/x52cli/test_timezone rename to cli/cli_test_timezone index 5c65453..7095a43 100755 --- a/tests/x52cli/test_timezone +++ b/cli/cli_test_timezone @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -source $(dirname $0)/../common_infra.sh +source $(dirname $0)/cli/common_infra.sh require_programs faketime TEST_SUITE_ID="libx52 timezone tests" diff --git a/tests/common_infra.sh b/cli/common_infra.sh similarity index 95% rename from tests/common_infra.sh rename to cli/common_infra.sh index 8158d13..b30f008 100644 --- a/tests/common_infra.sh +++ b/cli/common_infra.sh @@ -79,7 +79,7 @@ find_programs() fi # Find the X52cli script - X52CLI=$(find .. -path '*/x52cli/x52cli' -perm -+x) + X52CLI=$(find .. -path '*/x52cli' -perm -+x) if [[ -z "$X52CLI" ]] then @@ -87,14 +87,14 @@ find_programs() fi # Find the x52test_log_actions program - X52LOGACT=$(find .. -path '*/libusbx52/x52test_log_actions' -perm -+x) + X52LOGACT=$(find .. -path '*/x52test_log_actions' -perm -+x) if [[ -z "$X52LOGACT" ]] then exit 1 fi # Find the x52test_create_device_list program - X52DEVLIST=$(find .. -path '*/libusbx52/x52test_create_device_list' -perm -+x) + X52DEVLIST=$(find .. -path '*/x52test_create_device_list' -perm -+x) if [[ -z "$X52DEVLIST" ]] then exit 1 diff --git a/x52cli/x52_cli.c b/cli/x52_cli.c similarity index 100% rename from x52cli/x52_cli.c rename to cli/x52_cli.c diff --git a/configure.ac b/configure.ac index fe8ab2a..fa78dad 100644 --- a/configure.ac +++ b/configure.ac @@ -124,18 +124,8 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ po/Makefile.in Makefile lib/Makefile - libx52/Makefile libx52/libx52.pc - libusbx52/Makefile - libx52util/Makefile - libx52io/Makefile lib/pinelog/Makefile - udev/Makefile udev/60-saitek-x52-x52pro.rules - x52cli/Makefile - x52test/Makefile - evtest/Makefile - daemon/Makefile - tests/Makefile ]) AC_OUTPUT diff --git a/daemon/Makefile.am b/daemon/Makefile.am index f26358c..81fa1f4 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -3,15 +3,16 @@ # Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -ACLOCAL_AMFLAGS = -I m4 - -bin_PROGRAMS = x52d +bin_PROGRAMS += x52d # Service daemon that manages the X52 device x52d_SOURCES = \ - x52d_main.c x52d_config_parser.c x52d_config.c \ - x52d_device.c x52d_clock.c x52d_led.c + daemon/x52d_main.c \ + daemon/x52d_config_parser.c \ + daemon/x52d_config.c \ + daemon/x52d_device.c \ + daemon/x52d_clock.c \ + daemon/x52d_led.c x52d_CFLAGS = \ -I $(top_srcdir) \ @@ -27,17 +28,17 @@ x52d_CFLAGS = \ x52d_LDFLAGS = @INIH_LIBS@ @PTHREAD_LIBS@ $(WARN_LDFLAGS) x52d_LDADD = \ - ../lib/pinelog/libpinelog.la \ - ../libx52/libx52.la \ + lib/pinelog/libpinelog.la \ + libx52.la \ @LTLIBINTL@ x52dconfdir = @sysconfdir@/x52d -x52dconf_DATA = x52d.conf +x52dconf_DATA = daemon/x52d.conf -EXTRA_DIST = \ - x52d_clock.h \ - x52d_config.def \ - x52d_config.h \ - x52d_const.h \ - x52d_device.h \ - x52d.conf +EXTRA_DIST += \ + daemon/x52d_clock.h \ + daemon/x52d_config.def \ + daemon/x52d_config.h \ + daemon/x52d_const.h \ + daemon/x52d_device.h \ + daemon/x52d.conf diff --git a/evtest/Makefile.am b/evtest/Makefile.am index 40df5ec..c5722d2 100644 --- a/evtest/Makefile.am +++ b/evtest/Makefile.am @@ -4,12 +4,10 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -ACLOCAL_AMFLAGS = -I m4 - -bin_PROGRAMS = x52evtest +bin_PROGRAMS += x52evtest # Event test utility that works similarly to the Linux evtest -x52evtest_SOURCES = ev_test.c +x52evtest_SOURCES = evtest/ev_test.c x52evtest_CFLAGS = -I $(top_srcdir)/libx52io -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52evtest_LDFLAGS = $(WARN_LDFLAGS) -x52evtest_LDADD = ../libx52io/libx52io.la +x52evtest_LDADD = libx52io.la diff --git a/x52test/Makefile.am b/joytest/Makefile.am similarity index 66% rename from x52test/Makefile.am rename to joytest/Makefile.am index a11f409..cf87f71 100644 --- a/x52test/Makefile.am +++ b/joytest/Makefile.am @@ -4,15 +4,17 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -ACLOCAL_AMFLAGS = -I m4 - -bin_PROGRAMS = x52test +bin_PROGRAMS += x52test # Test utility that exercises all the library functions -x52test_SOURCES = x52_test.c x52_test_mfd.c x52_test_led.c x52_test_clock.c +x52test_SOURCES = \ + joytest/x52_test.c \ + joytest/x52_test_mfd.c \ + joytest/x52_test_led.c \ + joytest/x52_test_clock.c x52test_CFLAGS = -I $(top_srcdir)/libx52 -I $(top_srcdir) -DLOCALEDIR=\"$(localedir)\" $(WARN_CFLAGS) x52test_LDFLAGS = $(WARN_LDFLAGS) -x52test_LDADD = ../libx52/libx52.la +x52test_LDADD = libx52.la # Extra files that need to be in the distribution -EXTRA_DIST = x52_test_common.h +EXTRA_DIST += joytest/x52_test_common.h diff --git a/x52test/x52_test.c b/joytest/x52_test.c similarity index 100% rename from x52test/x52_test.c rename to joytest/x52_test.c diff --git a/x52test/x52_test_clock.c b/joytest/x52_test_clock.c similarity index 100% rename from x52test/x52_test_clock.c rename to joytest/x52_test_clock.c diff --git a/x52test/x52_test_common.h b/joytest/x52_test_common.h similarity index 100% rename from x52test/x52_test_common.h rename to joytest/x52_test_common.h diff --git a/x52test/x52_test_led.c b/joytest/x52_test_led.c similarity index 100% rename from x52test/x52_test_led.c rename to joytest/x52_test_led.c diff --git a/x52test/x52_test_mfd.c b/joytest/x52_test_mfd.c similarity index 100% rename from x52test/x52_test_mfd.c rename to joytest/x52_test_mfd.c diff --git a/libusbx52/Makefile.am b/libusbx52/Makefile.am index 4fdb6f7..1f82b6f 100644 --- a/libusbx52/Makefile.am +++ b/libusbx52/Makefile.am @@ -4,29 +4,22 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -ACLOCAL_AMFLAGS = -I m4 - -# Use the pthread compiler variables -LIBS += $(PTHREAD_LIBS) -AM_CFLAGS = $(PTHREAD_CFLAGS) -CC = $(PTHREAD_CC) - # libusb stub library for use by test programs -check_LTLIBRARIES = libusbx52.la +check_LTLIBRARIES += libusbx52.la -libusbx52_la_SOURCES = usb_x52_stub.c fopen_env.c -libusbx52_la_CFLAGS = @LIBUSB_CFLAGS@ $(WARN_CFLAGS) +libusbx52_la_SOURCES = libusbx52/usb_x52_stub.c libusbx52/fopen_env.c +libusbx52_la_CFLAGS = -I $(top_srcdir)/libusbx52 @LIBUSB_CFLAGS@ $(WARN_CFLAGS) libusbx52_la_LDFLAGS = -rpath /nowhere -module $(WARN_LDFLAGS) # Utility programs for use by tests -check_PROGRAMS = x52test_create_device_list x52test_log_actions +check_PROGRAMS += x52test_create_device_list x52test_log_actions -x52test_create_device_list_SOURCES = util/create_device_list.c $(libusbx52_la_SOURCES) -x52test_create_device_list_CFLAGS = @LIBUSB_CFLAGS@ $(WARN_CFLAGS) +x52test_create_device_list_SOURCES = libusbx52/util/create_device_list.c $(libusbx52_la_SOURCES) +x52test_create_device_list_CFLAGS = $(libusbx52_la_CFLAGS) x52test_create_device_list_LDFLAGS = $(WARN_LDFLAGS) -x52test_log_actions_SOURCES = util/log_actions.c $(libusbx52_la_SOURCES) -x52test_log_actions_CFLAGS = -I $(top_srcdir)/libx52 @LIBUSB_CFLAGS@ $(WARN_CFLAGS) +x52test_log_actions_SOURCES = libusbx52/util/log_actions.c $(libusbx52_la_SOURCES) +x52test_log_actions_CFLAGS = -I $(top_srcdir)/libx52 $(libusbx52_la_CFLAGS) x52test_log_actions_LDFLAGS = $(WARN_LDFLAGS) -EXTRA_DIST = README.md libusbx52.h +EXTRA_DIST += libusbx52/README.md libusbx52/libusbx52.h diff --git a/libx52/Makefile.am b/libx52/Makefile.am index 1d9e83e..3166c68 100644 --- a/libx52/Makefile.am +++ b/libx52/Makefile.am @@ -4,9 +4,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -ACLOCAL_AMFLAGS = -I m4 - -lib_LTLIBRARIES = libx52.la +lib_LTLIBRARIES += libx52.la # Core libx52 library # This library handles the USB communication between the host and the X52 @@ -15,9 +13,18 @@ lib_LTLIBRARIES = libx52.la libx52_v_CUR=6 libx52_v_AGE=4 libx52_v_REV=0 -libx52_la_SOURCES = x52_control.c x52_core.c x52_date_time.c x52_mfd_led.c \ - x52_strerror.c x52_stringify.c -libx52_la_CFLAGS = @LIBUSB_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" -I $(top_srcdir) $(WARN_CFLAGS) +libx52_la_SOURCES = \ + libx52/x52_control.c \ + libx52/x52_core.c \ + libx52/x52_date_time.c \ + libx52/x52_mfd_led.c \ + libx52/x52_strerror.c \ + libx52/x52_stringify.c +libx52_la_CFLAGS = \ + @LIBUSB_CFLAGS@ \ + -DLOCALEDIR=\"$(localedir)\" \ + -I $(top_srcdir) \ + $(WARN_CFLAGS) libx52_la_LDFLAGS = \ -export-symbols-regex '^libx52_' \ -version-info $(libx52_v_CUR):$(libx52_v_REV):$(libx52_v_AGE) @LIBUSB_LIBS@ \ @@ -25,37 +32,36 @@ libx52_la_LDFLAGS = \ libx52_la_LIBADD = @LTLIBINTL@ # Header files that need to be copied -x52includedir = $(includedir)/libx52 -x52include_HEADERS = libx52.h +x52include_HEADERS += libx52/libx52.h # pkg-config files -pkgconfig_DATA = libx52.pc +pkgconfig_DATA += libx52/libx52.pc if HAVE_CMOCKA -LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh -TESTS = libx52test -check_PROGRAMS = libx52test +TESTS += libx52test +check_PROGRAMS += libx52test -nodist_libx52test_SOURCES = test_libx52.c +nodist_libx52test_SOURCES = libx52/test_libx52.c libx52test_SOURCES = $(libx52_la_SOURCES) -libx52test_CFLAGS = @LIBUSB_CFLAGS@ -DLOCALEDIR='"$(localedir)"' -I $(top_srcdir) +libx52test_CFLAGS = @LIBUSB_CFLAGS@ -DLOCALEDIR='"$(localedir)"' -I $(top_srcdir) -I $(top_srcdir)/libx52 libx52test_CFLAGS += -Dlibusb_control_transfer=__wrap_libusb_control_transfer libx52test_LDFLAGS = @CMOCKA_LIBS@ @LIBUSB_LIBS@ libx52test_LDADD = libx52.la -CLEANFILES = test_libx52.c -test_libx52.c: $(srcdir)/x52_test_gen.py $(srcdir)/x52_tests.json - $(AM_V_GEN) $(PYTHON) $(srcdir)/x52_test_gen.py $(srcdir)/x52_tests.json > $@ +CLEANFILES += libx52/test_libx52.c +$(builddir)/libx52/test_libx52.c: $(srcdir)/libx52/x52_test_gen.py $(srcdir)/libx52/x52_tests.json + $(AM_V_GEN) $(PYTHON) $(srcdir)/libx52/x52_test_gen.py $(srcdir)/libx52/x52_tests.json > $@ endif # Extra files that need to be in the distribution -EXTRA_DIST = libx52.h x52_commands.h x52_common.h README.md +EXTRA_DIST += \ + libx52/libx52.h libx52/x52_commands.h libx52/x52_common.h libx52/README.md # Add test files to the distribution -EXTRA_DIST += x52_test_gen.py x52_tests.json +EXTRA_DIST += libx52/x52_test_gen.py libx52/x52_tests.json # Add documentation files to the distribution EXTRA_DIST += \ - doc/main.dox \ - doc/caveats.dox \ - doc/integration.dox + libx52/doc/main.dox \ + libx52/doc/caveats.dox \ + libx52/doc/integration.dox diff --git a/libx52io/Makefile.am b/libx52io/Makefile.am index 9fb534e..c3168ce 100644 --- a/libx52io/Makefile.am +++ b/libx52io/Makefile.am @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -lib_LTLIBRARIES = libx52io.la +lib_LTLIBRARIES += libx52io.la # X52 IO library # This library handles the HID parsing of the X52 USB reports @@ -13,7 +13,12 @@ lib_LTLIBRARIES = libx52io.la libx52io_v_CUR=0 libx52io_v_AGE=0 libx52io_v_REV=0 -libx52io_la_SOURCES = io_core.c io_axis.c io_parser.c io_strings.c io_device.c +libx52io_la_SOURCES = \ + libx52io/io_core.c \ + libx52io/io_axis.c \ + libx52io/io_parser.c \ + libx52io/io_strings.c \ + libx52io/io_device.c libx52io_la_CFLAGS = @HIDAPI_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" -I $(top_srcdir) $(WARN_CFLAGS) libx52io_la_LDFLAGS = \ -export-symbols-regex '^libx52io_' \ @@ -22,30 +27,31 @@ libx52io_la_LDFLAGS = \ libx52io_la_LIBADD = @LTLIBINTL@ # Header files that need to be copied -x52includedir = $(includedir)/libx52 -x52include_HEADERS = libx52io.h +x52include_HEADERS += libx52io/libx52io.h # pkg-config files # pkgconfig_DATA = libx52io.pc if HAVE_CMOCKA -LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh -TESTS = test-axis test-parser -check_PROGRAMS = $(TESTS) +TESTS += test-axis test-parser +check_PROGRAMS += $(TESTS) -test_axis_SOURCES = test_axis.c $(libx52io_la_SOURCES) +test_axis_SOURCES = libx52io/test_axis.c $(libx52io_la_SOURCES) test_axis_CFLAGS = $(libx52io_la_CFLAGS) test_axis_LDFLAGS = @CMOCKA_LIBS@ @HIDAPI_LIBS@ $(WARN_LDFLAGS) test_axis_LDADD = @LTLIBINTL@ -test_parser_SOURCES = test_parser.c $(libx52io_la_SOURCES) +test_parser_SOURCES = libx52io/test_parser.c $(libx52io_la_SOURCES) test_parser_CFLAGS = $(libx52io_la_CFLAGS) test_parser_LDFLAGS = @CMOCKA_LIBS@ @HIDAPI_LIBS@ $(WARN_LDFLAGS) test_parser_LDADD = @LTLIBINTL@ # Add a dependency on test_parser_tests.c -test_parser.c: test_parser_tests.c +libx52io/test_parser.c: libx52io/test_parser_tests.c endif # Extra files that need to be in the distribution -EXTRA_DIST = libx52io.h io_common.h test_parser_tests.c +EXTRA_DIST += \ + libx52io/libx52io.h \ + libx52io/io_common.h \ + libx52io/test_parser_tests.c diff --git a/libx52util/Makefile.am b/libx52util/Makefile.am index 63d9bf2..a7864bb 100644 --- a/libx52util/Makefile.am +++ b/libx52util/Makefile.am @@ -4,28 +4,29 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -ACLOCAL_AMFLAGS = -I m4 - -lib_LTLIBRARIES = libx52util.la +lib_LTLIBRARIES += libx52util.la # libx52 utility library # This library provides extra utilities for ease of use -nodist_libx52util_la_SOURCES = util_char_map.c -libx52util_la_SOURCES = x52_char_map_lookup.c -libx52util_la_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) +nodist_libx52util_la_SOURCES = libx52util/util_char_map.c +libx52util_la_SOURCES = libx52util/x52_char_map_lookup.c +libx52util_la_CFLAGS = -I $(top_srcdir)/libx52util $(WARN_CFLAGS) libx52util_la_LDFLAGS = -version-info 1:0:0 $(WARN_LDFLAGS) # Header files that need to be copied -x52includedir = $(includedir)/libx52 -x52include_HEADERS = libx52util.h - -# Extra files that need to be in the distribution -EXTRA_DIST = x52_char_map.cfg \ - x52_char_map.h \ - x52_char_map_gen.py +x52include_HEADERS += libx52util/libx52util.h # Autogenerated file that needs to be cleaned up -CLEANFILES = util_char_map.c -util_char_map.c: $(srcdir)/x52_char_map.cfg x52_char_map_gen.py - $(AM_V_GEN) $(PYTHON) $(srcdir)/x52_char_map_gen.py $(srcdir)/x52_char_map.cfg $@ +CLEANFILES += libx52util/util_char_map.c +util_char_map_c_DEPENDS = \ + $(srcdir)/libx52util/x52_char_map_gen.py \ + $(srcdir)/libx52util/x52_char_map.cfg + +$(builddir)/libx52util/util_char_map.c: $(util_char_map_c_DEPENDS) + $(AM_V_GEN) $(PYTHON) $(util_char_map_c_DEPENDS) $@ + +# Extra files that need to be in the distribution +EXTRA_DIST += libx52util/x52_char_map.cfg \ + libx52util/x52_char_map.h \ + libx52util/x52_char_map_gen.py diff --git a/po/POTFILES.in b/po/POTFILES.in index 9bab045..4a869a0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,11 +6,11 @@ libx52io/io_strings.c evtest/ev_test.c -x52test/x52_test.c -x52test/x52_test_clock.c -x52test/x52_test_common.h -x52test/x52_test_led.c -x52test/x52_test_mfd.c +joytest/x52_test.c +joytest/x52_test_clock.c +joytest/x52_test_common.h +joytest/x52_test_led.c +joytest/x52_test_mfd.c daemon/x52d_main.c daemon/x52d_clock.c diff --git a/po/x52pro-linux.pot b/po/x52pro-linux.pot index 208fccf..301bfd0 100644 --- a/po/x52pro-linux.pot +++ b/po/x52pro-linux.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.2\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 22:25-0700\n" +"POT-Creation-Date: 2021-07-29 22:58-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -255,239 +255,239 @@ msgstr "" msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "" -#: x52test/x52_test.c:97 +#: joytest/x52_test.c:97 msgid "Test brightness scale (~ 1m)" msgstr "" -#: x52test/x52_test.c:98 +#: joytest/x52_test.c:98 msgid "Test LED states (~ 45s)" msgstr "" -#: x52test/x52_test.c:99 +#: joytest/x52_test.c:99 msgid "Test MFD string display (~ 30s)" msgstr "" -#: x52test/x52_test.c:100 +#: joytest/x52_test.c:100 msgid "Test MFD displays all characters (~ 2m 15s)" msgstr "" -#: x52test/x52_test.c:101 +#: joytest/x52_test.c:101 msgid "Test the blink and shift commands (< 10s)" msgstr "" -#: x52test/x52_test.c:102 +#: joytest/x52_test.c:102 msgid "Test the clock commands (~1m)" msgstr "" -#: x52test/x52_test.c:126 +#: joytest/x52_test.c:126 msgid "" "x52test is a suite of tests to write to the X52 Pro device\n" "and test the extra functionality available in the LEDs and MFD\n" msgstr "" -#: x52test/x52_test.c:130 +#: joytest/x52_test.c:130 msgid "These tests take roughly 6 minutes to run" msgstr "" -#: x52test/x52_test.c:132 +#: joytest/x52_test.c:132 msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime" msgstr "" -#: x52test/x52_test.c:138 +#: joytest/x52_test.c:138 #, c-format msgid "Unable to initialize X52 library: %s\n" msgstr "" -#: x52test/x52_test.c:153 +#: joytest/x52_test.c:153 msgid "All tests completed successfully" msgstr "" -#: x52test/x52_test.c:155 +#: joytest/x52_test.c:155 #, c-format msgid "Got error %s\n" msgstr "" -#: x52test/x52_test.c:157 +#: joytest/x52_test.c:157 #, c-format msgid "Received %s signal, quitting...\n" msgstr "" -#: x52test/x52_test.c:176 +#: joytest/x52_test.c:176 msgid "" "These are the available tests with a description and\n" "approximate runtime. Not specifying any tests will run\n" "all the tests\n" msgstr "" -#: x52test/x52_test.c:180 +#: joytest/x52_test.c:180 msgid "List of tests:" msgstr "" -#: x52test/x52_test.c:230 +#: joytest/x52_test.c:230 #, c-format msgid "" "Usage: %s [list of tests]\n" "\n" msgstr "" -#: x52test/x52_test.c:244 +#: joytest/x52_test.c:244 #, c-format msgid "" "Unrecognized test identifier: %s\n" "\n" msgstr "" -#: x52test/x52_test.c:257 +#: joytest/x52_test.c:257 msgid "Not running any tests" msgstr "" -#: x52test/x52_test_clock.c:32 +#: joytest/x52_test_clock.c:32 msgid "Clock" msgstr "" -#: x52test/x52_test_clock.c:33 +#: joytest/x52_test_clock.c:33 msgid "This tests the clock display" msgstr "" -#: x52test/x52_test_clock.c:38 +#: joytest/x52_test_clock.c:38 msgid "" "\n" "Testing clock time minute display for 90 minutes" msgstr "" -#: x52test/x52_test_clock.c:44 +#: joytest/x52_test_clock.c:44 msgid "" "\n" "Testing clock time hour display for 36 hours, 12 hour mode" msgstr "" -#: x52test/x52_test_clock.c:47 +#: joytest/x52_test_clock.c:47 msgid "" "\n" "Testing clock time hour display for 36 hours, 24 hour mode" msgstr "" -#: x52test/x52_test_clock.c:52 +#: joytest/x52_test_clock.c:52 msgid "" "\n" "Testing clock date display for 31 days, dd-mm-yy" msgstr "" -#: x52test/x52_test_clock.c:56 +#: joytest/x52_test_clock.c:56 msgid "" "\n" "Testing clock date display for 31 days, mm-dd-yy" msgstr "" -#: x52test/x52_test_clock.c:60 +#: joytest/x52_test_clock.c:60 msgid "" "\n" "Testing clock date display for 31 days, yy-mm-dd" msgstr "" -#: x52test/x52_test_common.h:26 +#: joytest/x52_test_common.h:26 #, c-format msgid "" "\n" "%s(%s) failed with %d(%s)\n" msgstr "" -#: x52test/x52_test_common.h:32 +#: joytest/x52_test_common.h:32 #, c-format msgid "" "\n" "update failed with %d(%s)\n" msgstr "" -#: x52test/x52_test_led.c:19 +#: joytest/x52_test_led.c:19 #, c-format msgid "LED %s - %s\n" msgstr "" -#: x52test/x52_test_led.c:25 x52test/x52_test_led.c:32 +#: joytest/x52_test_led.c:25 joytest/x52_test_led.c:32 #, c-format msgid "" "\n" "Testing LED %s\n" msgstr "" -#: x52test/x52_test_led.c:42 +#: joytest/x52_test_led.c:42 msgid "LEDs" msgstr "" -#: x52test/x52_test_led.c:48 +#: joytest/x52_test_led.c:48 msgid "Skipping LED tests since the device does not support LED control" msgstr "" -#: x52test/x52_test_led.c:55 +#: joytest/x52_test_led.c:55 msgid "This cycles the LEDs through all possible states" msgstr "" -#: x52test/x52_test_led.c:73 +#: joytest/x52_test_led.c:73 #, c-format msgid "" "\n" "Testing %s\n" msgstr "" -#: x52test/x52_test_led.c:84 +#: joytest/x52_test_led.c:84 msgid "Blink & Shift" msgstr "" -#: x52test/x52_test_led.c:85 +#: joytest/x52_test_led.c:85 msgid "This tests the blink indicator and shift functionality" msgstr "" -#: x52test/x52_test_mfd.c:24 +#: joytest/x52_test_mfd.c:24 msgid "Brightness" msgstr "" -#: x52test/x52_test_mfd.c:26 +#: joytest/x52_test_mfd.c:26 msgid "This test cycles through the MFD and LED brightness scales" msgstr "" -#: x52test/x52_test_mfd.c:29 +#: joytest/x52_test_mfd.c:29 msgid "" "\n" "MFD: " msgstr "" -#: x52test/x52_test_mfd.c:36 +#: joytest/x52_test_mfd.c:36 msgid "" "\n" "LED: " msgstr "" -#: x52test/x52_test_mfd.c:55 +#: joytest/x52_test_mfd.c:55 msgid "MFD text" msgstr "" -#: x52test/x52_test_mfd.c:56 +#: joytest/x52_test_mfd.c:56 msgid "This test tests the character displays of the MFD\n" msgstr "" -#: x52test/x52_test_mfd.c:60 +#: joytest/x52_test_mfd.c:60 #, c-format msgid "Writing characters %s\n" msgstr "" -#: x52test/x52_test_mfd.c:82 +#: joytest/x52_test_mfd.c:82 msgid "MFD display" msgstr "" -#: x52test/x52_test_mfd.c:83 +#: joytest/x52_test_mfd.c:83 msgid "" "This test checks if the display elements can display all characters\n" "You should see the display cycling through each character, with every\n" "cell displaying the same character\n" msgstr "" -#: x52test/x52_test_mfd.c:88 +#: joytest/x52_test_mfd.c:88 #, c-format msgid "Testing character 0x%02x..." msgstr "" -#: x52test/x52_test_mfd.c:96 +#: joytest/x52_test_mfd.c:96 msgid "OK" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 1b21b52..f5a4e9a 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: x52pro-linux 0.2.1\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n" -"POT-Creation-Date: 2021-07-29 22:25-0700\n" +"POT-Creation-Date: 2021-07-29 22:58-0700\n" "PO-Revision-Date: 2021-07-27 02:08-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -255,31 +255,31 @@ msgstr "Estingtay (interruptay otay exitay)\n" msgid "Event @ %ld.%06ld: %s, value %d\n" msgstr "Eventay @ %ld.%06ld: %s, aluevay %d\n" -#: x52test/x52_test.c:97 +#: joytest/x52_test.c:97 msgid "Test brightness scale (~ 1m)" msgstr "Esttay ightnessbray alescay (~ 1m)" -#: x52test/x52_test.c:98 +#: joytest/x52_test.c:98 msgid "Test LED states (~ 45s)" msgstr "Esstay EDLay atesstay (~ 45s)" -#: x52test/x52_test.c:99 +#: joytest/x52_test.c:99 msgid "Test MFD string display (~ 30s)" msgstr "Esttay MFDay ingstray isplayday (~ 30s)" -#: x52test/x52_test.c:100 +#: joytest/x52_test.c:100 msgid "Test MFD displays all characters (~ 2m 15s)" msgstr "Esttay MFDay isplaysday allay aracterschay (~ 2m 15s)" -#: x52test/x52_test.c:101 +#: joytest/x52_test.c:101 msgid "Test the blink and shift commands (< 10s)" msgstr "Esttay ethay inkblay anday iftshay ommandscay (< 10s)" -#: x52test/x52_test.c:102 +#: joytest/x52_test.c:102 msgid "Test the clock commands (~1m)" msgstr "Esttay ethay ockclay ommandscay (~1m)" -#: x52test/x52_test.c:126 +#: joytest/x52_test.c:126 msgid "" "x52test is a suite of tests to write to the X52 Pro device\n" "and test the extra functionality available in the LEDs and MFD\n" @@ -288,36 +288,36 @@ msgstr "" "X52 Pro eviceday anday esttay ethay extray unctionalityfay\n" "availableay inay ethay EDsLay anday FDMay\n" -#: x52test/x52_test.c:130 +#: joytest/x52_test.c:130 msgid "These tests take roughly 6 minutes to run" msgstr "Esethay eststay aketay oughlyray 6 inutesmay otay unray" -#: x52test/x52_test.c:132 +#: joytest/x52_test.c:132 msgid "Press Enter to begin the tests, press Ctrl-C to abort anytime" msgstr "" "Esspray Enteray otay eginbay ethay eststay, esspray Ctrl-C otay abortay " "anytimeay" -#: x52test/x52_test.c:138 +#: joytest/x52_test.c:138 #, c-format msgid "Unable to initialize X52 library: %s\n" msgstr "Unableay otay initializeay X52 ibrarylay: %s\n" -#: x52test/x52_test.c:153 +#: joytest/x52_test.c:153 msgid "All tests completed successfully" msgstr "Allay eststay ompletedcay uccessfullysay" -#: x52test/x52_test.c:155 +#: joytest/x52_test.c:155 #, c-format msgid "Got error %s\n" msgstr "Otgay erroray %s\n" -#: x52test/x52_test.c:157 +#: joytest/x52_test.c:157 #, c-format msgid "Received %s signal, quitting...\n" msgstr "Eceivedray %s ignalsay, uittingqay...\n" -#: x52test/x52_test.c:176 +#: joytest/x52_test.c:176 msgid "" "These are the available tests with a description and\n" "approximate runtime. Not specifying any tests will run\n" @@ -328,18 +328,18 @@ msgstr "" "ecifyingspay anyay eststay illway unray allay ethay\n" "eststay\n" -#: x52test/x52_test.c:180 +#: joytest/x52_test.c:180 msgid "List of tests:" msgstr "Istlay ofay eststay:" -#: x52test/x52_test.c:230 +#: joytest/x52_test.c:230 #, c-format msgid "" "Usage: %s [list of tests]\n" "\n" msgstr "Usageay: %s [istlay ofay eststay]\n" -#: x52test/x52_test.c:244 +#: joytest/x52_test.c:244 #, c-format msgid "" "Unrecognized test identifier: %s\n" @@ -348,19 +348,19 @@ msgstr "" "Unrecognizeday esttay identifieray: %s\n" "\n" -#: x52test/x52_test.c:257 +#: joytest/x52_test.c:257 msgid "Not running any tests" msgstr "Otnay unningray anyay eststay" -#: x52test/x52_test_clock.c:32 +#: joytest/x52_test_clock.c:32 msgid "Clock" msgstr "Ockclay" -#: x52test/x52_test_clock.c:33 +#: joytest/x52_test_clock.c:33 msgid "This tests the clock display" msgstr "Isthay eststay ethay ockclay isplayday" -#: x52test/x52_test_clock.c:38 +#: joytest/x52_test_clock.c:38 msgid "" "\n" "Testing clock time minute display for 90 minutes" @@ -368,7 +368,7 @@ msgstr "" "\n" "Estingtay ockclay imetay inutemay isplayday orfay 90 inutesmay" -#: x52test/x52_test_clock.c:44 +#: joytest/x52_test_clock.c:44 msgid "" "\n" "Testing clock time hour display for 36 hours, 12 hour mode" @@ -376,7 +376,7 @@ msgstr "" "\n" "Estingtay ockclay imetay ourhay isplayday orfay 36 ourshay, 12 ourhay odemay" -#: x52test/x52_test_clock.c:47 +#: joytest/x52_test_clock.c:47 msgid "" "\n" "Testing clock time hour display for 36 hours, 24 hour mode" @@ -384,7 +384,7 @@ msgstr "" "\n" "Estingtay ockclay imetay ourhay isplayday orfay 36 ourshay, 24 ourhay odemay" -#: x52test/x52_test_clock.c:52 +#: joytest/x52_test_clock.c:52 msgid "" "\n" "Testing clock date display for 31 days, dd-mm-yy" @@ -392,7 +392,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, dd-mm-yy" -#: x52test/x52_test_clock.c:56 +#: joytest/x52_test_clock.c:56 msgid "" "\n" "Testing clock date display for 31 days, mm-dd-yy" @@ -400,7 +400,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, mm-dd-yy" -#: x52test/x52_test_clock.c:60 +#: joytest/x52_test_clock.c:60 msgid "" "\n" "Testing clock date display for 31 days, yy-mm-dd" @@ -408,7 +408,7 @@ msgstr "" "\n" "Estingtay ockclay ateday isplayday orfay 31 aysday, yy-mm-dd" -#: x52test/x52_test_common.h:26 +#: joytest/x52_test_common.h:26 #, c-format msgid "" "\n" @@ -417,7 +417,7 @@ msgstr "" "\n" "%s(%s) ailedfay ithway %d(%s)\n" -#: x52test/x52_test_common.h:32 +#: joytest/x52_test_common.h:32 #, c-format msgid "" "\n" @@ -426,12 +426,12 @@ msgstr "" "\n" "updateay ailedfay ithway %d(%s)\n" -#: x52test/x52_test_led.c:19 +#: joytest/x52_test_led.c:19 #, c-format msgid "LED %s - %s\n" msgstr "EDLay %s - %s\n" -#: x52test/x52_test_led.c:25 x52test/x52_test_led.c:32 +#: joytest/x52_test_led.c:25 joytest/x52_test_led.c:32 #, c-format msgid "" "\n" @@ -440,21 +440,21 @@ msgstr "" "\n" "Estingtay EDLay %s\n" -#: x52test/x52_test_led.c:42 +#: joytest/x52_test_led.c:42 msgid "LEDs" msgstr "EDsLay" -#: x52test/x52_test_led.c:48 +#: joytest/x52_test_led.c:48 msgid "Skipping LED tests since the device does not support LED control" msgstr "" "Ippingskay EDLay eststay incesay ethay eviceday oesday otnay\n" "upportsay EDLay ontrolcay" -#: x52test/x52_test_led.c:55 +#: joytest/x52_test_led.c:55 msgid "This cycles the LEDs through all possible states" msgstr "Isthay yclescay ethay EDsLay oughthray allay ossiblepay tatessay" -#: x52test/x52_test_led.c:73 +#: joytest/x52_test_led.c:73 #, c-format msgid "" "\n" @@ -463,25 +463,25 @@ msgstr "" "\n" "Estingtay %s\n" -#: x52test/x52_test_led.c:84 +#: joytest/x52_test_led.c:84 msgid "Blink & Shift" msgstr "Inkblay & Iftshay" -#: x52test/x52_test_led.c:85 +#: joytest/x52_test_led.c:85 msgid "This tests the blink indicator and shift functionality" msgstr "Isthay eststay ethay inkblay indicatoray anday iftshay unctionalityfay" -#: x52test/x52_test_mfd.c:24 +#: joytest/x52_test_mfd.c:24 msgid "Brightness" msgstr "Ightnessbray" -#: x52test/x52_test_mfd.c:26 +#: joytest/x52_test_mfd.c:26 msgid "This test cycles through the MFD and LED brightness scales" msgstr "" "Isthay esttay yclescay oughthray ethay FDMay anday EDLay ightnessbray " "alesscay" -#: x52test/x52_test_mfd.c:29 +#: joytest/x52_test_mfd.c:29 msgid "" "\n" "MFD: " @@ -489,7 +489,7 @@ msgstr "" "\n" "FDMay: " -#: x52test/x52_test_mfd.c:36 +#: joytest/x52_test_mfd.c:36 msgid "" "\n" "LED: " @@ -497,24 +497,24 @@ msgstr "" "\n" "EDLay: " -#: x52test/x52_test_mfd.c:55 +#: joytest/x52_test_mfd.c:55 msgid "MFD text" msgstr "FDMay exttay" -#: x52test/x52_test_mfd.c:56 +#: joytest/x52_test_mfd.c:56 msgid "This test tests the character displays of the MFD\n" msgstr "Isthay esttay eststay ethay aracterchay isplaysday ofay the FDMay\n" -#: x52test/x52_test_mfd.c:60 +#: joytest/x52_test_mfd.c:60 #, c-format msgid "Writing characters %s\n" msgstr "Itingwray aracterschay %s\n" -#: x52test/x52_test_mfd.c:82 +#: joytest/x52_test_mfd.c:82 msgid "MFD display" msgstr "FDMay isplayday" -#: x52test/x52_test_mfd.c:83 +#: joytest/x52_test_mfd.c:83 msgid "" "This test checks if the display elements can display all characters\n" "You should see the display cycling through each character, with every\n" @@ -525,12 +525,12 @@ msgstr "" "oughthray eachay aracterchay, ithway everyay ellcay isplayingday ethay\n" "amesay aracterchay\n" -#: x52test/x52_test_mfd.c:88 +#: joytest/x52_test_mfd.c:88 #, c-format msgid "Testing character 0x%02x..." msgstr "Estingtay aracterchay 0x%02x..." -#: x52test/x52_test_mfd.c:96 +#: joytest/x52_test_mfd.c:96 msgid "OK" msgstr "OKay" diff --git a/udev/Makefile.am b/udev/Makefile.am index b2d9258..f2cf713 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -4,8 +4,7 @@ # # SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 -# Extra files that need to be in the distribution -EXTRA_DIST = 60-saitek-x52-x52pro.rules +EXTRA_DIST += udev/60-saitek-x52-x52pro.rules if HAVE_UDEV @@ -13,7 +12,7 @@ if HAVE_UDEV # writable by root, and if we're running make distcheck, we're most likely not # running as root. Therefore, disable this if we're running make distcheck if !IS_MAKE_DISTCHECK -udevrules_DATA = 60-saitek-x52-x52pro.rules +udevrules_DATA = udev/60-saitek-x52-x52pro.rules # Update udev only if being installed by root install-data-hook: diff --git a/x52cli/Makefile.am b/x52cli/Makefile.am deleted file mode 100644 index 5117f13..0000000 --- a/x52cli/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -# Automake for x52cli -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -ACLOCAL_AMFLAGS = -I m4 - -bin_PROGRAMS = x52cli - -# Command line utility that front ends the core library -x52cli_SOURCES = x52_cli.c -x52cli_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) -x52cli_LDFLAGS = $(WARN_LDFLAGS) -x52cli_LDADD = ../libx52/libx52.la From abdf47d721f8c4559f1cac57fc1b0bd710d977db Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 29 Jul 2021 23:55:07 -0700 Subject: [PATCH 61/68] Delete obsolete files --- tests/Makefile.am | 19 ---- tools/hidraw/hid-example.c | 178 ------------------------------------- tools/hidraw/hidraw.c | 106 ---------------------- tools/readjoy/Makefile | 10 --- tools/readjoy/readjoy.c | 42 --------- 5 files changed, 355 deletions(-) delete mode 100644 tests/Makefile.am delete mode 100644 tools/hidraw/hid-example.c delete mode 100644 tools/hidraw/hidraw.c delete mode 100644 tools/readjoy/Makefile delete mode 100644 tools/readjoy/readjoy.c diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 2007129..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# Automake for x52cli tests -# -# Copyright (C) 2012-2020 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -# Source: https://stackoverflow.com/a/20831065 -LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh - -TESTS = \ - x52cli/test_leds \ - x52cli/test_brightness \ - x52cli/test_indicator \ - x52cli/test_mfd \ - x52cli/test_clock \ - x52cli/test_timezone - -EXTRA_DIST = common_infra.sh $(TESTS) - diff --git a/tools/hidraw/hid-example.c b/tools/hidraw/hid-example.c deleted file mode 100644 index b01b3ab..0000000 --- a/tools/hidraw/hid-example.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Hidraw Userspace Example - * - * Copyright (c) 2010 Alan Ott - * Copyright (c) 2010 Signal 11 Software - * - * The code may be used by anyone for any purpose, - * and can serve as a starting point for developing - * applications using hidraw. - */ - -/* Linux */ -#include -#include -#include - -/* - * Ugly hack to work around failing compilation on systems that don't - * yet populate new version of hidraw.h to userspace. - * - * If you need this, please have your distro update the kernel headers. - */ -#ifndef HIDIOCSFEATURE -#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) -#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) -#endif - -/* Unix */ -#include -#include -#include -#include -#include - -/* C */ -#include -#include -#include -#include - -const char *bus_str(int bus); - -int main(int argc, char **argv) -{ - int fd; - int i, res, desc_size = 0; - char buf[256]; - struct hidraw_report_descriptor rpt_desc; - struct hidraw_devinfo info; - - /* Open the Device with non-blocking reads. In real life, - don't use a hard coded path; use libudev instead. */ - fd = open("/dev/hidraw0", O_RDWR|O_NONBLOCK); - - if (fd < 0) { - perror("Unable to open device"); - return 1; - } - - memset(&rpt_desc, 0x0, sizeof(rpt_desc)); - memset(&info, 0x0, sizeof(info)); - memset(buf, 0x0, sizeof(buf)); - - /* Get Report Descriptor Size */ - res = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size); - if (res < 0) - perror("HIDIOCGRDESCSIZE"); - else - printf("Report Descriptor Size: %d\n", desc_size); - - /* Get Report Descriptor */ - rpt_desc.size = desc_size; - res = ioctl(fd, HIDIOCGRDESC, &rpt_desc); - if (res < 0) { - perror("HIDIOCGRDESC"); - } else { - printf("Report Descriptor:\n"); - for (i = 0; i < rpt_desc.size; i++) - printf("%hhx ", rpt_desc.value[i]); - puts("\n"); - } - - /* Get Raw Name */ - res = ioctl(fd, HIDIOCGRAWNAME(256), buf); - if (res < 0) - perror("HIDIOCGRAWNAME"); - else - printf("Raw Name: %s\n", buf); - - /* Get Physical Location */ - res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); - if (res < 0) - perror("HIDIOCGRAWPHYS"); - else - printf("Raw Phys: %s\n", buf); - - /* Get Raw Info */ - res = ioctl(fd, HIDIOCGRAWINFO, &info); - if (res < 0) { - perror("HIDIOCGRAWINFO"); - } else { - printf("Raw Info:\n"); - printf("\tbustype: %d (%s)\n", - info.bustype, bus_str(info.bustype)); - printf("\tvendor: 0x%04hx\n", info.vendor); - printf("\tproduct: 0x%04hx\n", info.product); - } - - /* Set Feature */ - buf[0] = 0x9; /* Report Number */ - buf[1] = 0xff; - buf[2] = 0xff; - buf[3] = 0xff; - res = ioctl(fd, HIDIOCSFEATURE(4), buf); - if (res < 0) - perror("HIDIOCSFEATURE"); - else - printf("ioctl HIDIOCGFEATURE returned: %d\n", res); - - /* Get Feature */ - buf[0] = 0x9; /* Report Number */ - res = ioctl(fd, HIDIOCGFEATURE(256), buf); - if (res < 0) { - perror("HIDIOCGFEATURE"); - } else { - printf("ioctl HIDIOCGFEATURE returned: %d\n", res); - printf("Report data (not containing the report number):\n\t"); - for (i = 0; i < res; i++) - printf("%hhx ", buf[i]); - puts("\n"); - } - - /* Send a Report to the Device */ - buf[0] = 0x1; /* Report Number */ - buf[1] = 0x77; - res = 0; //write(fd, buf, 2); - if (res < 0) { - printf("Error: %d\n", errno); - perror("write"); - } else { - printf("write() wrote %d bytes\n", res); - } - - /* Get a report from the device */ - res = read(fd, buf, 16); - if (res < 0) { - perror("read"); - } else { - printf("read() read %d bytes:\n\t", res); - for (i = 0; i < res; i++) - printf("%hhx ", buf[i]); - puts("\n"); - } - close(fd); - return 0; -} - -const char * -bus_str(int bus) -{ - switch (bus) { - case BUS_USB: - return "USB"; - break; - case BUS_HIL: - return "HIL"; - break; - case BUS_BLUETOOTH: - return "Bluetooth"; - break; - case BUS_VIRTUAL: - return "Virtual"; - break; - default: - return "Other"; - break; - } -} diff --git a/tools/hidraw/hidraw.c b/tools/hidraw/hidraw.c deleted file mode 100644 index ac09ff7..0000000 --- a/tools/hidraw/hidraw.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Hidraw Userspace Example - * - * Copyright (c) 2010 Alan Ott - * Copyright (c) 2010 Signal 11 Software - * - * The code may be used by anyone for any purpose, - * and can serve as a starting point for developing - * applications using hidraw. - */ - -/* Linux */ -#include -#include -#include - -/* - * Ugly hack to work around failing compilation on systems that don't - * yet populate new version of hidraw.h to userspace. - * - * If you need this, please have your distro update the kernel headers. - */ -#ifndef HIDIOCSFEATURE -#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) -#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) -#endif - -/* Unix */ -#include -#include -#include -#include -#include - -/* C */ -#include -#include -#include -#include - -const char *bus_str(int bus); - -int main(int argc, char **argv) -{ - int fd; - int i, res, desc_size = 0; - unsigned char buf[256]; - struct hidraw_report_descriptor rpt_desc; - struct hidraw_devinfo info; - - if (argc != 2) { - fprintf(stderr, "usage: %s \n", argv[0]); - return 1; - } - - /* Open the Device with non-blocking reads. In real life, - don't use a hard coded path; use libudev instead. */ - fd = open(argv[1], O_RDONLY); - - if (fd < 0) { - perror("Unable to open device"); - return 1; - } - - memset(&rpt_desc, 0x0, sizeof(rpt_desc)); - memset(&info, 0x0, sizeof(info)); - memset(buf, 0x0, sizeof(buf)); - -retry: - /* Get a report from the device */ - res = read(fd, buf, 16); - if (res < 0) { - perror("read"); - } else { - printf("read() read %d bytes:\n\t", res); - for (i = 0; i < res; i++) - printf("%02x ", buf[i]); - puts("\n"); - } - - goto retry; - close(fd); - return 0; -} - -const char * -bus_str(int bus) -{ - switch (bus) { - case BUS_USB: - return "USB"; - break; - case BUS_HIL: - return "HIL"; - break; - case BUS_BLUETOOTH: - return "Bluetooth"; - break; - case BUS_VIRTUAL: - return "Virtual"; - break; - default: - return "Other"; - break; - } -} diff --git a/tools/readjoy/Makefile b/tools/readjoy/Makefile deleted file mode 100644 index eabbba3..0000000 --- a/tools/readjoy/Makefile +++ /dev/null @@ -1,10 +0,0 @@ - -readjoy: readjoy.c - gcc -o $@ $< - -all: readjoy - -.PHONY: clean -clean: - rm -f readjoy - diff --git a/tools/readjoy/readjoy.c b/tools/readjoy/readjoy.c deleted file mode 100644 index 2540f84..0000000 --- a/tools/readjoy/readjoy.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - struct js_event joy_event; - int fd; - if (argc != 2) { - fprintf(stderr, "Usage: %s /dev/input/jsX\n", argv[0]); - return -1; - } - - fd = open(argv[1], O_RDONLY); - if (!fd) { - fprintf(stderr, "Error: Unable to open %s!\n", argv[1]); - return -2; - } - - for(;;) { - if (read(fd, &joy_event, sizeof(joy_event)) != sizeof(joy_event)) { - fprintf(stderr, "Error: Unable to read from joystick!\n"); - return -3; - } else { - if (joy_event.type & JS_EVENT_INIT) { - printf("*"); - } - - if (joy_event.type & JS_EVENT_BUTTON) { - printf("B"); - } else if (joy_event.type & JS_EVENT_AXIS) { - printf("A"); - } else { - printf("?"); - } - printf("%u: %d\n", joy_event.number, joy_event.value); - } - } - - return 0; -} From 51913094cb63b6fc6d0277d6545e0151239de555 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 03:03:16 -0700 Subject: [PATCH 62/68] Use cmocka to test CLI --- cli/Makefile.am | 20 +- cli/cli_test_brightness | 35 - cli/cli_test_clock | 210 -- cli/cli_test_indicator | 36 - cli/cli_test_leds | 83 - cli/cli_test_mfd | 91 - cli/cli_test_timezone | 68 - cli/common_infra.sh | 203 -- cli/test_x52_cli.c | 177 + cli/test_x52_cli_tests.c | 6858 ++++++++++++++++++++++++++++++++++++++ cli/x52_cli.c | 6 +- 11 files changed, 7050 insertions(+), 737 deletions(-) delete mode 100755 cli/cli_test_brightness delete mode 100755 cli/cli_test_clock delete mode 100755 cli/cli_test_indicator delete mode 100755 cli/cli_test_leds delete mode 100755 cli/cli_test_mfd delete mode 100755 cli/cli_test_timezone delete mode 100644 cli/common_infra.sh create mode 100644 cli/test_x52_cli.c create mode 100644 cli/test_x52_cli_tests.c diff --git a/cli/Makefile.am b/cli/Makefile.am index 90726e8..1b33572 100644 --- a/cli/Makefile.am +++ b/cli/Makefile.am @@ -12,14 +12,14 @@ x52cli_CFLAGS = -I $(top_srcdir)/libx52 $(WARN_CFLAGS) x52cli_LDFLAGS = $(WARN_LDFLAGS) x52cli_LDADD = libx52.la -# TODO: Automake doesn't recognize these tests as scripts, and looks for -# C sources. We need to replace these tests with a CMocka test suite -CLI_TESTS = \ - cli/cli_test_leds \ - cli/cli_test_brightness \ - cli/cli_test_indicator \ - cli/cli_test_mfd \ - cli/cli_test_clock \ - cli/cli_test_timezone +if HAVE_CMOCKA +TESTS += test-cli +check_PROGRAMS += test-cli -EXTRA_DIST += cli/common_infra.sh $(CLI_TESTS) +test_cli_SOURCES = cli/x52_cli.c cli/test_x52_cli.c +test_cli_CFLAGS = -DX52_CLI_TESTING -I $(top_srcdir)/libx52 +test_cli_LDFLAGS = @CMOCKA_LIBS@ $(WARN_LDFLAGS) + +# Add a dependency on test_x52_cli_tests.c +cli/test_x52_cli.c: cli/test_x52_cli_tests.c +endif diff --git a/cli/cli_test_brightness b/cli/cli_test_brightness deleted file mode 100755 index c45d9ff..0000000 --- a/cli/cli_test_brightness +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# MFD & LED brightness tests -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh - -TEST_SUITE_ID="libx52 MFD & LED brightness tests" - -brightness_test() -{ - local unit=$(echo $1 | tr a-z A-Z) - local bri=$(printf '0x%04x' $2) - local index="\$X52_${unit}_BRIGHTNESS_INDEX" - TEST_ID="Test setting $unit brightness to $bri" - - expect_pattern $(eval echo $index) $bri - - $X52CLI bri $unit $bri - - verify_output -} - -for unit in mfd led -do - for bri in $(seq 0 128) - do - brightness_test $unit $bri - done -done - -verify_test_suite - diff --git a/cli/cli_test_clock b/cli/cli_test_clock deleted file mode 100755 index abcb9a9..0000000 --- a/cli/cli_test_clock +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env bash -# Clock tests -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh - -TEST_SUITE_ID="libx52 clock tests" - -clock_test_utc() -{ - local timezone=$1 - local time_format=$2 - local date_format=$3 - TEST_ID="Test setting clock to $timezone time, $time_format, $date_format" - - local dd=$(date +%_d) - local mm=$(date +%_m) - local yy=$(date +%_y) - local hr=$(date +%_H) - local mn=$(date +%_M) - - local clock_value=$(($hr * 256 + $mn)) - if [[ $time_format == 24hr ]] - then - clock_value=$(($clock_value + 32768)) - fi - - case $date_format in - ddmmyy) - date_value=$(($mm * 256 + $dd)) - year_value=$yy - ;; - mmddyy) - date_value=$(($dd * 256 + $mm)) - year_value=$yy - ;; - yymmdd) - date_value=$(($mm * 256 + $yy)) - year_value=$dd - ;; - *) - ;; - esac - - expect_pattern \ - $X52_CLOCK_DATE_INDEX $(printf '%04x' $date_value) \ - $X52_CLOCK_YEAR_INDEX $(printf '%04x' $year_value) \ - $X52_CLOCK_1_INDEX $(printf '%04x' $clock_value) \ - - $X52CLI clock $timezone $time_format $date_format - - verify_output -} - -offset_test() -{ - local clock_id=$1 - local offset=$2 - local time_format=$3 - TEST_ID="Test setting clock $clock_id offset to $offset, $time_format" - - local index="\$X52_CLOCK_${clock_id}_INDEX" - local value=0 - - # Handle negative case - if [[ $offset -lt 0 ]] - then - value=$((-$offset)) - value=$(($value & 0x3ff)) - value=$(($value | 1024)) - else - value=$offset - fi - - if [[ $time_format == 24hr ]] - then - value=$(($value + 32768)) - fi - - expect_pattern $(eval echo $index) $(printf '%04x' $value) - - $X52CLI offset $clock_id $offset $time_format - - verify_output - -} - -raw_time_test() -{ - local hh=$1 - local mm=$2 - local time_format=$3 - TEST_ID=$(printf "Test setting time to %02d:%02d, %s" $hh $mm $time_format) - - local value=$(($hh * 256 + $mm)) - if [[ $time_format == 24hr ]] - then - value=$((value + 32768)) - fi - - expect_pattern $X52_CLOCK_1_INDEX $(printf '%04x' $value) - - $X52CLI time $hh $mm $time_format - - verify_output -} - -raw_date_test() -{ - local dd=$1 - local mm=$2 - local yy=$3 - local date_format=$4 - - case "$date_format" in - ddmmyy) - dd1=$dd - mm1=$mm - yy1=$yy - ;; - mmddyy) - dd1=$mm - mm1=$dd - yy1=$yy - ;; - yymmdd) - dd1=$yy - mm1=$mm - yy1=$dd - ;; - esac - - TEST_ID=$(printf "Test setting date in %s format to %02d-%02d-%02d" $date_format $dd1 $mm1 $yy1) - - local date_value=$(printf '%04x' $(($mm1 * 256 + $dd1))) - local year_value=$(printf '%04x' $yy1) - - expect_pattern \ - $X52_CLOCK_DATE_INDEX $date_value \ - $X52_CLOCK_YEAR_INDEX $year_value - - $X52CLI date $dd $mm $yy $date_format - - verify_output -} - -# For all test cases, we want to assume that the local timezone -# is the same as UTC, as otherwise, it can cause havoc, depending -# on when and where the tests are run. -export TZ=UTC - -for timezone in 'local' gmt -do - for time_format in 12hr 24hr - do - for date_format in ddmmyy mmddyy yymmdd - do - clock_test_utc $timezone $time_format $date_format - done - done -done - -# For the offset test cases, x52cli reinitializes the internal data -# structure every time it is called, therefore, the timezone for clock -# 1 is automatically reset to UTC. -unset TZ - -for clock in 2 3 -do - for time_format in 12hr 24hr - do - # Run offset tests for every 30 minute offset from UTC - for offset in $(seq -1020 30 1020) - do - offset_test $clock $offset $time_format - done - done -done - -# The raw time test cases are a limited set of tests, it simply runs for -# every minute from 00:00 through 00:59, then it runs for every hour from -# 00:00 through 23:00. The tests are run in both 12 hour and 24 hour mode. -for mm in $(seq 0 59) -do - for time_format in 12hr 24hr - do - raw_time_test 0 $mm $time_format - done -done - -for hh in $(seq 0 23) -do - for time_format in 12hr 24hr - do - raw_time_test $hh 0 $time_format - done -done - -# The raw date tests simply verify that the date February 1, year 3 is -# displayed correctly in all 3 date formats -for date_format in ddmmyy mmddyy yymmdd -do - raw_date_test 1 2 3 $date_format -done - -verify_test_suite - diff --git a/cli/cli_test_indicator b/cli/cli_test_indicator deleted file mode 100755 index 3ee2ff0..0000000 --- a/cli/cli_test_indicator +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -# Indicator (blink & shift) tests -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh - -TEST_SUITE_ID="libx52 indicator tests (blink & shift)" - -indicator_test() -{ - local indicator=$(echo $1 | tr a-z A-Z) - local state=$(echo $2 | tr a-z A-Z) - local index="\$X52_${indicator}_INDICATOR_INDEX" - local value="\$X52_INDICATOR_STATE_${state}" - TEST_ID="Test setting $indicator $state" - - expect_pattern $(eval echo $index $value) - - $X52CLI $indicator $state - - verify_output -} - -for indicator in blink shift -do - for state in on off - do - indicator_test $indicator $state - done -done - -verify_test_suite - diff --git a/cli/cli_test_leds b/cli/cli_test_leds deleted file mode 100755 index d89f532..0000000 --- a/cli/cli_test_leds +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash -# LED tests -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh - -TEST_SUITE_ID="libx52 LED state tests" - -mono_led_test() -{ - local led_ident=$(echo $1 | tr a-z A-Z) - local led_state=$2 - local state=$(echo "\$X52_LED_${led_ident}_${led_state}" | tr a-z A-Z) - local TEST_ID="Test setting the $led_ident button $led_state" - - expect_pattern $X52_LED_COMMAND_INDEX $(eval echo $state) - - $X52CLI led $led_ident $led_state - - verify_output -} - -color_led_test() -{ - local led_ident=$(echo $1 | tr a-z A-Z) - local led_color=$(echo $2 | tr A-Z a-z) - local led_r_state=off - local led_g_state=off - local TEST_ID="Test setting the $led_ident button to $led_color" - - case $led_color in - 'red') - led_r_state=on - ;; - 'green') - led_g_state=on - ;; - 'amber') - led_r_state=on - led_g_state=on - ;; - 'off') - ;; - *) - echo "ERROR: Unknown ident" >&2 - exit $EXIT_HARD_ERROR - ;; - esac - - led_r_state=$(echo "\$X52_LED_${led_ident}_red_${led_r_state}" | tr a-z A-Z) - led_g_state=$(echo "\$X52_LED_${led_ident}_green_${led_g_state}" | tr a-z A-Z) - - expect_pattern \ - $X52_LED_COMMAND_INDEX $(eval echo $led_r_state) \ - $X52_LED_COMMAND_INDEX $(eval echo $led_g_state) - - $X52CLI led $led_ident $led_color - - verify_output -} - -# Run Mono-color LED tests -for led in fire throttle -do - for state in on off - do - mono_led_test $led $state - done -done - -# Run multi-color LED tests -for led in a b d e t1 t2 t3 pov clutch -do - for color in off red amber green - do - color_led_test $led $color - done -done - -verify_test_suite diff --git a/cli/cli_test_mfd b/cli/cli_test_mfd deleted file mode 100755 index a1d56ff..0000000 --- a/cli/cli_test_mfd +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -# MFD tests -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh - -TEST_SUITE_ID="libx52 MFD text tests" - -# Take in input as a string, and convert them to list of MFD set format -format_text() -{ - local clear_index=$(eval echo $1) - local set_index=$(eval echo $2) - local input_string=$3 - local output_list="$clear_index 0" - local count=0 - - while [[ ${#input_string} -gt 1 ]] - do - char1=${input_string:0:1} - char2=${input_string:1:1} - input_string=${input_string:2} - output_list="$output_list $set_index $(printf '%02x%02x' \'$char2 \'$char1)" - ((count+=2)) - - # The library ignores strings longer than 16 characters - if [[ $count -eq 16 ]] - then - # Discard the rest of the input string - input_string= - fi - done - - if [[ ${#input_string} -eq 1 ]] - then - # Add the remaining character, but pad with a space - output_list="$output_list $set_index $(printf '20%02x' \'$input_string)" - fi - - echo $output_list - return 0 -} - -mfd_text_test() -{ - local line=$1 - local clear_index="\$X52_MFD_LINE_${line}_CLR_INDEX" - local set_index="\$X52_MFD_LINE_${line}_SET_INDEX" - local text="$2" - TEST_ID="Test setting MFD line $line to '$text'" - - pattern=$(format_text $clear_index $set_index "$text") - expect_pattern $pattern - - $X52CLI mfd $line "$text" - - verify_output -} - -for text in \ - a \ - ab \ - abc \ - abcd \ - abcde \ - abcdef \ - abcdefg \ - abcdefgh \ - abcdefghi \ - abcdefghij \ - abcdefghijk \ - abcdefghijkl \ - abcdefghijklm \ - abcdefghijklmn \ - abcdefghijklmno \ - abcdefghijklmnop \ - abcdefghijklmnopq \ - abcdefghijklmnopqr \ - ; -do - for line in 0 1 2 - do - mfd_text_test $line "$text" - done -done - -verify_test_suite - diff --git a/cli/cli_test_timezone b/cli/cli_test_timezone deleted file mode 100755 index 7095a43..0000000 --- a/cli/cli_test_timezone +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# Timezone tests -# -# Copyright (C) 2020 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -source $(dirname $0)/cli/common_infra.sh -require_programs faketime - -TEST_SUITE_ID="libx52 timezone tests" - -# Use the America/Los_Angeles timezone -# Standard time is UTC-08:00, Daylight time is UTC-07:00 -export TZ=America/Los_Angeles - -# All timezone tests use DD-MM-YY and 12hr format -timezone_test() -{ - local datetime="$1" - - TEST_ID="Test setting clock to '$(date --date="$datetime")'" - - local dd=$(date --date="$datetime" +%_d) - local mm=$(date --date="$datetime" +%_m) - local yy=$(date --date="$datetime" +%_y) - local hr=$(date --date="$datetime" +%_H) - local mn=$(date --date="$datetime" +%_M) - - local off - if [[ "$(date --date="$datetime" +%Z)" == 'PDT' ]] - then - # Pacific Daylight Time - # Default offset for clocks 2 & 3 should be +420 minutes - off=420 - else - # Pacific Standard time - # Default offset for clocks 2 & 3 should be +480 minutes - off=480 - fi - - local clock_value=$(($hr * 256 + $mn)) - local date_value=$(($mm * 256 + $dd)) - local year_value=$yy - - expect_pattern \ - $X52_CLOCK_DATE_INDEX $(printf '%04x' $date_value) \ - $X52_CLOCK_YEAR_INDEX $(printf '%04x' $year_value) \ - $X52_CLOCK_1_INDEX $(printf '%04x' $clock_value) \ - $X52_CLOCK_2_INDEX $(printf '%04x' $off) \ - $X52_CLOCK_3_INDEX $(printf '%04x' $off) \ - - faketime "$datetime" $X52CLI clock local 12hr ddmmyy - verify_output -} - -# Check timezone test for 14:15:16 on the 13th day of every month from -# January 2017 to December 2019 - -for year in $(seq 2017 2019) -do - for month in $(seq 1 12) - do - timezone_test "$(printf '%d-%02d-13 14:15:16' $year $month)" - done -done - -verify_test_suite diff --git a/cli/common_infra.sh b/cli/common_infra.sh deleted file mode 100644 index b30f008..0000000 --- a/cli/common_infra.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/bash -# Common infrastructure for the test cases -# -# Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) -# -# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 - -# Set up some command sequences -X52_LED_COMMAND_INDEX='00b8' -X52_LED_FIRE_ON='0101' -X52_LED_FIRE_OFF='0100' -X52_LED_A_RED_ON='0201' -X52_LED_A_RED_OFF='0200' -X52_LED_A_GREEN_ON='0301' -X52_LED_A_GREEN_OFF='0300' -X52_LED_B_RED_ON='0401' -X52_LED_B_RED_OFF='0400' -X52_LED_B_GREEN_ON='0501' -X52_LED_B_GREEN_OFF='0500' -X52_LED_D_RED_ON='0601' -X52_LED_D_RED_OFF='0600' -X52_LED_D_GREEN_ON='0701' -X52_LED_D_GREEN_OFF='0700' -X52_LED_E_RED_ON='0801' -X52_LED_E_RED_OFF='0800' -X52_LED_E_GREEN_ON='0901' -X52_LED_E_GREEN_OFF='0900' -X52_LED_T1_RED_ON='0a01' -X52_LED_T1_RED_OFF='0a00' -X52_LED_T1_GREEN_ON='0b01' -X52_LED_T1_GREEN_OFF='0b00' -X52_LED_T2_RED_ON='0c01' -X52_LED_T2_RED_OFF='0c00' -X52_LED_T2_GREEN_ON='0d01' -X52_LED_T2_GREEN_OFF='0d00' -X52_LED_T3_RED_ON='0e01' -X52_LED_T3_RED_OFF='0e00' -X52_LED_T3_GREEN_ON='0f01' -X52_LED_T3_GREEN_OFF='0f00' -X52_LED_POV_RED_ON='1001' -X52_LED_POV_RED_OFF='1000' -X52_LED_POV_GREEN_ON='1101' -X52_LED_POV_GREEN_OFF='1100' -X52_LED_CLUTCH_RED_ON='1201' -X52_LED_CLUTCH_RED_OFF='1200' -X52_LED_CLUTCH_GREEN_ON='1301' -X52_LED_CLUTCH_GREEN_OFF='1300' -X52_LED_THROTTLE_ON='1401' -X52_LED_THROTTLE_OFF='1400' - -X52_MFD_BRIGHTNESS_INDEX='00b1' -X52_LED_BRIGHTNESS_INDEX='00b2' - -X52_BLINK_INDICATOR_INDEX='00b4' -X52_SHIFT_INDICATOR_INDEX='00fd' -X52_INDICATOR_STATE_ON='0051' -X52_INDICATOR_STATE_OFF='0050' - -X52_CLOCK_1_INDEX='00c0' -X52_CLOCK_2_INDEX='00c1' -X52_CLOCK_3_INDEX='00c2' -X52_CLOCK_DATE_INDEX='00c4' -X52_CLOCK_YEAR_INDEX='00c8' - -X52_MFD_LINE_0_SET_INDEX='00d1' -X52_MFD_LINE_1_SET_INDEX='00d2' -X52_MFD_LINE_2_SET_INDEX='00d4' -X52_MFD_LINE_0_CLR_INDEX='00d9' -X52_MFD_LINE_1_CLR_INDEX='00da' -X52_MFD_LINE_2_CLR_INDEX='00dc' - -find_programs() -{ - # Tests and distcheck do not work on OSX, skip the tests - if [[ $(uname -s) == [Dd]arwin* ]] - then - echo "1..0 # skip Tests not supported on OSX" - exit 0 - fi - - # Find the X52cli script - X52CLI=$(find .. -path '*/x52cli' -perm -+x) - - if [[ -z "$X52CLI" ]] - then - exit 1 - fi - - # Find the x52test_log_actions program - X52LOGACT=$(find .. -path '*/x52test_log_actions' -perm -+x) - if [[ -z "$X52LOGACT" ]] - then - exit 1 - fi - - # Find the x52test_create_device_list program - X52DEVLIST=$(find .. -path '*/x52test_create_device_list' -perm -+x) - if [[ -z "$X52DEVLIST" ]] - then - exit 1 - fi -} - -# This is for additional programs that are not needed by every test case -require_programs() -{ - local skip=false - for prog in "$@" - do - if ! command -v "$prog" - then - echo "1..0 # skip Required program '$prog' not found" - skip=true - fi - done - - if $skip - then - exit 0 - fi -} - -setup_preload() -{ - # Find the libusb stub library - LIBUSB=$(find .. -name 'libusbx52.so.*.*.*' -type f) - - if [[ -z "$LIBUSB" ]] - then - exit 1 - fi - - export LD_PRELOAD=$(realpath $LIBUSB) -} - -setup_test() -{ - export LIBUSBX52_DEVICE_LIST=$(mktemp) - EXPECTED_OUTPUT=$(mktemp) - OBSERVED_OUTPUT=$(mktemp) - trap "rm -f $EXPECTED_OUTPUT $OBSERVED_OUTPUT $LIBUSBX52_DEVICE_LIST" EXIT - - $X52DEVLIST 06a3 0762 - - TEST_COUNT=0 - TEST_PASS=0 - TEST_FAIL=0 -} - -expect_pattern() -{ - TEST_NUM=$((TEST_NUM + 1)) - # Save pattern to expected output file - export LIBUSBX52_OUTPUT_DATA=$EXPECTED_OUTPUT - $X52LOGACT $@ - - # Save actual API calls to observed output file - export LIBUSBX52_OUTPUT_DATA=$OBSERVED_OUTPUT -} - -verify_output() -{ - TEST_COUNT=$(($TEST_COUNT + 1)) - if diff -q $EXPECTED_OUTPUT $OBSERVED_OUTPUT - then - echo "ok $TEST_COUNT $TEST_ID" - TEST_PASS=$(($TEST_PASS + 1)) - else - echo "not ok $TEST_COUNT $TEST_ID" - echo '# Expected:' - echo '# =========' - sed 's/^/#\t/' $EXPECTED_OUTPUT - echo '#' - echo '# Observed:' - echo '# =========' - sed 's/^/#\t/' $OBSERVED_OUTPUT - TEST_FAIL=$(($TEST_FAIL + 1)) - fi -} - -verify_test_suite() -{ - local sep='--------' - sep="$sep$sep" - sep="$sep$sep" - sep="$sep$sep" - - echo '#' $sep - echo '#' $TEST_SUITE_ID - echo '#' $sep - echo -e "# Total Tests:\t$TEST_COUNT" - echo -e "# Tests Passed:\t$TEST_PASS" - echo -e "# Tests Failed:\t$TEST_FAIL" - echo '#' $sep - - echo "1..$TEST_COUNT" -} - -set -e -find_programs -setup_test -setup_preload - diff --git a/cli/test_x52_cli.c b/cli/test_x52_cli.c new file mode 100644 index 0000000..2fdb800 --- /dev/null +++ b/cli/test_x52_cli.c @@ -0,0 +1,177 @@ +/* + * Saitek X52 Pro MFD & LED driver - CLI test harness + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#include +#include +#include +#include +#include + +#include "libx52.h" + +extern int run_main(int argc, char **argv); + +/* Wrapper functions for libx52 */ +int libx52_init(libx52_device **dev) +{ + *dev = NULL; + return LIBX52_SUCCESS; +} + +int libx52_connect(libx52_device *dev) +{ + return LIBX52_SUCCESS; +} + +int libx52_update(libx52_device *dev) +{ + return LIBX52_SUCCESS; +} + +void libx52_exit(libx52_device *dev) +{ +} + +const char *libx52_strerror(libx52_error_code rc) +{ + return ""; +} + +int libx52_set_text(libx52_device *x52, uint8_t line, const char *text, uint8_t length) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(line); + check_expected(text); + check_expected(length); + + return mock(); +} + +int libx52_set_led_state(libx52_device *x52, libx52_led_id id, libx52_led_state state) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(id); + check_expected(state); + + return mock(); +} + +int libx52_set_clock(libx52_device *x52, time_t time, int local) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(time); + check_expected(local); + + return mock(); +} + +int libx52_set_clock_timezone(libx52_device *x52, libx52_clock_id clock, int offset) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(clock); + check_expected(offset); + + return mock(); +} + +int libx52_set_clock_format(libx52_device *x52, libx52_clock_id clock, libx52_clock_format format) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(clock); + check_expected(format); + + return mock(); +} + +int libx52_set_time(libx52_device *x52, uint8_t hour, uint8_t minute) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(hour); + check_expected(minute); + + return mock(); +} + +int libx52_set_date(libx52_device *x52, uint8_t dd, uint8_t mm, uint8_t yy) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(dd); + check_expected(mm); + check_expected(yy); + + return mock(); +} + +int libx52_set_date_format(libx52_device *x52, libx52_date_format format) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(format); + + return mock(); +} + +int libx52_set_brightness(libx52_device *x52, uint8_t mfd, uint16_t brightness) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(mfd); + check_expected(brightness); + + return mock(); +} + +int libx52_set_shift(libx52_device *x52, uint8_t state) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(state); + + return mock(); +} + +int libx52_set_blink(libx52_device *x52, uint8_t state) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(state); + + return mock(); +} + +int libx52_vendor_command(libx52_device *x52, uint16_t index, uint16_t value) +{ + function_called(); + assert_ptr_equal(x52, NULL); + check_expected(index); + check_expected(value); + + return mock(); +} + +#include "test_x52_cli_tests.c" +#define TEST_LIST + +const struct CMUnitTest tests[] = { + #include "test_x52_cli_tests.c" +}; + +int main(int argc, char **argv) +{ + cmocka_set_message_output(CM_OUTPUT_TAP); + cmocka_run_group_tests(tests, NULL, NULL); + return 0; +} + diff --git a/cli/test_x52_cli_tests.c b/cli/test_x52_cli_tests.c new file mode 100644 index 0000000..2be6e06 --- /dev/null +++ b/cli/test_x52_cli_tests.c @@ -0,0 +1,6858 @@ +/* + * Saitek X52 Pro MFD & LED driver - CLI test suite + * + * Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org) + * + * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 + */ + +#ifndef TEST_LIST +// Setup the test case function +#define TEST_CASE(tc) static void tc(void **state) +#define TEST_DEF 1 +// Function header, this calls the corresponding libx52 function, and expects +// a certain number of calls to that function +#define SETUP(...) \ + int rc; \ + char *argv[] = {"x52cli", __VA_ARGS__}; + +#define FUNC(fn, count) \ + expect_function_calls(libx52_ ## fn, count); \ + will_return_count(libx52_ ## fn, LIBX52_SUCCESS, count); + +#define EXPECT(fn, param, value) expect_value(libx52_ ## fn, param, value); +#define EXPECT_STRING(fn, param, value) expect_string(libx52_ ##fn, param, value); +#define FINISH() \ + rc = run_main(sizeof(argv)/sizeof(argv[0]), argv); \ + assert_int_equal(rc, LIBX52_SUCCESS); + +#else // !defined TEST_LIST +#define TEST_CASE(tc) cmocka_unit_test(tc), +#define TEST_DEF 0 +#endif // defined TEST_LIST + +/* LED test cases {{{ */ +TEST_CASE(led_fire_off) +#if TEST_DEF +{ + SETUP("led", "fire", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_FIRE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_fire_on) +#if TEST_DEF +{ + SETUP("led", "fire", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_FIRE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_fire_red) +#if TEST_DEF +{ + SETUP("led", "fire", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_FIRE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_fire_amber) +#if TEST_DEF +{ + SETUP("led", "fire", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_FIRE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_fire_green) +#if TEST_DEF +{ + SETUP("led", "fire", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_FIRE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_a_off) +#if TEST_DEF +{ + SETUP("led", "a", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_A) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_a_on) +#if TEST_DEF +{ + SETUP("led", "a", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_A) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_a_red) +#if TEST_DEF +{ + SETUP("led", "a", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_A) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_a_amber) +#if TEST_DEF +{ + SETUP("led", "a", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_A) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_a_green) +#if TEST_DEF +{ + SETUP("led", "a", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_A) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_b_off) +#if TEST_DEF +{ + SETUP("led", "b", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_B) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_b_on) +#if TEST_DEF +{ + SETUP("led", "b", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_B) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_b_red) +#if TEST_DEF +{ + SETUP("led", "b", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_B) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_b_amber) +#if TEST_DEF +{ + SETUP("led", "b", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_B) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_b_green) +#if TEST_DEF +{ + SETUP("led", "b", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_B) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_d_off) +#if TEST_DEF +{ + SETUP("led", "d", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_D) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_d_on) +#if TEST_DEF +{ + SETUP("led", "d", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_D) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_d_red) +#if TEST_DEF +{ + SETUP("led", "d", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_D) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_d_amber) +#if TEST_DEF +{ + SETUP("led", "d", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_D) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_d_green) +#if TEST_DEF +{ + SETUP("led", "d", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_D) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_e_off) +#if TEST_DEF +{ + SETUP("led", "e", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_E) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_e_on) +#if TEST_DEF +{ + SETUP("led", "e", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_E) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_e_red) +#if TEST_DEF +{ + SETUP("led", "e", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_E) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_e_amber) +#if TEST_DEF +{ + SETUP("led", "e", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_E) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_e_green) +#if TEST_DEF +{ + SETUP("led", "e", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_E) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_t1_off) +#if TEST_DEF +{ + SETUP("led", "t1", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T1) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_t1_on) +#if TEST_DEF +{ + SETUP("led", "t1", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T1) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_t1_red) +#if TEST_DEF +{ + SETUP("led", "t1", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T1) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_t1_amber) +#if TEST_DEF +{ + SETUP("led", "t1", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T1) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_t1_green) +#if TEST_DEF +{ + SETUP("led", "t1", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T1) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_t2_off) +#if TEST_DEF +{ + SETUP("led", "t2", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T2) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_t2_on) +#if TEST_DEF +{ + SETUP("led", "t2", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T2) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_t2_red) +#if TEST_DEF +{ + SETUP("led", "t2", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T2) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_t2_amber) +#if TEST_DEF +{ + SETUP("led", "t2", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T2) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_t2_green) +#if TEST_DEF +{ + SETUP("led", "t2", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T2) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_t3_off) +#if TEST_DEF +{ + SETUP("led", "t3", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T3) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_t3_on) +#if TEST_DEF +{ + SETUP("led", "t3", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T3) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_t3_red) +#if TEST_DEF +{ + SETUP("led", "t3", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T3) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_t3_amber) +#if TEST_DEF +{ + SETUP("led", "t3", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T3) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_t3_green) +#if TEST_DEF +{ + SETUP("led", "t3", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_T3) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_pov_off) +#if TEST_DEF +{ + SETUP("led", "pov", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_POV) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_pov_on) +#if TEST_DEF +{ + SETUP("led", "pov", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_POV) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_pov_red) +#if TEST_DEF +{ + SETUP("led", "pov", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_POV) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_pov_amber) +#if TEST_DEF +{ + SETUP("led", "pov", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_POV) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_pov_green) +#if TEST_DEF +{ + SETUP("led", "pov", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_POV) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +TEST_CASE(led_throttle_off) +#if TEST_DEF +{ + SETUP("led", "throttle", "off") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_THROTTLE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_OFF) + FINISH() +} +#endif + +TEST_CASE(led_throttle_on) +#if TEST_DEF +{ + SETUP("led", "throttle", "on") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_THROTTLE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_ON) + FINISH() +} +#endif + +TEST_CASE(led_throttle_red) +#if TEST_DEF +{ + SETUP("led", "throttle", "red") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_THROTTLE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_RED) + FINISH() +} +#endif + +TEST_CASE(led_throttle_amber) +#if TEST_DEF +{ + SETUP("led", "throttle", "amber") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_THROTTLE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_AMBER) + FINISH() +} +#endif + +TEST_CASE(led_throttle_green) +#if TEST_DEF +{ + SETUP("led", "throttle", "green") + FUNC(set_led_state, 1) + EXPECT(set_led_state, id, LIBX52_LED_THROTTLE) + EXPECT(set_led_state, state, LIBX52_LED_STATE_GREEN) + FINISH() +} +#endif + +/* }}} */ + +/* Brightness test cases {{{ */ +TEST_CASE(brightness_mfd_0) +#if TEST_DEF +{ + SETUP("bri", "mfd", "0") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 0) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_1) +#if TEST_DEF +{ + SETUP("bri", "mfd", "1") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 1) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_2) +#if TEST_DEF +{ + SETUP("bri", "mfd", "2") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 2) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_3) +#if TEST_DEF +{ + SETUP("bri", "mfd", "3") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 3) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_4) +#if TEST_DEF +{ + SETUP("bri", "mfd", "4") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 4) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_5) +#if TEST_DEF +{ + SETUP("bri", "mfd", "5") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 5) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_6) +#if TEST_DEF +{ + SETUP("bri", "mfd", "6") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 6) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_7) +#if TEST_DEF +{ + SETUP("bri", "mfd", "7") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 7) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_8) +#if TEST_DEF +{ + SETUP("bri", "mfd", "8") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 8) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_9) +#if TEST_DEF +{ + SETUP("bri", "mfd", "9") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 9) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_10) +#if TEST_DEF +{ + SETUP("bri", "mfd", "10") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 10) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_11) +#if TEST_DEF +{ + SETUP("bri", "mfd", "11") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 11) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_12) +#if TEST_DEF +{ + SETUP("bri", "mfd", "12") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 12) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_13) +#if TEST_DEF +{ + SETUP("bri", "mfd", "13") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 13) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_14) +#if TEST_DEF +{ + SETUP("bri", "mfd", "14") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 14) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_15) +#if TEST_DEF +{ + SETUP("bri", "mfd", "15") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 15) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_16) +#if TEST_DEF +{ + SETUP("bri", "mfd", "16") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 16) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_17) +#if TEST_DEF +{ + SETUP("bri", "mfd", "17") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 17) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_18) +#if TEST_DEF +{ + SETUP("bri", "mfd", "18") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 18) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_19) +#if TEST_DEF +{ + SETUP("bri", "mfd", "19") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 19) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_20) +#if TEST_DEF +{ + SETUP("bri", "mfd", "20") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 20) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_21) +#if TEST_DEF +{ + SETUP("bri", "mfd", "21") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 21) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_22) +#if TEST_DEF +{ + SETUP("bri", "mfd", "22") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 22) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_23) +#if TEST_DEF +{ + SETUP("bri", "mfd", "23") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 23) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_24) +#if TEST_DEF +{ + SETUP("bri", "mfd", "24") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 24) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_25) +#if TEST_DEF +{ + SETUP("bri", "mfd", "25") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 25) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_26) +#if TEST_DEF +{ + SETUP("bri", "mfd", "26") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 26) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_27) +#if TEST_DEF +{ + SETUP("bri", "mfd", "27") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 27) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_28) +#if TEST_DEF +{ + SETUP("bri", "mfd", "28") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 28) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_29) +#if TEST_DEF +{ + SETUP("bri", "mfd", "29") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 29) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_30) +#if TEST_DEF +{ + SETUP("bri", "mfd", "30") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 30) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_31) +#if TEST_DEF +{ + SETUP("bri", "mfd", "31") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 31) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_32) +#if TEST_DEF +{ + SETUP("bri", "mfd", "32") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 32) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_33) +#if TEST_DEF +{ + SETUP("bri", "mfd", "33") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 33) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_34) +#if TEST_DEF +{ + SETUP("bri", "mfd", "34") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 34) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_35) +#if TEST_DEF +{ + SETUP("bri", "mfd", "35") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 35) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_36) +#if TEST_DEF +{ + SETUP("bri", "mfd", "36") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 36) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_37) +#if TEST_DEF +{ + SETUP("bri", "mfd", "37") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 37) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_38) +#if TEST_DEF +{ + SETUP("bri", "mfd", "38") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 38) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_39) +#if TEST_DEF +{ + SETUP("bri", "mfd", "39") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 39) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_40) +#if TEST_DEF +{ + SETUP("bri", "mfd", "40") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 40) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_41) +#if TEST_DEF +{ + SETUP("bri", "mfd", "41") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 41) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_42) +#if TEST_DEF +{ + SETUP("bri", "mfd", "42") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 42) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_43) +#if TEST_DEF +{ + SETUP("bri", "mfd", "43") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 43) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_44) +#if TEST_DEF +{ + SETUP("bri", "mfd", "44") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 44) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_45) +#if TEST_DEF +{ + SETUP("bri", "mfd", "45") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 45) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_46) +#if TEST_DEF +{ + SETUP("bri", "mfd", "46") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 46) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_47) +#if TEST_DEF +{ + SETUP("bri", "mfd", "47") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 47) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_48) +#if TEST_DEF +{ + SETUP("bri", "mfd", "48") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 48) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_49) +#if TEST_DEF +{ + SETUP("bri", "mfd", "49") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 49) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_50) +#if TEST_DEF +{ + SETUP("bri", "mfd", "50") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 50) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_51) +#if TEST_DEF +{ + SETUP("bri", "mfd", "51") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 51) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_52) +#if TEST_DEF +{ + SETUP("bri", "mfd", "52") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 52) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_53) +#if TEST_DEF +{ + SETUP("bri", "mfd", "53") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 53) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_54) +#if TEST_DEF +{ + SETUP("bri", "mfd", "54") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 54) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_55) +#if TEST_DEF +{ + SETUP("bri", "mfd", "55") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 55) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_56) +#if TEST_DEF +{ + SETUP("bri", "mfd", "56") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 56) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_57) +#if TEST_DEF +{ + SETUP("bri", "mfd", "57") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 57) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_58) +#if TEST_DEF +{ + SETUP("bri", "mfd", "58") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 58) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_59) +#if TEST_DEF +{ + SETUP("bri", "mfd", "59") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 59) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_60) +#if TEST_DEF +{ + SETUP("bri", "mfd", "60") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 60) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_61) +#if TEST_DEF +{ + SETUP("bri", "mfd", "61") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 61) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_62) +#if TEST_DEF +{ + SETUP("bri", "mfd", "62") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 62) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_63) +#if TEST_DEF +{ + SETUP("bri", "mfd", "63") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 63) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_64) +#if TEST_DEF +{ + SETUP("bri", "mfd", "64") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 64) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_65) +#if TEST_DEF +{ + SETUP("bri", "mfd", "65") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 65) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_66) +#if TEST_DEF +{ + SETUP("bri", "mfd", "66") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 66) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_67) +#if TEST_DEF +{ + SETUP("bri", "mfd", "67") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 67) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_68) +#if TEST_DEF +{ + SETUP("bri", "mfd", "68") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 68) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_69) +#if TEST_DEF +{ + SETUP("bri", "mfd", "69") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 69) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_70) +#if TEST_DEF +{ + SETUP("bri", "mfd", "70") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 70) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_71) +#if TEST_DEF +{ + SETUP("bri", "mfd", "71") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 71) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_72) +#if TEST_DEF +{ + SETUP("bri", "mfd", "72") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 72) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_73) +#if TEST_DEF +{ + SETUP("bri", "mfd", "73") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 73) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_74) +#if TEST_DEF +{ + SETUP("bri", "mfd", "74") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 74) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_75) +#if TEST_DEF +{ + SETUP("bri", "mfd", "75") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 75) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_76) +#if TEST_DEF +{ + SETUP("bri", "mfd", "76") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 76) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_77) +#if TEST_DEF +{ + SETUP("bri", "mfd", "77") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 77) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_78) +#if TEST_DEF +{ + SETUP("bri", "mfd", "78") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 78) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_79) +#if TEST_DEF +{ + SETUP("bri", "mfd", "79") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 79) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_80) +#if TEST_DEF +{ + SETUP("bri", "mfd", "80") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 80) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_81) +#if TEST_DEF +{ + SETUP("bri", "mfd", "81") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 81) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_82) +#if TEST_DEF +{ + SETUP("bri", "mfd", "82") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 82) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_83) +#if TEST_DEF +{ + SETUP("bri", "mfd", "83") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 83) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_84) +#if TEST_DEF +{ + SETUP("bri", "mfd", "84") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 84) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_85) +#if TEST_DEF +{ + SETUP("bri", "mfd", "85") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 85) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_86) +#if TEST_DEF +{ + SETUP("bri", "mfd", "86") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 86) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_87) +#if TEST_DEF +{ + SETUP("bri", "mfd", "87") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 87) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_88) +#if TEST_DEF +{ + SETUP("bri", "mfd", "88") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 88) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_89) +#if TEST_DEF +{ + SETUP("bri", "mfd", "89") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 89) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_90) +#if TEST_DEF +{ + SETUP("bri", "mfd", "90") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 90) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_91) +#if TEST_DEF +{ + SETUP("bri", "mfd", "91") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 91) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_92) +#if TEST_DEF +{ + SETUP("bri", "mfd", "92") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 92) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_93) +#if TEST_DEF +{ + SETUP("bri", "mfd", "93") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 93) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_94) +#if TEST_DEF +{ + SETUP("bri", "mfd", "94") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 94) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_95) +#if TEST_DEF +{ + SETUP("bri", "mfd", "95") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 95) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_96) +#if TEST_DEF +{ + SETUP("bri", "mfd", "96") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 96) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_97) +#if TEST_DEF +{ + SETUP("bri", "mfd", "97") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 97) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_98) +#if TEST_DEF +{ + SETUP("bri", "mfd", "98") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 98) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_99) +#if TEST_DEF +{ + SETUP("bri", "mfd", "99") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 99) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_100) +#if TEST_DEF +{ + SETUP("bri", "mfd", "100") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 100) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_101) +#if TEST_DEF +{ + SETUP("bri", "mfd", "101") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 101) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_102) +#if TEST_DEF +{ + SETUP("bri", "mfd", "102") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 102) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_103) +#if TEST_DEF +{ + SETUP("bri", "mfd", "103") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 103) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_104) +#if TEST_DEF +{ + SETUP("bri", "mfd", "104") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 104) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_105) +#if TEST_DEF +{ + SETUP("bri", "mfd", "105") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 105) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_106) +#if TEST_DEF +{ + SETUP("bri", "mfd", "106") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 106) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_107) +#if TEST_DEF +{ + SETUP("bri", "mfd", "107") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 107) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_108) +#if TEST_DEF +{ + SETUP("bri", "mfd", "108") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 108) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_109) +#if TEST_DEF +{ + SETUP("bri", "mfd", "109") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 109) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_110) +#if TEST_DEF +{ + SETUP("bri", "mfd", "110") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 110) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_111) +#if TEST_DEF +{ + SETUP("bri", "mfd", "111") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 111) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_112) +#if TEST_DEF +{ + SETUP("bri", "mfd", "112") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 112) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_113) +#if TEST_DEF +{ + SETUP("bri", "mfd", "113") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 113) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_114) +#if TEST_DEF +{ + SETUP("bri", "mfd", "114") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 114) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_115) +#if TEST_DEF +{ + SETUP("bri", "mfd", "115") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 115) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_116) +#if TEST_DEF +{ + SETUP("bri", "mfd", "116") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 116) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_117) +#if TEST_DEF +{ + SETUP("bri", "mfd", "117") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 117) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_118) +#if TEST_DEF +{ + SETUP("bri", "mfd", "118") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 118) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_119) +#if TEST_DEF +{ + SETUP("bri", "mfd", "119") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 119) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_120) +#if TEST_DEF +{ + SETUP("bri", "mfd", "120") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 120) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_121) +#if TEST_DEF +{ + SETUP("bri", "mfd", "121") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 121) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_122) +#if TEST_DEF +{ + SETUP("bri", "mfd", "122") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 122) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_123) +#if TEST_DEF +{ + SETUP("bri", "mfd", "123") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 123) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_124) +#if TEST_DEF +{ + SETUP("bri", "mfd", "124") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 124) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_125) +#if TEST_DEF +{ + SETUP("bri", "mfd", "125") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 125) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_126) +#if TEST_DEF +{ + SETUP("bri", "mfd", "126") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 126) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_127) +#if TEST_DEF +{ + SETUP("bri", "mfd", "127") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 127) + FINISH() +} +#endif + +TEST_CASE(brightness_mfd_128) +#if TEST_DEF +{ + SETUP("bri", "mfd", "128") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 1) + EXPECT(set_brightness, brightness, 128) + FINISH() +} +#endif + +TEST_CASE(brightness_led_0) +#if TEST_DEF +{ + SETUP("bri", "led", "0") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 0) + FINISH() +} +#endif + +TEST_CASE(brightness_led_1) +#if TEST_DEF +{ + SETUP("bri", "led", "1") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 1) + FINISH() +} +#endif + +TEST_CASE(brightness_led_2) +#if TEST_DEF +{ + SETUP("bri", "led", "2") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 2) + FINISH() +} +#endif + +TEST_CASE(brightness_led_3) +#if TEST_DEF +{ + SETUP("bri", "led", "3") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 3) + FINISH() +} +#endif + +TEST_CASE(brightness_led_4) +#if TEST_DEF +{ + SETUP("bri", "led", "4") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 4) + FINISH() +} +#endif + +TEST_CASE(brightness_led_5) +#if TEST_DEF +{ + SETUP("bri", "led", "5") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 5) + FINISH() +} +#endif + +TEST_CASE(brightness_led_6) +#if TEST_DEF +{ + SETUP("bri", "led", "6") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 6) + FINISH() +} +#endif + +TEST_CASE(brightness_led_7) +#if TEST_DEF +{ + SETUP("bri", "led", "7") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 7) + FINISH() +} +#endif + +TEST_CASE(brightness_led_8) +#if TEST_DEF +{ + SETUP("bri", "led", "8") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 8) + FINISH() +} +#endif + +TEST_CASE(brightness_led_9) +#if TEST_DEF +{ + SETUP("bri", "led", "9") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 9) + FINISH() +} +#endif + +TEST_CASE(brightness_led_10) +#if TEST_DEF +{ + SETUP("bri", "led", "10") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 10) + FINISH() +} +#endif + +TEST_CASE(brightness_led_11) +#if TEST_DEF +{ + SETUP("bri", "led", "11") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 11) + FINISH() +} +#endif + +TEST_CASE(brightness_led_12) +#if TEST_DEF +{ + SETUP("bri", "led", "12") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 12) + FINISH() +} +#endif + +TEST_CASE(brightness_led_13) +#if TEST_DEF +{ + SETUP("bri", "led", "13") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 13) + FINISH() +} +#endif + +TEST_CASE(brightness_led_14) +#if TEST_DEF +{ + SETUP("bri", "led", "14") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 14) + FINISH() +} +#endif + +TEST_CASE(brightness_led_15) +#if TEST_DEF +{ + SETUP("bri", "led", "15") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 15) + FINISH() +} +#endif + +TEST_CASE(brightness_led_16) +#if TEST_DEF +{ + SETUP("bri", "led", "16") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 16) + FINISH() +} +#endif + +TEST_CASE(brightness_led_17) +#if TEST_DEF +{ + SETUP("bri", "led", "17") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 17) + FINISH() +} +#endif + +TEST_CASE(brightness_led_18) +#if TEST_DEF +{ + SETUP("bri", "led", "18") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 18) + FINISH() +} +#endif + +TEST_CASE(brightness_led_19) +#if TEST_DEF +{ + SETUP("bri", "led", "19") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 19) + FINISH() +} +#endif + +TEST_CASE(brightness_led_20) +#if TEST_DEF +{ + SETUP("bri", "led", "20") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 20) + FINISH() +} +#endif + +TEST_CASE(brightness_led_21) +#if TEST_DEF +{ + SETUP("bri", "led", "21") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 21) + FINISH() +} +#endif + +TEST_CASE(brightness_led_22) +#if TEST_DEF +{ + SETUP("bri", "led", "22") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 22) + FINISH() +} +#endif + +TEST_CASE(brightness_led_23) +#if TEST_DEF +{ + SETUP("bri", "led", "23") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 23) + FINISH() +} +#endif + +TEST_CASE(brightness_led_24) +#if TEST_DEF +{ + SETUP("bri", "led", "24") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 24) + FINISH() +} +#endif + +TEST_CASE(brightness_led_25) +#if TEST_DEF +{ + SETUP("bri", "led", "25") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 25) + FINISH() +} +#endif + +TEST_CASE(brightness_led_26) +#if TEST_DEF +{ + SETUP("bri", "led", "26") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 26) + FINISH() +} +#endif + +TEST_CASE(brightness_led_27) +#if TEST_DEF +{ + SETUP("bri", "led", "27") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 27) + FINISH() +} +#endif + +TEST_CASE(brightness_led_28) +#if TEST_DEF +{ + SETUP("bri", "led", "28") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 28) + FINISH() +} +#endif + +TEST_CASE(brightness_led_29) +#if TEST_DEF +{ + SETUP("bri", "led", "29") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 29) + FINISH() +} +#endif + +TEST_CASE(brightness_led_30) +#if TEST_DEF +{ + SETUP("bri", "led", "30") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 30) + FINISH() +} +#endif + +TEST_CASE(brightness_led_31) +#if TEST_DEF +{ + SETUP("bri", "led", "31") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 31) + FINISH() +} +#endif + +TEST_CASE(brightness_led_32) +#if TEST_DEF +{ + SETUP("bri", "led", "32") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 32) + FINISH() +} +#endif + +TEST_CASE(brightness_led_33) +#if TEST_DEF +{ + SETUP("bri", "led", "33") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 33) + FINISH() +} +#endif + +TEST_CASE(brightness_led_34) +#if TEST_DEF +{ + SETUP("bri", "led", "34") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 34) + FINISH() +} +#endif + +TEST_CASE(brightness_led_35) +#if TEST_DEF +{ + SETUP("bri", "led", "35") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 35) + FINISH() +} +#endif + +TEST_CASE(brightness_led_36) +#if TEST_DEF +{ + SETUP("bri", "led", "36") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 36) + FINISH() +} +#endif + +TEST_CASE(brightness_led_37) +#if TEST_DEF +{ + SETUP("bri", "led", "37") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 37) + FINISH() +} +#endif + +TEST_CASE(brightness_led_38) +#if TEST_DEF +{ + SETUP("bri", "led", "38") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 38) + FINISH() +} +#endif + +TEST_CASE(brightness_led_39) +#if TEST_DEF +{ + SETUP("bri", "led", "39") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 39) + FINISH() +} +#endif + +TEST_CASE(brightness_led_40) +#if TEST_DEF +{ + SETUP("bri", "led", "40") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 40) + FINISH() +} +#endif + +TEST_CASE(brightness_led_41) +#if TEST_DEF +{ + SETUP("bri", "led", "41") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 41) + FINISH() +} +#endif + +TEST_CASE(brightness_led_42) +#if TEST_DEF +{ + SETUP("bri", "led", "42") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 42) + FINISH() +} +#endif + +TEST_CASE(brightness_led_43) +#if TEST_DEF +{ + SETUP("bri", "led", "43") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 43) + FINISH() +} +#endif + +TEST_CASE(brightness_led_44) +#if TEST_DEF +{ + SETUP("bri", "led", "44") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 44) + FINISH() +} +#endif + +TEST_CASE(brightness_led_45) +#if TEST_DEF +{ + SETUP("bri", "led", "45") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 45) + FINISH() +} +#endif + +TEST_CASE(brightness_led_46) +#if TEST_DEF +{ + SETUP("bri", "led", "46") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 46) + FINISH() +} +#endif + +TEST_CASE(brightness_led_47) +#if TEST_DEF +{ + SETUP("bri", "led", "47") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 47) + FINISH() +} +#endif + +TEST_CASE(brightness_led_48) +#if TEST_DEF +{ + SETUP("bri", "led", "48") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 48) + FINISH() +} +#endif + +TEST_CASE(brightness_led_49) +#if TEST_DEF +{ + SETUP("bri", "led", "49") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 49) + FINISH() +} +#endif + +TEST_CASE(brightness_led_50) +#if TEST_DEF +{ + SETUP("bri", "led", "50") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 50) + FINISH() +} +#endif + +TEST_CASE(brightness_led_51) +#if TEST_DEF +{ + SETUP("bri", "led", "51") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 51) + FINISH() +} +#endif + +TEST_CASE(brightness_led_52) +#if TEST_DEF +{ + SETUP("bri", "led", "52") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 52) + FINISH() +} +#endif + +TEST_CASE(brightness_led_53) +#if TEST_DEF +{ + SETUP("bri", "led", "53") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 53) + FINISH() +} +#endif + +TEST_CASE(brightness_led_54) +#if TEST_DEF +{ + SETUP("bri", "led", "54") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 54) + FINISH() +} +#endif + +TEST_CASE(brightness_led_55) +#if TEST_DEF +{ + SETUP("bri", "led", "55") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 55) + FINISH() +} +#endif + +TEST_CASE(brightness_led_56) +#if TEST_DEF +{ + SETUP("bri", "led", "56") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 56) + FINISH() +} +#endif + +TEST_CASE(brightness_led_57) +#if TEST_DEF +{ + SETUP("bri", "led", "57") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 57) + FINISH() +} +#endif + +TEST_CASE(brightness_led_58) +#if TEST_DEF +{ + SETUP("bri", "led", "58") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 58) + FINISH() +} +#endif + +TEST_CASE(brightness_led_59) +#if TEST_DEF +{ + SETUP("bri", "led", "59") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 59) + FINISH() +} +#endif + +TEST_CASE(brightness_led_60) +#if TEST_DEF +{ + SETUP("bri", "led", "60") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 60) + FINISH() +} +#endif + +TEST_CASE(brightness_led_61) +#if TEST_DEF +{ + SETUP("bri", "led", "61") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 61) + FINISH() +} +#endif + +TEST_CASE(brightness_led_62) +#if TEST_DEF +{ + SETUP("bri", "led", "62") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 62) + FINISH() +} +#endif + +TEST_CASE(brightness_led_63) +#if TEST_DEF +{ + SETUP("bri", "led", "63") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 63) + FINISH() +} +#endif + +TEST_CASE(brightness_led_64) +#if TEST_DEF +{ + SETUP("bri", "led", "64") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 64) + FINISH() +} +#endif + +TEST_CASE(brightness_led_65) +#if TEST_DEF +{ + SETUP("bri", "led", "65") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 65) + FINISH() +} +#endif + +TEST_CASE(brightness_led_66) +#if TEST_DEF +{ + SETUP("bri", "led", "66") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 66) + FINISH() +} +#endif + +TEST_CASE(brightness_led_67) +#if TEST_DEF +{ + SETUP("bri", "led", "67") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 67) + FINISH() +} +#endif + +TEST_CASE(brightness_led_68) +#if TEST_DEF +{ + SETUP("bri", "led", "68") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 68) + FINISH() +} +#endif + +TEST_CASE(brightness_led_69) +#if TEST_DEF +{ + SETUP("bri", "led", "69") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 69) + FINISH() +} +#endif + +TEST_CASE(brightness_led_70) +#if TEST_DEF +{ + SETUP("bri", "led", "70") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 70) + FINISH() +} +#endif + +TEST_CASE(brightness_led_71) +#if TEST_DEF +{ + SETUP("bri", "led", "71") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 71) + FINISH() +} +#endif + +TEST_CASE(brightness_led_72) +#if TEST_DEF +{ + SETUP("bri", "led", "72") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 72) + FINISH() +} +#endif + +TEST_CASE(brightness_led_73) +#if TEST_DEF +{ + SETUP("bri", "led", "73") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 73) + FINISH() +} +#endif + +TEST_CASE(brightness_led_74) +#if TEST_DEF +{ + SETUP("bri", "led", "74") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 74) + FINISH() +} +#endif + +TEST_CASE(brightness_led_75) +#if TEST_DEF +{ + SETUP("bri", "led", "75") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 75) + FINISH() +} +#endif + +TEST_CASE(brightness_led_76) +#if TEST_DEF +{ + SETUP("bri", "led", "76") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 76) + FINISH() +} +#endif + +TEST_CASE(brightness_led_77) +#if TEST_DEF +{ + SETUP("bri", "led", "77") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 77) + FINISH() +} +#endif + +TEST_CASE(brightness_led_78) +#if TEST_DEF +{ + SETUP("bri", "led", "78") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 78) + FINISH() +} +#endif + +TEST_CASE(brightness_led_79) +#if TEST_DEF +{ + SETUP("bri", "led", "79") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 79) + FINISH() +} +#endif + +TEST_CASE(brightness_led_80) +#if TEST_DEF +{ + SETUP("bri", "led", "80") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 80) + FINISH() +} +#endif + +TEST_CASE(brightness_led_81) +#if TEST_DEF +{ + SETUP("bri", "led", "81") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 81) + FINISH() +} +#endif + +TEST_CASE(brightness_led_82) +#if TEST_DEF +{ + SETUP("bri", "led", "82") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 82) + FINISH() +} +#endif + +TEST_CASE(brightness_led_83) +#if TEST_DEF +{ + SETUP("bri", "led", "83") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 83) + FINISH() +} +#endif + +TEST_CASE(brightness_led_84) +#if TEST_DEF +{ + SETUP("bri", "led", "84") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 84) + FINISH() +} +#endif + +TEST_CASE(brightness_led_85) +#if TEST_DEF +{ + SETUP("bri", "led", "85") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 85) + FINISH() +} +#endif + +TEST_CASE(brightness_led_86) +#if TEST_DEF +{ + SETUP("bri", "led", "86") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 86) + FINISH() +} +#endif + +TEST_CASE(brightness_led_87) +#if TEST_DEF +{ + SETUP("bri", "led", "87") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 87) + FINISH() +} +#endif + +TEST_CASE(brightness_led_88) +#if TEST_DEF +{ + SETUP("bri", "led", "88") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 88) + FINISH() +} +#endif + +TEST_CASE(brightness_led_89) +#if TEST_DEF +{ + SETUP("bri", "led", "89") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 89) + FINISH() +} +#endif + +TEST_CASE(brightness_led_90) +#if TEST_DEF +{ + SETUP("bri", "led", "90") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 90) + FINISH() +} +#endif + +TEST_CASE(brightness_led_91) +#if TEST_DEF +{ + SETUP("bri", "led", "91") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 91) + FINISH() +} +#endif + +TEST_CASE(brightness_led_92) +#if TEST_DEF +{ + SETUP("bri", "led", "92") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 92) + FINISH() +} +#endif + +TEST_CASE(brightness_led_93) +#if TEST_DEF +{ + SETUP("bri", "led", "93") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 93) + FINISH() +} +#endif + +TEST_CASE(brightness_led_94) +#if TEST_DEF +{ + SETUP("bri", "led", "94") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 94) + FINISH() +} +#endif + +TEST_CASE(brightness_led_95) +#if TEST_DEF +{ + SETUP("bri", "led", "95") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 95) + FINISH() +} +#endif + +TEST_CASE(brightness_led_96) +#if TEST_DEF +{ + SETUP("bri", "led", "96") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 96) + FINISH() +} +#endif + +TEST_CASE(brightness_led_97) +#if TEST_DEF +{ + SETUP("bri", "led", "97") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 97) + FINISH() +} +#endif + +TEST_CASE(brightness_led_98) +#if TEST_DEF +{ + SETUP("bri", "led", "98") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 98) + FINISH() +} +#endif + +TEST_CASE(brightness_led_99) +#if TEST_DEF +{ + SETUP("bri", "led", "99") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 99) + FINISH() +} +#endif + +TEST_CASE(brightness_led_100) +#if TEST_DEF +{ + SETUP("bri", "led", "100") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 100) + FINISH() +} +#endif + +TEST_CASE(brightness_led_101) +#if TEST_DEF +{ + SETUP("bri", "led", "101") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 101) + FINISH() +} +#endif + +TEST_CASE(brightness_led_102) +#if TEST_DEF +{ + SETUP("bri", "led", "102") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 102) + FINISH() +} +#endif + +TEST_CASE(brightness_led_103) +#if TEST_DEF +{ + SETUP("bri", "led", "103") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 103) + FINISH() +} +#endif + +TEST_CASE(brightness_led_104) +#if TEST_DEF +{ + SETUP("bri", "led", "104") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 104) + FINISH() +} +#endif + +TEST_CASE(brightness_led_105) +#if TEST_DEF +{ + SETUP("bri", "led", "105") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 105) + FINISH() +} +#endif + +TEST_CASE(brightness_led_106) +#if TEST_DEF +{ + SETUP("bri", "led", "106") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 106) + FINISH() +} +#endif + +TEST_CASE(brightness_led_107) +#if TEST_DEF +{ + SETUP("bri", "led", "107") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 107) + FINISH() +} +#endif + +TEST_CASE(brightness_led_108) +#if TEST_DEF +{ + SETUP("bri", "led", "108") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 108) + FINISH() +} +#endif + +TEST_CASE(brightness_led_109) +#if TEST_DEF +{ + SETUP("bri", "led", "109") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 109) + FINISH() +} +#endif + +TEST_CASE(brightness_led_110) +#if TEST_DEF +{ + SETUP("bri", "led", "110") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 110) + FINISH() +} +#endif + +TEST_CASE(brightness_led_111) +#if TEST_DEF +{ + SETUP("bri", "led", "111") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 111) + FINISH() +} +#endif + +TEST_CASE(brightness_led_112) +#if TEST_DEF +{ + SETUP("bri", "led", "112") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 112) + FINISH() +} +#endif + +TEST_CASE(brightness_led_113) +#if TEST_DEF +{ + SETUP("bri", "led", "113") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 113) + FINISH() +} +#endif + +TEST_CASE(brightness_led_114) +#if TEST_DEF +{ + SETUP("bri", "led", "114") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 114) + FINISH() +} +#endif + +TEST_CASE(brightness_led_115) +#if TEST_DEF +{ + SETUP("bri", "led", "115") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 115) + FINISH() +} +#endif + +TEST_CASE(brightness_led_116) +#if TEST_DEF +{ + SETUP("bri", "led", "116") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 116) + FINISH() +} +#endif + +TEST_CASE(brightness_led_117) +#if TEST_DEF +{ + SETUP("bri", "led", "117") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 117) + FINISH() +} +#endif + +TEST_CASE(brightness_led_118) +#if TEST_DEF +{ + SETUP("bri", "led", "118") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 118) + FINISH() +} +#endif + +TEST_CASE(brightness_led_119) +#if TEST_DEF +{ + SETUP("bri", "led", "119") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 119) + FINISH() +} +#endif + +TEST_CASE(brightness_led_120) +#if TEST_DEF +{ + SETUP("bri", "led", "120") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 120) + FINISH() +} +#endif + +TEST_CASE(brightness_led_121) +#if TEST_DEF +{ + SETUP("bri", "led", "121") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 121) + FINISH() +} +#endif + +TEST_CASE(brightness_led_122) +#if TEST_DEF +{ + SETUP("bri", "led", "122") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 122) + FINISH() +} +#endif + +TEST_CASE(brightness_led_123) +#if TEST_DEF +{ + SETUP("bri", "led", "123") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 123) + FINISH() +} +#endif + +TEST_CASE(brightness_led_124) +#if TEST_DEF +{ + SETUP("bri", "led", "124") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 124) + FINISH() +} +#endif + +TEST_CASE(brightness_led_125) +#if TEST_DEF +{ + SETUP("bri", "led", "125") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 125) + FINISH() +} +#endif + +TEST_CASE(brightness_led_126) +#if TEST_DEF +{ + SETUP("bri", "led", "126") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 126) + FINISH() +} +#endif + +TEST_CASE(brightness_led_127) +#if TEST_DEF +{ + SETUP("bri", "led", "127") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 127) + FINISH() +} +#endif + +TEST_CASE(brightness_led_128) +#if TEST_DEF +{ + SETUP("bri", "led", "128") + FUNC(set_brightness, 1) + EXPECT(set_brightness, mfd, 0) + EXPECT(set_brightness, brightness, 128) + FINISH() +} +#endif + +/* }}} */ + +/* Indicator test cases {{{ */ +TEST_CASE(indicator_blink_on) +#if TEST_DEF +{ + SETUP("blink", "on") + FUNC(set_blink, 1) + EXPECT(set_blink, state, 1) + FINISH() +} +#endif + +TEST_CASE(indicator_blink_off) +#if TEST_DEF +{ + SETUP("blink", "off") + FUNC(set_blink, 1) + EXPECT(set_blink, state, 0) + FINISH() +} +#endif + +TEST_CASE(indicator_shift_on) +#if TEST_DEF +{ + SETUP("shift", "on") + FUNC(set_shift, 1) + EXPECT(set_shift, state, 1) + FINISH() +} +#endif + +TEST_CASE(indicator_shift_off) +#if TEST_DEF +{ + SETUP("shift", "off") + FUNC(set_shift, 1) + EXPECT(set_shift, state, 0) + FINISH() +} +#endif + +/* }}} */ + +/* MFD text tests {{{ */ +TEST_CASE(mfd_0_1) +#if TEST_DEF +{ + SETUP("mfd", "0", "a") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "a") + EXPECT(set_text, length, 1) + FINISH() +} +#endif + +TEST_CASE(mfd_0_2) +#if TEST_DEF +{ + SETUP("mfd", "0", "ab") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "ab") + EXPECT(set_text, length, 2) + FINISH() +} +#endif + +TEST_CASE(mfd_0_3) +#if TEST_DEF +{ + SETUP("mfd", "0", "abc") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abc") + EXPECT(set_text, length, 3) + FINISH() +} +#endif + +TEST_CASE(mfd_0_4) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcd") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcd") + EXPECT(set_text, length, 4) + FINISH() +} +#endif + +TEST_CASE(mfd_0_5) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcde") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcde") + EXPECT(set_text, length, 5) + FINISH() +} +#endif + +TEST_CASE(mfd_0_6) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdef") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdef") + EXPECT(set_text, length, 6) + FINISH() +} +#endif + +TEST_CASE(mfd_0_7) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefg") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefg") + EXPECT(set_text, length, 7) + FINISH() +} +#endif + +TEST_CASE(mfd_0_8) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefgh") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefgh") + EXPECT(set_text, length, 8) + FINISH() +} +#endif + +TEST_CASE(mfd_0_9) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghi") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghi") + EXPECT(set_text, length, 9) + FINISH() +} +#endif + +TEST_CASE(mfd_0_10) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghij") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghij") + EXPECT(set_text, length, 10) + FINISH() +} +#endif + +TEST_CASE(mfd_0_11) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijk") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijk") + EXPECT(set_text, length, 11) + FINISH() +} +#endif + +TEST_CASE(mfd_0_12) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijkl") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijkl") + EXPECT(set_text, length, 12) + FINISH() +} +#endif + +TEST_CASE(mfd_0_13) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklm") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklm") + EXPECT(set_text, length, 13) + FINISH() +} +#endif + +TEST_CASE(mfd_0_14) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklmn") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklmn") + EXPECT(set_text, length, 14) + FINISH() +} +#endif + +TEST_CASE(mfd_0_15) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklmno") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklmno") + EXPECT(set_text, length, 15) + FINISH() +} +#endif + +TEST_CASE(mfd_0_16) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklmnop") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklmnop") + EXPECT(set_text, length, 16) + FINISH() +} +#endif + +TEST_CASE(mfd_0_17) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklmnopq") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklmnopq") + EXPECT(set_text, length, 17) + FINISH() +} +#endif + +TEST_CASE(mfd_0_18) +#if TEST_DEF +{ + SETUP("mfd", "0", "abcdefghijklmnopqr") + FUNC(set_text, 1) + EXPECT(set_text, line, 0) + EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") + EXPECT(set_text, length, 18) + FINISH() +} +#endif + +TEST_CASE(mfd_1_1) +#if TEST_DEF +{ + SETUP("mfd", "1", "a") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "a") + EXPECT(set_text, length, 1) + FINISH() +} +#endif + +TEST_CASE(mfd_1_2) +#if TEST_DEF +{ + SETUP("mfd", "1", "ab") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "ab") + EXPECT(set_text, length, 2) + FINISH() +} +#endif + +TEST_CASE(mfd_1_3) +#if TEST_DEF +{ + SETUP("mfd", "1", "abc") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abc") + EXPECT(set_text, length, 3) + FINISH() +} +#endif + +TEST_CASE(mfd_1_4) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcd") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcd") + EXPECT(set_text, length, 4) + FINISH() +} +#endif + +TEST_CASE(mfd_1_5) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcde") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcde") + EXPECT(set_text, length, 5) + FINISH() +} +#endif + +TEST_CASE(mfd_1_6) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdef") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdef") + EXPECT(set_text, length, 6) + FINISH() +} +#endif + +TEST_CASE(mfd_1_7) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefg") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefg") + EXPECT(set_text, length, 7) + FINISH() +} +#endif + +TEST_CASE(mfd_1_8) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefgh") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefgh") + EXPECT(set_text, length, 8) + FINISH() +} +#endif + +TEST_CASE(mfd_1_9) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghi") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghi") + EXPECT(set_text, length, 9) + FINISH() +} +#endif + +TEST_CASE(mfd_1_10) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghij") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghij") + EXPECT(set_text, length, 10) + FINISH() +} +#endif + +TEST_CASE(mfd_1_11) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijk") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijk") + EXPECT(set_text, length, 11) + FINISH() +} +#endif + +TEST_CASE(mfd_1_12) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijkl") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijkl") + EXPECT(set_text, length, 12) + FINISH() +} +#endif + +TEST_CASE(mfd_1_13) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklm") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklm") + EXPECT(set_text, length, 13) + FINISH() +} +#endif + +TEST_CASE(mfd_1_14) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklmn") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklmn") + EXPECT(set_text, length, 14) + FINISH() +} +#endif + +TEST_CASE(mfd_1_15) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklmno") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklmno") + EXPECT(set_text, length, 15) + FINISH() +} +#endif + +TEST_CASE(mfd_1_16) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklmnop") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklmnop") + EXPECT(set_text, length, 16) + FINISH() +} +#endif + +TEST_CASE(mfd_1_17) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklmnopq") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklmnopq") + EXPECT(set_text, length, 17) + FINISH() +} +#endif + +TEST_CASE(mfd_1_18) +#if TEST_DEF +{ + SETUP("mfd", "1", "abcdefghijklmnopqr") + FUNC(set_text, 1) + EXPECT(set_text, line, 1) + EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") + EXPECT(set_text, length, 18) + FINISH() +} +#endif + +TEST_CASE(mfd_2_1) +#if TEST_DEF +{ + SETUP("mfd", "2", "a") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "a") + EXPECT(set_text, length, 1) + FINISH() +} +#endif + +TEST_CASE(mfd_2_2) +#if TEST_DEF +{ + SETUP("mfd", "2", "ab") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "ab") + EXPECT(set_text, length, 2) + FINISH() +} +#endif + +TEST_CASE(mfd_2_3) +#if TEST_DEF +{ + SETUP("mfd", "2", "abc") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abc") + EXPECT(set_text, length, 3) + FINISH() +} +#endif + +TEST_CASE(mfd_2_4) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcd") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcd") + EXPECT(set_text, length, 4) + FINISH() +} +#endif + +TEST_CASE(mfd_2_5) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcde") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcde") + EXPECT(set_text, length, 5) + FINISH() +} +#endif + +TEST_CASE(mfd_2_6) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdef") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdef") + EXPECT(set_text, length, 6) + FINISH() +} +#endif + +TEST_CASE(mfd_2_7) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefg") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefg") + EXPECT(set_text, length, 7) + FINISH() +} +#endif + +TEST_CASE(mfd_2_8) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefgh") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefgh") + EXPECT(set_text, length, 8) + FINISH() +} +#endif + +TEST_CASE(mfd_2_9) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghi") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghi") + EXPECT(set_text, length, 9) + FINISH() +} +#endif + +TEST_CASE(mfd_2_10) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghij") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghij") + EXPECT(set_text, length, 10) + FINISH() +} +#endif + +TEST_CASE(mfd_2_11) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijk") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijk") + EXPECT(set_text, length, 11) + FINISH() +} +#endif + +TEST_CASE(mfd_2_12) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijkl") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijkl") + EXPECT(set_text, length, 12) + FINISH() +} +#endif + +TEST_CASE(mfd_2_13) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklm") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklm") + EXPECT(set_text, length, 13) + FINISH() +} +#endif + +TEST_CASE(mfd_2_14) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklmn") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklmn") + EXPECT(set_text, length, 14) + FINISH() +} +#endif + +TEST_CASE(mfd_2_15) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklmno") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklmno") + EXPECT(set_text, length, 15) + FINISH() +} +#endif + +TEST_CASE(mfd_2_16) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklmnop") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklmnop") + EXPECT(set_text, length, 16) + FINISH() +} +#endif + +TEST_CASE(mfd_2_17) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklmnopq") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklmnopq") + EXPECT(set_text, length, 17) + FINISH() +} +#endif + +TEST_CASE(mfd_2_18) +#if TEST_DEF +{ + SETUP("mfd", "2", "abcdefghijklmnopqr") + FUNC(set_text, 1) + EXPECT(set_text, line, 2) + EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") + EXPECT(set_text, length, 18) + FINISH() +} +#endif + +/* }}} */ + +/* Clock tests {{{ */ +TEST_CASE(clock_local_12hr_ddmmyy) +#if TEST_DEF +{ + SETUP("clock", "local", "12hr", "ddmmyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_DDMMYY) + FINISH() +} +#endif + +TEST_CASE(clock_local_12hr_mmddyy) +#if TEST_DEF +{ + SETUP("clock", "local", "12hr", "mmddyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_MMDDYY) + FINISH() +} +#endif + +TEST_CASE(clock_local_12hr_yymmdd) +#if TEST_DEF +{ + SETUP("clock", "local", "12hr", "yymmdd") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_YYMMDD) + FINISH() +} +#endif + +TEST_CASE(clock_local_24hr_ddmmyy) +#if TEST_DEF +{ + SETUP("clock", "local", "24hr", "ddmmyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_DDMMYY) + FINISH() +} +#endif + +TEST_CASE(clock_local_24hr_mmddyy) +#if TEST_DEF +{ + SETUP("clock", "local", "24hr", "mmddyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_MMDDYY) + FINISH() +} +#endif + +TEST_CASE(clock_local_24hr_yymmdd) +#if TEST_DEF +{ + SETUP("clock", "local", "24hr", "yymmdd") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 1) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_YYMMDD) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_12hr_ddmmyy) +#if TEST_DEF +{ + SETUP("clock", "gmt", "12hr", "ddmmyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_DDMMYY) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_12hr_mmddyy) +#if TEST_DEF +{ + SETUP("clock", "gmt", "12hr", "mmddyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_MMDDYY) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_12hr_yymmdd) +#if TEST_DEF +{ + SETUP("clock", "gmt", "12hr", "yymmdd") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_YYMMDD) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_24hr_ddmmyy) +#if TEST_DEF +{ + SETUP("clock", "gmt", "24hr", "ddmmyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_DDMMYY) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_24hr_mmddyy) +#if TEST_DEF +{ + SETUP("clock", "gmt", "24hr", "mmddyy") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_MMDDYY) + FINISH() +} +#endif + +TEST_CASE(clock_gmt_24hr_yymmdd) +#if TEST_DEF +{ + SETUP("clock", "gmt", "24hr", "yymmdd") + FUNC(set_clock, 1) + EXPECT(set_clock, local, 0) + EXPECT(set_clock, time, time(NULL)) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_YYMMDD) + FINISH() +} +#endif +/* }}} */ + +/* Clock offset tests {{{ */ +TEST_CASE(offset_2__30_12hr) +#if TEST_DEF +{ + SETUP("offset", "2", "-30", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, -30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_2__30_24hr) +#if TEST_DEF +{ + SETUP("offset", "2", "-30", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, -30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(offset_2_0_12hr) +#if TEST_DEF +{ + SETUP("offset", "2", "0", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_2_0_24hr) +#if TEST_DEF +{ + SETUP("offset", "2", "0", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(offset_2_30_12hr) +#if TEST_DEF +{ + SETUP("offset", "2", "30", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_2_30_24hr) +#if TEST_DEF +{ + SETUP("offset", "2", "30", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_timezone, offset, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_2) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(offset_3__30_12hr) +#if TEST_DEF +{ + SETUP("offset", "3", "-30", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, -30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_3__30_24hr) +#if TEST_DEF +{ + SETUP("offset", "3", "-30", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, -30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(offset_3_0_12hr) +#if TEST_DEF +{ + SETUP("offset", "3", "0", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_3_0_24hr) +#if TEST_DEF +{ + SETUP("offset", "3", "0", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(offset_3_30_12hr) +#if TEST_DEF +{ + SETUP("offset", "3", "30", "12hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(offset_3_30_24hr) +#if TEST_DEF +{ + SETUP("offset", "3", "30", "24hr") + FUNC(set_clock_timezone, 1) + EXPECT(set_clock_timezone, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_timezone, offset, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_3) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +/* }}} */ + +/* Raw time tests {{{ */ +TEST_CASE(raw_time_0_0_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_0_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_1_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "1", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 1) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_1_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "1", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 1) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_2_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "2", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 2) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_2_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "2", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 2) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_3_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "3", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 3) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_3_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "3", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 3) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_4_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "4", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 4) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_4_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "4", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 4) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_5_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "5", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 5) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_5_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "5", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 5) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_6_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "6", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 6) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_6_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "6", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 6) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_7_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "7", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 7) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_7_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "7", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 7) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_8_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "8", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 8) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_8_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "8", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 8) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_9_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "9", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 9) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_9_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "9", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 9) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_10_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "10", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 10) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_10_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "10", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 10) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_11_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "11", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 11) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_11_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "11", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 11) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_12_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "12", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 12) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_12_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "12", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 12) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_13_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "13", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 13) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_13_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "13", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 13) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_14_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "14", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 14) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_14_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "14", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 14) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_15_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "15", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 15) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_15_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "15", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 15) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_16_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "16", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 16) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_16_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "16", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 16) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_17_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "17", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 17) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_17_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "17", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 17) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_18_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "18", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 18) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_18_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "18", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 18) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_19_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "19", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 19) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_19_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "19", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 19) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_20_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "20", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 20) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_20_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "20", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 20) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_21_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "21", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 21) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_21_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "21", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 21) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_22_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "22", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 22) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_22_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "22", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 22) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_23_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "23", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 23) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_23_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "23", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 23) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_24_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "24", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 24) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_24_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "24", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 24) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_25_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "25", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 25) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_25_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "25", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 25) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_26_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "26", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 26) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_26_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "26", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 26) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_27_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "27", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 27) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_27_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "27", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 27) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_28_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "28", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 28) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_28_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "28", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 28) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_29_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "29", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 29) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_29_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "29", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 29) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_30_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "30", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_30_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "30", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 30) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_31_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "31", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 31) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_31_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "31", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 31) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_32_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "32", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 32) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_32_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "32", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 32) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_33_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "33", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 33) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_33_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "33", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 33) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_34_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "34", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 34) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_34_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "34", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 34) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_35_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "35", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 35) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_35_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "35", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 35) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_36_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "36", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 36) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_36_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "36", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 36) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_37_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "37", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 37) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_37_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "37", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 37) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_38_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "38", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 38) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_38_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "38", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 38) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_39_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "39", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 39) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_39_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "39", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 39) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_40_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "40", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 40) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_40_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "40", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 40) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_41_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "41", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 41) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_41_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "41", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 41) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_42_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "42", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 42) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_42_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "42", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 42) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_43_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "43", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 43) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_43_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "43", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 43) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_44_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "44", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 44) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_44_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "44", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 44) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_45_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "45", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 45) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_45_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "45", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 45) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_46_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "46", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 46) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_46_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "46", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 46) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_47_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "47", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 47) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_47_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "47", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 47) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_48_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "48", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 48) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_48_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "48", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 48) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_49_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "49", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 49) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_49_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "49", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 49) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_50_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "50", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 50) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_50_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "50", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 50) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_51_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "51", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 51) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_51_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "51", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 51) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_52_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "52", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 52) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_52_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "52", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 52) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_53_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "53", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 53) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_53_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "53", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 53) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_54_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "54", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 54) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_54_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "54", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 54) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_55_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "55", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 55) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_55_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "55", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 55) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_56_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "56", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 56) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_56_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "56", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 56) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_57_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "57", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 57) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_57_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "57", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 57) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_58_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "58", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 58) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_58_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "58", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 58) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_59_12hr) +#if TEST_DEF +{ + SETUP("time", "0", "59", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 59) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_0_59_24hr) +#if TEST_DEF +{ + SETUP("time", "0", "59", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 0) + EXPECT(set_time, minute, 59) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_1_0_12hr) +#if TEST_DEF +{ + SETUP("time", "1", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 1) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_1_0_24hr) +#if TEST_DEF +{ + SETUP("time", "1", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 1) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_2_0_12hr) +#if TEST_DEF +{ + SETUP("time", "2", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 2) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_2_0_24hr) +#if TEST_DEF +{ + SETUP("time", "2", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 2) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_3_0_12hr) +#if TEST_DEF +{ + SETUP("time", "3", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 3) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_3_0_24hr) +#if TEST_DEF +{ + SETUP("time", "3", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 3) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_4_0_12hr) +#if TEST_DEF +{ + SETUP("time", "4", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 4) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_4_0_24hr) +#if TEST_DEF +{ + SETUP("time", "4", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 4) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_5_0_12hr) +#if TEST_DEF +{ + SETUP("time", "5", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 5) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_5_0_24hr) +#if TEST_DEF +{ + SETUP("time", "5", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 5) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_6_0_12hr) +#if TEST_DEF +{ + SETUP("time", "6", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 6) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_6_0_24hr) +#if TEST_DEF +{ + SETUP("time", "6", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 6) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_7_0_12hr) +#if TEST_DEF +{ + SETUP("time", "7", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 7) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_7_0_24hr) +#if TEST_DEF +{ + SETUP("time", "7", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 7) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_8_0_12hr) +#if TEST_DEF +{ + SETUP("time", "8", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 8) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_8_0_24hr) +#if TEST_DEF +{ + SETUP("time", "8", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 8) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_9_0_12hr) +#if TEST_DEF +{ + SETUP("time", "9", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 9) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_9_0_24hr) +#if TEST_DEF +{ + SETUP("time", "9", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 9) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_10_0_12hr) +#if TEST_DEF +{ + SETUP("time", "10", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 10) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_10_0_24hr) +#if TEST_DEF +{ + SETUP("time", "10", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 10) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_11_0_12hr) +#if TEST_DEF +{ + SETUP("time", "11", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 11) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_11_0_24hr) +#if TEST_DEF +{ + SETUP("time", "11", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 11) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_12_0_12hr) +#if TEST_DEF +{ + SETUP("time", "12", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 12) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_12_0_24hr) +#if TEST_DEF +{ + SETUP("time", "12", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 12) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_13_0_12hr) +#if TEST_DEF +{ + SETUP("time", "13", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 13) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_13_0_24hr) +#if TEST_DEF +{ + SETUP("time", "13", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 13) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_14_0_12hr) +#if TEST_DEF +{ + SETUP("time", "14", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 14) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_14_0_24hr) +#if TEST_DEF +{ + SETUP("time", "14", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 14) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_15_0_12hr) +#if TEST_DEF +{ + SETUP("time", "15", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 15) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_15_0_24hr) +#if TEST_DEF +{ + SETUP("time", "15", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 15) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_16_0_12hr) +#if TEST_DEF +{ + SETUP("time", "16", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 16) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_16_0_24hr) +#if TEST_DEF +{ + SETUP("time", "16", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 16) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_17_0_12hr) +#if TEST_DEF +{ + SETUP("time", "17", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 17) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_17_0_24hr) +#if TEST_DEF +{ + SETUP("time", "17", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 17) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_18_0_12hr) +#if TEST_DEF +{ + SETUP("time", "18", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 18) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_18_0_24hr) +#if TEST_DEF +{ + SETUP("time", "18", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 18) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_19_0_12hr) +#if TEST_DEF +{ + SETUP("time", "19", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 19) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_19_0_24hr) +#if TEST_DEF +{ + SETUP("time", "19", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 19) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_20_0_12hr) +#if TEST_DEF +{ + SETUP("time", "20", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 20) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_20_0_24hr) +#if TEST_DEF +{ + SETUP("time", "20", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 20) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_21_0_12hr) +#if TEST_DEF +{ + SETUP("time", "21", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 21) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_21_0_24hr) +#if TEST_DEF +{ + SETUP("time", "21", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 21) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_22_0_12hr) +#if TEST_DEF +{ + SETUP("time", "22", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 22) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_22_0_24hr) +#if TEST_DEF +{ + SETUP("time", "22", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 22) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_23_0_12hr) +#if TEST_DEF +{ + SETUP("time", "23", "0", "12hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 23) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) + FINISH() +} +#endif + +TEST_CASE(raw_time_23_0_24hr) +#if TEST_DEF +{ + SETUP("time", "23", "0", "24hr") + FUNC(set_time, 1) + EXPECT(set_time, hour, 23) + EXPECT(set_time, minute, 0) + FUNC(set_clock_format, 1) + EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) + EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) + FINISH() +} +#endif +/* }}} */ + +/* Raw date tests {{{ */ +TEST_CASE(raw_date_ddmmyy) +#if TEST_DEF +{ + SETUP("date", "1", "2", "3", "ddmmyy") + FUNC(set_date, 1) + EXPECT(set_date, dd, 1) + EXPECT(set_date, mm, 2) + EXPECT(set_date, yy, 3) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_DDMMYY) + FINISH() +} +#endif + +TEST_CASE(raw_date_mmddyy) +#if TEST_DEF +{ + SETUP("date", "1", "2", "3", "mmddyy") + FUNC(set_date, 1) + EXPECT(set_date, dd, 1) + EXPECT(set_date, mm, 2) + EXPECT(set_date, yy, 3) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_MMDDYY) + FINISH() +} +#endif + +TEST_CASE(raw_date_yymmdd) +#if TEST_DEF +{ + SETUP("date", "1", "2", "3", "yymmdd") + FUNC(set_date, 1) + EXPECT(set_date, dd, 1) + EXPECT(set_date, mm, 2) + EXPECT(set_date, yy, 3) + FUNC(set_date_format, 1) + EXPECT(set_date_format, format, LIBX52_DATE_FORMAT_YYMMDD) + FINISH() +} +#endif +/* }}} */ + +#undef TEST_CASE +#undef TEST_DEF diff --git a/cli/x52_cli.c b/cli/x52_cli.c index 0dcb210..467d291 100644 --- a/cli/x52_cli.c +++ b/cli/x52_cli.c @@ -1,7 +1,7 @@ /* * Saitek X52 Pro MFD & LED driver * - * Copyright (C) 2015 Nirenjan Krishnan (nirenjan@nirenjan.org) + * Copyright (C) 2015-2021 Nirenjan Krishnan (nirenjan@nirenjan.org) * * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0 */ @@ -469,7 +469,11 @@ static void do_help(const struct command_handler *cmd) } } +#ifdef X52_CLI_TESTING +int run_main(int argc, char **argv) +#else int main(int argc, char **argv) +#endif { libx52_device *x52; struct string_map result; From 23ff7c720281fc8004f23f3777d07f86f2c4e0ce Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 03:04:12 -0700 Subject: [PATCH 63/68] Don't use TESTS when updating check_PROGRAMS --- libx52io/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libx52io/Makefile.am b/libx52io/Makefile.am index c3168ce..d60937c 100644 --- a/libx52io/Makefile.am +++ b/libx52io/Makefile.am @@ -34,7 +34,7 @@ x52include_HEADERS += libx52io/libx52io.h if HAVE_CMOCKA TESTS += test-axis test-parser -check_PROGRAMS += $(TESTS) +check_PROGRAMS += test-axis test-parser test_axis_SOURCES = libx52io/test_axis.c $(libx52io_la_SOURCES) test_axis_CFLAGS = $(libx52io_la_CFLAGS) From 9047485204260f3ac2f52d551449f45c1146f3ee Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 03:09:21 -0700 Subject: [PATCH 64/68] Include CLI tests file into distribution --- cli/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/Makefile.am b/cli/Makefile.am index 1b33572..ea5c7d1 100644 --- a/cli/Makefile.am +++ b/cli/Makefile.am @@ -23,3 +23,5 @@ test_cli_LDFLAGS = @CMOCKA_LIBS@ $(WARN_LDFLAGS) # Add a dependency on test_x52_cli_tests.c cli/test_x52_cli.c: cli/test_x52_cli_tests.c endif + +EXTRA_DIST += cli/test_x52_cli_tests.c From 377aea90b5b220fe6d720b0857e0cb9de9b61d8c Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 11:48:14 -0700 Subject: [PATCH 65/68] 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. --- cli/test_x52_cli_tests.c | 5493 -------------------------------------- 1 file changed, 5493 deletions(-) diff --git a/cli/test_x52_cli_tests.c b/cli/test_x52_cli_tests.c index 2be6e06..e535cc1 100644 --- a/cli/test_x52_cli_tests.c +++ b/cli/test_x52_cli_tests.c @@ -618,1359 +618,6 @@ TEST_CASE(brightness_mfd_2) } #endif -TEST_CASE(brightness_mfd_3) -#if TEST_DEF -{ - SETUP("bri", "mfd", "3") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 3) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_4) -#if TEST_DEF -{ - SETUP("bri", "mfd", "4") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 4) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_5) -#if TEST_DEF -{ - SETUP("bri", "mfd", "5") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 5) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_6) -#if TEST_DEF -{ - SETUP("bri", "mfd", "6") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 6) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_7) -#if TEST_DEF -{ - SETUP("bri", "mfd", "7") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 7) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_8) -#if TEST_DEF -{ - SETUP("bri", "mfd", "8") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 8) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_9) -#if TEST_DEF -{ - SETUP("bri", "mfd", "9") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 9) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_10) -#if TEST_DEF -{ - SETUP("bri", "mfd", "10") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 10) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_11) -#if TEST_DEF -{ - SETUP("bri", "mfd", "11") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 11) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_12) -#if TEST_DEF -{ - SETUP("bri", "mfd", "12") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 12) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_13) -#if TEST_DEF -{ - SETUP("bri", "mfd", "13") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 13) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_14) -#if TEST_DEF -{ - SETUP("bri", "mfd", "14") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 14) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_15) -#if TEST_DEF -{ - SETUP("bri", "mfd", "15") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 15) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_16) -#if TEST_DEF -{ - SETUP("bri", "mfd", "16") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 16) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_17) -#if TEST_DEF -{ - SETUP("bri", "mfd", "17") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 17) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_18) -#if TEST_DEF -{ - SETUP("bri", "mfd", "18") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 18) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_19) -#if TEST_DEF -{ - SETUP("bri", "mfd", "19") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 19) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_20) -#if TEST_DEF -{ - SETUP("bri", "mfd", "20") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 20) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_21) -#if TEST_DEF -{ - SETUP("bri", "mfd", "21") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 21) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_22) -#if TEST_DEF -{ - SETUP("bri", "mfd", "22") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 22) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_23) -#if TEST_DEF -{ - SETUP("bri", "mfd", "23") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 23) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_24) -#if TEST_DEF -{ - SETUP("bri", "mfd", "24") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 24) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_25) -#if TEST_DEF -{ - SETUP("bri", "mfd", "25") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 25) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_26) -#if TEST_DEF -{ - SETUP("bri", "mfd", "26") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 26) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_27) -#if TEST_DEF -{ - SETUP("bri", "mfd", "27") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 27) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_28) -#if TEST_DEF -{ - SETUP("bri", "mfd", "28") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 28) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_29) -#if TEST_DEF -{ - SETUP("bri", "mfd", "29") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 29) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_30) -#if TEST_DEF -{ - SETUP("bri", "mfd", "30") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 30) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_31) -#if TEST_DEF -{ - SETUP("bri", "mfd", "31") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 31) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_32) -#if TEST_DEF -{ - SETUP("bri", "mfd", "32") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 32) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_33) -#if TEST_DEF -{ - SETUP("bri", "mfd", "33") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 33) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_34) -#if TEST_DEF -{ - SETUP("bri", "mfd", "34") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 34) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_35) -#if TEST_DEF -{ - SETUP("bri", "mfd", "35") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 35) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_36) -#if TEST_DEF -{ - SETUP("bri", "mfd", "36") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 36) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_37) -#if TEST_DEF -{ - SETUP("bri", "mfd", "37") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 37) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_38) -#if TEST_DEF -{ - SETUP("bri", "mfd", "38") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 38) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_39) -#if TEST_DEF -{ - SETUP("bri", "mfd", "39") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 39) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_40) -#if TEST_DEF -{ - SETUP("bri", "mfd", "40") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 40) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_41) -#if TEST_DEF -{ - SETUP("bri", "mfd", "41") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 41) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_42) -#if TEST_DEF -{ - SETUP("bri", "mfd", "42") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 42) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_43) -#if TEST_DEF -{ - SETUP("bri", "mfd", "43") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 43) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_44) -#if TEST_DEF -{ - SETUP("bri", "mfd", "44") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 44) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_45) -#if TEST_DEF -{ - SETUP("bri", "mfd", "45") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 45) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_46) -#if TEST_DEF -{ - SETUP("bri", "mfd", "46") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 46) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_47) -#if TEST_DEF -{ - SETUP("bri", "mfd", "47") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 47) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_48) -#if TEST_DEF -{ - SETUP("bri", "mfd", "48") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 48) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_49) -#if TEST_DEF -{ - SETUP("bri", "mfd", "49") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 49) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_50) -#if TEST_DEF -{ - SETUP("bri", "mfd", "50") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 50) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_51) -#if TEST_DEF -{ - SETUP("bri", "mfd", "51") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 51) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_52) -#if TEST_DEF -{ - SETUP("bri", "mfd", "52") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 52) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_53) -#if TEST_DEF -{ - SETUP("bri", "mfd", "53") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 53) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_54) -#if TEST_DEF -{ - SETUP("bri", "mfd", "54") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 54) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_55) -#if TEST_DEF -{ - SETUP("bri", "mfd", "55") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 55) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_56) -#if TEST_DEF -{ - SETUP("bri", "mfd", "56") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 56) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_57) -#if TEST_DEF -{ - SETUP("bri", "mfd", "57") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 57) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_58) -#if TEST_DEF -{ - SETUP("bri", "mfd", "58") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 58) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_59) -#if TEST_DEF -{ - SETUP("bri", "mfd", "59") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 59) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_60) -#if TEST_DEF -{ - SETUP("bri", "mfd", "60") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 60) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_61) -#if TEST_DEF -{ - SETUP("bri", "mfd", "61") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 61) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_62) -#if TEST_DEF -{ - SETUP("bri", "mfd", "62") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 62) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_63) -#if TEST_DEF -{ - SETUP("bri", "mfd", "63") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 63) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_64) -#if TEST_DEF -{ - SETUP("bri", "mfd", "64") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 64) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_65) -#if TEST_DEF -{ - SETUP("bri", "mfd", "65") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 65) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_66) -#if TEST_DEF -{ - SETUP("bri", "mfd", "66") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 66) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_67) -#if TEST_DEF -{ - SETUP("bri", "mfd", "67") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 67) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_68) -#if TEST_DEF -{ - SETUP("bri", "mfd", "68") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 68) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_69) -#if TEST_DEF -{ - SETUP("bri", "mfd", "69") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 69) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_70) -#if TEST_DEF -{ - SETUP("bri", "mfd", "70") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 70) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_71) -#if TEST_DEF -{ - SETUP("bri", "mfd", "71") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 71) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_72) -#if TEST_DEF -{ - SETUP("bri", "mfd", "72") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 72) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_73) -#if TEST_DEF -{ - SETUP("bri", "mfd", "73") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 73) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_74) -#if TEST_DEF -{ - SETUP("bri", "mfd", "74") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 74) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_75) -#if TEST_DEF -{ - SETUP("bri", "mfd", "75") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 75) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_76) -#if TEST_DEF -{ - SETUP("bri", "mfd", "76") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 76) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_77) -#if TEST_DEF -{ - SETUP("bri", "mfd", "77") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 77) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_78) -#if TEST_DEF -{ - SETUP("bri", "mfd", "78") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 78) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_79) -#if TEST_DEF -{ - SETUP("bri", "mfd", "79") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 79) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_80) -#if TEST_DEF -{ - SETUP("bri", "mfd", "80") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 80) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_81) -#if TEST_DEF -{ - SETUP("bri", "mfd", "81") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 81) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_82) -#if TEST_DEF -{ - SETUP("bri", "mfd", "82") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 82) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_83) -#if TEST_DEF -{ - SETUP("bri", "mfd", "83") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 83) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_84) -#if TEST_DEF -{ - SETUP("bri", "mfd", "84") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 84) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_85) -#if TEST_DEF -{ - SETUP("bri", "mfd", "85") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 85) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_86) -#if TEST_DEF -{ - SETUP("bri", "mfd", "86") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 86) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_87) -#if TEST_DEF -{ - SETUP("bri", "mfd", "87") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 87) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_88) -#if TEST_DEF -{ - SETUP("bri", "mfd", "88") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 88) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_89) -#if TEST_DEF -{ - SETUP("bri", "mfd", "89") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 89) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_90) -#if TEST_DEF -{ - SETUP("bri", "mfd", "90") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 90) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_91) -#if TEST_DEF -{ - SETUP("bri", "mfd", "91") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 91) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_92) -#if TEST_DEF -{ - SETUP("bri", "mfd", "92") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 92) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_93) -#if TEST_DEF -{ - SETUP("bri", "mfd", "93") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 93) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_94) -#if TEST_DEF -{ - SETUP("bri", "mfd", "94") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 94) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_95) -#if TEST_DEF -{ - SETUP("bri", "mfd", "95") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 95) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_96) -#if TEST_DEF -{ - SETUP("bri", "mfd", "96") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 96) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_97) -#if TEST_DEF -{ - SETUP("bri", "mfd", "97") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 97) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_98) -#if TEST_DEF -{ - SETUP("bri", "mfd", "98") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 98) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_99) -#if TEST_DEF -{ - SETUP("bri", "mfd", "99") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 99) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_100) -#if TEST_DEF -{ - SETUP("bri", "mfd", "100") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 100) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_101) -#if TEST_DEF -{ - SETUP("bri", "mfd", "101") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 101) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_102) -#if TEST_DEF -{ - SETUP("bri", "mfd", "102") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 102) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_103) -#if TEST_DEF -{ - SETUP("bri", "mfd", "103") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 103) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_104) -#if TEST_DEF -{ - SETUP("bri", "mfd", "104") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 104) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_105) -#if TEST_DEF -{ - SETUP("bri", "mfd", "105") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 105) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_106) -#if TEST_DEF -{ - SETUP("bri", "mfd", "106") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 106) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_107) -#if TEST_DEF -{ - SETUP("bri", "mfd", "107") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 107) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_108) -#if TEST_DEF -{ - SETUP("bri", "mfd", "108") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 108) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_109) -#if TEST_DEF -{ - SETUP("bri", "mfd", "109") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 109) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_110) -#if TEST_DEF -{ - SETUP("bri", "mfd", "110") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 110) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_111) -#if TEST_DEF -{ - SETUP("bri", "mfd", "111") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 111) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_112) -#if TEST_DEF -{ - SETUP("bri", "mfd", "112") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 112) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_113) -#if TEST_DEF -{ - SETUP("bri", "mfd", "113") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 113) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_114) -#if TEST_DEF -{ - SETUP("bri", "mfd", "114") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 114) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_115) -#if TEST_DEF -{ - SETUP("bri", "mfd", "115") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 115) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_116) -#if TEST_DEF -{ - SETUP("bri", "mfd", "116") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 116) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_117) -#if TEST_DEF -{ - SETUP("bri", "mfd", "117") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 117) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_118) -#if TEST_DEF -{ - SETUP("bri", "mfd", "118") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 118) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_119) -#if TEST_DEF -{ - SETUP("bri", "mfd", "119") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 119) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_120) -#if TEST_DEF -{ - SETUP("bri", "mfd", "120") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 120) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_121) -#if TEST_DEF -{ - SETUP("bri", "mfd", "121") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 121) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_122) -#if TEST_DEF -{ - SETUP("bri", "mfd", "122") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 122) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_123) -#if TEST_DEF -{ - SETUP("bri", "mfd", "123") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 123) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_124) -#if TEST_DEF -{ - SETUP("bri", "mfd", "124") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 124) - FINISH() -} -#endif - -TEST_CASE(brightness_mfd_125) -#if TEST_DEF -{ - SETUP("bri", "mfd", "125") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 1) - EXPECT(set_brightness, brightness, 125) - FINISH() -} -#endif - TEST_CASE(brightness_mfd_126) #if TEST_DEF { @@ -2037,1359 +684,6 @@ TEST_CASE(brightness_led_2) } #endif -TEST_CASE(brightness_led_3) -#if TEST_DEF -{ - SETUP("bri", "led", "3") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 3) - FINISH() -} -#endif - -TEST_CASE(brightness_led_4) -#if TEST_DEF -{ - SETUP("bri", "led", "4") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 4) - FINISH() -} -#endif - -TEST_CASE(brightness_led_5) -#if TEST_DEF -{ - SETUP("bri", "led", "5") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 5) - FINISH() -} -#endif - -TEST_CASE(brightness_led_6) -#if TEST_DEF -{ - SETUP("bri", "led", "6") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 6) - FINISH() -} -#endif - -TEST_CASE(brightness_led_7) -#if TEST_DEF -{ - SETUP("bri", "led", "7") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 7) - FINISH() -} -#endif - -TEST_CASE(brightness_led_8) -#if TEST_DEF -{ - SETUP("bri", "led", "8") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 8) - FINISH() -} -#endif - -TEST_CASE(brightness_led_9) -#if TEST_DEF -{ - SETUP("bri", "led", "9") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 9) - FINISH() -} -#endif - -TEST_CASE(brightness_led_10) -#if TEST_DEF -{ - SETUP("bri", "led", "10") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 10) - FINISH() -} -#endif - -TEST_CASE(brightness_led_11) -#if TEST_DEF -{ - SETUP("bri", "led", "11") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 11) - FINISH() -} -#endif - -TEST_CASE(brightness_led_12) -#if TEST_DEF -{ - SETUP("bri", "led", "12") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 12) - FINISH() -} -#endif - -TEST_CASE(brightness_led_13) -#if TEST_DEF -{ - SETUP("bri", "led", "13") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 13) - FINISH() -} -#endif - -TEST_CASE(brightness_led_14) -#if TEST_DEF -{ - SETUP("bri", "led", "14") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 14) - FINISH() -} -#endif - -TEST_CASE(brightness_led_15) -#if TEST_DEF -{ - SETUP("bri", "led", "15") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 15) - FINISH() -} -#endif - -TEST_CASE(brightness_led_16) -#if TEST_DEF -{ - SETUP("bri", "led", "16") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 16) - FINISH() -} -#endif - -TEST_CASE(brightness_led_17) -#if TEST_DEF -{ - SETUP("bri", "led", "17") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 17) - FINISH() -} -#endif - -TEST_CASE(brightness_led_18) -#if TEST_DEF -{ - SETUP("bri", "led", "18") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 18) - FINISH() -} -#endif - -TEST_CASE(brightness_led_19) -#if TEST_DEF -{ - SETUP("bri", "led", "19") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 19) - FINISH() -} -#endif - -TEST_CASE(brightness_led_20) -#if TEST_DEF -{ - SETUP("bri", "led", "20") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 20) - FINISH() -} -#endif - -TEST_CASE(brightness_led_21) -#if TEST_DEF -{ - SETUP("bri", "led", "21") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 21) - FINISH() -} -#endif - -TEST_CASE(brightness_led_22) -#if TEST_DEF -{ - SETUP("bri", "led", "22") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 22) - FINISH() -} -#endif - -TEST_CASE(brightness_led_23) -#if TEST_DEF -{ - SETUP("bri", "led", "23") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 23) - FINISH() -} -#endif - -TEST_CASE(brightness_led_24) -#if TEST_DEF -{ - SETUP("bri", "led", "24") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 24) - FINISH() -} -#endif - -TEST_CASE(brightness_led_25) -#if TEST_DEF -{ - SETUP("bri", "led", "25") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 25) - FINISH() -} -#endif - -TEST_CASE(brightness_led_26) -#if TEST_DEF -{ - SETUP("bri", "led", "26") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 26) - FINISH() -} -#endif - -TEST_CASE(brightness_led_27) -#if TEST_DEF -{ - SETUP("bri", "led", "27") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 27) - FINISH() -} -#endif - -TEST_CASE(brightness_led_28) -#if TEST_DEF -{ - SETUP("bri", "led", "28") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 28) - FINISH() -} -#endif - -TEST_CASE(brightness_led_29) -#if TEST_DEF -{ - SETUP("bri", "led", "29") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 29) - FINISH() -} -#endif - -TEST_CASE(brightness_led_30) -#if TEST_DEF -{ - SETUP("bri", "led", "30") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 30) - FINISH() -} -#endif - -TEST_CASE(brightness_led_31) -#if TEST_DEF -{ - SETUP("bri", "led", "31") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 31) - FINISH() -} -#endif - -TEST_CASE(brightness_led_32) -#if TEST_DEF -{ - SETUP("bri", "led", "32") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 32) - FINISH() -} -#endif - -TEST_CASE(brightness_led_33) -#if TEST_DEF -{ - SETUP("bri", "led", "33") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 33) - FINISH() -} -#endif - -TEST_CASE(brightness_led_34) -#if TEST_DEF -{ - SETUP("bri", "led", "34") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 34) - FINISH() -} -#endif - -TEST_CASE(brightness_led_35) -#if TEST_DEF -{ - SETUP("bri", "led", "35") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 35) - FINISH() -} -#endif - -TEST_CASE(brightness_led_36) -#if TEST_DEF -{ - SETUP("bri", "led", "36") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 36) - FINISH() -} -#endif - -TEST_CASE(brightness_led_37) -#if TEST_DEF -{ - SETUP("bri", "led", "37") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 37) - FINISH() -} -#endif - -TEST_CASE(brightness_led_38) -#if TEST_DEF -{ - SETUP("bri", "led", "38") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 38) - FINISH() -} -#endif - -TEST_CASE(brightness_led_39) -#if TEST_DEF -{ - SETUP("bri", "led", "39") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 39) - FINISH() -} -#endif - -TEST_CASE(brightness_led_40) -#if TEST_DEF -{ - SETUP("bri", "led", "40") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 40) - FINISH() -} -#endif - -TEST_CASE(brightness_led_41) -#if TEST_DEF -{ - SETUP("bri", "led", "41") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 41) - FINISH() -} -#endif - -TEST_CASE(brightness_led_42) -#if TEST_DEF -{ - SETUP("bri", "led", "42") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 42) - FINISH() -} -#endif - -TEST_CASE(brightness_led_43) -#if TEST_DEF -{ - SETUP("bri", "led", "43") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 43) - FINISH() -} -#endif - -TEST_CASE(brightness_led_44) -#if TEST_DEF -{ - SETUP("bri", "led", "44") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 44) - FINISH() -} -#endif - -TEST_CASE(brightness_led_45) -#if TEST_DEF -{ - SETUP("bri", "led", "45") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 45) - FINISH() -} -#endif - -TEST_CASE(brightness_led_46) -#if TEST_DEF -{ - SETUP("bri", "led", "46") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 46) - FINISH() -} -#endif - -TEST_CASE(brightness_led_47) -#if TEST_DEF -{ - SETUP("bri", "led", "47") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 47) - FINISH() -} -#endif - -TEST_CASE(brightness_led_48) -#if TEST_DEF -{ - SETUP("bri", "led", "48") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 48) - FINISH() -} -#endif - -TEST_CASE(brightness_led_49) -#if TEST_DEF -{ - SETUP("bri", "led", "49") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 49) - FINISH() -} -#endif - -TEST_CASE(brightness_led_50) -#if TEST_DEF -{ - SETUP("bri", "led", "50") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 50) - FINISH() -} -#endif - -TEST_CASE(brightness_led_51) -#if TEST_DEF -{ - SETUP("bri", "led", "51") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 51) - FINISH() -} -#endif - -TEST_CASE(brightness_led_52) -#if TEST_DEF -{ - SETUP("bri", "led", "52") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 52) - FINISH() -} -#endif - -TEST_CASE(brightness_led_53) -#if TEST_DEF -{ - SETUP("bri", "led", "53") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 53) - FINISH() -} -#endif - -TEST_CASE(brightness_led_54) -#if TEST_DEF -{ - SETUP("bri", "led", "54") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 54) - FINISH() -} -#endif - -TEST_CASE(brightness_led_55) -#if TEST_DEF -{ - SETUP("bri", "led", "55") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 55) - FINISH() -} -#endif - -TEST_CASE(brightness_led_56) -#if TEST_DEF -{ - SETUP("bri", "led", "56") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 56) - FINISH() -} -#endif - -TEST_CASE(brightness_led_57) -#if TEST_DEF -{ - SETUP("bri", "led", "57") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 57) - FINISH() -} -#endif - -TEST_CASE(brightness_led_58) -#if TEST_DEF -{ - SETUP("bri", "led", "58") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 58) - FINISH() -} -#endif - -TEST_CASE(brightness_led_59) -#if TEST_DEF -{ - SETUP("bri", "led", "59") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 59) - FINISH() -} -#endif - -TEST_CASE(brightness_led_60) -#if TEST_DEF -{ - SETUP("bri", "led", "60") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 60) - FINISH() -} -#endif - -TEST_CASE(brightness_led_61) -#if TEST_DEF -{ - SETUP("bri", "led", "61") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 61) - FINISH() -} -#endif - -TEST_CASE(brightness_led_62) -#if TEST_DEF -{ - SETUP("bri", "led", "62") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 62) - FINISH() -} -#endif - -TEST_CASE(brightness_led_63) -#if TEST_DEF -{ - SETUP("bri", "led", "63") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 63) - FINISH() -} -#endif - -TEST_CASE(brightness_led_64) -#if TEST_DEF -{ - SETUP("bri", "led", "64") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 64) - FINISH() -} -#endif - -TEST_CASE(brightness_led_65) -#if TEST_DEF -{ - SETUP("bri", "led", "65") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 65) - FINISH() -} -#endif - -TEST_CASE(brightness_led_66) -#if TEST_DEF -{ - SETUP("bri", "led", "66") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 66) - FINISH() -} -#endif - -TEST_CASE(brightness_led_67) -#if TEST_DEF -{ - SETUP("bri", "led", "67") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 67) - FINISH() -} -#endif - -TEST_CASE(brightness_led_68) -#if TEST_DEF -{ - SETUP("bri", "led", "68") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 68) - FINISH() -} -#endif - -TEST_CASE(brightness_led_69) -#if TEST_DEF -{ - SETUP("bri", "led", "69") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 69) - FINISH() -} -#endif - -TEST_CASE(brightness_led_70) -#if TEST_DEF -{ - SETUP("bri", "led", "70") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 70) - FINISH() -} -#endif - -TEST_CASE(brightness_led_71) -#if TEST_DEF -{ - SETUP("bri", "led", "71") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 71) - FINISH() -} -#endif - -TEST_CASE(brightness_led_72) -#if TEST_DEF -{ - SETUP("bri", "led", "72") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 72) - FINISH() -} -#endif - -TEST_CASE(brightness_led_73) -#if TEST_DEF -{ - SETUP("bri", "led", "73") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 73) - FINISH() -} -#endif - -TEST_CASE(brightness_led_74) -#if TEST_DEF -{ - SETUP("bri", "led", "74") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 74) - FINISH() -} -#endif - -TEST_CASE(brightness_led_75) -#if TEST_DEF -{ - SETUP("bri", "led", "75") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 75) - FINISH() -} -#endif - -TEST_CASE(brightness_led_76) -#if TEST_DEF -{ - SETUP("bri", "led", "76") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 76) - FINISH() -} -#endif - -TEST_CASE(brightness_led_77) -#if TEST_DEF -{ - SETUP("bri", "led", "77") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 77) - FINISH() -} -#endif - -TEST_CASE(brightness_led_78) -#if TEST_DEF -{ - SETUP("bri", "led", "78") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 78) - FINISH() -} -#endif - -TEST_CASE(brightness_led_79) -#if TEST_DEF -{ - SETUP("bri", "led", "79") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 79) - FINISH() -} -#endif - -TEST_CASE(brightness_led_80) -#if TEST_DEF -{ - SETUP("bri", "led", "80") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 80) - FINISH() -} -#endif - -TEST_CASE(brightness_led_81) -#if TEST_DEF -{ - SETUP("bri", "led", "81") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 81) - FINISH() -} -#endif - -TEST_CASE(brightness_led_82) -#if TEST_DEF -{ - SETUP("bri", "led", "82") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 82) - FINISH() -} -#endif - -TEST_CASE(brightness_led_83) -#if TEST_DEF -{ - SETUP("bri", "led", "83") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 83) - FINISH() -} -#endif - -TEST_CASE(brightness_led_84) -#if TEST_DEF -{ - SETUP("bri", "led", "84") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 84) - FINISH() -} -#endif - -TEST_CASE(brightness_led_85) -#if TEST_DEF -{ - SETUP("bri", "led", "85") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 85) - FINISH() -} -#endif - -TEST_CASE(brightness_led_86) -#if TEST_DEF -{ - SETUP("bri", "led", "86") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 86) - FINISH() -} -#endif - -TEST_CASE(brightness_led_87) -#if TEST_DEF -{ - SETUP("bri", "led", "87") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 87) - FINISH() -} -#endif - -TEST_CASE(brightness_led_88) -#if TEST_DEF -{ - SETUP("bri", "led", "88") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 88) - FINISH() -} -#endif - -TEST_CASE(brightness_led_89) -#if TEST_DEF -{ - SETUP("bri", "led", "89") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 89) - FINISH() -} -#endif - -TEST_CASE(brightness_led_90) -#if TEST_DEF -{ - SETUP("bri", "led", "90") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 90) - FINISH() -} -#endif - -TEST_CASE(brightness_led_91) -#if TEST_DEF -{ - SETUP("bri", "led", "91") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 91) - FINISH() -} -#endif - -TEST_CASE(brightness_led_92) -#if TEST_DEF -{ - SETUP("bri", "led", "92") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 92) - FINISH() -} -#endif - -TEST_CASE(brightness_led_93) -#if TEST_DEF -{ - SETUP("bri", "led", "93") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 93) - FINISH() -} -#endif - -TEST_CASE(brightness_led_94) -#if TEST_DEF -{ - SETUP("bri", "led", "94") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 94) - FINISH() -} -#endif - -TEST_CASE(brightness_led_95) -#if TEST_DEF -{ - SETUP("bri", "led", "95") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 95) - FINISH() -} -#endif - -TEST_CASE(brightness_led_96) -#if TEST_DEF -{ - SETUP("bri", "led", "96") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 96) - FINISH() -} -#endif - -TEST_CASE(brightness_led_97) -#if TEST_DEF -{ - SETUP("bri", "led", "97") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 97) - FINISH() -} -#endif - -TEST_CASE(brightness_led_98) -#if TEST_DEF -{ - SETUP("bri", "led", "98") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 98) - FINISH() -} -#endif - -TEST_CASE(brightness_led_99) -#if TEST_DEF -{ - SETUP("bri", "led", "99") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 99) - FINISH() -} -#endif - -TEST_CASE(brightness_led_100) -#if TEST_DEF -{ - SETUP("bri", "led", "100") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 100) - FINISH() -} -#endif - -TEST_CASE(brightness_led_101) -#if TEST_DEF -{ - SETUP("bri", "led", "101") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 101) - FINISH() -} -#endif - -TEST_CASE(brightness_led_102) -#if TEST_DEF -{ - SETUP("bri", "led", "102") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 102) - FINISH() -} -#endif - -TEST_CASE(brightness_led_103) -#if TEST_DEF -{ - SETUP("bri", "led", "103") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 103) - FINISH() -} -#endif - -TEST_CASE(brightness_led_104) -#if TEST_DEF -{ - SETUP("bri", "led", "104") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 104) - FINISH() -} -#endif - -TEST_CASE(brightness_led_105) -#if TEST_DEF -{ - SETUP("bri", "led", "105") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 105) - FINISH() -} -#endif - -TEST_CASE(brightness_led_106) -#if TEST_DEF -{ - SETUP("bri", "led", "106") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 106) - FINISH() -} -#endif - -TEST_CASE(brightness_led_107) -#if TEST_DEF -{ - SETUP("bri", "led", "107") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 107) - FINISH() -} -#endif - -TEST_CASE(brightness_led_108) -#if TEST_DEF -{ - SETUP("bri", "led", "108") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 108) - FINISH() -} -#endif - -TEST_CASE(brightness_led_109) -#if TEST_DEF -{ - SETUP("bri", "led", "109") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 109) - FINISH() -} -#endif - -TEST_CASE(brightness_led_110) -#if TEST_DEF -{ - SETUP("bri", "led", "110") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 110) - FINISH() -} -#endif - -TEST_CASE(brightness_led_111) -#if TEST_DEF -{ - SETUP("bri", "led", "111") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 111) - FINISH() -} -#endif - -TEST_CASE(brightness_led_112) -#if TEST_DEF -{ - SETUP("bri", "led", "112") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 112) - FINISH() -} -#endif - -TEST_CASE(brightness_led_113) -#if TEST_DEF -{ - SETUP("bri", "led", "113") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 113) - FINISH() -} -#endif - -TEST_CASE(brightness_led_114) -#if TEST_DEF -{ - SETUP("bri", "led", "114") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 114) - FINISH() -} -#endif - -TEST_CASE(brightness_led_115) -#if TEST_DEF -{ - SETUP("bri", "led", "115") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 115) - FINISH() -} -#endif - -TEST_CASE(brightness_led_116) -#if TEST_DEF -{ - SETUP("bri", "led", "116") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 116) - FINISH() -} -#endif - -TEST_CASE(brightness_led_117) -#if TEST_DEF -{ - SETUP("bri", "led", "117") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 117) - FINISH() -} -#endif - -TEST_CASE(brightness_led_118) -#if TEST_DEF -{ - SETUP("bri", "led", "118") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 118) - FINISH() -} -#endif - -TEST_CASE(brightness_led_119) -#if TEST_DEF -{ - SETUP("bri", "led", "119") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 119) - FINISH() -} -#endif - -TEST_CASE(brightness_led_120) -#if TEST_DEF -{ - SETUP("bri", "led", "120") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 120) - FINISH() -} -#endif - -TEST_CASE(brightness_led_121) -#if TEST_DEF -{ - SETUP("bri", "led", "121") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 121) - FINISH() -} -#endif - -TEST_CASE(brightness_led_122) -#if TEST_DEF -{ - SETUP("bri", "led", "122") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 122) - FINISH() -} -#endif - -TEST_CASE(brightness_led_123) -#if TEST_DEF -{ - SETUP("bri", "led", "123") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 123) - FINISH() -} -#endif - -TEST_CASE(brightness_led_124) -#if TEST_DEF -{ - SETUP("bri", "led", "124") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 124) - FINISH() -} -#endif - -TEST_CASE(brightness_led_125) -#if TEST_DEF -{ - SETUP("bri", "led", "125") - FUNC(set_brightness, 1) - EXPECT(set_brightness, mfd, 0) - EXPECT(set_brightness, brightness, 125) - FINISH() -} -#endif - TEST_CASE(brightness_led_126) #if TEST_DEF { @@ -3493,198 +787,6 @@ TEST_CASE(mfd_0_2) } #endif -TEST_CASE(mfd_0_3) -#if TEST_DEF -{ - SETUP("mfd", "0", "abc") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abc") - EXPECT(set_text, length, 3) - FINISH() -} -#endif - -TEST_CASE(mfd_0_4) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcd") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcd") - EXPECT(set_text, length, 4) - FINISH() -} -#endif - -TEST_CASE(mfd_0_5) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcde") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcde") - EXPECT(set_text, length, 5) - FINISH() -} -#endif - -TEST_CASE(mfd_0_6) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdef") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdef") - EXPECT(set_text, length, 6) - FINISH() -} -#endif - -TEST_CASE(mfd_0_7) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefg") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefg") - EXPECT(set_text, length, 7) - FINISH() -} -#endif - -TEST_CASE(mfd_0_8) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefgh") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefgh") - EXPECT(set_text, length, 8) - FINISH() -} -#endif - -TEST_CASE(mfd_0_9) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghi") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghi") - EXPECT(set_text, length, 9) - FINISH() -} -#endif - -TEST_CASE(mfd_0_10) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghij") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghij") - EXPECT(set_text, length, 10) - FINISH() -} -#endif - -TEST_CASE(mfd_0_11) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijk") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijk") - EXPECT(set_text, length, 11) - FINISH() -} -#endif - -TEST_CASE(mfd_0_12) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijkl") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijkl") - EXPECT(set_text, length, 12) - FINISH() -} -#endif - -TEST_CASE(mfd_0_13) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklm") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklm") - EXPECT(set_text, length, 13) - FINISH() -} -#endif - -TEST_CASE(mfd_0_14) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklmn") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklmn") - EXPECT(set_text, length, 14) - FINISH() -} -#endif - -TEST_CASE(mfd_0_15) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklmno") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklmno") - EXPECT(set_text, length, 15) - FINISH() -} -#endif - -TEST_CASE(mfd_0_16) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklmnop") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklmnop") - EXPECT(set_text, length, 16) - FINISH() -} -#endif - -TEST_CASE(mfd_0_17) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklmnopq") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklmnopq") - EXPECT(set_text, length, 17) - FINISH() -} -#endif - -TEST_CASE(mfd_0_18) -#if TEST_DEF -{ - SETUP("mfd", "0", "abcdefghijklmnopqr") - FUNC(set_text, 1) - EXPECT(set_text, line, 0) - EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") - EXPECT(set_text, length, 18) - FINISH() -} -#endif - TEST_CASE(mfd_1_1) #if TEST_DEF { @@ -3709,198 +811,6 @@ TEST_CASE(mfd_1_2) } #endif -TEST_CASE(mfd_1_3) -#if TEST_DEF -{ - SETUP("mfd", "1", "abc") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abc") - EXPECT(set_text, length, 3) - FINISH() -} -#endif - -TEST_CASE(mfd_1_4) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcd") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcd") - EXPECT(set_text, length, 4) - FINISH() -} -#endif - -TEST_CASE(mfd_1_5) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcde") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcde") - EXPECT(set_text, length, 5) - FINISH() -} -#endif - -TEST_CASE(mfd_1_6) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdef") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdef") - EXPECT(set_text, length, 6) - FINISH() -} -#endif - -TEST_CASE(mfd_1_7) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefg") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefg") - EXPECT(set_text, length, 7) - FINISH() -} -#endif - -TEST_CASE(mfd_1_8) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefgh") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefgh") - EXPECT(set_text, length, 8) - FINISH() -} -#endif - -TEST_CASE(mfd_1_9) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghi") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghi") - EXPECT(set_text, length, 9) - FINISH() -} -#endif - -TEST_CASE(mfd_1_10) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghij") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghij") - EXPECT(set_text, length, 10) - FINISH() -} -#endif - -TEST_CASE(mfd_1_11) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijk") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijk") - EXPECT(set_text, length, 11) - FINISH() -} -#endif - -TEST_CASE(mfd_1_12) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijkl") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijkl") - EXPECT(set_text, length, 12) - FINISH() -} -#endif - -TEST_CASE(mfd_1_13) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklm") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklm") - EXPECT(set_text, length, 13) - FINISH() -} -#endif - -TEST_CASE(mfd_1_14) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklmn") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklmn") - EXPECT(set_text, length, 14) - FINISH() -} -#endif - -TEST_CASE(mfd_1_15) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklmno") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklmno") - EXPECT(set_text, length, 15) - FINISH() -} -#endif - -TEST_CASE(mfd_1_16) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklmnop") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklmnop") - EXPECT(set_text, length, 16) - FINISH() -} -#endif - -TEST_CASE(mfd_1_17) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklmnopq") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklmnopq") - EXPECT(set_text, length, 17) - FINISH() -} -#endif - -TEST_CASE(mfd_1_18) -#if TEST_DEF -{ - SETUP("mfd", "1", "abcdefghijklmnopqr") - FUNC(set_text, 1) - EXPECT(set_text, line, 1) - EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") - EXPECT(set_text, length, 18) - FINISH() -} -#endif - TEST_CASE(mfd_2_1) #if TEST_DEF { @@ -3925,198 +835,6 @@ TEST_CASE(mfd_2_2) } #endif -TEST_CASE(mfd_2_3) -#if TEST_DEF -{ - SETUP("mfd", "2", "abc") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abc") - EXPECT(set_text, length, 3) - FINISH() -} -#endif - -TEST_CASE(mfd_2_4) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcd") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcd") - EXPECT(set_text, length, 4) - FINISH() -} -#endif - -TEST_CASE(mfd_2_5) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcde") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcde") - EXPECT(set_text, length, 5) - FINISH() -} -#endif - -TEST_CASE(mfd_2_6) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdef") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdef") - EXPECT(set_text, length, 6) - FINISH() -} -#endif - -TEST_CASE(mfd_2_7) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefg") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefg") - EXPECT(set_text, length, 7) - FINISH() -} -#endif - -TEST_CASE(mfd_2_8) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefgh") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefgh") - EXPECT(set_text, length, 8) - FINISH() -} -#endif - -TEST_CASE(mfd_2_9) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghi") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghi") - EXPECT(set_text, length, 9) - FINISH() -} -#endif - -TEST_CASE(mfd_2_10) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghij") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghij") - EXPECT(set_text, length, 10) - FINISH() -} -#endif - -TEST_CASE(mfd_2_11) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijk") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijk") - EXPECT(set_text, length, 11) - FINISH() -} -#endif - -TEST_CASE(mfd_2_12) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijkl") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijkl") - EXPECT(set_text, length, 12) - FINISH() -} -#endif - -TEST_CASE(mfd_2_13) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklm") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklm") - EXPECT(set_text, length, 13) - FINISH() -} -#endif - -TEST_CASE(mfd_2_14) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklmn") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklmn") - EXPECT(set_text, length, 14) - FINISH() -} -#endif - -TEST_CASE(mfd_2_15) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklmno") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklmno") - EXPECT(set_text, length, 15) - FINISH() -} -#endif - -TEST_CASE(mfd_2_16) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklmnop") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklmnop") - EXPECT(set_text, length, 16) - FINISH() -} -#endif - -TEST_CASE(mfd_2_17) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklmnopq") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklmnopq") - EXPECT(set_text, length, 17) - FINISH() -} -#endif - -TEST_CASE(mfd_2_18) -#if TEST_DEF -{ - SETUP("mfd", "2", "abcdefghijklmnopqr") - FUNC(set_text, 1) - EXPECT(set_text, line, 2) - EXPECT_STRING(set_text, text, "abcdefghijklmnopqr") - EXPECT(set_text, length, 18) - FINISH() -} -#endif - /* }}} */ /* Clock tests {{{ */ @@ -4541,1630 +1259,6 @@ TEST_CASE(raw_time_0_1_24hr) } #endif -TEST_CASE(raw_time_0_2_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "2", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 2) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_2_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "2", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 2) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_3_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "3", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 3) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_3_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "3", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 3) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_4_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "4", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 4) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_4_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "4", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 4) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_5_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "5", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 5) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_5_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "5", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 5) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_6_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "6", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 6) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_6_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "6", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 6) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_7_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "7", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 7) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_7_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "7", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 7) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_8_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "8", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 8) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_8_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "8", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 8) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_9_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "9", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 9) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_9_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "9", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 9) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_10_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "10", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 10) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_10_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "10", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 10) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_11_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "11", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 11) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_11_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "11", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 11) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_12_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "12", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 12) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_12_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "12", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 12) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_13_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "13", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 13) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_13_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "13", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 13) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_14_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "14", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 14) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_14_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "14", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 14) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_15_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "15", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 15) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_15_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "15", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 15) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_16_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "16", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 16) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_16_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "16", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 16) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_17_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "17", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 17) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_17_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "17", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 17) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_18_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "18", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 18) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_18_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "18", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 18) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_19_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "19", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 19) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_19_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "19", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 19) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_20_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "20", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 20) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_20_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "20", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 20) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_21_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "21", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 21) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_21_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "21", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 21) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_22_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "22", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 22) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_22_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "22", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 22) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_23_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "23", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 23) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_23_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "23", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 23) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_24_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "24", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 24) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_24_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "24", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 24) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_25_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "25", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 25) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_25_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "25", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 25) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_26_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "26", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 26) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_26_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "26", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 26) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_27_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "27", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 27) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_27_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "27", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 27) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_28_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "28", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 28) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_28_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "28", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 28) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_29_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "29", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 29) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_29_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "29", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 29) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_30_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "30", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 30) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_30_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "30", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 30) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_31_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "31", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 31) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_31_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "31", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 31) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_32_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "32", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 32) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_32_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "32", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 32) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_33_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "33", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 33) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_33_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "33", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 33) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_34_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "34", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 34) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_34_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "34", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 34) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_35_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "35", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 35) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_35_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "35", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 35) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_36_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "36", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 36) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_36_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "36", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 36) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_37_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "37", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 37) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_37_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "37", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 37) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_38_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "38", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 38) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_38_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "38", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 38) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_39_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "39", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 39) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_39_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "39", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 39) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_40_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "40", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 40) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_40_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "40", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 40) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_41_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "41", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 41) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_41_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "41", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 41) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_42_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "42", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 42) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_42_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "42", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 42) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_43_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "43", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 43) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_43_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "43", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 43) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_44_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "44", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 44) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_44_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "44", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 44) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_45_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "45", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 45) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_45_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "45", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 45) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_46_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "46", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 46) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_46_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "46", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 46) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_47_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "47", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 47) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_47_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "47", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 47) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_48_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "48", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 48) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_48_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "48", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 48) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_49_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "49", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 49) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_49_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "49", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 49) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_50_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "50", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 50) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_50_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "50", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 50) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_51_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "51", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 51) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_51_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "51", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 51) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_52_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "52", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 52) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_52_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "52", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 52) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_53_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "53", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 53) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_53_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "53", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 53) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_54_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "54", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 54) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_54_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "54", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 54) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_55_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "55", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 55) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_55_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "55", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 55) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_56_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "56", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 56) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_56_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "56", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 56) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_57_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "57", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 57) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_57_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "57", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 57) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_58_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "58", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 58) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_58_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "58", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 58) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_59_12hr) -#if TEST_DEF -{ - SETUP("time", "0", "59", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 59) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_0_59_24hr) -#if TEST_DEF -{ - SETUP("time", "0", "59", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 0) - EXPECT(set_time, minute, 59) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - TEST_CASE(raw_time_1_0_12hr) #if TEST_DEF { @@ -6221,593 +1315,6 @@ TEST_CASE(raw_time_2_0_24hr) } #endif -TEST_CASE(raw_time_3_0_12hr) -#if TEST_DEF -{ - SETUP("time", "3", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 3) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_3_0_24hr) -#if TEST_DEF -{ - SETUP("time", "3", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 3) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_4_0_12hr) -#if TEST_DEF -{ - SETUP("time", "4", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 4) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_4_0_24hr) -#if TEST_DEF -{ - SETUP("time", "4", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 4) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_5_0_12hr) -#if TEST_DEF -{ - SETUP("time", "5", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 5) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_5_0_24hr) -#if TEST_DEF -{ - SETUP("time", "5", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 5) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_6_0_12hr) -#if TEST_DEF -{ - SETUP("time", "6", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 6) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_6_0_24hr) -#if TEST_DEF -{ - SETUP("time", "6", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 6) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_7_0_12hr) -#if TEST_DEF -{ - SETUP("time", "7", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 7) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_7_0_24hr) -#if TEST_DEF -{ - SETUP("time", "7", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 7) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_8_0_12hr) -#if TEST_DEF -{ - SETUP("time", "8", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 8) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_8_0_24hr) -#if TEST_DEF -{ - SETUP("time", "8", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 8) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_9_0_12hr) -#if TEST_DEF -{ - SETUP("time", "9", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 9) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_9_0_24hr) -#if TEST_DEF -{ - SETUP("time", "9", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 9) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_10_0_12hr) -#if TEST_DEF -{ - SETUP("time", "10", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 10) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_10_0_24hr) -#if TEST_DEF -{ - SETUP("time", "10", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 10) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_11_0_12hr) -#if TEST_DEF -{ - SETUP("time", "11", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 11) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_11_0_24hr) -#if TEST_DEF -{ - SETUP("time", "11", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 11) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_12_0_12hr) -#if TEST_DEF -{ - SETUP("time", "12", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 12) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_12_0_24hr) -#if TEST_DEF -{ - SETUP("time", "12", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 12) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_13_0_12hr) -#if TEST_DEF -{ - SETUP("time", "13", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 13) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_13_0_24hr) -#if TEST_DEF -{ - SETUP("time", "13", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 13) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_14_0_12hr) -#if TEST_DEF -{ - SETUP("time", "14", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 14) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_14_0_24hr) -#if TEST_DEF -{ - SETUP("time", "14", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 14) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_15_0_12hr) -#if TEST_DEF -{ - SETUP("time", "15", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 15) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_15_0_24hr) -#if TEST_DEF -{ - SETUP("time", "15", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 15) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_16_0_12hr) -#if TEST_DEF -{ - SETUP("time", "16", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 16) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_16_0_24hr) -#if TEST_DEF -{ - SETUP("time", "16", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 16) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_17_0_12hr) -#if TEST_DEF -{ - SETUP("time", "17", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 17) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_17_0_24hr) -#if TEST_DEF -{ - SETUP("time", "17", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 17) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_18_0_12hr) -#if TEST_DEF -{ - SETUP("time", "18", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 18) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_18_0_24hr) -#if TEST_DEF -{ - SETUP("time", "18", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 18) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_19_0_12hr) -#if TEST_DEF -{ - SETUP("time", "19", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 19) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_19_0_24hr) -#if TEST_DEF -{ - SETUP("time", "19", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 19) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_20_0_12hr) -#if TEST_DEF -{ - SETUP("time", "20", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 20) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_20_0_24hr) -#if TEST_DEF -{ - SETUP("time", "20", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 20) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_21_0_12hr) -#if TEST_DEF -{ - SETUP("time", "21", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 21) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_21_0_24hr) -#if TEST_DEF -{ - SETUP("time", "21", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 21) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_22_0_12hr) -#if TEST_DEF -{ - SETUP("time", "22", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 22) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_22_0_24hr) -#if TEST_DEF -{ - SETUP("time", "22", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 22) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_23_0_12hr) -#if TEST_DEF -{ - SETUP("time", "23", "0", "12hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 23) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_12HR) - FINISH() -} -#endif - -TEST_CASE(raw_time_23_0_24hr) -#if TEST_DEF -{ - SETUP("time", "23", "0", "24hr") - FUNC(set_time, 1) - EXPECT(set_time, hour, 23) - EXPECT(set_time, minute, 0) - FUNC(set_clock_format, 1) - EXPECT(set_clock_format, clock, LIBX52_CLOCK_1) - EXPECT(set_clock_format, format, LIBX52_CLOCK_FORMAT_24HR) - FINISH() -} -#endif /* }}} */ /* Raw date tests {{{ */ From dbd683a98b52866e8243d4752410906106606664 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 12:02:02 -0700 Subject: [PATCH 66/68] Add vendor command test cases This change adds test cases to validate the `raw` command in x52cli. --- cli/test_x52_cli_tests.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/cli/test_x52_cli_tests.c b/cli/test_x52_cli_tests.c index e535cc1..f86d00c 100644 --- a/cli/test_x52_cli_tests.c +++ b/cli/test_x52_cli_tests.c @@ -1361,5 +1361,41 @@ TEST_CASE(raw_date_yymmdd) #endif /* }}} */ +/* Vendor command tests {{{ */ +TEST_CASE(vendor_command_hex) +#if TEST_DEF +{ + SETUP("raw", "0x0123", "0x4567") + FUNC(vendor_command, 1) + EXPECT(vendor_command, index, 0x0123) + EXPECT(vendor_command, value, 0x4567) + FINISH() +} +#endif + +TEST_CASE(vendor_command_oct) +#if TEST_DEF +{ + SETUP("raw", "0123", "0456") + FUNC(vendor_command, 1) + EXPECT(vendor_command, index, 0123) + EXPECT(vendor_command, value, 0456) + FINISH() +} +#endif + +TEST_CASE(vendor_command_dec) +#if TEST_DEF +{ + SETUP("raw", "123", "456") + FUNC(vendor_command, 1) + EXPECT(vendor_command, index, 123) + EXPECT(vendor_command, value, 456) + FINISH() +} +#endif + +/* }}} */ + #undef TEST_CASE #undef TEST_DEF From 2cdf22b8c1bb3347607a4629bda0e6bed4e20284 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 30 Jul 2021 13:31:00 -0700 Subject: [PATCH 67/68] Remove dependency on faketime --- INSTALL.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 04aed31..b9b5296 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -45,10 +45,7 @@ the utilities, you will need the following packages: * doxygen * rsync -You will also need the following packages to run the unit tests: - -* faketime -* cmocka +You will also need the `cmocka` package to run the unit tests. # Installation Instructions From e358aa96882ba32bd0cebdb5fc304b43d8aedeff Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sun, 1 Aug 2021 03:00:21 -0700 Subject: [PATCH 68/68] Update ChangeLog.md --- ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index a71d937..b091a14 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -22,6 +22,8 @@ The format is based upon [Keep a Changelog]. be used in the actual rules file. This allows systems such as openSUSE which use `input` as the group for input devices to behave the same as Ubuntu and other similar systems. +- Code layout changed to improve parallel builds. +- x52cli tests modified to use cmocka tests. ## [0.2.1] - 2020-06-28 ### Added