Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to retrieve status from NFC device #481

Open
garrett-davidson opened this issue Mar 27, 2018 · 3 comments
Open

No way to retrieve status from NFC device #481

garrett-davidson opened this issue Mar 27, 2018 · 3 comments

Comments

@garrett-davidson
Copy link

I'm currently working on an app that uses libnfc, and when an error occurs, I'd like to be able to send display different error messages to my users based on which error was received on the NFC device. I'm using a PN532 board. Internally, the struct appears to have a last_status_byte field containing exactly what I want, but this value is not exposed to the user anywhere that I can find. I have tried the return value from nfc_initiator_transceive_bytes ,nfc_perror, nfc_strerror, and nfc_device_get_last_error. All of them opaquely hide the actual status behind a generic -20 RF transmission error, effectively hiding useful information for seemingly no good reason.

@garrett-davidson
Copy link
Author

Unless I'm completely missing something, I propose adding a method uint8_t nfc_device_get_last_status(const nfc_device *pnd) which provides access to this hidden value. I'm doing this now on my fork for my purposes mentioned above. If someone knows of a better way to do this that I missed, please share.

@garrett-davidson
Copy link
Author

Just submitted PR #482 with a fix for this.

@garrett-davidson
Copy link
Author

Closed the pull request. Upon further investigation, it seems that no matter what the actual error received from the board is, libnfc always returns a 1 (ETIMEOUT). If this is a known problem, it makes sense why this feature was not available. Because it appears to be related, I think this bug should expand to cover the ETIMEOUT problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant