Rename DESFIRE_4K to DESFIRE.

The code can work with virtually any size of DESFire (since the operating
system embedded in the card handle almost everything), so there is no need for
us to distinguish cards of different sizes.
This commit is contained in:
Romain Tartiere 2010-07-27 08:44:12 +00:00
parent eca3c540ad
commit 9872a1b087
7 changed files with 12 additions and 26 deletions

View file

@ -61,12 +61,8 @@ main(int argc, char *argv[])
}
for (int i = 0; (!error) && tags[i]; i++) {
switch (freefare_get_tag_type (tags[i])) {
case DESFIRE_4K:
break;
default:
continue;
}
if (DESFIRE != freefare_get_tag_type (tags[i]))
continue;
int res;
char *tag_uid = freefare_get_tag_uid (tags[i]);

View file

@ -92,12 +92,8 @@ main(int argc, char *argv[])
}
for (int i = 0; (!error) && tags[i]; i++) {
switch (freefare_get_tag_type (tags[i])) {
case DESFIRE_4K:
break;
default:
continue;
}
if (DESFIRE != freefare_get_tag_type (tags[i]))
continue;
char *tag_uid = freefare_get_tag_uid (tags[i]);
char buffer[BUFSIZ];

View file

@ -59,12 +59,8 @@ main(int argc, char *argv[])
}
for (int i = 0; (!error) && tags[i]; i++) {
switch (freefare_get_tag_type (tags[i])) {
case DESFIRE_4K:
break;
default:
continue;
}
if (DESFIRE != freefare_get_tag_type (tags[i]))
continue;
int res;
char *tag_uid = freefare_get_tag_uid (tags[i]);

View file

@ -27,7 +27,7 @@ struct supported_tag supported_tags[] = {
{ { 0x00, 0x04 }, 0x08, CLASSIC_1K, "Mifare Classic 1k" },
{ { 0x00, 0x02 }, 0x18, CLASSIC_4K, "Mifare Classic 4k" },
{ { 0x00, 0x02 }, 0x38, CLASSIC_4K, "Mifare Classic 4k (Emulated)" },
{ { 0x03, 0x44 }, 0x20, DESFIRE_4K, "Mifare DESFire 4k" },
{ { 0x03, 0x44 }, 0x20, DESFIRE, "Mifare DESFire 4k" },
{ { 0x00, 0x44 }, 0x00, ULTRALIGHT, "Mifare UltraLight" },
};
@ -107,7 +107,7 @@ freefare_get_tags (nfc_device_t *device)
case CLASSIC_4K:
tags[tag_count-1] = mifare_classic_tag_new ();
break;
case DESFIRE_4K:
case DESFIRE:
tags[tag_count-1] = mifare_desfire_tag_new ();
break;
case ULTRALIGHT:
@ -176,7 +176,7 @@ freefare_free_tag (MifareTag tag)
case CLASSIC_4K:
mifare_classic_tag_free (tag);
break;
case DESFIRE_4K:
case DESFIRE:
mifare_desfire_tag_free (tag);
break;
case ULTRALIGHT:

View file

@ -40,9 +40,7 @@ enum mifare_tag_type {
// PLUS_S4K,
// PLUS_X2K,
// PLUS_X4K,
// DESFIRE_2K,
DESFIRE_4K,
// DESFIRE_8K
DESFIRE
};
struct mifare_tag;

View file

@ -181,7 +181,7 @@ struct mifare_ultralight_tag {
#define ASSERT_INACTIVE(tag) do { if (tag->active) return errno = ENXIO, -1; } while (0)
#define ASSERT_MIFARE_CLASSIC(tag) do { if ((tag->tag_info->type != CLASSIC_1K) && (tag->tag_info->type != CLASSIC_4K)) return errno = ENODEV, -1; } while (0)
#define ASSERT_MIFARE_DESFIRE(tag) do { if (tag->tag_info->type != DESFIRE_4K) return errno = ENODEV, -1; } while (0)
#define ASSERT_MIFARE_DESFIRE(tag) do { if (tag->tag_info->type != DESFIRE) return errno = ENODEV, -1; } while (0)
#define ASSERT_MIFARE_ULTRALIGHT(tag) do { if (tag->tag_info->type != ULTRALIGHT) return errno = ENODEV, -1; } while (0)
/*

View file

@ -46,7 +46,7 @@ cut_setup ()
tag = NULL;
for (int i=0; tags[i]; i++) {
if (freefare_get_tag_type(tags[i]) == DESFIRE_4K) {
if (freefare_get_tag_type(tags[i]) == DESFIRE) {
tag = tags[i];
res = mifare_desfire_connect (tag);
cut_assert_equal_int (0, res, cut_message ("mifare_desfire_connect() failed"));