summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-03 11:08:18 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-11-04 23:32:52 +0100
commit4d2ce949b3b41f8bf0af446fa20205ddd229e579 (patch)
tree01fa19471d9831b296bea5d7049f765e38b30bbb /rbutil/rbutilqt/base/bootloaderinstallimx.cpp
parent335ec75d60bba82f23fc47b20f9390e0cba9c9c5 (diff)
downloadrockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.tar.gz
rockbox-4d2ce949b3b41f8bf0af446fa20205ddd229e579.zip
Use cutelogger for Rockbox Utility internal trace.
Change tracing from qDebug() to use cutelogger, which is available under the LGPL2.1. This allows to automatically add filename and line number to the log, and also provides multiple log levels. Change-Id: I5dbdaf902ba54ea99f07ae10a07467c52fdac910
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallimx.cpp')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallimx.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallimx.cpp b/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
index e12849e856..74c6f94f78 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallimx.cpp
@@ -21,6 +21,7 @@
21#include "bootloaderinstallbase.h" 21#include "bootloaderinstallbase.h"
22#include "bootloaderinstallimx.h" 22#include "bootloaderinstallimx.h"
23#include "../mkimxboot/mkimxboot.h" 23#include "../mkimxboot/mkimxboot.h"
24#include "Logger.h"
24 25
25// class for running mkimxboot() in a separate thread to keep the UI responsive. 26// class for running mkimxboot() in a separate thread to keep the UI responsive.
26class BootloaderThreadImx : public QThread 27class BootloaderThreadImx : public QThread
@@ -45,7 +46,7 @@ class BootloaderThreadImx : public QThread
45 46
46void BootloaderThreadImx::run(void) 47void BootloaderThreadImx::run(void)
47{ 48{
48 qDebug() << "[BootloaderThreadImx] Thread started."; 49 LOG_INFO() << "Thread started.";
49 struct imx_option_t opt; 50 struct imx_option_t opt;
50 memset(&opt, 0, sizeof(opt)); 51 memset(&opt, 0, sizeof(opt));
51 opt.debug = false; 52 opt.debug = false;
@@ -55,7 +56,7 @@ void BootloaderThreadImx::run(void)
55 m_error = mkimxboot(m_inputfile.toLocal8Bit().constData(), 56 m_error = mkimxboot(m_inputfile.toLocal8Bit().constData(),
56 m_bootfile.toLocal8Bit().constData(), 57 m_bootfile.toLocal8Bit().constData(),
57 m_outputfile.toLocal8Bit().constData(), opt); 58 m_outputfile.toLocal8Bit().constData(), opt);
58 qDebug() << "[BootloaderThreadImx] Thread finished, result:" << m_error; 59 LOG_INFO() << "Thread finished, result:" << m_error;
59} 60}
60 61
61 62
@@ -88,13 +89,13 @@ bool BootloaderInstallImx::install(void)
88{ 89{
89 if(!QFileInfo(m_offile).isReadable()) 90 if(!QFileInfo(m_offile).isReadable())
90 { 91 {
91 qDebug() << "[BootloaderInstallImx] could not read original firmware file" 92 LOG_ERROR() << "could not read original firmware file"
92 << m_offile; 93 << m_offile;
93 emit logItem(tr("Could not read original firmware file"), LOGERROR); 94 emit logItem(tr("Could not read original firmware file"), LOGERROR);
94 return false; 95 return false;
95 } 96 }
96 97
97 qDebug() << "[BootloaderInstallImx] downloading bootloader"; 98 LOG_INFO() << "downloading bootloader";
98 // download bootloader from server 99 // download bootloader from server
99 emit logItem(tr("Downloading bootloader file"), LOGINFO); 100 emit logItem(tr("Downloading bootloader file"), LOGINFO);
100 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); 101 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
@@ -105,7 +106,7 @@ bool BootloaderInstallImx::install(void)
105 106
106void BootloaderInstallImx::installStage2(void) 107void BootloaderInstallImx::installStage2(void)
107{ 108{
108 qDebug() << "[BootloaderInstallImx] patching file..."; 109 LOG_INFO() << "patching file...";
109 emit logItem(tr("Patching file..."), LOGINFO); 110 emit logItem(tr("Patching file..."), LOGINFO);
110 m_tempfile.open(); 111 m_tempfile.open();
111 112
@@ -132,26 +133,26 @@ void BootloaderInstallImx::installStage3(void)
132 // if the patch failed 133 // if the patch failed
133 if (err != IMX_SUCCESS) 134 if (err != IMX_SUCCESS)
134 { 135 {
135 qDebug() << "[BootloaderInstallImx] Could not patch the original firmware file"; 136 LOG_ERROR() << "Could not patch the original firmware file";
136 emit logItem(tr("Patching the original firmware failed"), LOGERROR); 137 emit logItem(tr("Patching the original firmware failed"), LOGERROR);
137 emit done(true); 138 emit done(true);
138 return; 139 return;
139 } 140 }
140 141
141 qDebug() << "[BootloaderInstallImx] Original Firmware succesfully patched"; 142 LOG_INFO() << "Original Firmware succesfully patched";
142 emit logItem(tr("Succesfully patched firmware file"), LOGINFO); 143 emit logItem(tr("Succesfully patched firmware file"), LOGINFO);
143 144
144 // if a bootloader is already present delete it. 145 // if a bootloader is already present delete it.
145 QString fwfile(m_blfile); 146 QString fwfile(m_blfile);
146 if(QFileInfo(fwfile).isFile()) 147 if(QFileInfo(fwfile).isFile())
147 { 148 {
148 qDebug() << "[BootloaderInstallImx] deleting old target file"; 149 LOG_INFO() << "deleting old target file";
149 QFile::remove(fwfile); 150 QFile::remove(fwfile);
150 } 151 }
151 152
152 // place (new) bootloader. Copy, since the temporary file will be removed 153 // place (new) bootloader. Copy, since the temporary file will be removed
153 // automatically. 154 // automatically.
154 qDebug() << "[BootloaderInstallImx] moving patched bootloader to" << fwfile; 155 LOG_INFO() << "moving patched bootloader to" << fwfile;
155 if(m_patchedFile.copy(fwfile)) 156 if(m_patchedFile.copy(fwfile))
156 { 157 {
157 emit logItem(tr("Bootloader successful installed"), LOGOK); 158 emit logItem(tr("Bootloader successful installed"), LOGOK);