diff options
Diffstat (limited to 'rbutil/rbutilqt/installbootloader.cpp')
-rw-r--r-- | rbutil/rbutilqt/installbootloader.cpp | 73 |
1 files changed, 55 insertions, 18 deletions
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp index 3f28323c8c..10f6a9f678 100644 --- a/rbutil/rbutilqt/installbootloader.cpp +++ b/rbutil/rbutilqt/installbootloader.cpp | |||
@@ -312,7 +312,7 @@ void BootloaderInstaller::gigabeatPrepare() | |||
312 | QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; | 312 | QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; |
313 | 313 | ||
314 | m_dp->addItem(tr("Downloading file %1.%2") | 314 | m_dp->addItem(tr("Downloading file %1.%2") |
315 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); | 315 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()),LOGINFO); |
316 | 316 | ||
317 | // temporary file needs to be opened to get the filename | 317 | // temporary file needs to be opened to get the filename |
318 | downloadFile.open(); | 318 | downloadFile.open(); |
@@ -325,11 +325,11 @@ void BootloaderInstaller::gigabeatPrepare() | |||
325 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | 325 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); |
326 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | 326 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); |
327 | connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); | 327 | connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort())); |
328 | 328 | ||
329 | getter->getFile(QUrl(url)); | 329 | getter->getFile(QUrl(url)); |
330 | } | 330 | } |
331 | else //UnInstallation | 331 | else //UnInstallation |
332 | { | 332 | { |
333 | QString firmware; | 333 | QString firmware; |
334 | firmware = resolvePathCase(m_mountpoint + "/GBSYSTEM/FWIMG/FWIMG01.DAT"); | 334 | firmware = resolvePathCase(m_mountpoint + "/GBSYSTEM/FWIMG/FWIMG01.DAT"); |
335 | QString firmwareOrig = resolvePathCase(firmware.append(".ORIG")); | 335 | QString firmwareOrig = resolvePathCase(firmware.append(".ORIG")); |
@@ -339,7 +339,7 @@ void BootloaderInstaller::gigabeatPrepare() | |||
339 | // check if original firmware exists | 339 | // check if original firmware exists |
340 | if(!firmwareOrigFI.exists()) | 340 | if(!firmwareOrigFI.exists()) |
341 | { | 341 | { |
342 | m_dp->addItem(tr("Could not find the Original Firmware at: %1") | 342 | m_dp->addItem(tr("Could not find the Original Firmware at: %1") |
343 | .arg(firmwareOrig),LOGERROR); | 343 | .arg(firmwareOrig),LOGERROR); |
344 | emit done(true); | 344 | emit done(true); |
345 | return; | 345 | return; |
@@ -351,7 +351,7 @@ void BootloaderInstaller::gigabeatPrepare() | |||
351 | //remove modified firmware | 351 | //remove modified firmware |
352 | if(!firmwareFile.remove()) | 352 | if(!firmwareFile.remove()) |
353 | { | 353 | { |
354 | m_dp->addItem(tr("Could not remove the Firmware at: %1") | 354 | m_dp->addItem(tr("Could not remove the Firmware at: %1") |
355 | .arg(firmware),LOGERROR); | 355 | .arg(firmware),LOGERROR); |
356 | emit done(true); | 356 | emit done(true); |
357 | return; | 357 | return; |
@@ -360,7 +360,7 @@ void BootloaderInstaller::gigabeatPrepare() | |||
360 | // rename original firmware back | 360 | // rename original firmware back |
361 | if(!firmwareOrigFile.rename(firmware)) | 361 | if(!firmwareOrigFile.rename(firmware)) |
362 | { | 362 | { |
363 | m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") | 363 | m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2") |
364 | .arg(firmwareOrig,firmware),LOGERROR); | 364 | .arg(firmwareOrig,firmware),LOGERROR); |
365 | emit done(true); | 365 | emit done(true); |
366 | return; | 366 | return; |
@@ -369,7 +369,7 @@ void BootloaderInstaller::gigabeatPrepare() | |||
369 | removeInstallLog(); | 369 | removeInstallLog(); |
370 | 370 | ||
371 | emit done(false); //success | 371 | emit done(false); //success |
372 | } | 372 | } |
373 | 373 | ||
374 | } | 374 | } |
375 | 375 | ||
@@ -1330,9 +1330,22 @@ void BootloaderInstaller::iriverFinish() | |||
1330 | newHex.close(); | 1330 | newHex.close(); |
1331 | 1331 | ||
1332 | // iriver decode | 1332 | // iriver decode |
1333 | if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1) | 1333 | int result; |
1334 | { | 1334 | if ((result = iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE)) < 0) |
1335 | m_dp->addItem(tr("Error in descramble"),LOGERROR); | 1335 | { |
1336 | QString error; | ||
1337 | switch(result) { | ||
1338 | case -1: error = tr("Can't open input file"); break; | ||
1339 | case -2: error = tr("Can't open output file"); break; | ||
1340 | case -3: error = tr("invalid file: header length wrong"); break; | ||
1341 | case -4: error = tr("invalid file: unrecognized header"); break; | ||
1342 | case -5: error = tr("invalid file: \"length\" field wrong"); break; | ||
1343 | case -6: error = tr("invalid file: \"length2\" field wrong"); break; | ||
1344 | case -7: error = tr("invalid file: internal checksum error"); break; | ||
1345 | case -8: error = tr("invalid file: \"length3\" field wrong"); break; | ||
1346 | default: error = tr("unknown"); break; | ||
1347 | } | ||
1348 | m_dp->addItem(tr("Error in descramble: %1").arg(error), LOGERROR); | ||
1336 | firmwareBin.remove(); | 1349 | firmwareBin.remove(); |
1337 | newBin.remove(); | 1350 | newBin.remove(); |
1338 | newHex.remove(); | 1351 | newHex.remove(); |
@@ -1340,9 +1353,20 @@ void BootloaderInstaller::iriverFinish() | |||
1340 | return; | 1353 | return; |
1341 | } | 1354 | } |
1342 | // mkboot | 1355 | // mkboot |
1343 | if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp)) | 1356 | if((result = mkboot(firmwareBinName, newBinName, m_tempfilename, origin)) < 0) |
1344 | { | 1357 | { |
1345 | m_dp->addItem(tr("Error in patching"),LOGERROR); | 1358 | QString error; |
1359 | switch(result) { | ||
1360 | case -1: error = tr("could not open input file"); break; | ||
1361 | case -2: error = tr("reading header failed"); break; | ||
1362 | case -3: error = tr("reading firmware failed"); break; | ||
1363 | case -4: error = tr("can't open bootloader file"); break; | ||
1364 | case -5: error = tr("reading bootloader file failed"); break; | ||
1365 | case -6: error = tr("can't open output file"); break; | ||
1366 | case -7: error = tr("writing output file failed"); break; | ||
1367 | } | ||
1368 | m_dp->addItem(tr("Error in patching: %1").arg(error), LOGERROR); | ||
1369 | |||
1346 | firmwareBin.remove(); | 1370 | firmwareBin.remove(); |
1347 | newBin.remove(); | 1371 | newBin.remove(); |
1348 | newHex.remove(); | 1372 | newHex.remove(); |
@@ -1350,9 +1374,22 @@ void BootloaderInstaller::iriverFinish() | |||
1350 | return; | 1374 | return; |
1351 | } | 1375 | } |
1352 | // iriver_encode | 1376 | // iriver_encode |
1353 | if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1) | 1377 | if((result = iriver_encode(newBinName, newHexName, FALSE)) < 0) |
1354 | { | 1378 | { |
1355 | m_dp->addItem(tr("Error in scramble"),LOGERROR); | 1379 | QString error; |
1380 | switch(result) { | ||
1381 | case -1: error = tr("Can't open input file"); break; | ||
1382 | case -2: error = tr("Can't open output file"); break; | ||
1383 | case -3: error = tr("invalid file: header length wrong"); break; | ||
1384 | case -4: error = tr("invalid file: unrecognized header"); break; | ||
1385 | case -5: error = tr("invalid file: \"length\" field wrong"); break; | ||
1386 | case -6: error = tr("invalid file: \"length2\" field wrong"); break; | ||
1387 | case -7: error = tr("invalid file: internal checksum error"); break; | ||
1388 | case -8: error = tr("invalid file: \"length3\" field wrong"); break; | ||
1389 | default: error = tr("unknown"); break; | ||
1390 | } | ||
1391 | m_dp->addItem(tr("Error in scramble: %1").arg(error), LOGERROR); | ||
1392 | |||
1356 | firmwareBin.remove(); | 1393 | firmwareBin.remove(); |
1357 | newBin.remove(); | 1394 | newBin.remove(); |
1358 | newHex.remove(); | 1395 | newHex.remove(); |