Any successfull PowerDown command have to change local power mode state

This commit is contained in:
Romuald Conty 2012-05-16 16:48:06 +00:00
parent 782b72e29f
commit 10f24d97aa

View file

@ -927,7 +927,6 @@ pn53x_idle (struct nfc_device *pnd)
if ((res = pn53x_PowerDown (pnd)) < 0) { if ((res = pn53x_PowerDown (pnd)) < 0) {
return res; return res;
} }
CHIP_DATA (pnd)->power_mode = LOWVBAT;
} }
break; break;
case INITIATOR: case INITIATOR:
@ -944,7 +943,6 @@ pn53x_idle (struct nfc_device *pnd)
if ((res = pn53x_PowerDown (pnd)) < 0) { if ((res = pn53x_PowerDown (pnd)) < 0) {
return res; return res;
} }
CHIP_DATA (pnd)->power_mode = LOWVBAT;
} else { } else {
// Use InRelease to go in "Standby mode" // Use InRelease to go in "Standby mode"
if ((res = pn53x_InRelease (pnd, 0)) < 0) { if ((res = pn53x_InRelease (pnd, 0)) < 0) {
@ -2181,7 +2179,11 @@ int
pn53x_PowerDown (struct nfc_device *pnd) pn53x_PowerDown (struct nfc_device *pnd)
{ {
uint8_t abtCmd[] = { PowerDown, 0xf0 }; uint8_t abtCmd[] = { PowerDown, 0xf0 };
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, 0, -1)); int res;
if ((res = pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, 0, -1)) < 0)
return res;
CHIP_DATA (pnd)->power_mode = LOWVBAT;
return res;
} }
/** /**