aciodrv: address some magic numbers with felica polling
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
#include "aciodrv/icca.h"
|
#include "aciodrv/icca.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define IDLE_RESPONSES_BETWEEN_FELICA_POLLS 5
|
||||||
|
|
||||||
struct icca_handler_ctx {
|
struct icca_handler_ctx {
|
||||||
bool init;
|
bool init;
|
||||||
bool slotted_reader;
|
bool slotted_reader;
|
||||||
@@ -114,7 +117,7 @@ bool aciotest_icca_handler_update(
|
|||||||
++icca_ctx->last_poll;
|
++icca_ctx->last_poll;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icca_ctx->last_poll >= 5) {
|
if (icca_ctx->last_poll >= IDLE_RESPONSES_BETWEEN_FELICA_POLLS) {
|
||||||
if (!aciodrv_icca_poll_felica(device, node_id)) {
|
if (!aciodrv_icca_poll_felica(device, node_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
#define IDLE_RESPONSES_BETWEEN_FELICA_POLLS 5
|
||||||
#define NUMBER_OF_EMULATED_READERS 2
|
#define NUMBER_OF_EMULATED_READERS 2
|
||||||
#define INVALID_NODE_ID -1
|
#define INVALID_NODE_ID -1
|
||||||
|
|
||||||
@@ -133,11 +134,9 @@ bool eam_io_init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
icca_node_id[i] = nid;
|
icca_node_id[i] = nid;
|
||||||
|
|
||||||
icca_is_slotted[i] = true;
|
|
||||||
icca_poll_counter[i] = 0;
|
icca_poll_counter[i] = 0;
|
||||||
|
|
||||||
icca_is_slotted[i] = aciodrv_icca_is_slotted(device, nid);
|
icca_is_slotted[i] = aciodrv_icca_is_slotted(device, nid);
|
||||||
|
log_misc("ICC reader %d is_slotted: %d", nid, icca_is_slotted[i]);
|
||||||
|
|
||||||
if (!aciodrv_icca_init(device, icca_node_id[i])) {
|
if (!aciodrv_icca_init(device, icca_node_id[i])) {
|
||||||
log_warning("Initializing icca %d failed", i);
|
log_warning("Initializing icca %d failed", i);
|
||||||
@@ -279,7 +278,7 @@ bool eam_io_poll(uint8_t unit_no)
|
|||||||
// we must manually call this every few polls to actually update the felica state
|
// we must manually call this every few polls to actually update the felica state
|
||||||
// we don't do it every poll, since card polling isn't that time sensitive of an operation
|
// we don't do it every poll, since card polling isn't that time sensitive of an operation
|
||||||
// libacio does it every 5ish polls after the last AC_IO_ICCA_STATUS_BUSY_NEW message
|
// libacio does it every 5ish polls after the last AC_IO_ICCA_STATUS_BUSY_NEW message
|
||||||
if (icca_poll_counter[unit_no] >= 5) {
|
if (icca_poll_counter[unit_no] >= IDLE_RESPONSES_BETWEEN_FELICA_POLLS) {
|
||||||
response = aciodrv_icca_poll_felica(
|
response = aciodrv_icca_poll_felica(
|
||||||
aciomgr_port_checkout(acio_manager_ctx),
|
aciomgr_port_checkout(acio_manager_ctx),
|
||||||
icca_node_id[unit_no]);
|
icca_node_id[unit_no]);
|
||||||
|
|||||||
Reference in New Issue
Block a user