Skip to content

Commit

Permalink
Merge pull request #1 from dguidipc/master
Browse files Browse the repository at this point in the history
merge back
  • Loading branch information
camopants authored Jun 28, 2018
2 parents 38f86fa + a12e2b1 commit 656d1b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 49 deletions.
54 changes: 6 additions & 48 deletions Cmd/DLOnlyCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include "../Err/Exception.h"
#include "../Err/FlashToolErrorCodeDef.h"

#include <QtGui>

namespace APCore
{

Expand All @@ -33,6 +31,8 @@ DLOnlyCommand::~DLOnlyCommand()

bool DLOnlyCommand::CheckPMTLayoutChange(const QSharedPointer<Connection> &conn)
{
bool ret = false;

APCore::CoreHandle *core_handle = __POOL_OF_HANDLE(key_);
if(core_handle == NULL)
{
Expand All @@ -50,49 +50,12 @@ bool DLOnlyCommand::CheckPMTLayoutChange(const QSharedPointer<Connection> &conn)
RomInfoFactory info_factory(key_);
info_factory.GetRomList(conn, rom_list);

QWidgetList l = QApplication::allWidgets();
QTableWidget *tw = NULL;
foreach (QWidget *w, l) {
if (w->objectName() == "downloadTableWidget") {
tw = dynamic_cast<QTableWidget*>(w);
break;
}
}

int row = 1;
bool warningWrongFlash = false;

for(std::list<ROM_INFO>::const_iterator rom_it = rom_list.begin();
rom_it != rom_list.end(); ++rom_it)
{
const PART_INFO *pmt =
proxy.read_pmt(rom_it->name);

bool partitionSelected = false;
if (tw) {
QTableWidgetItem *twi = tw->item(row, 0);
if (twi) {
if (pmt)
qDebug() << "Partition Name" << QString::fromLatin1(rom_it->name) << twi->checkState() << QString::fromLatin1(pmt->name);
else
qDebug() << "Partition Name" << rom_it->name << twi->checkState() << "MISSING";

if (twi->checkState() != 0 && warningWrongFlash)
return true;

if (!pmt)
warningWrongFlash = true;

if (twi->checkState())
partitionSelected = true;
}
else
qDebug() << "Done";
}

if (rom_it->item_is_visable)
row++;

if (pmt != NULL && pmt_is_changed(pmt, *rom_it))
{

Expand All @@ -103,21 +66,16 @@ bool DLOnlyCommand::CheckPMTLayoutChange(const QSharedPointer<Connection> &conn)
}
else
{
qDebug("PMT changed for <%s>: addr<0x%llx>-->addr<0x%llx>, len<0x%llx>-->len<0x%llx>",
rom_it->name, pmt->begin_addr, rom_it->begin_addr, pmt->image_length, rom_it->partition_size);
LOGD("PMT changed for <%s>: addr<0x%llx>-->addr<0x%llx>, len<0x%llx>-->len<0x%llx>",
rom_it->name, pmt->begin_addr, rom_it->begin_addr, pmt->image_length, rom_it->partition_size);

if (pmt->begin_addr != rom_it->begin_addr && partitionSelected) {
qDebug() << "Starting offset differs - cannot proceed";
return true;
}
rom_it->name, pmt->begin_addr, rom_it->begin_addr, pmt->image_length, rom_it->partition_size);
ret = true;
break;
}
}

}

return false;
return ret;
}

void DLOnlyCommand::exec(const QSharedPointer<Connection> &conn)
Expand Down
2 changes: 1 addition & 1 deletion Flow/ErrString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


DEFINE_ERROR(ERROR_BL_INCONSISTENT,"Bootloaders must be selected/deselected together.");
DEFINE_ERROR(ERROR_ROM_MUST_ENABLE,"PMT changed for the ROM; it must be downloaded.\nPlease select \"Firmware upgrade\" scene and try again");
DEFINE_ERROR(ERROR_ROM_MUST_ENABLE,"The Scatter file does not correspond to this device,\nthe partition table is different.\nPlease select a matching Scatter file\nor select \"Firmware upgrade\" to format the device");
DEFINE_ERROR(ERROR_PMT_UNAVAILABLE,"Failed to get PMT info.");
DEFINE_ERROR(ERROR_DATA_LOST, "Data will be lost.");
DEFINE_ERROR(ERROR_UNKNOWN_ROM, "Unrecognized ROM detected.");
Expand Down

0 comments on commit 656d1b1

Please sign in to comment.