diff options
author | Dominik Hofer <dominik.hofer@bfh.ch> | 2019-12-27 17:30:59 +0100 |
---|---|---|
committer | Dominik Hofer <dominik.hofer@bfh.ch> | 2019-12-27 17:30:59 +0100 |
commit | 939c3035191fb6ad89099e5d0249b91a11f9a479 (patch) | |
tree | 6729201473be506701f2e60f860f16021f6a03c4 | |
parent | 4bb273a3790c17d0932ba3983da8d5030444d93b (diff) | |
download | taler-mdb-939c3035191fb6ad89099e5d0249b91a11f9a479.tar.gz taler-mdb-939c3035191fb6ad89099e5d0249b91a11f9a479.tar.bz2 taler-mdb-939c3035191fb6ad89099e5d0249b91a11f9a479.zip |
Change GPIO Pin
-rw-r--r-- | src/main.c | 94 |
1 files changed, 92 insertions, 2 deletions
@@ -125,6 +125,7 @@ along with /* VMC commands */ #define VMC_CMD_START 0x02 #define VMC_CMD_END 0x03 +#define VMC_CMD_RESET 0x10 /** * Acknowledgement @@ -135,6 +136,8 @@ along with * Request for configuration. */ #define VMC_CONF 0x11 +#define VMC_READER_CONF 0x00 +#define VMC_SETUP_MAX_MIN_PRICES 0x01 /** * Machine is polling for something. @@ -192,7 +195,11 @@ along with /* Session Commands */ /* Refer to the mdb interface specifications v4.2 p.131 */ #define READER_BEGIN_SESSION "03" +<<<<<<< Updated upstream #define READER_FUNDS_AVAILABLE "000A" +======= +#define READER_FUNDS_AVAILABLE "00A0" +>>>>>>> Stashed changes #define READER_END_SESSION "07" /* Vend Commands */ @@ -796,6 +803,11 @@ cleanup_payment (struct PaymentActivity *pa) nfc_abort_command (pa->pnd); nfc_close (pa->pnd); } + if (NULL != cancelbutton_task) + { + GNUNET_SCHEDULER_cancel (cancelbutton_task); + cancelbutton_task = NULL; + } if (NULL != pa->po) TALER_MERCHANT_proposal_cancel (pa->po); if (NULL != pa->cpo) @@ -896,6 +908,11 @@ shutdown_task (void *cls) cleanup_payment (payment_activity); payment_activity = NULL; } + if (NULL != cancelbutton_task) + { + GNUNET_SCHEDULER_cancel (cancelbutton_task); + cancelbutton_task = NULL; + } if (NULL != keyboard_task) { GNUNET_SCHEDULER_cancel (keyboard_task); @@ -947,7 +964,11 @@ shutdown_task (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/unexport for cancel button\n"); } +<<<<<<< Updated upstream (void) write (cancelButton.cancelbuttonfd, "17", 2); +======= + (void) write (cancelButton.cancelbuttonfd, "23", 2); +>>>>>>> Stashed changes close (cancelButton.cancelbuttonfd); } /* free the allocated productes read from config file */ @@ -2043,14 +2064,64 @@ handle_command (const char *hex, break; } case VMC_CONF: +<<<<<<< Updated upstream GNUNET_log (GNUNET_ERROR_TYPE_INFO, +======= + { + unsigned int subcmd; + + if (4 > hex_len) + { + GNUNET_break_op (0); + return; + } + if (1 != sscanf (&hex[2], + "%2X", + &subcmd)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Received non-HEX input `%.*s'\n", + (int) hex_len - 2, + &hex[2]); + GNUNET_break_op (0); + return; + } + switch (subcmd) + { + case VMC_READER_CONF: + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, +>>>>>>> Stashed changes "Received request for configuration via MDB\n"); - mdb.cmd = &readerConfigData; - break; + mdb.cmd = &readerConfigData; + break; + + } + case VMC_SETUP_MAX_MIN_PRICES: + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Received max and min prices via MDB\n"); + break; + } + default: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Unknown MDB sub-command %X of command %X\n", + subcmd, + cmd); + break; + } + break; + } case VMC_POLL: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received POLL from MDB (ignored)\n"); break; + case VMC_CMD_RESET: + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received RESET from MDB (ignored)\n"); + break; + } case VMC_READER: { unsigned int subcmd; @@ -2592,25 +2663,44 @@ run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/export for cancel button\n"); } +<<<<<<< Updated upstream (void) write (cancelButton.cancelbuttonfd, "17", 2); close (cancelButton.cancelbuttonfd); cancelButton.cancelbuttonfd = open ("/sys/class/gpio/gpio17/direction", +======= + (void) write (cancelButton.cancelbuttonfd, "23", 2); + close (cancelButton.cancelbuttonfd); + + cancelButton.cancelbuttonfd = open ("/sys/class/gpio/gpio23/direction", +>>>>>>> Stashed changes O_WRONLY); if (0 > cancelButton.cancelbuttonfd) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, +<<<<<<< Updated upstream "Unable to open /gpio/gpio17/direction for cancel button\n"); +======= + "Unable to open /gpio/gpio23/direction for cancel button\n"); +>>>>>>> Stashed changes } (void) write (cancelButton.cancelbuttonfd, "in", 2); close (cancelButton.cancelbuttonfd); +<<<<<<< Updated upstream cancelButton.cancelbuttonfd = open ("/sys/class/gpio/gpio17/value", +======= + cancelButton.cancelbuttonfd = open ("/sys/class/gpio/gpio23/value", +>>>>>>> Stashed changes O_RDONLY); if (0 > cancelButton.cancelbuttonfd) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, +<<<<<<< Updated upstream "Unable to open /gpio/gpio17/value for cancel button\n"); +======= + "Unable to open /gpio/gpio23/value for cancel button\n"); +>>>>>>> Stashed changes } |