timmerk / nfc-tools

Automatically exported from code.google.com/p/nfc-tools
0 stars 0 forks source link

Get info about mifare tag. #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm writing GUI application using libfreefare and I need to have exact 
information about tag i'm communicating with (Mifare Classic 1K or 4k). Do 
you have plans to add such functionality to libfreefare library? 

br, 
rosek

Original issue reported on code.google.com by rose...@gmail.com on 16 Feb 2010 at 6:58

GoogleCodeExporter commented 9 years ago
Hello,

Thanks for your interest in libfreefare.

Yes, its planned to provide some information about tag. Except 1K/4K 
information, do
you any idea about ohter information you want ?

Original comment by romu...@libnfc.org on 17 Feb 2010 at 3:41

GoogleCodeExporter commented 9 years ago
Hello,

I'm wondering if creating *_get_tags function to each type of tag is the best. 
If I'd like to add to my application support for mifare classic and ultralight 
tags I 
must firstly use mifare_classic_get_tags and then mifare_ultraligth_get_tags 
and do 
twice all this libnfc stuff like disactivating and activating field and so on. 

Then you add support for more types; Plus, DesFire... ;P
Could you look for my suggestion how to solve this problem ? I attach files 
which I 
changed in libfreefare. 

Original comment by rose...@gmail.com on 18 Feb 2010 at 12:42

Attachments:

GoogleCodeExporter commented 9 years ago
Hey!

Refactoring the code to detect tags in a single place is on my TODO list ;-)  
So is to finish and push the implementation of the support for DESFire ...

I'll take it.

Original comment by romain.t...@gmail.com on 18 Feb 2010 at 3:39

GoogleCodeExporter commented 9 years ago
I'm on it

Original comment by romain.t...@gmail.com on 19 Feb 2010 at 10:29

GoogleCodeExporter commented 9 years ago
Hi rosek,

You should have a look at r165.

BTW, I am wondering if returning a value part of an enum is that convenient.  
Maybe functions like 
is_mifare_classic(), is_mifare_desfire_4k() etc would be simpler (and make it 
easy to create bindings for other 
languages since i would only use basic C types).

Any comment welcomed!

Original comment by romain.t...@gmail.com on 19 Feb 2010 at 2:54

GoogleCodeExporter commented 9 years ago

Original comment by romain.t...@gmail.com on 19 Feb 2010 at 2:54

GoogleCodeExporter commented 9 years ago
Hi romain,

Thanks for this, this is what i need :) 
Actually I got some errors because I have included mifaretag.h from libnfc. 
This 
header have sucture with the same name; mifare_tag. So it is imposible to use 
libfreefare and include mifaretag.h. When I removed this header everythink work 
well. 
You could think about refactor your structures with freefare prefix.   

/usr/local/include/freefare.h:48: error: using typedef-name ‘mifare_tag’ 
after 
‘struct’
/usr/local/include/nfc/mifaretag.h:53: error: ‘mifare_tag’ has a previous 
declaration 
here
/usr/local/include/freefare.h:49: error: using typedef-name ‘mifare_tag’ 
after 
‘struct’
/usr/local/include/nfc/mifaretag.h:53: error: ‘mifare_tag’ has a previous 
declaration 
here
/usr/local/include/freefare.h:49: error: invalid type in declaration before 
‘;’ token

Original comment by rose...@gmail.com on 22 Feb 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Oh, and about is_mifare_x() functions, I think it's good idea :)

Original comment by rose...@gmail.com on 22 Feb 2010 at 3:16

GoogleCodeExporter commented 9 years ago
Hey!

Do you really need nfc/mifaretag.h ?  I know that theire is some MIFARE Classic 
related code in the libnfc but 
don't think you can't do without it when using the libfreefare. AFAIK, all this 
coude could (shoud (shall)) be 
removed from the libnfc when libfreefare will be production ready.

Roel or Romuald way be more suitable to answer this question (I added them to 
CC)

Regarding the is_mifare_x() functions, I am thinking about two kind of 
functions.  The first ones to get a tag's 
type (e.g. MIFARE Classic, MIFARE DESFire, etc.) and the second ones to get the 
tag's size (e.g. 
mifare_classic_get_sector_count(), mifare_classic_get_block_count(), 
mad_get_free_sector_count()).  It would 
be more convenient I think than a single function that can tell you that a 
provided tag is say "MIFARE Classic 
4K".

Thanks!

Original comment by romain.t...@gmail.com on 25 Feb 2010 at 12:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This MIFARE Classic code in libnfc is currently only for demonstration 
purposes. I
must agree that the NFC chip actually supports the protocol in hardware (there 
are
several chip-API functions for communicating with a MIFARE Classic tag).

Looking to the future I think indeed that it would be better to get rid of
tag-specific code from the main library (libnfc). Since that currently only 
focuses
on bringing the hardware and software together for further use in 3rd party apps
(like nfc-tools). But the discussion to this is still open, I invite you guys 
to open
a topic about this in the main community to led everybody decide on the future 
course.

Original comment by r...@libnfc.org on 28 Feb 2010 at 2:18

GoogleCodeExporter commented 9 years ago
In libnfc 1.4.x series, nfc/mifaretag.h will not be installed anymore.

Original comment by romu...@libnfc.org on 21 May 2010 at 11:44

GoogleCodeExporter commented 9 years ago
Confirmed since svn revision 418 of libnfc:
http://code.google.com/p/libnfc/source/detail?r=418

Original comment by romu...@libnfc.org on 7 Jun 2010 at 10:43