X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/3d4207f3b673c479e572b960d5a307b1f73a912d..32da0a464e03b39f894ecfe04cee0da114ff0c9a:/client/cmdhw.c diff --git a/client/cmdhw.c b/client/cmdhw.c index b561c7d4..24b4bada 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -26,7 +26,8 @@ static int CmdHelp(const char *Cmd); static void lookupChipID(uint32_t iChipID, uint32_t mem_used) { - char asBuff[100]; + char asBuff[120]; + memset(asBuff, 0, sizeof(asBuff)); uint32_t mem_avail = 0; switch(iChipID) @@ -136,12 +137,17 @@ static void lookupChipID(uint32_t iChipID, uint32_t mem_used) mem_avail = 2048; break; } - PrintAndLog("Nonvolatile Program Memory Size: %dK bytes. Used: %d bytes (%2.0f\%). Free: %d bytes (%2.0f\%).", + + uint32_t mem_left = 0; + if ( mem_avail > 0 ) + mem_left = (mem_avail * 1024) - mem_used; + + PrintAndLog("Nonvolatile Program Memory Size: %uK bytes. Used: %u bytes (%2.0f\%). Free: %u bytes (%2.0f\%).", mem_avail, mem_used, - mem_avail == 0 ? 0 : (float)mem_used/(mem_avail*1024)*100, - mem_avail*1024 - mem_used, - mem_avail == 0 ? 0 : (float)(mem_avail*1024-mem_used)/(mem_avail*1024)*100 + mem_avail == 0 ? 0.0f : (float)mem_used/(mem_avail*1024)*100, + mem_left, + mem_avail == 0 ? 0.0f : (float)mem_left/(mem_avail*1024)*100 ); switch((iChipID&0xF000)>>12) { @@ -443,7 +449,6 @@ int CmdStatus(const char *Cmd) return 0; } - int CmdPing(const char *Cmd) { clearCommandBuffer();