summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallams.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallams.cpp b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
index 132578bee7..051093eccc 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallams.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
@@ -40,6 +40,8 @@ QString BootloaderInstallAms::ofHint()
40 "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and " 40 "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and "
41 "the <a href='http://www.rockbox.org/wiki/SansaAMS'>SansaAMS</a> " 41 "the <a href='http://www.rockbox.org/wiki/SansaAMS'>SansaAMS</a> "
42 "wiki page on how to obtain this file.<br/>" 42 "wiki page on how to obtain this file.<br/>"
43 "<b>Note:</b> This file is not present on your player and will "
44 "disappear automatically after installing it.<br/><br/>"
43 "Press Ok to continue and browse your computer for the firmware " 45 "Press Ok to continue and browse your computer for the firmware "
44 "file."); 46 "file.");
45} 47}
@@ -48,22 +50,22 @@ bool BootloaderInstallAms::install(void)
48{ 50{
49 if(m_offile.isEmpty()) 51 if(m_offile.isEmpty())
50 return false; 52 return false;
51 53
52 qDebug() << "[BootloaderInstallAms] installing bootloader"; 54 qDebug() << "[BootloaderInstallAms] installing bootloader";
53 55
54 // download firmware from server 56 // download firmware from server
55 emit logItem(tr("Downloading bootloader file"), LOGINFO); 57 emit logItem(tr("Downloading bootloader file"), LOGINFO);
56 58
57 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); 59 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
58 downloadBlStart(m_blurl); 60 downloadBlStart(m_blurl);
59 61
60 return true; 62 return true;
61} 63}
62 64
63void BootloaderInstallAms::installStage2(void) 65void BootloaderInstallAms::installStage2(void)
64{ 66{
65 qDebug() << "[BootloaderInstallAms] installStage2"; 67 qDebug() << "[BootloaderInstallAms] installStage2";
66 68
67 unsigned char* buf; 69 unsigned char* buf;
68 unsigned char* of_packed; 70 unsigned char* of_packed;
69 int of_packedsize; 71 int of_packedsize;
@@ -79,9 +81,9 @@ void BootloaderInstallAms::installStage2(void)
79 int patchable; 81 int patchable;
80 int totalsize; 82 int totalsize;
81 char errstr[200]; 83 char errstr[200];
82 84
83 sum.md5 = md5sum; 85 sum.md5 = md5sum;
84 86
85 m_tempfile.open(); 87 m_tempfile.open();
86 QString bootfile = m_tempfile.fileName(); 88 QString bootfile = m_tempfile.fileName();
87 m_tempfile.close(); 89 m_tempfile.close();
@@ -91,14 +93,14 @@ void BootloaderInstallAms::installStage2(void)
91 &bootloader_size,&rb_packedsize, 93 &bootloader_size,&rb_packedsize,
92 errstr,sizeof(errstr)); 94 errstr,sizeof(errstr));
93 if (rb_packed == NULL) 95 if (rb_packed == NULL)
94 { 96 {
95 qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile; 97 qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile;
96 emit logItem(errstr, LOGERROR); 98 emit logItem(errstr, LOGERROR);
97 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); 99 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
98 emit done(true); 100 emit done(true);
99 return; 101 return;
100 } 102 }
101 103
102 /* Load original firmware file */ 104 /* Load original firmware file */
103 buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum, 105 buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum,
104 &firmware_size, &of_packed ,&of_packedsize, 106 &firmware_size, &of_packed ,&of_packedsize,
@@ -129,16 +131,16 @@ void BootloaderInstallAms::installStage2(void)
129 emit done(true); 131 emit done(true);
130 return; 132 return;
131 } 133 }
132 134
133 /* patch the firmware */ 135 /* patch the firmware */
134 emit logItem(tr("Patching Firmware..."), LOGINFO); 136 emit logItem(tr("Patching Firmware..."), LOGINFO);
135 137
136 patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf, 138 patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf,
137 len,of_packed,of_packedsize,rb_packed,rb_packedsize); 139 len,of_packed,of_packedsize,rb_packed,rb_packedsize);
138 140
139 /* write out file */ 141 /* write out file */
140 QFile out(m_blfile); 142 QFile out(m_blfile);
141 143
142 if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) 144 if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate))
143 { 145 {
144 qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing"; 146 qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing";
@@ -149,7 +151,7 @@ void BootloaderInstallAms::installStage2(void)
149 emit done(true); 151 emit done(true);
150 return; 152 return;
151 } 153 }
152 154
153 n = out.write((char*)buf, len); 155 n = out.write((char*)buf, len);
154 156
155 if (n != len) 157 if (n != len)
@@ -164,11 +166,11 @@ void BootloaderInstallAms::installStage2(void)
164 } 166 }
165 167
166 out.close(); 168 out.close();
167 169
168 free(buf); 170 free(buf);
169 free(of_packed); 171 free(of_packed);
170 free(rb_packed); 172 free(rb_packed);
171 173
172 //end of install 174 //end of install
173 qDebug() << "[BootloaderInstallAms] install successfull"; 175 qDebug() << "[BootloaderInstallAms] install successfull";
174 emit logItem(tr("Success: modified firmware file created"), LOGINFO); 176 emit logItem(tr("Success: modified firmware file created"), LOGINFO);