]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - rpp-test-sw/commands/cmd_can.c
candump: Ensure than controller ID is not out of range
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_can.c
index fd2f342d05b6592f249a016673a758ddb8391b2b..f98422b50822027b9b7bdcd8430435b356ae7fab 100644 (file)
@@ -737,6 +737,11 @@ int cmd_do_can_dump(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                return 1;
        }
 
+       if (controller_id < 1 || controller_id > 3) {
+               rpp_sci_printf("Invalid controller ID\n");
+               return -CMDERR_NODEV;
+       }
+
        rpp_can_init(&can_config);
 
        while (cmd_io->getc(cmd_io) < 0) {
@@ -987,12 +992,12 @@ cmd_des_t const cmd_des_can_dump = {
        "IDs are zero-filled to length 3 if a message in the standard frame\n"
        "format is received and to 8 for extended frame format messages.\n"
        "\n"
-       "caninit must be called before using this command.\n"
+       "`caninit` must be called before using this command.\n"
        "\n"
        "### Example ###\n"
        "\n"
        "    --> candump 2\n"
-       "can2  0000FADE  [2]  12 34\n",
+       "    can2  0000FADE  [2]  12 34\n",
        CMD_HANDLER(cmd_do_can_dump), (void *)&cmd_list_can
 };
 
@@ -1071,11 +1076,16 @@ cmd_des_t const cmd_des_can_test={
     "    appropriate error code is printed.\n"
     "\n"
     "At the end the CAN bus is reset and left with the configuration from\n"
-    "test 1. Any previous configuration is canceled, but is not deleted, so\n"
-    "any following call of `caninit` command will restore the CAN bus to\n"
-    "previous configuration.\n"
+    "test 1.\n"
+    "\n"
+    "The command can be called even after the CAN bus has been already\n"
+    "configured by previous invocation of the `caninit` command. The\n"
+    "previous timing configuration set by `cantiming#` command not\n"
+    "modified. Therefore, calling `caninit` after this command finishes\n"
+    "restores the previous timing settings.\n"
     "\n"
-    "For error codes description refer please the API documentation for the rpp-test-sw.\n"
+    "For error codes description please refer to the API documentation for\n"
+    "the rpp-test-sw.\n"
     "\n"
     "### Example ###\n"
     "\n"