summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2005-08-25 15:59:21 +0000
committerSascha Hauer <s.hauer@pengutronix.de>2005-08-25 15:59:21 +0000
commit20f68a38328803a14f3086fb28f2096d31ebdc7b (patch)
tree9b456486365cf53331c63f48c17e7dc2ebc5a8e3
parentb837431cb0e6e88355d89b691f2ff65fc9f27514 (diff)
downloadcanutils-20f68a38328803a14f3086fb28f2096d31ebdc7b.tar.gz
added twice verbose option
git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-1.0-trunk@41 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c
-rw-r--r--cansequence.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cansequence.c b/cansequence.c
index 16a81b5..5911594 100644
--- a/cansequence.c
+++ b/cansequence.c
@@ -41,7 +41,7 @@ void print_usage(char *prg)
" -r, --receive work as receiver\n"
" -l --loop=COUNT send COUNT messages\n"
" -q --quit quit if a wrong sequence is encountered\n"
- " -v, --verbose be verbose\n"
+ " -v, --verbose be verbose (twice to be even more verbose\n"
" -h --help this help\n"
" --version print version information and exit\n",
prg, PF_CAN, SOCK_RAW, CAN_PROTO_RAW);
@@ -114,7 +114,7 @@ int main(int argc, char **argv)
break;
case 'v':
- verbose = 1;
+ verbose++;
break;
case VERSION_OPTION:
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
sequence_init = 0;
sequence = frame.payload.data[0];
}
- if(verbose)
+ if(verbose>1)
printf("received frame. sequence number: %d\n",sequence);
if( frame.payload.data[0] != sequence) {
printf("received wrong sequence count. expected: %d, got: %d\n",
@@ -169,6 +169,8 @@ int main(int argc, char **argv)
exit(1);
sequence = frame.payload.data[0];
}
+ if(verbose && !sequence)
+ printf("sequence wrap around\n");
sequence++;
}
}
@@ -177,16 +179,16 @@ int main(int argc, char **argv)
frame.can_id = 2;
frame.payload.data[0] = 0;
while ((infinite || loopcount--) && running) {
- if(verbose)
+ if(verbose>1)
printf("sending frame. sequence number: %d\n",sequence);
+ if(verbose && !sequence)
+ printf("sequence wrap around\n");
if( write(s, &frame, sizeof(frame)) < 0) {
perror("write");
break;
}
(unsigned char)frame.payload.data[0]++;
sequence++;
-// printf("%d %d\n",sequence,(unsigned char)frame.payload.data[0]);
-// usleep(10000);
}
}
return 0;