diff -r 5f27403587a8 -r d1d2aa556344 tools/main.cpp --- a/tools/main.cpp Fri Jun 27 07:22:02 2008 +0000 +++ b/tools/main.cpp Fri Jun 27 08:58:04 2008 +0000 @@ -23,6 +23,7 @@ static string command; vector commandArgs; static bool quiet = false; +static bool verbose = false; string dataTypeStr; bool force = false; @@ -33,22 +34,21 @@ cerr << "Usage: ethercat [OPTIONS]" << endl << "Commands:" << endl - << " alias Write alias address(es)." << endl - << " config Show slave configurations." << endl - << " data Output binary domain process data." << endl - << " debug Set the master debug level." << endl - << " domain Show domain information." << endl - << " list (ls) List all slaves (former 'lsec')." << endl - << " master Show master information." << endl - << " pdos List Pdo mapping." << endl - << " sdos List Sdo dictionaries." << endl - << " sdo_download (sd) Write an Sdo entry." << endl - << " sdo_upload (su) Read an Sdo entry." << endl - << " slave Show slave information." << endl - << " sii_read (sr) Output a slave's SII contents." << endl - << " sii_write (sw) Write slave's SII contents." << endl - << " state Request slave states." << endl - << " xml Generate slave information xmls." << endl + << " alias Write alias addresses." << endl + << " config Show bus configuration." << endl + << " data Output binary domain process data." << endl + << " debug Set the master's debug level." << endl + << " domain Show domain information." << endl + << " master Show master information." << endl + << " pdos List Pdo assignment/mapping." << endl + << " sdo_download Write an Sdo entry." << endl + << " sdos List Sdo dictionaries." << endl + << " sdo_upload Read an Sdo entry." << endl + << " sii_read Output a slave's SII contents." << endl + << " sii_write Write slave's SII contents." << endl + << " slaves Show slaves." << endl + << " state Request slave states." << endl + << " xml Generate slave information xmls." << endl << "Global options:" << endl << " --master -m Index of the master to use. Default: " << DEFAULT_MASTER << endl @@ -62,7 +62,8 @@ << endl << " --type -t Forced Sdo data type." << endl << " --force -f Force action." << endl - << " --quiet -q Show less output." << endl + << " --quiet -q Output less information." << endl + << " --verbose -v Output more information." << endl << " --help -h Show this help." << endl; } @@ -74,19 +75,20 @@ char *remainder; static struct option longOptions[] = { - //name, has_arg, flag, val - {"master", required_argument, NULL, 'm'}, - {"slave", required_argument, NULL, 's'}, - {"domain", required_argument, NULL, 'd'}, - {"type", required_argument, NULL, 't'}, - {"force", no_argument, NULL, 'f'}, - {"quiet", no_argument, NULL, 'q'}, - {"help", no_argument, NULL, 'h'}, + //name, has_arg, flag, val + {"master", required_argument, NULL, 'm'}, + {"slave", required_argument, NULL, 's'}, + {"domain", required_argument, NULL, 'd'}, + {"type", required_argument, NULL, 't'}, + {"force", no_argument, NULL, 'f'}, + {"quiet", no_argument, NULL, 'q'}, + {"verbose", no_argument, NULL, 'v'}, + {"help", no_argument, NULL, 'h'}, {} }; do { - c = getopt_long(argc, argv, "m:s:d:t:fqh", longOptions, &optionIndex); + c = getopt_long(argc, argv, "m:s:d:t:fqvh", longOptions, &optionIndex); switch (c) { case 'm': @@ -140,6 +142,12 @@ case 'q': quiet = true; + verbose = false; + break; + + case 'v': + verbose = true; + quiet = false; break; case 'h': @@ -187,8 +195,6 @@ master.setDebug(commandArgs); } else if (command == "domain") { master.showDomains(domainIndex); - } else if (command == "list" || command == "ls") { - master.listSlaves(); } else if (command == "master") { master.showMaster(); } else if (command == "pdos") { @@ -199,8 +205,9 @@ master.sdoDownload(slavePosition, dataTypeStr, commandArgs); } else if (command == "sdo_upload" || command == "su") { master.sdoUpload(slavePosition, dataTypeStr, commandArgs); - } else if (command == "slave") { - master.showSlaves(slavePosition); + } else if (command == "slave" || command == "slaves" + || command == "list" || command == "ls") { + master.showSlaves(slavePosition, verbose); } else if (command == "sii_read" || command == "sr") { master.siiRead(slavePosition); } else if (command == "sii_write" || command == "sw") {