]> rtime.felk.cvut.cz Git - sojka/can-utils.git/blobdiff - candump.c
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
[sojka/can-utils.git] / candump.c
index 888c0fb4b731aab962dc82659a00a765d3c86bb6..ac51192354b06d76a91d4b4fcbd08ed5e80f9401 100644 (file)
--- a/candump.c
+++ b/candump.c
@@ -41,7 +41,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
+ * Send feedback to <linux-can@vger.kernel.org>
  *
  */
 
@@ -121,6 +121,7 @@ void print_usage(char *prg)
        fprintf(stderr, "         -n <count>  (terminate after receiption of <count> CAN frames)\n");
        fprintf(stderr, "         -r <size>   (set socket receive buffer to <size>)\n");
        fprintf(stderr, "         -d          (monitor dropped CAN frames)\n");
+       fprintf(stderr, "         -e          (dump CAN error frames in human-readable format)\n");
        fprintf(stderr, "\n");
        fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
        fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
@@ -235,7 +236,7 @@ int main(int argc, char **argv)
        last_tv.tv_sec  = 0;
        last_tv.tv_usec = 0;
 
-       while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldLn:r:h?")) != -1) {
+       while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldLn:r:he?")) != -1) {
                switch (opt) {
                case 't':
                        timestamp = optarg[0];
@@ -263,6 +264,10 @@ int main(int argc, char **argv)
                        view |= CANLIB_VIEW_SWAP;
                        break;
 
+               case 'e':
+                       view |= CANLIB_VIEW_ERROR;
+                       break;
+
                case 's':
                        silent = atoi(optarg);
                        if (silent > SILENT_ON) {
@@ -606,7 +611,7 @@ int main(int argc, char **argv)
                                        return 1;
                                }
 
-                               if (nbytes < sizeof(struct can_frame)) {
+                               if ((size_t)nbytes < sizeof(struct can_frame)) {
                                        fprintf(stderr, "read: incomplete CAN frame\n");
                                        return 1;
                                }
@@ -622,7 +627,7 @@ int main(int argc, char **argv)
                                        if (nbytes < 0) {
                                                perror("bridge write");
                                                return 1;
-                                       } else if (nbytes < sizeof(struct can_frame)) {
+                                       } else if ((size_t)nbytes < sizeof(struct can_frame)) {
                                                fprintf(stderr,"bridge write: incomplete CAN frame\n");
                                                return 1;
                                        }