diff options
author | Boss Marco <bossm8@students.bfh.ch> | 2019-12-05 17:04:03 +0100 |
---|---|---|
committer | Boss Marco <bossm8@students.bfh.ch> | 2019-12-05 17:11:52 +0100 |
commit | 2cc5d9391842b717fd0b50b58562c63ba97f1e4d (patch) | |
tree | 0831807642a8747071a7470b5af9b1a9a9182888 | |
parent | a1173e118edb4a6d386b152e9c3176107d403521 (diff) | |
download | taler-mdb-2cc5d9391842b717fd0b50b58562c63ba97f1e4d.tar.gz taler-mdb-2cc5d9391842b717fd0b50b58562c63ba97f1e4d.tar.bz2 taler-mdb-2cc5d9391842b717fd0b50b58562c63ba97f1e4d.zip |
fix and backlight file now in .conf too
-rw-r--r-- | src/main.c | 27 | ||||
-rw-r--r-- | taler.conf | 2 |
2 files changed, 24 insertions, 5 deletions
@@ -491,11 +491,16 @@ static struct MdbCommand approveVend; static struct MdbCommand endSession; /** - * @brief FRAMEBUFFER_DEVICE framebuffer device to diplay qr code + * Name of the framebuffer device (i.e. /dev/fb1). */ static char *framebuffer_device_filename; /** + * Name of the backlight file of @e framebuffer_device_filename (i.e. /sys/class/backlight/soc:backlight/brightness). + */ +static char *framebuffer_backlight_filename; + +/** * Name of the UART device with the MDB (i.e. /dev/ttyAMA0). */ static char *uart_device_filename; @@ -1535,7 +1540,7 @@ write_mdb_command (void *cls) chkSum += mdb.txBuffer[idx] = mdb.cmd->cmd.bin[idx]; for (size_t idx = 0; idx < mdb.cmd->data.bin_size; idx++) chkSum += mdb.txBuffer[idx + mdb.cmd->cmd.bin_size] = - mdb.cmd->data.bin[idx]; + mdb.cmd->data.bin[idx]; mdb.txBuffer[mdb.cmd->cmd.bin_size + mdb.cmd->data.bin_size] = (uint8_t) (chkSum & 0xFF); } @@ -2073,7 +2078,19 @@ run (void *cls, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "taler-mdb", "FRAMEBUFFER_DEVICE"); - uart_device_filename = GNUNET_strdup ("/dev/fb1"); + framebuffer_device_filename = GNUNET_strdup ("/dev/fb1"); + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (cfg, + "taler-mdb", + "FRAMEBUFFER_BACKLIGHT", + &framebuffer_backlight_filename)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + "taler-mdb", + "FRAMEBUFFER_BACKLIGHT"); + framebuffer_backlight_filename = GNUNET_strdup ( + "/sys/class/backlight/soc:backlight/brightness"); } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, @@ -2228,12 +2245,12 @@ run (void *cls, * sizeof (uint16_t)); qrDisplay.backlightfd = open ( - "/sys/class/backlight/soc:backlight/brightness", O_WRONLY); + framebuffer_backlight_filename, O_WRONLY); if (0 > qrDisplay.backlightfd) { GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "open", - "/sys/class/backlight/soc:backlight/brightness"); + framebuffer_backlight_filename); } else { @@ -18,6 +18,8 @@ UART_DEVICE = /dev/ttyAMA0 # Name of the framebuffer to use for the QR code. FRAMEBUFFER_DEVICE = /dev/fb1 +# Name of the backlight file for the framebuffer +FRAMEBUFFER_BACKLIGHT = /sys/class/backlight/soc:backlight/brightness #Products #end declaration |