Add note to AMS bootloader installation about OF file.

Some devices contain a bin file in the root folder of the player. This caused
confusion a couple of times, since the installer asks for a bin file. Add a
note that the required file is not present on the player and will get removed
automatically.

Change-Id: I6cd5c25b319770555c3939377a3ed86ed3181dad
This commit is contained in:
Dominik Riebeling 2013-06-09 17:32:30 +02:00
parent 9574b30066
commit a2c3e3fd0d

View file

@ -40,6 +40,8 @@ QString BootloaderInstallAms::ofHint()
"<a href='http://www.rockbox.org/manual.shtml'>manual</a> and " "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and "
"the <a href='http://www.rockbox.org/wiki/SansaAMS'>SansaAMS</a> " "the <a href='http://www.rockbox.org/wiki/SansaAMS'>SansaAMS</a> "
"wiki page on how to obtain this file.<br/>" "wiki page on how to obtain this file.<br/>"
"<b>Note:</b> This file is not present on your player and will "
"disappear automatically after installing it.<br/><br/>"
"Press Ok to continue and browse your computer for the firmware " "Press Ok to continue and browse your computer for the firmware "
"file."); "file.");
} }
@ -48,22 +50,22 @@ bool BootloaderInstallAms::install(void)
{ {
if(m_offile.isEmpty()) if(m_offile.isEmpty())
return false; return false;
qDebug() << "[BootloaderInstallAms] installing bootloader"; qDebug() << "[BootloaderInstallAms] installing bootloader";
// download firmware from server // download firmware from server
emit logItem(tr("Downloading bootloader file"), LOGINFO); emit logItem(tr("Downloading bootloader file"), LOGINFO);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
downloadBlStart(m_blurl); downloadBlStart(m_blurl);
return true; return true;
} }
void BootloaderInstallAms::installStage2(void) void BootloaderInstallAms::installStage2(void)
{ {
qDebug() << "[BootloaderInstallAms] installStage2"; qDebug() << "[BootloaderInstallAms] installStage2";
unsigned char* buf; unsigned char* buf;
unsigned char* of_packed; unsigned char* of_packed;
int of_packedsize; int of_packedsize;
@ -79,9 +81,9 @@ void BootloaderInstallAms::installStage2(void)
int patchable; int patchable;
int totalsize; int totalsize;
char errstr[200]; char errstr[200];
sum.md5 = md5sum; sum.md5 = md5sum;
m_tempfile.open(); m_tempfile.open();
QString bootfile = m_tempfile.fileName(); QString bootfile = m_tempfile.fileName();
m_tempfile.close(); m_tempfile.close();
@ -91,14 +93,14 @@ void BootloaderInstallAms::installStage2(void)
&bootloader_size,&rb_packedsize, &bootloader_size,&rb_packedsize,
errstr,sizeof(errstr)); errstr,sizeof(errstr));
if (rb_packed == NULL) if (rb_packed == NULL)
{ {
qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile; qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile;
emit logItem(errstr, LOGERROR); emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
emit done(true); emit done(true);
return; return;
} }
/* Load original firmware file */ /* Load original firmware file */
buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum, buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum,
&firmware_size, &of_packed ,&of_packedsize, &firmware_size, &of_packed ,&of_packedsize,
@ -129,16 +131,16 @@ void BootloaderInstallAms::installStage2(void)
emit done(true); emit done(true);
return; return;
} }
/* patch the firmware */ /* patch the firmware */
emit logItem(tr("Patching Firmware..."), LOGINFO); emit logItem(tr("Patching Firmware..."), LOGINFO);
patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf, patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf,
len,of_packed,of_packedsize,rb_packed,rb_packedsize); len,of_packed,of_packedsize,rb_packed,rb_packedsize);
/* write out file */ /* write out file */
QFile out(m_blfile); QFile out(m_blfile);
if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate))
{ {
qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing"; qDebug() << "[BootloaderInstallAms] Could not open" << m_blfile << "for writing";
@ -149,7 +151,7 @@ void BootloaderInstallAms::installStage2(void)
emit done(true); emit done(true);
return; return;
} }
n = out.write((char*)buf, len); n = out.write((char*)buf, len);
if (n != len) if (n != len)
@ -164,11 +166,11 @@ void BootloaderInstallAms::installStage2(void)
} }
out.close(); out.close();
free(buf); free(buf);
free(of_packed); free(of_packed);
free(rb_packed); free(rb_packed);
//end of install //end of install
qDebug() << "[BootloaderInstallAms] install successfull"; qDebug() << "[BootloaderInstallAms] install successfull";
emit logItem(tr("Success: modified firmware file created"), LOGINFO); emit logItem(tr("Success: modified firmware file created"), LOGINFO);