summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/installbootloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/installbootloader.cpp')
-rw-r--r--rbutil/rbutilqt/installbootloader.cpp364
1 files changed, 182 insertions, 182 deletions
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp
index 5e743cb8dd..6265f519f9 100644
--- a/rbutil/rbutilqt/installbootloader.cpp
+++ b/rbutil/rbutilqt/installbootloader.cpp
@@ -16,13 +16,13 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "installbootloader.h" 20#include "installbootloader.h"
21#include "irivertools/checksums.h" 21#include "irivertools/checksums.h"
22 22
23BootloaderInstaller::BootloaderInstaller(QObject* parent): QObject(parent) 23BootloaderInstaller::BootloaderInstaller(QObject* parent): QObject(parent)
24{ 24{
25 25
26} 26}
27 27
28void BootloaderInstaller::install(ProgressloggerInterface* dp) 28void BootloaderInstaller::install(ProgressloggerInterface* dp)
@@ -31,50 +31,50 @@ void BootloaderInstaller::install(ProgressloggerInterface* dp)
31 m_install = true; 31 m_install = true;
32 m_dp->addItem(tr("Starting bootloader installation"),LOGINFO); 32 m_dp->addItem(tr("Starting bootloader installation"),LOGINFO);
33 connect(this, SIGNAL(done(bool)), this, SLOT(installEnded(bool))); 33 connect(this, SIGNAL(done(bool)), this, SLOT(installEnded(bool)));
34 34
35 if(m_bootloadermethod == "gigabeatf") 35 if(m_bootloadermethod == "gigabeatf")
36 { 36 {
37 // connect internal signal 37 // connect internal signal
38 connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare())); 38 connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare()));
39 connect(this,SIGNAL(finish()),this,SLOT(gigabeatFinish())); 39 connect(this,SIGNAL(finish()),this,SLOT(gigabeatFinish()));
40 } 40 }
41 else if(m_bootloadermethod == "iaudio") 41 else if(m_bootloadermethod == "iaudio")
42 { 42 {
43 // connect internal signal 43 // connect internal signal
44 connect(this,SIGNAL(prepare()),this,SLOT(iaudioPrepare())); 44 connect(this,SIGNAL(prepare()),this,SLOT(iaudioPrepare()));
45 connect(this,SIGNAL(finish()),this,SLOT(iaudioFinish())); 45 connect(this,SIGNAL(finish()),this,SLOT(iaudioFinish()));
46 } 46 }
47 else if(m_bootloadermethod == "h10") 47 else if(m_bootloadermethod == "h10")
48 { 48 {
49 // connect internal signal 49 // connect internal signal
50 connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare())); 50 connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare()));
51 connect(this,SIGNAL(finish()),this,SLOT(h10Finish())); 51 connect(this,SIGNAL(finish()),this,SLOT(h10Finish()));
52 } 52 }
53 else if(m_bootloadermethod == "ipodpatcher") 53 else if(m_bootloadermethod == "ipodpatcher")
54 { 54 {
55 // connect internal signal 55 // connect internal signal
56 connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); 56 connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare()));
57 connect(this,SIGNAL(finish()),this,SLOT(ipodFinish())); 57 connect(this,SIGNAL(finish()),this,SLOT(ipodFinish()));
58 } 58 }
59 else if(m_bootloadermethod == "sansapatcher") 59 else if(m_bootloadermethod == "sansapatcher")
60 { 60 {
61 // connect internal signal 61 // connect internal signal
62 connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); 62 connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare()));
63 connect(this,SIGNAL(finish()),this,SLOT(sansaFinish())); 63 connect(this,SIGNAL(finish()),this,SLOT(sansaFinish()));
64 } 64 }
65 else if(m_bootloadermethod == "fwpatcher") 65 else if(m_bootloadermethod == "fwpatcher")
66 { 66 {
67 // connect internal signal 67 // connect internal signal
68 connect(this,SIGNAL(prepare()),this,SLOT(iriverPrepare())); 68 connect(this,SIGNAL(prepare()),this,SLOT(iriverPrepare()));
69 connect(this,SIGNAL(finish()),this,SLOT(iriverFinish())); 69 connect(this,SIGNAL(finish()),this,SLOT(iriverFinish()));
70 } 70 }
71 else 71 else
72 { 72 {
73 m_dp->addItem(tr("unsupported install Method"),LOGERROR); 73 m_dp->addItem(tr("unsupported install Method"),LOGERROR);
74 emit done(true); 74 emit done(true);
75 return; 75 return;
76 } 76 }
77 77
78 emit prepare(); 78 emit prepare();
79} 79}
80 80
@@ -84,38 +84,38 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp)
84 m_install = false; 84 m_install = false;
85 m_dp->addItem(tr("Starting bootloader uninstallation"),LOGINFO); 85 m_dp->addItem(tr("Starting bootloader uninstallation"),LOGINFO);
86 connect(this, SIGNAL(done(bool)), this, SLOT(installEnded(bool))); 86 connect(this, SIGNAL(done(bool)), this, SLOT(installEnded(bool)));
87 87
88 if(m_bootloadermethod == "gigabeatf") 88 if(m_bootloadermethod == "gigabeatf")
89 { 89 {
90 // connect internal signal 90 // connect internal signal
91 connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare())); 91 connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare()));
92 } 92 }
93 else if(m_bootloadermethod == "iaudio") 93 else if(m_bootloadermethod == "iaudio")
94 { 94 {
95 m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); 95 m_dp->addItem(tr("No uninstallation possible"),LOGWARNING);
96 emit done(true); 96 emit done(true);
97 return; 97 return;
98 } 98 }
99 else if(m_bootloadermethod == "iaudio") 99 else if(m_bootloadermethod == "iaudio")
100 { 100 {
101 // connect internal signal 101 // connect internal signal
102 connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare())); 102 connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare()));
103 } 103 }
104 else if(m_bootloadermethod == "ipodpatcher") 104 else if(m_bootloadermethod == "ipodpatcher")
105 { 105 {
106 // connect internal signal 106 // connect internal signal
107 connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); 107 connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare()));
108 } 108 }
109 else if(m_bootloadermethod == "sansapatcher") 109 else if(m_bootloadermethod == "sansapatcher")
110 { 110 {
111 // connect internal signal 111 // connect internal signal
112 connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); 112 connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare()));
113 } 113 }
114 else if(m_bootloadermethod == "fwpatcher") 114 else if(m_bootloadermethod == "fwpatcher")
115 { 115 {
116 m_dp->addItem(tr("No uninstallation possible"),LOGWARNING); 116 m_dp->addItem(tr("No uninstallation possible"),LOGWARNING);
117 emit done(true); 117 emit done(true);
118 return; 118 return;
119 } 119 }
120 else 120 else
121 { 121 {
@@ -123,7 +123,7 @@ void BootloaderInstaller::uninstall(ProgressloggerInterface* dp)
123 emit done(true); 123 emit done(true);
124 return; 124 return;
125 } 125 }
126 126
127 emit prepare(); 127 emit prepare();
128} 128}
129 129
@@ -138,9 +138,9 @@ void BootloaderInstaller::downloadRequestFinished(int id, bool error)
138void BootloaderInstaller::downloadDone(bool error) 138void BootloaderInstaller::downloadDone(bool error)
139{ 139{
140 qDebug() << "Install::downloadDone, error:" << error; 140 qDebug() << "Install::downloadDone, error:" << error;
141 141
142 // update progress bar 142 // update progress bar
143 143
144 int max = m_dp->getProgressMax(); 144 int max = m_dp->getProgressMax();
145 if(max == 0) { 145 if(max == 0) {
146 max = 100; 146 max = 100;
@@ -160,9 +160,9 @@ void BootloaderInstaller::downloadDone(bool error)
160 return; 160 return;
161 } 161 }
162 else m_dp->addItem(tr("Download finished."),LOGOK); 162 else m_dp->addItem(tr("Download finished."),LOGOK);
163 163
164 emit finish(); 164 emit finish();
165 165
166} 166}
167 167
168void BootloaderInstaller::updateDataReadProgress(int read, int total) 168void BootloaderInstaller::updateDataReadProgress(int read, int total)
@@ -183,7 +183,7 @@ bool BootloaderInstaller::downloadInfo()
183{ 183{
184 // try to get the current build information 184 // try to get the current build information
185 infodownloader = new HttpGet(this); 185 infodownloader = new HttpGet(this);
186 186
187 connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool))); 187 connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool)));
188 connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool))); 188 connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool)));
189 189
@@ -192,7 +192,7 @@ bool BootloaderInstaller::downloadInfo()
192 qDebug() << "downloading bootloader info"; 192 qDebug() << "downloading bootloader info";
193 infodownloader->setFile(&bootloaderInfo); 193 infodownloader->setFile(&bootloaderInfo);
194 infodownloader->getFile(QUrl(m_bootloaderinfoUrl)); 194 infodownloader->getFile(QUrl(m_bootloaderinfoUrl));
195 195
196 // block until its downloaded 196 // block until its downloaded
197 qDebug() << "Waiting for Download finished"; 197 qDebug() << "Waiting for Download finished";
198 infoDownloaded=false; 198 infoDownloaded=false;
@@ -204,27 +204,27 @@ bool BootloaderInstaller::downloadInfo()
204 204
205void BootloaderInstaller::infoDownloadDone(bool error) 205void BootloaderInstaller::infoDownloadDone(bool error)
206{ 206{
207 if(error) 207 if(error)
208 { 208 {
209 qDebug() << "network error:" << infodownloader->error(); 209 qDebug() << "network error:" << infodownloader->error();
210 return; 210 return;
211 } 211 }
212 qDebug() << "network status:" << infodownloader->error(); 212 qDebug() << "network status:" << infodownloader->error();
213 213
214 infoDownloaded = true; 214 infoDownloaded = true;
215} 215}
216 216
217void BootloaderInstaller::infoRequestFinished(int id, bool error) 217void BootloaderInstaller::infoRequestFinished(int id, bool error)
218{ 218{
219 219
220 if(error) 220 if(error)
221 { 221 {
222 QString errorString; 222 QString errorString;
223 errorString = tr("Network error: %1. Please check your network and proxy settings.") 223 errorString = tr("Network error: %1. Please check your network and proxy settings.")
224 .arg(infodownloader->errorString()); 224 .arg(infodownloader->errorString());
225 if(error) QMessageBox::about(NULL, "Network Error", errorString); 225 if(error) QMessageBox::about(NULL, "Network Error", errorString);
226 qDebug() << "downloadDone:" << id << error; 226 qDebug() << "downloadDone:" << id << error;
227 227
228 infoError = true; 228 infoError = true;
229 infoDownloaded = true; 229 infoDownloaded = true;
230 } 230 }
@@ -241,7 +241,7 @@ void BootloaderInstaller::createInstallLog()
241 QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this); 241 QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this);
242 bootloaderInfo.close(); 242 bootloaderInfo.close();
243 info.beginGroup(m_device); 243 info.beginGroup(m_device);
244 244
245 installlog.beginGroup("Bootloader"); 245 installlog.beginGroup("Bootloader");
246 installlog.setValue("md5sum",info.value("md5sum").toString()); 246 installlog.setValue("md5sum",info.value("md5sum").toString());
247 installlog.endGroup(); 247 installlog.endGroup();
@@ -263,19 +263,19 @@ bool BootloaderInstaller::uptodate()
263{ 263{
264 QString installedMd5; 264 QString installedMd5;
265 QString serverMd5; 265 QString serverMd5;
266 266
267 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); 267 QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
268 installlog.beginGroup("Bootloader"); 268 installlog.beginGroup("Bootloader");
269 installedMd5 = installlog.value("md5sum").toString(); 269 installedMd5 = installlog.value("md5sum").toString();
270 installlog.endGroup(); 270 installlog.endGroup();
271 271
272 bootloaderInfo.open(); 272 bootloaderInfo.open();
273 QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this); 273 QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this);
274 bootloaderInfo.close(); 274 bootloaderInfo.close();
275 info.beginGroup(m_device); 275 info.beginGroup(m_device);
276 serverMd5 = info.value("md5sum").toString(); 276 serverMd5 = info.value("md5sum").toString();
277 info.endGroup(); 277 info.endGroup();
278 278
279 if(installedMd5 != serverMd5) 279 if(installedMd5 != serverMd5)
280 return false; 280 return false;
281 else 281 else
@@ -283,7 +283,7 @@ bool BootloaderInstaller::uptodate()
283} 283}
284 284
285/************************************************** 285/**************************************************
286*** gigabeat secific code 286*** gigabeat secific code
287***************************************************/ 287***************************************************/
288 288
289void BootloaderInstaller::gigabeatPrepare() 289void BootloaderInstaller::gigabeatPrepare()
@@ -291,7 +291,7 @@ void BootloaderInstaller::gigabeatPrepare()
291 if(m_install) // Installation 291 if(m_install) // Installation
292 { 292 {
293 QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; 293 QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername;
294 294
295 m_dp->addItem(tr("Downloading file %1.%2") 295 m_dp->addItem(tr("Downloading file %1.%2")
296 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 296 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
297 297
@@ -307,75 +307,75 @@ void BootloaderInstaller::gigabeatPrepare()
307 // connect signals from HttpGet 307 // connect signals from HttpGet
308 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 308 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
309 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 309 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
310 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 310 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
311 } 311 }
312 else //UnInstallation 312 else //UnInstallation
313 { 313 {
314 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/FWIMG01.DAT"; 314 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/FWIMG01.DAT";
315 QString firmwareOrig = firmware.append(".ORIG"); 315 QString firmwareOrig = firmware.append(".ORIG");
316 316
317 QFileInfo firmwareOrigFI(firmwareOrig); 317 QFileInfo firmwareOrigFI(firmwareOrig);
318 318
319 // check if original firmware exists 319 // check if original firmware exists
320 if(!firmwareOrigFI.exists()) 320 if(!firmwareOrigFI.exists())
321 { 321 {
322 m_dp->addItem(tr("Could not find the Original Firmware at: %1") 322 m_dp->addItem(tr("Could not find the Original Firmware at: %1")
323 .arg(firmwareOrig),LOGERROR); 323 .arg(firmwareOrig),LOGERROR);
324 emit done(true); 324 emit done(true);
325 return; 325 return;
326 } 326 }
327 327
328 QFile firmwareFile(firmware); 328 QFile firmwareFile(firmware);
329 QFile firmwareOrigFile(firmwareOrig); 329 QFile firmwareOrigFile(firmwareOrig);
330 330
331 //remove modified firmware 331 //remove modified firmware
332 if(!firmwareFile.remove()) 332 if(!firmwareFile.remove())
333 { 333 {
334 m_dp->addItem(tr("Could not remove the Firmware at: %1") 334 m_dp->addItem(tr("Could not remove the Firmware at: %1")
335 .arg(firmware),LOGERROR); 335 .arg(firmware),LOGERROR);
336 emit done(true); 336 emit done(true);
337 return; 337 return;
338 } 338 }
339 339
340 //copy original firmware 340 //copy original firmware
341 if(!firmwareOrigFile.copy(firmware)) 341 if(!firmwareOrigFile.copy(firmware))
342 { 342 {
343 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") 343 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
344 .arg(firmwareOrig,firmware),LOGERROR); 344 .arg(firmwareOrig,firmware),LOGERROR);
345 emit done(true); 345 emit done(true);
346 return; 346 return;
347 } 347 }
348 348
349 removeInstallLog(); 349 removeInstallLog();
350 350
351 emit done(false); //success 351 emit done(false); //success
352 } 352 }
353 353
354} 354}
355 355
356void BootloaderInstaller::gigabeatFinish() 356void BootloaderInstaller::gigabeatFinish()
357{ 357{
358 // this step is only need for installation, so no code for uninstall here 358 // this step is only need for installation, so no code for uninstall here
359 359
360 m_dp->addItem(tr("Finishing bootloader install"),LOGINFO); 360 m_dp->addItem(tr("Finishing bootloader install"),LOGINFO);
361 361
362 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername; 362 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername;
363 363
364 QFileInfo firmwareFI(firmware); 364 QFileInfo firmwareFI(firmware);
365 365
366 // check if firmware exists 366 // check if firmware exists
367 if(!firmwareFI.exists()) 367 if(!firmwareFI.exists())
368 { 368 {
369 m_dp->addItem(tr("Could not find the Firmware at: %1") 369 m_dp->addItem(tr("Could not find the Firmware at: %1")
370 .arg(firmware),LOGERROR); 370 .arg(firmware),LOGERROR);
371 emit done(true); 371 emit done(true);
372 return; 372 return;
373 } 373 }
374 374
375 QString firmwareOrig = firmware; 375 QString firmwareOrig = firmware;
376 firmwareOrig.append(".ORIG"); 376 firmwareOrig.append(".ORIG");
377 QFileInfo firmwareOrigFI(firmwareOrig); 377 QFileInfo firmwareOrigFI(firmwareOrig);
378 378
379 // rename the firmware, if there is no original firmware there 379 // rename the firmware, if there is no original firmware there
380 if(!firmwareOrigFI.exists()) 380 if(!firmwareOrigFI.exists())
381 { 381 {
@@ -393,7 +393,7 @@ void BootloaderInstaller::gigabeatFinish()
393 QFile firmwareFile(firmware); 393 QFile firmwareFile(firmware);
394 firmwareFile.remove(); 394 firmwareFile.remove();
395 } 395 }
396 396
397 //copy the firmware 397 //copy the firmware
398 if(!downloadFile.copy(firmware)) 398 if(!downloadFile.copy(firmware))
399 { 399 {
@@ -402,11 +402,11 @@ void BootloaderInstaller::gigabeatFinish()
402 emit done(true); 402 emit done(true);
403 return; 403 return;
404 } 404 }
405 405
406 downloadFile.remove(); 406 downloadFile.remove();
407 407
408 createInstallLog(); 408 createInstallLog();
409 409
410 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); 410 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
411 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO); 411 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
412 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO); 412 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
@@ -414,22 +414,22 @@ void BootloaderInstaller::gigabeatFinish()
414 m_dp->addItem(tr("3. Hold POWER to turn the Device off."),LOGINFO); 414 m_dp->addItem(tr("3. Hold POWER to turn the Device off."),LOGINFO);
415 m_dp->addItem(tr("4. Toggle the Battery switch on the Device."),LOGINFO); 415 m_dp->addItem(tr("4. Toggle the Battery switch on the Device."),LOGINFO);
416 m_dp->addItem(tr("5. Hold POWER to boot the Rockbox bootloader."),LOGINFO); 416 m_dp->addItem(tr("5. Hold POWER to boot the Rockbox bootloader."),LOGINFO);
417 417
418 418
419 m_dp->abort(); 419 m_dp->abort();
420 420
421 emit done(false); // success 421 emit done(false); // success
422 422
423} 423}
424 424
425/************************************************** 425/**************************************************
426*** iaudio secific code 426*** iaudio secific code
427***************************************************/ 427***************************************************/
428void BootloaderInstaller::iaudioPrepare() 428void BootloaderInstaller::iaudioPrepare()
429{ 429{
430 430
431 QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername; 431 QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername;
432 432
433 m_dp->addItem(tr("Downloading file %1.%2") 433 m_dp->addItem(tr("Downloading file %1.%2")
434 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 434 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
435 435
@@ -444,14 +444,14 @@ void BootloaderInstaller::iaudioPrepare()
444 getter->getFile(QUrl(url)); 444 getter->getFile(QUrl(url));
445 // connect signals from HttpGet 445 // connect signals from HttpGet
446 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 446 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
447 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 447 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
448 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 448 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
449} 449}
450 450
451void BootloaderInstaller::iaudioFinish() 451void BootloaderInstaller::iaudioFinish()
452{ 452{
453 QString firmware = m_mountpoint + "/FIRMWARE/" + m_bootloadername; 453 QString firmware = m_mountpoint + "/FIRMWARE/" + m_bootloadername;
454 454
455 //copy the firmware 455 //copy the firmware
456 if(!downloadFile.copy(firmware)) 456 if(!downloadFile.copy(firmware))
457 { 457 {
@@ -460,33 +460,33 @@ void BootloaderInstaller::iaudioFinish()
460 emit done(true); 460 emit done(true);
461 return; 461 return;
462 } 462 }
463 463
464 downloadFile.remove(); 464 downloadFile.remove();
465 465
466 createInstallLog(); 466 createInstallLog();
467 467
468 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); 468 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
469 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO); 469 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
470 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO); 470 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
471 m_dp->addItem(tr("2. Turn you Device OFF."),LOGINFO); 471 m_dp->addItem(tr("2. Turn you Device OFF."),LOGINFO);
472 m_dp->addItem(tr("3. Insert Charger."),LOGINFO); 472 m_dp->addItem(tr("3. Insert Charger."),LOGINFO);
473 473
474 m_dp->abort(); 474 m_dp->abort();
475 475
476 emit done(false); // success 476 emit done(false); // success
477 477
478} 478}
479 479
480 480
481/************************************************** 481/**************************************************
482*** h10 secific code 482*** h10 secific code
483***************************************************/ 483***************************************************/
484void BootloaderInstaller::h10Prepare() 484void BootloaderInstaller::h10Prepare()
485{ 485{
486 if(m_install) // Installation 486 if(m_install) // Installation
487 { 487 {
488 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; 488 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
489 489
490 m_dp->addItem(tr("Downloading file %1.%2") 490 m_dp->addItem(tr("Downloading file %1.%2")
491 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 491 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
492 492
@@ -501,17 +501,17 @@ void BootloaderInstaller::h10Prepare()
501 getter->getFile(QUrl(url)); 501 getter->getFile(QUrl(url));
502 // connect signals from HttpGet 502 // connect signals from HttpGet
503 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 503 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
504 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 504 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
505 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 505 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
506 } 506 }
507 else // Uninstallation 507 else // Uninstallation
508 { 508 {
509 509
510 QString firmwarename = m_bootloadername.section('/', -1); 510 QString firmwarename = m_bootloadername.section('/', -1);
511 511
512 QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; 512 QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename;
513 QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4"; 513 QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4";
514 514
515 QFileInfo firmwareFI(firmware); 515 QFileInfo firmwareFI(firmware);
516 if(!firmwareFI.exists()) //Firmware dosent exists on player 516 if(!firmwareFI.exists()) //Firmware dosent exists on player
517 { 517 {
@@ -525,7 +525,7 @@ void BootloaderInstaller::h10Prepare()
525 return; 525 return;
526 } 526 }
527 } 527 }
528 528
529 QFileInfo firmwareOrigFI(firmwareOrig); 529 QFileInfo firmwareOrigFI(firmwareOrig);
530 if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player 530 if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player
531 { 531 {
@@ -534,32 +534,32 @@ void BootloaderInstaller::h10Prepare()
534 emit done(true); 534 emit done(true);
535 return; 535 return;
536 } 536 }
537 537
538 QFile firmwareFile(firmware); 538 QFile firmwareFile(firmware);
539 QFile firmwareOrigFile(firmwareOrig); 539 QFile firmwareOrigFile(firmwareOrig);
540 540
541 //remove modified firmware 541 //remove modified firmware
542 if(!firmwareFile.remove()) 542 if(!firmwareFile.remove())
543 { 543 {
544 m_dp->addItem(tr("Could not remove the Firmware at: %1") 544 m_dp->addItem(tr("Could not remove the Firmware at: %1")
545 .arg(firmware),LOGERROR); 545 .arg(firmware),LOGERROR);
546 emit done(true); 546 emit done(true);
547 return; 547 return;
548 } 548 }
549 549
550 //copy original firmware 550 //copy original firmware
551 if(!firmwareOrigFile.copy(firmware)) 551 if(!firmwareOrigFile.copy(firmware))
552 { 552 {
553 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") 553 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
554 .arg(firmwareOrig,firmware),LOGERROR); 554 .arg(firmwareOrig,firmware),LOGERROR);
555 emit done(true); 555 emit done(true);
556 return; 556 return;
557 } 557 }
558 558
559 removeInstallLog(); 559 removeInstallLog();
560 560
561 emit done(false); //success 561 emit done(false); //success
562 562
563 } 563 }
564} 564}
565 565
@@ -569,9 +569,9 @@ void BootloaderInstaller::h10Finish()
569 569
570 QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; 570 QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename;
571 QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4"; 571 QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4";
572 572
573 QFileInfo firmwareFI(firmware); 573 QFileInfo firmwareFI(firmware);
574 574
575 if(!firmwareFI.exists()) //Firmware dosent exists on player 575 if(!firmwareFI.exists()) //Firmware dosent exists on player
576 { 576 {
577 firmware = m_mountpoint + "/SYSTEM/H10EMP.mi4"; //attempt other firmwarename 577 firmware = m_mountpoint + "/SYSTEM/H10EMP.mi4"; //attempt other firmwarename
@@ -584,9 +584,9 @@ void BootloaderInstaller::h10Finish()
584 return; 584 return;
585 } 585 }
586 } 586 }
587 587
588 QFileInfo firmwareOrigFI(firmwareOrig); 588 QFileInfo firmwareOrigFI(firmwareOrig);
589 589
590 if(!firmwareOrigFI.exists()) //there is already a original firmware 590 if(!firmwareOrigFI.exists()) //there is already a original firmware
591 { 591 {
592 QFile firmwareFile(firmware); 592 QFile firmwareFile(firmware);
@@ -611,20 +611,20 @@ void BootloaderInstaller::h10Finish()
611 emit done(true); 611 emit done(true);
612 return; 612 return;
613 } 613 }
614 614
615 downloadFile.remove(); 615 downloadFile.remove();
616 616
617 createInstallLog(); 617 createInstallLog();
618 618
619 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); 619 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
620 m_dp->abort(); 620 m_dp->abort();
621 621
622 emit done(false); // success 622 emit done(false); // success
623 623
624} 624}
625 625
626/************************************************** 626/**************************************************
627*** ipod secific code 627*** ipod secific code
628***************************************************/ 628***************************************************/
629int verbose =0; 629int verbose =0;
630// reserves memory for ipodpatcher 630// reserves memory for ipodpatcher
@@ -651,12 +651,12 @@ void BootloaderInstaller::ipodPrepare()
651 m_dp->addItem(tr("Too many Ipods found"),LOGERROR); 651 m_dp->addItem(tr("Too many Ipods found"),LOGERROR);
652 emit done(true); 652 emit done(true);
653 } 653 }
654 654
655 if(m_install) // Installation 655 if(m_install) // Installation
656 { 656 {
657 657
658 QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod"; 658 QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod";
659 659
660 m_dp->addItem(tr("Downloading file %1.%2") 660 m_dp->addItem(tr("Downloading file %1.%2")
661 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 661 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
662 662
@@ -671,8 +671,8 @@ void BootloaderInstaller::ipodPrepare()
671 getter->getFile(QUrl(url)); 671 getter->getFile(QUrl(url));
672 // connect signals from HttpGet 672 // connect signals from HttpGet
673 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 673 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
674 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 674 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
675 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 675 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
676 } 676 }
677 else // Uninstallation 677 else // Uninstallation
678 { 678 {
@@ -693,13 +693,13 @@ void BootloaderInstaller::ipodPrepare()
693 if (ipod.pinfo[0].start==0) 693 if (ipod.pinfo[0].start==0)
694 { 694 {
695 m_dp->addItem(tr("No partition 0 on disk"),LOGERROR); 695 m_dp->addItem(tr("No partition 0 on disk"),LOGERROR);
696 696
697 int i; 697 int i;
698 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; 698 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
699 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO); 699 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO);
700 for ( i = 0; i < 4; i++ ) 700 for ( i = 0; i < 4; i++ )
701 { 701 {
702 if (ipod.pinfo[i].start != 0) 702 if (ipod.pinfo[i].start != 0)
703 { 703 {
704 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( 704 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
705 i).arg( 705 i).arg(
@@ -734,43 +734,43 @@ void BootloaderInstaller::ipodPrepare()
734 { 734 {
735 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING); 735 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING);
736 } 736 }
737 737
738 if (ipod_reopen_rw(&ipod) < 0) 738 if (ipod_reopen_rw(&ipod) < 0)
739 { 739 {
740 m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR); 740 m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR);
741 emit done(true); 741 emit done(true);
742 return; 742 return;
743 } 743 }
744 744
745 if (ipod.ipod_directory[0].entryOffset==0) { 745 if (ipod.ipod_directory[0].entryOffset==0) {
746 m_dp->addItem(tr("No bootloader detected."),LOGERROR); 746 m_dp->addItem(tr("No bootloader detected."),LOGERROR);
747 emit done(true); 747 emit done(true);
748 return; 748 return;
749 } 749 }
750 750
751 if (delete_bootloader(&ipod)==0) 751 if (delete_bootloader(&ipod)==0)
752 { 752 {
753 m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK); 753 m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
754 removeInstallLog(); 754 removeInstallLog();
755 emit done(false); 755 emit done(false);
756 ipod_close(&ipod); 756 ipod_close(&ipod);
757 return; 757 return;
758 } 758 }
759 else 759 else
760 { 760 {
761 m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR); 761 m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR);
762 emit done(true); 762 emit done(true);
763 ipod_close(&ipod); 763 ipod_close(&ipod);
764 return; 764 return;
765 } 765 }
766 } 766 }
767} 767}
768 768
769void BootloaderInstaller::ipodFinish() 769void BootloaderInstaller::ipodFinish()
770{ 770{
771 struct ipod_t ipod; 771 struct ipod_t ipod;
772 ipod_scan(&ipod); 772 ipod_scan(&ipod);
773 773
774 if (ipod_open(&ipod, 0) < 0) 774 if (ipod_open(&ipod, 0) < 0)
775 { 775 {
776 m_dp->addItem(tr("could not open ipod"),LOGERROR); 776 m_dp->addItem(tr("could not open ipod"),LOGERROR);
@@ -788,15 +788,15 @@ void BootloaderInstaller::ipodFinish()
788 if (ipod.pinfo[0].start==0) 788 if (ipod.pinfo[0].start==0)
789 { 789 {
790 m_dp->addItem(tr("No partition 0 on disk"),LOGERROR); 790 m_dp->addItem(tr("No partition 0 on disk"),LOGERROR);
791 791
792 int i; 792 int i;
793 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; 793 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
794 794
795 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO); 795 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"),LOGINFO);
796 796
797 for ( i = 0; i < 4; i++ ) 797 for ( i = 0; i < 4; i++ )
798 { 798 {
799 if (ipod.pinfo[i].start != 0) 799 if (ipod.pinfo[i].start != 0)
800 { 800 {
801 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( 801 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
802 i).arg( 802 i).arg(
@@ -832,32 +832,32 @@ void BootloaderInstaller::ipodFinish()
832 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING); 832 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"),LOGWARNING);
833 } 833 }
834 834
835 if (ipod_reopen_rw(&ipod) < 0) 835 if (ipod_reopen_rw(&ipod) < 0)
836 { 836 {
837 m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR); 837 m_dp->addItem(tr("Could not open Ipod in RW mode"),LOGERROR);
838 emit done(true); 838 emit done(true);
839 return; 839 return;
840 } 840 }
841 841
842 if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) 842 if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0)
843 { 843 {
844 m_dp->addItem(tr("Successfully added Bootloader"),LOGOK); 844 m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
845 createInstallLog(); 845 createInstallLog();
846 emit done(false); 846 emit done(false);
847 ipod_close(&ipod); 847 ipod_close(&ipod);
848 return; 848 return;
849 } 849 }
850 else 850 else
851 { 851 {
852 m_dp->addItem(tr("failed to add Bootloader"),LOGERROR); 852 m_dp->addItem(tr("failed to add Bootloader"),LOGERROR);
853 ipod_close(&ipod); 853 ipod_close(&ipod);
854 emit done(true); 854 emit done(true);
855 return; 855 return;
856 } 856 }
857} 857}
858 858
859/************************************************** 859/**************************************************
860*** sansa secific code 860*** sansa secific code
861***************************************************/ 861***************************************************/
862// reserves memory for sansapatcher 862// reserves memory for sansapatcher
863bool initSansapatcher() 863bool initSansapatcher()
@@ -884,11 +884,11 @@ void BootloaderInstaller::sansaPrepare()
884 m_dp->addItem(tr("Too many Sansas found"),LOGERROR); 884 m_dp->addItem(tr("Too many Sansas found"),LOGERROR);
885 emit done(true); 885 emit done(true);
886 } 886 }
887 887
888 if(m_install) // Installation 888 if(m_install) // Installation
889 { 889 {
890 QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername; 890 QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername;
891 891
892 m_dp->addItem(tr("Downloading file %1.%2") 892 m_dp->addItem(tr("Downloading file %1.%2")
893 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 893 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
894 894
@@ -903,19 +903,19 @@ void BootloaderInstaller::sansaPrepare()
903 getter->getFile(QUrl(url)); 903 getter->getFile(QUrl(url));
904 // connect signals from HttpGet 904 // connect signals from HttpGet
905 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 905 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
906 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 906 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
907 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 907 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
908 } 908 }
909 else // Uninstallation 909 else // Uninstallation
910 { 910 {
911 911
912 if (sansa_open(&sansa, 0) < 0) 912 if (sansa_open(&sansa, 0) < 0)
913 { 913 {
914 m_dp->addItem(tr("could not open Sansa"),LOGERROR); 914 m_dp->addItem(tr("could not open Sansa"),LOGERROR);
915 emit done(true); 915 emit done(true);
916 return; 916 return;
917 } 917 }
918 918
919 if (sansa_read_partinfo(&sansa,0) < 0) 919 if (sansa_read_partinfo(&sansa,0) < 0)
920 { 920 {
921 m_dp->addItem(tr("could not read partitiontable"),LOGERROR); 921 m_dp->addItem(tr("could not read partitiontable"),LOGERROR);
@@ -941,45 +941,45 @@ void BootloaderInstaller::sansaPrepare()
941 emit done(true); 941 emit done(true);
942 return; 942 return;
943 } 943 }
944
945 944
946 if (sansa_reopen_rw(&sansa) < 0) 945
946 if (sansa_reopen_rw(&sansa) < 0)
947 { 947 {
948 m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR); 948 m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR);
949 emit done(true); 949 emit done(true);
950 return; 950 return;
951 } 951 }
952 952
953 if (sansa_delete_bootloader(&sansa)==0) 953 if (sansa_delete_bootloader(&sansa)==0)
954 { 954 {
955 m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK); 955 m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
956 removeInstallLog(); 956 removeInstallLog();
957 emit done(false); 957 emit done(false);
958 sansa_close(&sansa); 958 sansa_close(&sansa);
959 return; 959 return;
960 } 960 }
961 else 961 else
962 { 962 {
963 m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR); 963 m_dp->addItem(tr("--delete-bootloader failed."),LOGERROR);
964 emit done(true); 964 emit done(true);
965 sansa_close(&sansa); 965 sansa_close(&sansa);
966 return; 966 return;
967 } 967 }
968 } 968 }
969} 969}
970 970
971void BootloaderInstaller::sansaFinish() 971void BootloaderInstaller::sansaFinish()
972{ 972{
973 struct sansa_t sansa; 973 struct sansa_t sansa;
974 sansa_scan(&sansa); 974 sansa_scan(&sansa);
975 975
976 if (sansa_open(&sansa, 0) < 0) 976 if (sansa_open(&sansa, 0) < 0)
977 { 977 {
978 m_dp->addItem(tr("could not open Sansa"),LOGERROR); 978 m_dp->addItem(tr("could not open Sansa"),LOGERROR);
979 emit done(true); 979 emit done(true);
980 return; 980 return;
981 } 981 }
982 982
983 if (sansa_read_partinfo(&sansa,0) < 0) 983 if (sansa_read_partinfo(&sansa,0) < 0)
984 { 984 {
985 m_dp->addItem(tr("could not read partitiontable"),LOGERROR); 985 m_dp->addItem(tr("could not read partitiontable"),LOGERROR);
@@ -990,7 +990,7 @@ void BootloaderInstaller::sansaFinish()
990 990
991 int i = is_e200(&sansa); 991 int i = is_e200(&sansa);
992 if (i < 0) { 992 if (i < 0) {
993 993
994 m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i),LOGERROR); 994 m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i),LOGERROR);
995 emit done(true); 995 emit done(true);
996 return; 996 return;
@@ -1008,33 +1008,33 @@ void BootloaderInstaller::sansaFinish()
1008 return; 1008 return;
1009 } 1009 }
1010 1010
1011 if (sansa_reopen_rw(&sansa) < 0) 1011 if (sansa_reopen_rw(&sansa) < 0)
1012 { 1012 {
1013 m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR); 1013 m_dp->addItem(tr("Could not open Sansa in RW mode"),LOGERROR);
1014 emit done(true); 1014 emit done(true);
1015 return; 1015 return;
1016 } 1016 }
1017 1017
1018 if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0) 1018 if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0)
1019 { 1019 {
1020 m_dp->addItem(tr("Successfully added Bootloader"),LOGOK); 1020 m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
1021 createInstallLog(); 1021 createInstallLog();
1022 emit done(false); 1022 emit done(false);
1023 sansa_close(&sansa); 1023 sansa_close(&sansa);
1024 return; 1024 return;
1025 } 1025 }
1026 else 1026 else
1027 { 1027 {
1028 m_dp->addItem(tr("failed to add Bootloader"),LOGERROR); 1028 m_dp->addItem(tr("failed to add Bootloader"),LOGERROR);
1029 sansa_close(&sansa); 1029 sansa_close(&sansa);
1030 emit done(true); 1030 emit done(true);
1031 return; 1031 return;
1032 } 1032 }
1033 1033
1034} 1034}
1035 1035
1036/************************************************** 1036/**************************************************
1037*** iriver /fwpatcher secific code 1037*** iriver /fwpatcher secific code
1038***************************************************/ 1038***************************************************/
1039 1039
1040void BootloaderInstaller::iriverPrepare() 1040void BootloaderInstaller::iriverPrepare()
@@ -1045,7 +1045,7 @@ void BootloaderInstaller::iriverPrepare()
1045 emit done(true); 1045 emit done(true);
1046 return; 1046 return;
1047 } 1047 }
1048 1048
1049 /* Check firmware against md5sums in h120sums and h100sums */ 1049 /* Check firmware against md5sums in h120sums and h100sums */
1050 series = 0; 1050 series = 0;
1051 table_entry = intable(md5sum_str, &h120pairs[0], 1051 table_entry = intable(md5sum_str, &h120pairs[0],
@@ -1053,15 +1053,15 @@ void BootloaderInstaller::iriverPrepare()
1053 if (table_entry >= 0) { 1053 if (table_entry >= 0) {
1054 series = 120; 1054 series = 120;
1055 } 1055 }
1056 else 1056 else
1057 { 1057 {
1058 table_entry = intable(md5sum_str, &h100pairs[0], 1058 table_entry = intable(md5sum_str, &h100pairs[0],
1059 sizeof(h100pairs)/sizeof(struct sumpairs)); 1059 sizeof(h100pairs)/sizeof(struct sumpairs));
1060 if (table_entry >= 0) 1060 if (table_entry >= 0)
1061 { 1061 {
1062 series = 100; 1062 series = 100;
1063 } 1063 }
1064 else 1064 else
1065 { 1065 {
1066 table_entry = intable(md5sum_str, &h300pairs[0], 1066 table_entry = intable(md5sum_str, &h300pairs[0],
1067 sizeof(h300pairs)/sizeof(struct sumpairs)); 1067 sizeof(h300pairs)/sizeof(struct sumpairs));
@@ -1075,9 +1075,9 @@ void BootloaderInstaller::iriverPrepare()
1075 emit done(true); 1075 emit done(true);
1076 return; 1076 return;
1077 } 1077 }
1078 1078
1079 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; 1079 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
1080 1080
1081 m_dp->addItem(tr("Downloading file %1.%2") 1081 m_dp->addItem(tr("Downloading file %1.%2")
1082 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); 1082 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO);
1083 1083
@@ -1092,8 +1092,8 @@ void BootloaderInstaller::iriverPrepare()
1092 getter->getFile(QUrl(url)); 1092 getter->getFile(QUrl(url));
1093 // connect signals from HttpGet 1093 // connect signals from HttpGet
1094 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 1094 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
1095 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 1095 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
1096 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); 1096 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
1097} 1097}
1098 1098
1099void BootloaderInstaller::iriverFinish() 1099void BootloaderInstaller::iriverFinish()
@@ -1118,7 +1118,7 @@ void BootloaderInstaller::iriverFinish()
1118 origin = 0x3f0000; 1118 origin = 0x3f0000;
1119 break; 1119 break;
1120 } 1120 }
1121 1121
1122 // temporary files needs to be opened to get the filename 1122 // temporary files needs to be opened to get the filename
1123 QTemporaryFile firmwareBin, newBin, newHex; 1123 QTemporaryFile firmwareBin, newBin, newHex;
1124 firmwareBin.open(); 1124 firmwareBin.open();
@@ -1130,9 +1130,9 @@ void BootloaderInstaller::iriverFinish()
1130 firmwareBin.close(); 1130 firmwareBin.close();
1131 newBin.close(); 1131 newBin.close();
1132 newHex.close(); 1132 newHex.close();
1133 1133
1134 // iriver decode 1134 // iriver decode
1135 if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1) 1135 if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1)
1136 { 1136 {
1137 m_dp->addItem(tr("Error in descramble"),LOGERROR); 1137 m_dp->addItem(tr("Error in descramble"),LOGERROR);
1138 firmwareBin.remove(); 1138 firmwareBin.remove();
@@ -1142,7 +1142,7 @@ void BootloaderInstaller::iriverFinish()
1142 return; 1142 return;
1143 } 1143 }
1144 // mkboot 1144 // mkboot
1145 if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp)) 1145 if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp))
1146 { 1146 {
1147 m_dp->addItem(tr("Error in patching"),LOGERROR); 1147 m_dp->addItem(tr("Error in patching"),LOGERROR);
1148 firmwareBin.remove(); 1148 firmwareBin.remove();
@@ -1152,7 +1152,7 @@ void BootloaderInstaller::iriverFinish()
1152 return; 1152 return;
1153 } 1153 }
1154 // iriver_encode 1154 // iriver_encode
1155 if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1) 1155 if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1)
1156 { 1156 {
1157 m_dp->addItem(tr("Error in scramble"),LOGERROR); 1157 m_dp->addItem(tr("Error in scramble"),LOGERROR);
1158 firmwareBin.remove(); 1158 firmwareBin.remove();
@@ -1161,9 +1161,9 @@ void BootloaderInstaller::iriverFinish()
1161 emit done(true); 1161 emit done(true);
1162 return; 1162 return;
1163 } 1163 }
1164 1164
1165 /* now md5sum it */ 1165 /* now md5sum it */
1166 if (!FileMD5(newHexName, md5sum_str)) 1166 if (!FileMD5(newHexName, md5sum_str))
1167 { 1167 {
1168 m_dp->addItem(tr("Error in checksumming"),LOGERROR); 1168 m_dp->addItem(tr("Error in checksumming"),LOGERROR);
1169 firmwareBin.remove(); 1169 firmwareBin.remove();
@@ -1177,7 +1177,7 @@ void BootloaderInstaller::iriverFinish()
1177 firmwareBin.remove(); 1177 firmwareBin.remove();
1178 newBin.remove(); 1178 newBin.remove();
1179 } 1179 }
1180 1180
1181 // Load patched Firmware to player 1181 // Load patched Firmware to player
1182 QString dest; 1182 QString dest;
1183 if(series == 100) 1183 if(series == 100)
@@ -1186,7 +1186,7 @@ void BootloaderInstaller::iriverFinish()
1186 dest = m_mountpoint + "/ihp_120.hex"; 1186 dest = m_mountpoint + "/ihp_120.hex";
1187 else if(series == 300) 1187 else if(series == 300)
1188 dest = m_mountpoint + "/H300.hex"; 1188 dest = m_mountpoint + "/H300.hex";
1189 1189
1190 // copy file 1190 // copy file
1191 QFile destfile(dest); 1191 QFile destfile(dest);
1192 if(destfile.exists()) destfile.remove(); 1192 if(destfile.exists()) destfile.remove();
@@ -1197,12 +1197,12 @@ void BootloaderInstaller::iriverFinish()
1197 emit done(true); 1197 emit done(true);
1198 return; 1198 return;
1199 } 1199 }
1200 1200
1201 downloadFile.remove(); 1201 downloadFile.remove();
1202 newHex.remove(); 1202 newHex.remove();
1203 1203
1204 createInstallLog(); 1204 createInstallLog();
1205 1205
1206 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK); 1206 m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
1207 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO); 1207 m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
1208 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO); 1208 m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
@@ -1210,7 +1210,7 @@ void BootloaderInstaller::iriverFinish()
1210 m_dp->addItem(tr("3. Use the Firmware flash option in the Original Firmware."),LOGINFO); 1210 m_dp->addItem(tr("3. Use the Firmware flash option in the Original Firmware."),LOGINFO);
1211 m_dp->addItem(tr("4. Reboot."),LOGINFO); 1211 m_dp->addItem(tr("4. Reboot."),LOGINFO);
1212 m_dp->abort(); 1212 m_dp->abort();
1213 1213
1214 emit done(false); // success 1214 emit done(false); // success
1215 1215
1216 1216