From 97cf9e925b197a2c01aab0c20a4d5e4e8695e833 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 20 Oct 2010 16:14:53 +0000 Subject: [PATCH] Attempt to fix ARYGON driver --- libnfc/buses/uart.c | 2 +- libnfc/drivers/arygon.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libnfc/buses/uart.c b/libnfc/buses/uart.c index f2afec7..5734bd2 100644 --- a/libnfc/buses/uart.c +++ b/libnfc/buses/uart.c @@ -99,7 +99,7 @@ uart_open (const char *pcPortName) return INVALID_SERIAL_PORT; } - tcflush (sp->fd, TCIFLUSH); + tcflush (sp->fd, TCIOFLUSH); return sp; } diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 9f01da2..88d9ea9 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -70,7 +70,7 @@ #define SERIAL_DEFAULT_PORT_SPEED 9600 // TODO Move this one level up for libnfc-1.6 -static const byte_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; +static const byte_t ack_frame[] = { DEV_ARYGON_PROTOCOL_TAMA, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; void arygon_ack (const nfc_device_spec_t nds); bool arygon_check_communication (const nfc_device_spec_t nds); @@ -172,9 +172,6 @@ arygon_connect (const nfc_device_desc_t * pndd) DBG ("Attempt to connect to: %s at %d bauds.", pndd->pcPort, pndd->uiSpeed); sp = uart_open (pndd->pcPort); - // Send ACK frame to cancel a previous command - arygon_ack ((nfc_device_spec_t) sp); - if (sp == INVALID_SERIAL_PORT) ERR ("Invalid serial port: %s", pndd->pcPort); if (sp == CLAIMED_SERIAL_PORT) @@ -184,6 +181,9 @@ arygon_connect (const nfc_device_desc_t * pndd) uart_set_speed (sp, pndd->uiSpeed); + // Send ACK frame to cancel a previous command + arygon_ack ((nfc_device_spec_t) sp); + DBG ("Successfully connected to: %s", pndd->pcPort); // We have a connection