[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] 10/23: parse filenames from config
From: |
gnunet |
Subject: |
[taler-taler-mdb] 10/23: parse filenames from config |
Date: |
Wed, 04 Dec 2019 14:15:56 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository taler-mdb.
commit fafab488ffee01f6f50a18c44c50150b1b4a762b
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Dec 4 12:44:12 2019 +0100
parse filenames from config
---
src/main.c | 34 ++++++++++++++++++++++++----------
taler.conf | 6 ++++++
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/src/main.c b/src/main.c
index e00d478..ed13896 100644
--- a/src/main.c
+++ b/src/main.c
@@ -385,9 +385,12 @@ static struct MdbCommand endSession;
/**
* @brief FRAMEBUFFER_DEVICE framebuffer device to diplay qr code
*/
-static const char *FRAMEBUFFER_DEVICE = "/dev/fb1";
+static char *framebuffer_device_filename;
-static char *UART_DEVICE;
+/**
+ * Name of the UART device with the MDB (i.e. /dev/ttyAMA0).
+ */
+static char *uart_device_filename;
/**
* Taler wallet application identifier
@@ -1188,7 +1191,7 @@ write_mdb_command (void *cls)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"write",
- UART_DEVICE);
+ uart_device_filename);
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1463,7 +1466,7 @@ read_mdb_command (void *cls)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"read",
- UART_DEVICE);
+ uart_device_filename);
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1625,12 +1628,12 @@ mdb_init ()
struct termios uart_opts_raw;
/* open uart connection */
- if (0 > (mdb.uartfd = open (UART_DEVICE,
+ if (0 > (mdb.uartfd = open (uart_device_filename,
O_RDWR | O_NOCTTY | O_NDELAY)))
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"open",
- UART_DEVICE);
+ uart_device_filename);
return GNUNET_SYSERR;
}
@@ -1712,12 +1715,23 @@ run (void *cls,
GNUNET_CONFIGURATION_get_value_filename (cfg,
"taler-mdb",
"UART_DEVICE",
- &UART_DEVICE))
+ &uart_device_filename))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"taler-mdb",
"UART_DEVICE");
- UART_DEVICE = GNUNET_strdup ("/dev/ttyAMA0");
+ uart_device_filename = GNUNET_strdup ("/dev/ttyAMA0");
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "taler-mdb",
+ "FRAMEBUFFER_DEVICE",
+ &framebuffer_device_filename))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler-mdb",
+ "FRAMEBUFFER_DEVICE");
+ uart_device_filename = GNUNET_strdup ("/dev/fb1");
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
@@ -1815,7 +1829,7 @@ run (void *cls,
#if HAVE_QRENCODE_H
/* open the framebuffer device */
- qrDisplay.devicefd = open (FRAMEBUFFER_DEVICE,
+ qrDisplay.devicefd = open (framebuffer_device_filename,
O_RDWR);
if (0 < qrDisplay.devicefd)
{
@@ -1889,7 +1903,7 @@ run (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"open(), could not open framebuffer device %s\n",
- FRAMEBUFFER_DEVICE);
+ framebuffer_device_filename);
}
#endif
start_read_keyboard ();
diff --git a/taler.conf b/taler.conf
index 4c34022..ac50abb 100644
--- a/taler.conf
+++ b/taler.conf
@@ -13,6 +13,12 @@ fulfillment-url = taler://fulfillment-success
# must be url - utf8 encoded
fulfillment-msg = /Enjoy+your+
+# Name of the UART where the MDB connector is reachable.
+UART_DEVICE = /dev/ttyAMA0
+
+# Name of the framebuffer to use for the QR code.
+FRAMEBUFFER_DEVICE = /dev/fb1
+
#Products
#end declaration
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-taler-mdb] branch master updated (b18e966 -> 9065ce5), gnunet, 2019/12/04
- [taler-taler-mdb] 03/23: Some corrections, gnunet, 2019/12/04
- [taler-taler-mdb] 13/23: fix shutdown, gnunet, 2019/12/04
- [taler-taler-mdb] 05/23: some little bugfixes, gnunet, 2019/12/04
- [taler-taler-mdb] 09/23: neg cond, gnunet, 2019/12/04
- [taler-taler-mdb] 08/23: neg cond, gnunet, 2019/12/04
- [taler-taler-mdb] 04/23: mdb communication working (test integration), gnunet, 2019/12/04
- [taler-taler-mdb] 10/23: parse filenames from config,
gnunet <=
- [taler-taler-mdb] 01/23: Added mdb communication module, gnunet, 2019/12/04
- [taler-taler-mdb] 02/23: integration mdb first try, gnunet, 2019/12/04
- [taler-taler-mdb] 06/23: major mdb refactoring, gnunet, 2019/12/04
- [taler-taler-mdb] 23/23: add TODO, gnunet, 2019/12/04
- [taler-taler-mdb] 15/23: config, gnunet, 2019/12/04
- [taler-taler-mdb] 21/23: fix NPE, gnunet, 2019/12/04
- [taler-taler-mdb] 22/23: logging, gnunet, 2019/12/04
- [taler-taler-mdb] 17/23: invert checks, gnunet, 2019/12/04
- [taler-taler-mdb] 19/23: fix end session handling, gnunet, 2019/12/04
- [taler-taler-mdb] 11/23: use more named constants, gnunet, 2019/12/04