Fix recently changed wakeup function for pn532_uart driver.

Pointy hat to: me ;)
This commit is contained in:
Romuald Conty 2010-04-14 10:39:18 +00:00
parent a3f68b566d
commit 0a08ef00c2
2 changed files with 7 additions and 3 deletions

View file

@ -53,7 +53,6 @@ static const struct driver_callbacks drivers_callbacks_list[] = {
{ PN533_USB_DRIVER_NAME, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
#endif /* HAVE_LIBUSB */
{ PN532_UART_DRIVER_NAME, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, pn532_uart_transceive, pn532_uart_disconnect },
{ ARYGON_DRIVER_NAME, arygon_pick_device, arygon_list_devices, arygon_connect, arygon_transceive, arygon_disconnect }
};
#endif // __NFC_DRIVERS_H__

View file

@ -251,8 +251,12 @@ pn532_uart_wakeup(const nfc_device_spec_t nds)
/** PN532C106 wakeup. */
/** High Speed Unit (HSU) wake up consist to send 0x55 and wait a "long" delay for PN532 being wakeup. */
/** To be sure that PN532 is alive, we have put a "Diagnose" command to execute a "Communication Line Test" */
const byte_t pncmd_pn532c106_wakeup[] = { 0x55,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD4,0x00,0x00,'l','i','b','n','f','c'};
const byte_t pncmd_pn532c106_wakeup[] = { 0x55,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x09,0xf7,0xd4,0x00,0x00,'l','i','b','n','f','c',0xbe,0x00 };
#ifdef DEBUG
printf(" TX: ");
print_hex(pncmd_pn532c106_wakeup,sizeof(pncmd_pn532c106_wakeup));
#endif
uart_send((serial_port)nds, pncmd_pn532c106_wakeup, sizeof(pncmd_pn532c106_wakeup));
if (!uart_receive((serial_port)nds,abtRx,&szRxLen)) {
@ -264,8 +268,9 @@ pn532_uart_wakeup(const nfc_device_spec_t nds)
print_hex(abtRx,szRxLen);
#endif
const byte_t attempted_result[] = { 0xD5,0x01,'l','i','b','n','f','c'};
const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00};
if(0 != memcmp(abtRx,attempted_result,sizeof(attempted_result))) {
DBG("Comminucation test failed, result doesn't match to attempted one.");
return false;
}
return true;