From 43547be36bb9d940db8c9e6d4fec9f7e698bbf87 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Wed, 23 Jul 2008 16:16:30 +0000 Subject: [PATCH] Added command-line help for every ethercat command. --- TODO | 1 - tool/cmd_alias.cpp | 16 ++++++++-------- tool/cmd_data.cpp | 5 ++++- tool/cmd_debug.cpp | 13 +++++++------ tool/cmd_domain.cpp | 9 ++++++--- tool/cmd_download.cpp | 27 ++++++++++++++++++++++++--- tool/cmd_master.cpp | 5 ++++- tool/cmd_pdos.cpp | 32 ++++++++++++++++++++++++++++++-- tool/cmd_sdos.cpp | 25 +++++++++++++++++++++++-- tool/cmd_sii_read.cpp | 17 +++++++++++++++-- tool/cmd_sii_write.cpp | 18 +++++++++++++++--- tool/cmd_slaves.cpp | 32 ++++++++++++++++++++++++++++++-- tool/cmd_states.cpp | 14 +++++++++++--- tool/cmd_upload.cpp | 24 +++++++++++++++++++++--- tool/cmd_xml.cpp | 13 +++++++++++-- tool/main.cpp | 22 ++++++++++++---------- 16 files changed, 221 insertions(+), 52 deletions(-) diff --git a/TODO b/TODO index 3a14d404..45d53cf2 100644 --- a/TODO +++ b/TODO @@ -14,7 +14,6 @@ Version 1.4.0: * Get original driver for r8169. * Race in jiffies frame timeout? * ethercat tool: - - Add help pages for each command. - Add -a and -p switches for config command. - Show attached slave position. - Show Pdos in 'ethercat slave -v'. diff --git a/tool/cmd_alias.cpp b/tool/cmd_alias.cpp index b6e15bbe..24556bb9 100644 --- a/tool/cmd_alias.cpp +++ b/tool/cmd_alias.cpp @@ -21,16 +21,16 @@ const char *help_alias = "one or for multiple slaves.\n" "\n" "Arguments:\n" - " ALIAS must be a 16 bit unsigned integer, specified\n" - " either in decimal (no prefix), octal (prefix '0')\n" - " or hexadecimal (prefix '0x').\n" + " ALIAS must be an unsigned 16 bit number. Zero means no alias.\n" "\n" "Command-specific options:\n" - " -s <SLAVE> Write the alias of the slave with the given\n" - " ring position. If this option is not\n" - " specified, the alias of all slaves is set.\n" - " The --force option is required in this\n" - " case.\n"; + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default). The --force option is\n" + " required in this case.\n" + " --force Acknowledge writing aliases of all slaves.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /*****************************************************************************/ diff --git a/tool/cmd_data.cpp b/tool/cmd_data.cpp index 64222279..ac241a08 100644 --- a/tool/cmd_data.cpp +++ b/tool/cmd_data.cpp @@ -19,7 +19,10 @@ const char *help_data = "Command-specific options:\n" " --domain -d <index> Positive numerical domain index, or 'all' for\n" " all domains (default). In this case, data of all\n" - " domains are concatenated.\n"; + " domains are concatenated.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_debug.cpp b/tool/cmd_debug.cpp index 528d2f61..e866e7d2 100644 --- a/tool/cmd_debug.cpp +++ b/tool/cmd_debug.cpp @@ -20,12 +20,13 @@ const char *help_debug = "Debug messages are printed to syslog.\n" "\n" "Arguments:\n" - " LEVEL must be an unsigned integer, specified\n" - " either in decimal (no prefix), octal (prefix '0')\n" - " or hexadecimal (prefix '0x').\n" - " 0 stands for no debugging output,\n" - " 1 means some debug messages, and\n" - " 2 outputs all frame data (use with caution!).\n"; + " LEVEL can have one of the following values:\n" + " 0 for no debugging output,\n" + " 1 for some debug messages, or\n" + " 2 for printing all frame contents (use with caution!).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_domain.cpp b/tool/cmd_domain.cpp index ac80fe6d..c3c2010d 100644 --- a/tool/cmd_domain.cpp +++ b/tool/cmd_domain.cpp @@ -17,7 +17,7 @@ const char *help_domains = "\n" "Show information about the application's configured domains.\n" "\n" - "Without the --verbose option, one domain is displayed per line.\n" + "Without the --verbose option, the domains are displayed one-per-line.\n" "Example:\n" "\n" "Domain0: LogBaseAddr 0x00000000, Size 6, WorkingCounter 0/1\n" @@ -36,12 +36,15 @@ const char *help_domains = " SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 6\n" " 00 00 00 00 00 00\n" "\n" - "The process data are displayed as raw hexadecimal bytes.\n" + "The process data are displayed as hexadecimal bytes.\n" "\n" "Command-specific options:\n" " --domain -d <index> Positive numerical domain index, or 'all'\n" " for all domains (default).\n" - " --verbose -v Show FMMUs and process data additionally.\n"; + " --verbose -v Show FMMUs and process data additionally.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_download.cpp b/tool/cmd_download.cpp index f56b7c15..de6c3c7b 100644 --- a/tool/cmd_download.cpp +++ b/tool/cmd_download.cpp @@ -13,12 +13,33 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_download = - "[OPTIONS]\n" + "[OPTIONS] <INDEX> <SUBINDEX> <VALUE>\n" "\n" + "Download an Sdo entry to a slave.\n" "\n" - "Command-specific options:\n"; + "The data type of the Sdo entry is taken from the Sdo dictionary by\n" + "default. It can be overridden with the --type option. If the slave\n" + "does not support the Sdo information service or the Sdo is not in the\n" + "dictionary, the --type option is mandatory.\n" + "\n" + "These are the valid Sdo entry data types:\n" + " int8, int16, int32, uint8, uint16, uint32, string.\n" + "\n" + "Arguments:\n" + " INDEX is the Sdo index and must be an unsigned 16 bit number.\n" + " SUBINDEX is the Sdo entry subindex and must be an unsigned 8 bit\n" + " number.\n" + " VALUE is the value to download and must correspond to the Sdo\n" + " entry datatype (see above).\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position (mandatory).\n" + " --type -t <type> Forced Sdo entry data type (see above).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; + /****************************************************************************/ diff --git a/tool/cmd_master.cpp b/tool/cmd_master.cpp index dc3dbad3..37f46d57 100644 --- a/tool/cmd_master.cpp +++ b/tool/cmd_master.cpp @@ -18,7 +18,10 @@ const char *help_master = "Show master and Ethernet device information.\n" "\n" "Command-specific options:\n" - " --master -m <master> Index of the master to use. Default: 0\n"; + " --master -m <index> Index of the master to use. Default: 0.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_pdos.cpp b/tool/cmd_pdos.cpp index a64e27e2..33f2ed11 100644 --- a/tool/cmd_pdos.cpp +++ b/tool/cmd_pdos.cpp @@ -12,12 +12,40 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_pdos = "[OPTIONS]\n" "\n" + "Displays sync managers, assigned Pdos and mapped Pdo entries.\n" "\n" - "Command-specific options:\n"; + "The information is displayed in three layers, which are indented\n" + "accordingly:\n" + "\n" + "1) Sync managers - Contains the sync manager information from the\n" + " SII: Index, physical start address, default size (raw value from\n" + " the SII), control register and enable word. Example:\n" + "\n" + " SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, Enable 1\n" + "\n" + "2) Assigned Pdos - Pdo direction, hexadecimal index and -if available-\n" + " the Pdo name. Example:\n" + "\n" + " TxPdo 0x1a00 \"Channel1\"\n" + "\n" + "3) Mapped Pdo entries - Pdo entry index and subindex (both\n" + " hexadecimal), the length in bit and -if available- the\n" + " description. Example:\n" + "\n" + " Pdo entry 0x3101:01, 8 bit, \"Status\"\n" + "\n" + "Note, that the displayed Pdo assignment and Pdo mapping information\n" + "can either originate from the SII or from the CoE communication area.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_sdos.cpp b/tool/cmd_sdos.cpp index 8d7d0bc3..6341d398 100644 --- a/tool/cmd_sdos.cpp +++ b/tool/cmd_sdos.cpp @@ -13,12 +13,33 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_sdos = "[OPTIONS]\n" "\n" + "Displays the Sdo dictionary with Sdos and Sdo entries.\n" "\n" - "Command-specific options:\n"; + "Sdo dictionary information is displayed in two layers, with are\n" + "indented accordingly:\n" + "\n" + "1) Sdos - Hexadecimal Sdo index and the name. Example:\n" + "\n" + " Sdo 0x1018, \"Identity object\"\n" + "\n" + "2) Sdo entries - Sdo index and Sdo entry subindex (both hexadecimal)\n" + " followed by the data type, the length in bit, and the description.\n" + " Example:\n" + "\n" + " 0x1018:01, uint32, 32 bit, \"Vendor id\"\n" + "\n" + "If the --quiet option is given, only the Sdos are printed.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default).\n" + " --quiet -q Print only Sdos (without Sdo entries).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_sii_read.cpp b/tool/cmd_sii_read.cpp index 0a59eeac..cac53b92 100644 --- a/tool/cmd_sii_read.cpp +++ b/tool/cmd_sii_read.cpp @@ -12,12 +12,25 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_sii_read = "[OPTIONS]\n" "\n" + "Outputs the SII (EEPROM) contents of a slave.\n" "\n" - "Command-specific options:\n"; + "Without the --verbose option, binary SII contents are output. They can\n" + "be piped to a tool like hexdump, for example:\n" + "\n" + " ethercat sii_read -s2 | hexdump -C\n" + "\n" + "With the --verbose option given, a textual representation of the data\n" + "is output, that is separated by SII category names.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position (mandatory).\n" + " --verbose -v Output textual data with category names.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_sii_write.cpp b/tool/cmd_sii_write.cpp index e64c9025..b4ae6f52 100644 --- a/tool/cmd_sii_write.cpp +++ b/tool/cmd_sii_write.cpp @@ -14,12 +14,24 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_sii_write = - "[OPTIONS]\n" + "[OPTIONS] <FILENAME>\n" "\n" + "Writes SII contents from a local file to a slave.\n" "\n" - "Command-specific options:\n"; + "The file contents are checked for validity and integrity. These checks\n" + "can be overridden with the --force option.\n" + "\n" + "Arguments:\n" + " FILENAME must be a path to a file that contains a positive number\n" + " of words.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position (mandatory).\n" + " --force Override validity checks.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_slaves.cpp b/tool/cmd_slaves.cpp index b9a0c4f7..addeff2e 100644 --- a/tool/cmd_slaves.cpp +++ b/tool/cmd_slaves.cpp @@ -13,12 +13,40 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_slaves = "[OPTIONS]\n" "\n" + "Display slaves on the bus.\n" "\n" - "Command-specific options:\n"; + "If the --verbose option is not given, the slaves are displayed\n" + "one-per-line. Example:\n" + "\n" + "1 5555:0 PREOP + EL3162 2C. Ana. Input 0-10V\n" + "| | | | | |\n" + "| | | | | \\- Name from SII if avaliable, otherwise\n" + "| | | | | hexadecimal vendor ID and product code\n" + "| | | | | separated by a colon.\n" + "| | | | \\- Error flag. '+' means no error, 'E' means,\n" + "| | | | that scanning or configuration failed.\n" + "| | | \\- Current slave state.\n" + "| | \\- Relative position (decimal) after the last slave with an\n" + "| | alias address set.\n" + "| \\- Alias address of the slave (if set to non-zero), or the alias\n" + "| of the last slave with an alias set, or zero if there is none.\n" + "\\- Ring position (use this with any --slave option).\n" + "\n" + "If the --verbose option is given, a detailed (multi-line) description\n" + "is output for each slave.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default).\n" + " --verbose -v Show detailed slave information.\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; + +/****************************************************************************/ void listSlaves(int); void showSlave(uint16_t); diff --git a/tool/cmd_states.cpp b/tool/cmd_states.cpp index adc52eba..b572a911 100644 --- a/tool/cmd_states.cpp +++ b/tool/cmd_states.cpp @@ -11,12 +11,20 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_states = - "[OPTIONS]\n" + "[OPTIONS] <STATE>\n" "\n" + "Request an application-layer state change for the specified slaves.\n" "\n" - "Command-specific options:\n"; + "Arguments:\n" + " STATE can be 'INIT', 'PREOP', 'SAFEOP', or 'OP'\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_upload.cpp b/tool/cmd_upload.cpp index e9421d32..2b6fed1c 100644 --- a/tool/cmd_upload.cpp +++ b/tool/cmd_upload.cpp @@ -13,12 +13,30 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_upload = - "[OPTIONS]\n" + "[OPTIONS] <INDEX> <SUBINDEX>\n" "\n" + "Upload an Sdo entry from a slave.\n" "\n" - "Command-specific options:\n"; + "The data type of the Sdo entry is taken from the Sdo dictionary by\n" + "default. It can be overridden with the --type option. If the slave\n" + "does not support the Sdo information service or the Sdo is not in the\n" + "dictionary, the --type option is mandatory.\n" + "\n" + "These are the valid Sdo entry data types:\n" + " int8, int16, int32, uint8, uint16, uint32, string.\n" + "\n" + "Arguments:\n" + " INDEX is the Sdo index and must be an unsigned 16 bit number.\n" + " SUBINDEX is the Sdo entry subindex and must be an unsigned 8 bit\n" + " number.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position (mandatory).\n" + " --type -t <type> Forced Sdo entry data type (see above).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/cmd_xml.cpp b/tool/cmd_xml.cpp index 8c3e841b..3578c730 100644 --- a/tool/cmd_xml.cpp +++ b/tool/cmd_xml.cpp @@ -12,12 +12,21 @@ using namespace std; /****************************************************************************/ -// FIXME const char *help_xml = "[OPTIONS]\n" "\n" + "Generate slave description XMLs from the master's slave information.\n" "\n" - "Command-specific options:\n"; + "Note that the Pdo information can either originate from the SII or\n" + "from the CoE communication area. For some slaves, this is dependant on\n" + "the last slave configuration.\n" + "\n" + "Command-specific options:\n" + " --slave -s <index> Positive numerical ring position, or 'all' for\n" + " all slaves (default).\n" + "\n" + "Numerical values can be specified either with decimal (no prefix),\n" + "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; /****************************************************************************/ diff --git a/tool/main.cpp b/tool/main.cpp index dd5f2e0c..1b5e297d 100644 --- a/tool/main.cpp +++ b/tool/main.cpp @@ -103,8 +103,9 @@ void printUsage() } cerr - << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS]" << endl - << "Commands:" << endl; + << "Usage: " << binaryBaseName << " <COMMAND> [OPTIONS] [ARGUMENTS]" + << endl << endl + << "Commands (can be abbreviated):" << endl; cerr << left; for (cmd = commands; cmd < cmdEnd; cmd++) { @@ -113,21 +114,22 @@ void printUsage() } cerr - << "Commands can be abbreviated." << endl + << endl << "Global options:" << endl - << " --master -m <master> Index of the master to use. Default: 0" + << " --master -m <master> Index of the master to use. Default: 0." << endl - << " --slave -s <index> Positive numerical ring position," - << endl - << " or 'all' for all slaves (default)." - << endl - << " --type -t <type> Forced Sdo data type." << endl - << " --force -f Force action." << endl + << " --force -f Force a command." << endl << " --quiet -q Output less information." << endl << " --verbose -v Output more information." << endl << " --help -h Show this help." << endl + << endl + << "Numerical values can be specified either with decimal " + << "(no prefix)," << endl + << "octal (prefix '0') or hexadecimal (prefix '0x') base." << endl + << endl << "Call '" << binaryBaseName << " <COMMAND> --help' for command-specific help." << endl + << endl << "Send bug reports to " << PACKAGE_BUGREPORT << "." << endl; } -- GitLab