From 942dcfa631af79cfa450c0275636ad9e846d1ac6 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 20 Apr 2010 15:05:57 +0000 Subject: [PATCH] PN532_UART: prevent from blocking when device doesn't reply correctly to wakeup command. --- libnfc/drivers/pn532_uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index a745a0c..8ef604b 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -233,7 +233,6 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con print_hex(abtRxBuf,szRxBufLen); #endif - const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 }; const byte_t pn53x_nack_frame[] = { 0x00,0x00,0xff,0xff,0x00,0x00 }; if(szRxBufLen >= sizeof(pn53x_ack_frame)) { @@ -298,7 +297,8 @@ pn532_uart_wakeup(const nfc_device_spec_t nds) #endif uart_send((serial_port)nds, pncmd_pn532c106_wakeup, sizeof(pncmd_pn532c106_wakeup)); - while (!uart_receive((serial_port)nds,abtRx,&szRxLen)) { + if(!uart_receive((serial_port)nds,abtRx,&szRxLen)) { + return false; } #ifdef DEBUG printf(" RX: ");