From 1682a861668aee5a1cf0a58007648eb84f138a40 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 31 Jan 2013 01:15:03 +0100 Subject: [PATCH] Add driver-dependent PowerDown --- libnfc/drivers/acr122_pcsc.c | 4 +++- libnfc/drivers/acr122_usb.c | 4 +++- libnfc/drivers/acr122s.c | 4 +++- libnfc/drivers/arygon.c | 4 +++- libnfc/drivers/pn532_uart.c | 3 ++- libnfc/drivers/pn53x_usb.c | 3 ++- libnfc/nfc-internal.h | 1 + 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libnfc/drivers/acr122_pcsc.c b/libnfc/drivers/acr122_pcsc.c index a0f6629..b87cd2b 100644 --- a/libnfc/drivers/acr122_pcsc.c +++ b/libnfc/drivers/acr122_pcsc.c @@ -516,6 +516,8 @@ const struct nfc_driver acr122_pcsc_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = NULL, // Abort is not supported in this driver - .idle = NULL, // Idle is not supported in this driver + .idle = pn53x_idle, + /* Even if PN532, PowerDown is not recommended on those devices */ + .powerdown = NULL, }; diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c index 020a6b9..533a3ed 100644 --- a/libnfc/drivers/acr122_usb.c +++ b/libnfc/drivers/acr122_usb.c @@ -893,5 +893,7 @@ const struct nfc_driver acr122_usb_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = acr122_usb_abort_command, - .idle = NULL, // Even with a PN532, PowerDown doesn't seem a good idea here + .idle = pn53x_idle, + /* Even if PN532, PowerDown is not recommended on those devices */ + .powerdown = NULL, }; diff --git a/libnfc/drivers/acr122s.c b/libnfc/drivers/acr122s.c index a2f4fa3..2c018d2 100644 --- a/libnfc/drivers/acr122s.c +++ b/libnfc/drivers/acr122s.c @@ -726,5 +726,7 @@ const struct nfc_driver acr122s_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = acr122s_abort_command, - .idle = NULL, + .idle = pn53x_idle, + /* Even if PN532, PowerDown is not recommended on those devices */ + .powerdown = NULL, }; diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 94fcda0..315f36e 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -587,6 +587,8 @@ const struct nfc_driver arygon_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = arygon_abort_command, - .idle = NULL, // FIXME arygon driver does not support idle() + .idle = pn53x_idle, + /* Even if PN532, PowerDown is not recommended on those devices */ + .powerdown = NULL, }; diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 3c9f2d6..10d71bd 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -528,6 +528,7 @@ const struct nfc_driver pn532_uart_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = pn532_uart_abort_command, - .idle = pn53x_idle, + .idle = pn53x_idle, + .powerdown = pn53x_PowerDown, }; diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 7440c80..f0580ff 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -791,5 +791,6 @@ const struct nfc_driver pn53x_usb_driver = { .device_get_information_about = pn53x_get_information_about, .abort_command = pn53x_usb_abort_command, - .idle = pn53x_idle, + .idle = pn53x_idle, + .powerdown = pn53x_PowerDown, }; diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index 5d1ff03..30e4947 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -147,6 +147,7 @@ struct nfc_driver { int (*abort_command)(struct nfc_device *pnd); int (*idle)(struct nfc_device *pnd); + int (*powerdown)(struct nfc_device *pnd); }; # define DEVICE_NAME_LENGTH 256