From b450423b5aec1e1bc2f9627f064ffba33c419aa7 Mon Sep 17 00:00:00 2001 From: meri Date: Wed, 2 May 2007 02:29:53 +0000 Subject: added UID output for loop mode git-svn-id: https://svn.gnumonks.org/trunk/librfid@1993 e0336214-984f-0b4b-a45f-81c69e1f0ede --- utils/mifare-tool.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'utils') 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"); -- cgit v1.2.3