summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeri <meri@e0336214-984f-0b4b-a45f-81c69e1f0ede>2007-05-02 02:29:53 +0000
committermeri <meri@e0336214-984f-0b4b-a45f-81c69e1f0ede>2007-05-02 02:29:53 +0000
commitb450423b5aec1e1bc2f9627f064ffba33c419aa7 (patch)
tree81724cccebf0cdff251d07277276da082cc9982c
parent3e83264376bdd37073d3d1c068b1b2414daf28cc (diff)
added UID output for loop mode
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1993 e0336214-984f-0b4b-a45f-81c69e1f0ede
-rw-r--r--utils/mifare-tool.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/utils/mifare-tool.c b/utils/mifare-tool.c
index aebd0d0..58c0692 100644
--- a/utils/mifare-tool.c
+++ b/utils/mifare-tool.c
@@ -92,7 +92,7 @@ static void mifare_l3(void)
int main(int argc, char **argv)
{
int len, rc, c, option_index = 0;
- unsigned int page;
+ unsigned int page,uid,uid_len;
char key[MIFARE_CL_KEY_LEN];
char buf[MIFARE_CL_PAGE_SIZE];
@@ -136,13 +136,20 @@ int main(int argc, char **argv)
mifare_l3();
if (mifare_cl_auth(key, page) < 0)
exit(1);
+
+ uid_len=sizeof(uid);
+ uid=0;
+ if(rfid_layer2_getopt(l2h,RFID_OPT_LAYER2_UID,&uid,&uid_len)>=0)
+ printf("UID=%08X (len=%u)\n",uid,uid_len);
+
+ len=MIFARE_CL_PAGE_SIZE;
rc = rfid_protocol_read(ph, page, buf, &len);
if (rc < 0) {
printf("\n");
fprintf(stderr, "error during read\n");
break;
}
- printf("%s\n", hexdump(buf, len));
+ printf("len=%u data=%s\n", len, hexdump(buf, len));
if (page & 0x3 == 0x3) {
struct mfcl_access_sect s;
@@ -171,6 +178,13 @@ int main(int argc, char **argv)
mifare_l3();
if (mifare_cl_auth(key, page) < 0)
continue;
+
+ uid_len=sizeof(uid);
+ uid=0;
+ if(rfid_layer2_getopt(l2h,RFID_OPT_LAYER2_UID,&uid,&uid_len)>=0)
+ printf("UID=%08X (len=%u)\n",uid,uid_len);
+
+ len=MIFARE_CL_PAGE_SIZE;
rc = rfid_protocol_read(ph, page, buf, &len);
if (rc < 0) {
printf("\n");
personal git repositories of Harald Welte. Your mileage may vary