Commit 1bc34a4b authored by Dennis Rassmann's avatar Dennis Rassmann

flasher: adding reboot to fastboot & boot flasher

Signed-off-by: Dennis Rassmann's avatarshowp1984 <showp1984@gmail.com>
parent c0056e72
......@@ -296,15 +296,18 @@ void flasher::flash_device(void)
ui->bar_flash->setValue(50);
break;
case REBOOT_FASTBOOT:
flash_state = reboot_fastboot();
ui->bar_flash->setValue(60);
break;
case FLASH_BOOTIMG:
flash_state = flash_boot();
ui->bar_flash->setValue(70);
break;
case CHECK_INSTALL:
ui->bar_flash->setValue(80);
break;
case RELEASE_CONTROLS:
ui->txt_out->append("Doing some cleanup...");
ret = rmdir_recursive(QString(qApp->applicationDirPath() + "/" + tmp_folder));
if (!ret) {
ui->txt_out->append("Error! Could not delete temporary directory: " + tmp_folder);
......@@ -315,6 +318,7 @@ void flasher::flash_device(void)
flashtimer->stop();
ui->btn_quit->setEnabled(true);
ui->actionQuit->setEnabled(true);
ui->txt_out->append("Installation finished...");
break;
default:
break;
......@@ -525,7 +529,6 @@ void flasher::push_files(void)
void flasher::push_files_finished(void) {
ui->txt_out->append("Modules pushed...");
//REBOOT_FASTBOOT
flash_state = REBOOT_FASTBOOT;
}
......@@ -561,3 +564,70 @@ void PushWorker::set_abstemppath(QString str)
{
abstemppath = str;
}
int flasher::reboot_fastboot(void)
{
ui->txt_out->append("Rebooting device to fastboot...");
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/adb -s " + snr + " reboot-bootloader" );
#endif
#ifdef Q_WS_MAC
p.start( "tools/adb-mac -s " + snr + " reboot-bootloader" );
#endif
#ifdef Q_WS_WIN
p.start( "tools\\adb.exe -s " + snr + " reboot-bootloader" );
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
return FLASH_BOOTIMG;
}
int flasher::flash_boot(void)
{
ui->txt_out->append("Flashing boot.img...");
QDirIterator it(QString(abstemppath), QDirIterator::Subdirectories);
while (it.hasNext()) {
if (it.next().contains("boot.img") && !it.next().isEmpty()) {
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/fastboot -d " + device + " flash boot " + it.next());
#endif
#ifdef Q_WS_MAC
p.start( "tools/fastboot-mac -d " + device + " flash boot " + it.next());
#endif
#ifdef Q_WS_WIN
p.start( "tools\\fastboot.exe -d " + device + " flash boot " + it.next());
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
}
}
ui->txt_out->append("boot.img flashed...");
ui->txt_out->append("Rebooting device...");
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/fastboot -d " + device + " reboot");
#endif
#ifdef Q_WS_MAC
p.start( "tools/fastboot-mac -d " + device + " reboot");
#endif
#ifdef Q_WS_WIN
p.start( "tools\\fastboot.exe -d " + device + " reboot");
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
return RELEASE_CONTROLS;
}
......@@ -76,6 +76,8 @@ private slots:
void push_files(void);
bool extract_zip(const QString&, const QString&, const QString&);
bool rmdir_recursive(const QString&);
int reboot_fastboot(void);
int flash_boot(void);
};
class PushWorker : public QThread {
......
/****************************************************************************
** Meta object code from reading C++ file 'detect.h'
**
** Created: Mon Jul 2 10:15:14 2012
** Created: Mon Jul 2 10:30:39 2012
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** Meta object code from reading C++ file 'dragons.h'
**
** Created: Mon Jul 2 10:15:13 2012
** Created: Mon Jul 2 10:30:37 2012
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** Meta object code from reading C++ file 'flasher.h'
**
** Created: Mon Jul 2 10:15:16 2012
** Created: Mon Jul 2 10:30:40 2012
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
......@@ -23,7 +23,7 @@ static const uint qt_meta_data_flasher[] = {
4, // revision
0, // classname
0, 0, // classinfo
13, 14, // methods
15, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
......@@ -44,6 +44,8 @@ static const uint qt_meta_data_flasher[] = {
211, 8, 8, 8, 0x08,
232, 229, 224, 8, 0x08,
269, 8, 224, 8, 0x08,
294, 8, 168, 8, 0x08,
312, 8, 168, 8, 0x08,
0 // eod
};
......@@ -56,7 +58,8 @@ static const char qt_meta_stringdata_flasher[] = {
"push_files_finished()\0int\0extract()\0"
"detect_device()\0get_booted()\0push_files()\0"
"bool\0,,\0extract_zip(QString,QString,QString)\0"
"rmdir_recursive(QString)\0"
"rmdir_recursive(QString)\0reboot_fastboot()\0"
"flash_boot()\0"
};
const QMetaObject flasher::staticMetaObject = {
......@@ -106,9 +109,13 @@ int flasher::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 12: { bool _r = rmdir_recursive((*reinterpret_cast< const QString(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 13: { int _r = reboot_fastboot();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 14: { int _r = flash_boot();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
default: ;
}
_id -= 13;
_id -= 15;
}
return _id;
}
......
/****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created: Mon Jul 2 10:15:11 2012
** Created: Mon Jul 2 10:30:35 2012
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
......
/****************************************************************************
** Meta object code from reading C++ file 'openfile.h'
**
** Created: Mon Jul 2 10:15:17 2012
** Created: Mon Jul 2 10:30:42 2012
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment