Do not require a Mifare UltraLight TAG to be connected to get it's UID.

Submitted by:	rosek86@gmail.com
This commit is contained in:
Romain Tartiere 2010-03-30 13:56:49 +00:00
parent 26aef03a48
commit 017029fbbe

View file

@ -193,16 +193,13 @@ char *
mifare_ultralight_get_uid (MifareTag tag) mifare_ultralight_get_uid (MifareTag tag)
{ {
char *uid = malloc (2 * 7 + 1); char *uid = malloc (2 * 7 + 1);
MifareUltralightPage p0, p1;
mifare_ultralight_read (tag, 0, &p0);
mifare_ultralight_read (tag, 1, &p1);
sprintf (uid, "%02x%02x%02x%02x%02x%02x%02x", sprintf (uid, "%02x%02x%02x%02x%02x%02x%02x",
p0[0], tag->info.abtUid[1],
p0[1], tag->info.abtUid[2],
p0[2], tag->info.abtUid[3],
p1[0], tag->info.abtUid[4],
p1[1], tag->info.abtUid[5],
p1[2], tag->info.abtUid[6],
p1[3]); tag->info.abtUid[7]);
return uid; return uid;
} }