From 7b1999d8fb02ac9ed554298096e5af10dc137994 Mon Sep 17 00:00:00 2001
From: Romuald Conty <romuald@libnfc.org>
Date: Tue, 20 Oct 2009 15:37:42 +0000
Subject: [PATCH] Add (dirty) code to wakeup for PN532C106.

---
 src/dev_pn532_uart.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/dev_pn532_uart.c b/src/dev_pn532_uart.c
index 2903654..1450a9a 100644
--- a/src/dev_pn532_uart.c
+++ b/src/dev_pn532_uart.c
@@ -91,6 +91,23 @@ dev_info* dev_pn532_uart_connect(const nfc_device_desc_t* pndd)
 
     rs232_set_speed(sp, pndd->uiSpeed);
   }
+  /** @info PN532C106 wakeup. */
+  /** @todo Put this command in pn53x init process */
+  byte_t abtRxBuf[BUFFER_LENGTH];
+  size_t szRxBufLen;
+  const byte_t pncmd_pn532c106_wakeup[] = { 0x55,0x55,0x00,0x00,0x00,0x00,0x00,0xFF,0x03,0xFD,0xD4,0x14,0x01,0x17,0x00 };
+
+  rs232_send(sp, pncmd_pn532c106_wakeup, sizeof(pncmd_pn532c106_wakeup));
+  delay_ms(10);
+
+  if (!rs232_receive(sp,abtRxBuf,&szRxBufLen)) {
+    ERR("Unable to receive data. (RX)");
+    return NULL;
+  }
+#ifdef DEBUG
+  printf(" RX: ");
+  print_hex(abtRxBuf,szRxBufLen);
+#endif
 
   DBG("Successfully connected to: %s",acConnect);