-
Notifications
You must be signed in to change notification settings - Fork 104
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
Added support for NTAG 21x tags #53
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thank you for this PR.
I added a commit (019bfd1) to revert to UNIX line endings (LF, not Windows CR+LF) to make the diff more readable, please check your editor's configuration and the output of git diff
to avoid this kind of problems.
There are currently some style inconsistencies in the libfreefare code, but it would be cool to avoid introducing more (that would be a story for another PR). For example, we have spaces between a function name and the opening parenthesis of it's parameters (but not in diagnostic messages) and also spaces after comas and semi column. Please refer the style section of the file HACKING.md
at the repository root for details.
I added a few more points inline
libfreefare/Makefile.am
Outdated
@@ -14,7 +14,8 @@ libfreefare_la_SOURCES = felica.c \ | |||
mifare_desfire_key.c \ | |||
mad.c \ | |||
mifare_application.c \ | |||
tlv.c | |||
tlv.c \ | |||
ntag21x.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the file list in alphabetical order.
examples/CMakeLists.txt
Outdated
mifare-detect-tag | ||
ntag-write | ||
ntag-setauth | ||
ntag-removeauth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the list in alphabetical order.
examples/Makefile.am
Outdated
mifare-detect-tag \ | ||
ntag-write \ | ||
ntag-setauth \ | ||
ntag-removeauth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetical order + indentation
examples/Makefile.am
Outdated
|
||
ntag_removeauth_SOURCES = ntag-removeauth.c | ||
ntag_removeauth_LDADD = $(top_builddir)/libfreefare/libfreefare.la | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetical order of targets
libfreefare/freefare.c
Outdated
} else if (mifare_ultralight_taste (device, target)) { | ||
tag = mifare_ultralight_tag_new (device, target); | ||
tag = mifare_ultralight_tag_new (device, target); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation changed unexpectedly
libfreefare/freefare.c
Outdated
@@ -169,6 +171,8 @@ freefare_get_tag_friendly_name (FreefareTag tag) | |||
return "Mifare UltraLightC"; | |||
case MIFARE_ULTRALIGHT: | |||
return "Mifare UltraLight"; | |||
case NTAG_21x: | |||
return "NTAG21x"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation look inconsistent
libfreefare/freefare.h
Outdated
int ntag21x_authenticate (FreefareTag tag, const NTAG21xKey key); // Authenticate with tag | ||
bool is_ntag21x(FreefareTag tag); // Check if tag type is NTAG21x | ||
bool ntag21x_is_auth_supported (nfc_device *device, nfc_iso14443a_info nai); // Check if tag supports 21x commands | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Function prototypes in the style guide for the magic of indentation here :-)
libfreefare/freefare_internal.h
Outdated
@@ -260,7 +282,7 @@ struct mifare_ultralight_tag { | |||
#define MIFARE_CLASSIC(tag) ((struct mifare_classic_tag *) tag) | |||
#define MIFARE_DESFIRE(tag) ((struct mifare_desfire_tag *) tag) | |||
#define MIFARE_ULTRALIGHT(tag) ((struct mifare_ultralight_tag *) tag) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the blank line between this group of macros and the comment
Oh, and no need to worry about the copyright, #49 is about removing them all since they are never updated. |
@smortex we've a "style" phony target in libnfc, maybe you could setup sth similar for libfreefare? https://github.com/nfc-tools/libnfc/blob/master/Makefile.am |
Fixed some identation, is there easy way to check if all is correct ? |
Hello @SloCompTech,
In order to check style "the easy way", I simply look at the Files changed tab of the pull request (on top of this page) which shows the wholes changes of all commits combined. Since these changes are related to adding a new feature, the page should only contain bunches of new lines of code (new files, etc), and a few logical changes. Therefore, any space change is suspicious and even if the spacing is wrong according to the style, it's better to keep it as it is in order to make the review easier (e.g. most changes in libfreefare/freefare.c should not be part of this pull request in order to make it easy to spot the actual changes (L74-75)). On this tab, the in-line review comments are automatically hidden when they are attached to code that has been changed, so the comments I made some time ago and are still relevant are shown there. Thank you for taking care of this, much appreciated 👍 |
Hi, |
@SloCompTech yes, you can create a new branch in order to have a reference to the current state of the repository, revert your Then, when you push your changes ( |
Hi, |
Hi I cloned the repository, rebased on top of master, and added a commit to fix some spacing problems, unfortunately I can't push it to your repository 😮. Either you did not "Allow edits from maintainers" (checkbox at the bottom of the right column of this page), otherwise GitHub do not want me to rebase your changes and I should revert that. Can you please check that maintainers edits are allowed and tell me? Thansk! |
Most problems where fixed, I have local modification that fix the few remaining ones.
hi @smortex, I have edit by maintainers enabled, but just in case I added you as colaborator, so please try to push to repo again |
Nah, with your authorization I realized that I was pushing to a new non-existent branch in your repo and not in master… I just cherry-picked my commit and cleaned-up my mess! |
Changes squashed and merged. Thanks! |
Hello,
I added support for NTAG21x tags according to NTAG213/215/216 documentation Rev. 3.2 June 2015
It includes:
Before it can be merged some things need to be checked: