From fbcfc81ce561954fc26c9e78c2a6d64e2798da8d Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 28 Sep 2009 14:09:16 +0000 Subject: [PATCH] status-bit warnings --- libtrbnet/trbcmd.c | 102 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/libtrbnet/trbcmd.c b/libtrbnet/trbcmd.c index f2adca4..a7488d2 100644 --- a/libtrbnet/trbcmd.c +++ b/libtrbnet/trbcmd.c @@ -16,7 +16,7 @@ static int hexMode = HEXMODE; -static const char trbcmd_version[] = "$Revision: 2.25 $"; +static const char trbcmd_version[] = "$Revision: 2.26 $"; /* ------ MAIN ---------------------------------------------------------- */ @@ -237,6 +237,16 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "r", CMD_SIZE) == 0) { /*******************************************/ @@ -282,6 +292,16 @@ int main(int argc, char ** argv) fprintf(stdout, "0x%04x 0x%08x\n", data[i], data[i + 1]); } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "rm", CMD_SIZE) == 0) { /*******************************************/ @@ -350,6 +370,15 @@ int main(int argc, char ** argv) } } + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + if (data != NULL) free(data); } else if (strncmp(cmd[0], "wm", CMD_SIZE) == 0) { @@ -429,6 +458,16 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "i", CMD_SIZE) == 0) { /*******************************************/ @@ -475,6 +514,16 @@ int main(int argc, char ** argv) uidBuffer[i + 1], uidBuffer[i + 2]); } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "s", CMD_SIZE) == 0) { /*******************************************/ @@ -517,6 +566,16 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "T", CMD_SIZE) == 0) { /*******************************************/ @@ -561,7 +620,17 @@ int main(int argc, char ** argv) if (trb_errno != TRB_ENDPOINT_NOT_REACHED) { exit(EXIT_FAILURE); } - } + } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "TR", CMD_SIZE) == 0) { /*********************************************/ @@ -610,6 +679,16 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "I", CMD_SIZE) == 0) { /*******************************************/ @@ -662,6 +741,16 @@ int main(int argc, char ** argv) for (i = 0; i < status; i++) { fprintf(stdout, "0x%08x\n", buffer[i]); } + + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "f", CMD_SIZE) == 0) { /*******************************************/ @@ -692,6 +781,15 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } + /* Check Status-Bits */ + if ((trb_term.status_common != 0x01) || + (trb_term.status_channel != 0)) { + if (scriptFile != NULL) { + fprintf(stderr, "Line #%d: ", lineCtr); + } + fprintf(stderr, "WARNING Status-Bits:\n%s\n", trb_strterm(trb_term)); + } + } else if (strncmp(cmd[0], "R", CMD_SIZE) == 0) { /*******************************************/ -- 2.43.0