Firmware Updater: Log avrdude arguments

This commit is contained in:
Vojtech Kral 2019-02-22 10:12:38 +01:00
parent ed5598f59f
commit 91ccdb0a4d
4 changed files with 17 additions and 9 deletions

View File

@ -169,22 +169,22 @@
#define LT_OBJDIR ".libs/" #define LT_OBJDIR ".libs/"
/* Name of package */ /* Name of package */
#define PACKAGE "avrdude" #define PACKAGE "avrdude-slic3r"
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "avrdude-dev@nongnu.org" #define PACKAGE_BUGREPORT "https://github.com/prusa3d/Slic3r/issues"
/* Define to the full name of this package. */ /* Define to the full name of this package. */
#define PACKAGE_NAME "avrdude" #define PACKAGE_NAME "avrdude-slic3r"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "avrdude 6.3-20160220" #define PACKAGE_STRING "avrdude 6.3-20160220"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "avrdude" #define PACKAGE_TARNAME "avrdude-slic3r"
/* Define to the home page for this package. */ /* Define to the home page for this package. */
#define PACKAGE_URL "" #define PACKAGE_URL "https://github.com/prusa3d/Slic3r"
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "6.3-20160220" #define PACKAGE_VERSION "6.3-20160220"

View File

@ -96,13 +96,20 @@ void AvrDude::priv::unset_handlers()
int AvrDude::priv::run_one(const std::vector<std::string> &args) { int AvrDude::priv::run_one(const std::vector<std::string> &args) {
std::vector<char*> c_args {{ const_cast<char*>(PACKAGE_NAME) }}; std::vector<char*> c_args {{ const_cast<char*>(PACKAGE) }};
std::string command_line { PACKAGE };
for (const auto &arg : args) { for (const auto &arg : args) {
c_args.push_back(const_cast<char*>(arg.data())); c_args.push_back(const_cast<char*>(arg.data()));
command_line.push_back(' ');
command_line.append(arg);
} }
command_line.push_back('\n');
HandlerGuard guard(*this); HandlerGuard guard(*this);
message_fn(command_line.c_str(), command_line.size());
const auto res = ::avrdude_main(static_cast<int>(c_args.size()), c_args.data(), sys_config.c_str()); const auto res = ::avrdude_main(static_cast<int>(c_args.size()), c_args.data(), sys_config.c_str());
return res; return res;

View File

@ -1082,6 +1082,7 @@ int avrdude_main(int argc, char * argv [], const char *sys_config)
if (rc < 0) { if (rc < 0) {
exitrc = 1; exitrc = 1;
pgm->ppidata = 0; /* clear all bits at exit */ pgm->ppidata = 0; /* clear all bits at exit */
avrdude_message(MSG_INFO, "%s: Could not open port: %s\n", progname, port);
goto main_exit; goto main_exit;
} }
is_open = 1; is_open = 1;

View File

@ -446,7 +446,7 @@ void FirmwareDialog::priv::prepare_common()
"-U", (boost::format("flash:w:0:%1%:i") % hex_file.path.string()).str(), "-U", (boost::format("flash:w:0:%1%:i") % hex_file.path.string()).str(),
}}; }};
BOOST_LOG_TRIVIAL(info) << "Invoking avrdude, arguments: " BOOST_LOG_TRIVIAL(info) << "Preparing arguments avrdude: "
<< std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) { << std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) {
return a + ' ' + b; return a + ' ' + b;
}); });
@ -492,7 +492,7 @@ void FirmwareDialog::priv::prepare_mk3()
"-U", (boost::format("flash:w:1:%1%:i") % hex_file.path.string()).str(), "-U", (boost::format("flash:w:1:%1%:i") % hex_file.path.string()).str(),
}}; }};
BOOST_LOG_TRIVIAL(info) << "Invoking avrdude for external flash flashing, arguments: " BOOST_LOG_TRIVIAL(info) << "Preparing avrdude arguments for external flash flashing: "
<< std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) { << std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) {
return a + ' ' + b; return a + ' ' + b;
}); });
@ -522,7 +522,7 @@ void FirmwareDialog::priv::prepare_mm_control()
"-U", (boost::format("flash:w:0:%1%:i") % hex_file.path.string()).str(), "-U", (boost::format("flash:w:0:%1%:i") % hex_file.path.string()).str(),
}}; }};
BOOST_LOG_TRIVIAL(info) << "Invoking avrdude, arguments: " BOOST_LOG_TRIVIAL(info) << "Preparing avrdude arguments: "
<< std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) { << std::accumulate(std::next(args.begin()), args.end(), args[0], [](std::string a, const std::string &b) {
return a + ' ' + b; return a + ' ' + b;
}); });