# HG changeset patch # User Florian Pose # Date 1214560125 0 # Node ID df1c8e4f0577e93d5ffac6e88916e573675a0d94 # Parent 54744527d7c656c1df84228379d42253640ab8ee Alias decimal. diff -r 54744527d7c6 -r df1c8e4f0577 TODO --- a/TODO Fri Jun 27 09:37:53 2008 +0000 +++ b/TODO Fri Jun 27 09:48:45 2008 +0000 @@ -15,8 +15,8 @@ * Adapt remaining examples. * READMEs for examples. * Update documentation. -* Overthink display style of hex numbers. * Add -a and -p switches for 'ethercat config' command. +* Scan Sdo indices with optional '0x'. * Race in jiffies frame timeout. * FoE * Allow master requesting when in ORPHANED phase diff -r 54744527d7c6 -r df1c8e4f0577 tools/Master.cpp --- a/tools/Master.cpp Fri Jun 27 09:37:53 2008 +0000 +++ b/tools/Master.cpp Fri Jun 27 09:48:45 2008 +0000 @@ -142,7 +142,7 @@ } strAlias << commandArgs[0]; - strAlias >> hex >> number; + strAlias >> number; if (strAlias.fail() || number < 0x0000 || number > 0xffff) { err << "Invalid alias '" << commandArgs[0] << "'!"; throw MasterException(err.str()); @@ -153,9 +153,8 @@ unsigned int numSlaves, i; if (!force) { - err << "This will write the alias addresses of all slaves to 0x" - << hex << setfill('0') << setw(4) << alias << "! " - << "Please specify --force to proceed."; + err << "This will write the alias addresses of all slaves to " + << alias << "! Please specify --force to proceed."; throw MasterException(err.str()); } @@ -978,11 +977,11 @@ for (i = 0; i < master.config_count; i++) { getConfig(&config, i); - cout << "Alias: 0x" - << hex << setfill('0') << setw(4) << config.alias << endl - << "Position: " << dec << config.position << endl + cout << "Alias: " + << dec << config.alias << endl + << "Position: " << config.position << endl << "Vendor Id: 0x" - << hex << setw(8) << config.vendor_id << endl + << hex << setfill('0') << setw(8) << config.vendor_id << endl << "Product code: 0x" << hex << setw(8) << config.product_code << endl << "Attached: " << (config.attached ? "yes" : "no") << endl @@ -1306,7 +1305,7 @@ for (i = 0; i < slave.sdo_count; i++) { getSdo(&sdo, slavePosition, i); - cout << "Sdo " + cout << "Sdo 0x" << hex << setfill('0') << setw(4) << sdo.sdo_index << ", \"" << sdo.name << "\"" << endl; @@ -1316,7 +1315,7 @@ for (j = 0; j <= sdo.max_subindex; j++) { getSdoEntry(&entry, slavePosition, -i, j); - cout << " " << hex << setfill('0') + cout << " 0x" << hex << setfill('0') << setw(4) << sdo.sdo_index << ":" << setw(2) << (unsigned int) entry.sdo_entry_subindex << ", "; @@ -1391,8 +1390,8 @@ if (strlen(slave.name)) { slaveInfo.name = slave.name; } else { - str << hex << setfill('0') - << setw(8) << slave.vendor_id << ":" + str << "0x" << hex << setfill('0') + << setw(8) << slave.vendor_id << ":0x" << setw(8) << slave.product_code; slaveInfo.name = str.str(); str.str(""); @@ -1437,7 +1436,7 @@ getSlave(&slave, slavePosition); cout << "Slave " << dec << slavePosition << endl - << "Alias: 0x" << hex << setfill('0') << setw(4) << slave.alias << endl + << "Alias: " << slave.alias << endl << "State: " << slaveState(slave.state) << endl << "Flag: " << (slave.error_flag ? 'E' : '+') << endl << "Identity:" << endl