From 6a4271d186e0ad7d6d3f71c617c108e9d23188d4 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 14 May 2016 14:34:35 +0200 Subject: [PATCH] CHG: Changed cardnumber printing from %d (signed) to %u (unsigned) for AWID50, it now prints correct in all cases. Thanks to @ntk for reminding me about it. --- armsrc/lfops.c | 8 ++++---- client/cmddata.c | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 69b76d12..74dd5ab8 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -898,25 +898,25 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol) fc = bytebits_to_byte(dest + 9, 8); cardnum = bytebits_to_byte(dest + 17, 16); code1 = bytebits_to_byte(dest + 8,fmtLen); - Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; case 50: fc = bytebits_to_byte(dest + 9, 16); cardnum = bytebits_to_byte(dest + 25, 32); code1 = bytebits_to_byte(dest + 8, (fmtLen-32) ); code2 = bytebits_to_byte(dest + 8 + (fmtLen-32), 32); - Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; default: if (fmtLen > 32 ) { cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16); code1 = bytebits_to_byte(dest+8,fmtLen-32); code2 = bytebits_to_byte(dest+8+(fmtLen-32),32); - Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16); code1 = bytebits_to_byte(dest+8,fmtLen); - Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); } break; } diff --git a/client/cmddata.c b/client/cmddata.c index 6992c6d9..d0c2dfb3 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -1315,9 +1315,9 @@ int CmdFSKdemodAWID(const char *Cmd) // bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // |26 bit| |-117--| |-----142------| // - // 00110010 0 0000011111010000000000000001000100101000100001111 0 00000000 - // bbbbbbbb w ffffffffffffffffccccccccccccccccccccccccccccccccc w xxxxxxxx - // |50 bit| |----4000------||-----------2248975-------------| + // 00110010 0 0000111110100000 00000000000100010010100010000111 1 000000000 + // bbbbbbbb w ffffffffffffffff cccccccccccccccccccccccccccccccc w xxxxxxxxx + // |50 bit| |----4000------| |-----------2248975------------| // b = format bit len, o = odd parity of last 3 bits // f = facility code, c = card number // w = wiegand parity @@ -1332,25 +1332,25 @@ int CmdFSKdemodAWID(const char *Cmd) fc = bytebits_to_byte(BitStream + 9, 8); cardnum = bytebits_to_byte(BitStream + 17, 16); code1 = bytebits_to_byte(BitStream + 8,fmtLen); - PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; case 50: fc = bytebits_to_byte(BitStream + 9, 16); cardnum = bytebits_to_byte(BitStream + 25, 32); code1 = bytebits_to_byte(BitStream + 8, (fmtLen-32) ); code2 = bytebits_to_byte(BitStream + 8 + (fmtLen-32), 32); - PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; default: if (fmtLen > 32 ) { cardnum = bytebits_to_byte(BitStream+8+(fmtLen-17), 16); code1 = bytebits_to_byte(BitStream+8,fmtLen-32); code2 = bytebits_to_byte(BitStream+8+(fmtLen-32),32); - PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(BitStream+8+(fmtLen-17), 16); code1 = bytebits_to_byte(BitStream+8,fmtLen); - PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); } break; } -- 2.39.2