From 7ed10a6da8346e701a7fdb3700193cf05f5f1641 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 15 Mar 2012 14:26:53 +0000 Subject: improve error messaging --- src/sp12.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/sp12.c b/src/sp12.c index c0c9139..ef4fd97 100644 --- a/src/sp12.c +++ b/src/sp12.c @@ -664,10 +664,9 @@ void processCommand(void) { rFlag = writeFuses(WRITE_LOCK_HM, WRITE_LOCK_LM, lockBits, \ W_LOCKLSB, W_LOCKLEN); if (rFlag == 9) { - fprintf(stderr, "For the %s: Write_lock not defined in _sp12dev.\n", - device.name); + fprintf(stderr, "For the %s: Write_lock not defined in _sp12dev.\n", device.name); } else if (rFlag == 2) { - fprintf(stderr, "For the %s: Wrong number of lock bits.\n", device.name); + fprintf(stderr, "For the %s: Wrong number of lock bits, expect %d.\n", device.name, W_LOCKLEN); } else { for (idx = 0; idx < R_LOCKLEN - W_LOCKLEN; idx++) printf(" "); @@ -680,10 +679,9 @@ void processCommand(void) { rFlag = writeFuses(WRITE_FUSES_HM, WRITE_FUSES_LM, fusesBits, \ W_FUSESLSB, W_FUSESLEN); if (rFlag == 9) { - fprintf(stderr, "For the %s: Write_fuses not defined in _sp12dev.\n", - device.name); + fprintf(stderr, "For the %s: Write_fuses not defined in _sp12dev.\n", device.name); } else if (rFlag == 2) { - fprintf(stderr, "For the %s; Wrong number of fuse bits.\n", device.name); + fprintf(stderr, "For the %s; Wrong number of fuse bits, expect %d.\n", device.name, W_FUSESLEN); } else { for (idx = 0; idx < (R_FUSESLEN - W_FUSESLEN) - W_FUSESLSB; idx++) printf(" "); @@ -696,11 +694,9 @@ void processCommand(void) { rFlag = writeFuses(WRITE_HIGH_FUSES_HM, WRITE_HIGH_FUSES_LM, fusesBits, \ WH_FUSESLSB, WH_FUSESLEN); if (rFlag == 9) { - fprintf(stderr, "For the %s: Write_high_fuses not defined in _sp12dev.\n", - device.name); + fprintf(stderr, "For the %s: Write_high_fuses not defined in _sp12dev.\n", device.name); } else if (rFlag == 2) { - fprintf(stderr, "For the %s; Wrong number of high fuse bits.\n", - device.name); + fprintf(stderr, "For the %s; Wrong number of high fuse bits, expect %d.\n", device.name, WH_FUSESLEN); } else { for (idx = 0; idx < (RH_FUSESLEN - WH_FUSESLEN) - WH_FUSESLSB; idx++) printf(" "); @@ -713,11 +709,9 @@ void processCommand(void) { rFlag = writeFuses(WRITE_EXTD_FUSES_HM, WRITE_EXTD_FUSES_LM, fusesBits, \ WX_FUSESLSB, WX_FUSESLEN); if (rFlag == 9) { - fprintf(stderr, "For the %s: Write_extd_fuses not defined in _sp12dev.\n", - device.name); + fprintf(stderr, "For the %s: Write_extd_fuses not defined in _sp12dev.\n", device.name); } else if (rFlag == 2) { - fprintf(stderr, "For the %s; Wrong number of high fuse bits.\n", - device.name); + fprintf(stderr, "For the %s; Wrong number of extended fuse bits, expect %d.\n", device.name, WX_FUSESLEN); } else { for (idx = 0; idx < (RX_FUSESLEN - WX_FUSESLEN) - WX_FUSESLSB; idx++) printf(" "); -- cgit v1.2.3