call idle() from driver-dependent close() rather than from nfc_close() as some driver still need to do an ack() before
This commit is contained in:
parent
683505f39b
commit
8bc7a1c291
8 changed files with 12 additions and 5 deletions
|
@ -10,6 +10,7 @@ Fixes:
|
||||||
- Fix nfc-scan-device -i option
|
- Fix nfc-scan-device -i option
|
||||||
- Remove wrong exit() calls in library
|
- Remove wrong exit() calls in library
|
||||||
- Fix issue in driver acr122_usb affecting Touchatag
|
- Fix issue in driver acr122_usb affecting Touchatag
|
||||||
|
- Reenable some idle in all drivers, add selectively PowerDown when possible
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
- nfc_emulate_target() now takes timeout parameter
|
- nfc_emulate_target() now takes timeout parameter
|
||||||
|
|
|
@ -324,6 +324,8 @@ error:
|
||||||
static void
|
static void
|
||||||
acr122_pcsc_close(nfc_device *pnd)
|
acr122_pcsc_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
SCardDisconnect(DRIVER_DATA(pnd)->hCard, SCARD_LEAVE_CARD);
|
SCardDisconnect(DRIVER_DATA(pnd)->hCard, SCARD_LEAVE_CARD);
|
||||||
acr122_pcsc_free_scardcontext();
|
acr122_pcsc_free_scardcontext();
|
||||||
|
|
||||||
|
|
|
@ -551,6 +551,7 @@ static void
|
||||||
acr122_usb_close(nfc_device *pnd)
|
acr122_usb_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
acr122_usb_ack(pnd);
|
acr122_usb_ack(pnd);
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
if ((res = usb_release_interface(DRIVER_DATA(pnd)->pudh, 0)) < 0) {
|
if ((res = usb_release_interface(DRIVER_DATA(pnd)->pudh, 0)) < 0) {
|
||||||
|
|
|
@ -520,6 +520,8 @@ static void
|
||||||
acr122s_close(nfc_device *pnd)
|
acr122s_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
acr122s_deactivate_sam(pnd);
|
acr122s_deactivate_sam(pnd);
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
uart_close(DRIVER_DATA(pnd)->port);
|
uart_close(DRIVER_DATA(pnd)->port);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
|
@ -211,6 +211,8 @@ arygon_connstring_decode(const nfc_connstring connstring, struct arygon_descript
|
||||||
static void
|
static void
|
||||||
arygon_close(nfc_device *pnd)
|
arygon_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
// Release UART port
|
// Release UART port
|
||||||
uart_close(DRIVER_DATA(pnd)->port);
|
uart_close(DRIVER_DATA(pnd)->port);
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,8 @@ pn532_connstring_decode(const nfc_connstring connstring, struct pn532_uart_descr
|
||||||
static void
|
static void
|
||||||
pn532_uart_close(nfc_device *pnd)
|
pn532_uart_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
// Release UART port
|
// Release UART port
|
||||||
uart_close(DRIVER_DATA(pnd)->port);
|
uart_close(DRIVER_DATA(pnd)->port);
|
||||||
|
|
||||||
|
|
|
@ -447,14 +447,14 @@ pn53x_usb_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
pn53x_usb_ack(pnd);
|
pn53x_usb_ack(pnd);
|
||||||
|
|
||||||
pn53x_idle(pnd);
|
|
||||||
|
|
||||||
if (DRIVER_DATA(pnd)->model == ASK_LOGO) {
|
if (DRIVER_DATA(pnd)->model == ASK_LOGO) {
|
||||||
/* Set P30, P31, P32, P33, P35 to logic 1 and P34 to 0 logic */
|
/* Set P30, P31, P32, P33, P35 to logic 1 and P34 to 0 logic */
|
||||||
/* ie. Switch all LEDs off and turn off progressive field */
|
/* ie. Switch all LEDs off and turn off progressive field */
|
||||||
pn53x_write_register(pnd, PN53X_SFR_P3, 0xFF, _BV(P30) | _BV(P31) | _BV(P32) | _BV(P33) | _BV(P35));
|
pn53x_write_register(pnd, PN53X_SFR_P3, 0xFF, _BV(P30) | _BV(P31) | _BV(P32) | _BV(P33) | _BV(P35));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pn53x_idle(pnd);
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
if ((res = usb_release_interface(DRIVER_DATA(pnd)->pudh, 0)) < 0) {
|
if ((res = usb_release_interface(DRIVER_DATA(pnd)->pudh, 0)) < 0) {
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to release USB interface (%s)", _usb_strerror(res));
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to release USB interface (%s)", _usb_strerror(res));
|
||||||
|
|
|
@ -209,11 +209,8 @@ void
|
||||||
nfc_close(nfc_device *pnd)
|
nfc_close(nfc_device *pnd)
|
||||||
{
|
{
|
||||||
if (pnd) {
|
if (pnd) {
|
||||||
// Go in idle mode
|
|
||||||
nfc_idle(pnd);
|
|
||||||
// Close, clean up and release the device
|
// Close, clean up and release the device
|
||||||
pnd->driver->close(pnd);
|
pnd->driver->close(pnd);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue