Commit fb836736 authored by Dennis Rassmann's avatar Dennis Rassmann

flasher: push modules

Signed-off-by: Dennis Rassmann's avatarshowp1984 <showp1984@gmail.com>
parent d0be6448
......@@ -21,7 +21,7 @@ dragons::~dragons()
timer->stop();
delete timer;
delete ui;
delete this;
//delete this;
}
void dragons::changeEvent(QEvent *e)
......
......@@ -10,9 +10,15 @@ flasher::flasher(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::flasher)
{
firstcall_push = true;
flashtimer = new QTimer(this);
connect(flashtimer, SIGNAL(timeout()), this, SLOT(flash_device()));
pushtimer = new QTimer(this);
connect(pushtimer, SIGNAL(timeout()), this, SLOT(push_files_timed()));
pushtimer->setSingleShot(true);
list = QStringList() << "" << "" << "" << "" << "" << "" << "";
list2 = QStringList() << "" << "";
list3 = QStringList() << "" << "";
......@@ -37,6 +43,8 @@ flasher::~flasher()
{
flashtimer->stop();
delete flashtimer;
pushtimer->stop();
delete pushtimer;
delete ui;
delete this;
}
......@@ -149,7 +157,6 @@ bool flasher::extract_zip(const QString & filePath, const QString & extDirPath,
QFile out;
QString name;
QString path;
QString temppath;
QString basepath = qApp->applicationDirPath();
QStringList splitpath = QStringList() << "" << "" << "" << "" << "" << "" << "" << "" << "" << "" << "" << "" << "" << "";
......@@ -172,7 +179,7 @@ bool flasher::extract_zip(const QString & filePath, const QString & extDirPath,
splitpath = file.getActualFileName().split("/");
temppath = splitpath.takeLast();
temppath = splitpath.join("/");
path = QString("%1/%2/%3").arg(basepath).arg(extDirPath).arg(temppath);
abstemppath = QString("%1/%2/%3").arg(basepath).arg(extDirPath).arg(temppath);
name = QString("%1/%2/%3").arg(basepath).arg(extDirPath).arg(file.getActualFileName());
if (file.getZipError() != UNZ_OK) {
......@@ -180,9 +187,9 @@ bool flasher::extract_zip(const QString & filePath, const QString & extDirPath,
return false;
}
filedir.setPath(path);
filedir.setPath(abstemppath);
if (!filedir.exists()) {
filedir.mkpath(path);
filedir.mkpath(abstemppath);
}
out.setFileName(name);
......@@ -291,7 +298,7 @@ void flasher::flash_device(void)
ui->bar_flash->setValue(40);
break;
case PUSH_FILES:
flash_state = push_files();
push_files();
ui->bar_flash->setValue(50);
break;
case REBOOT_FASTBOOT:
......@@ -469,23 +476,77 @@ int flasher::get_booted(void) {
return DETECT;
}
int flasher::push_files(void)
void flasher::push_files(void)
{
p.terminate();
p_out = "";
if (firstcall_push) {
firstcall_push = false;
ui->txt_out->append("Grabbing root...");
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/adb -s " + snr + " shell echo lool" );
p.start( "tools/adb -s " + snr + " root");
#endif
#ifdef Q_WS_MAC
p.start( "tools/adb-mac -s " + snr + " shell echo lool" );
p.start( "tools/adb-mac -s " + snr + " root");
#endif
#ifdef Q_WS_WIN
p.start( "tools\\adb.exe -s " + snr + " shell echo lool" );
p.start( "tools\\adb.exe -s " + snr + " root");
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
ui->txt_out->append("Remount /system with r/w...");
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/adb -s " + snr + " remount");
#endif
#ifdef Q_WS_MAC
p.start( "tools/adb-mac -s " + snr + " remount");
#endif
#ifdef Q_WS_WIN
p.start( "tools\\adb.exe -s " + snr + " remount");
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
pushtimer->start(0);
}
}
void flasher::push_files_timed(void)
{
ui->txt_out->append("Searching for modules...");
QDirIterator it(QString(abstemppath), QDirIterator::Subdirectories);
while (it.hasNext()) {
if (it.next().contains(".ko") && !it.next().isEmpty()) {
ui->txt_out->append(it.next());
p.terminate();
p_out = "";
#ifdef Q_WS_X11
p.start( "tools/adb -s " + snr + " push " + it.next() + " /system/lib/modules/");
#endif
#ifdef Q_WS_MAC
p.start( "tools/adb-mac -s " + snr + " push " + it.next() + " /system/lib/modules/");
#endif
#ifdef Q_WS_WIN
p.start( "tools\\adb.exe -s " + snr + " push " + it.next() + " /system/lib/modules/");
#endif
p.waitForFinished(-1);
p_out = p.readAllStandardOutput();
if (!p_out.isEmpty()) {
ui->txt_out->append(p_out);
}
}
}
return RELEASE_CONTROLS;
ui->txt_out->append("Modules pushed...");
//REBOOT_FASTBOOT
flash_state = RELEASE_CONTROLS;
}
......@@ -41,10 +41,12 @@ private:
Ui::flasher *ui;
Info *infowind;
QTimer *flashtimer;
QTimer *pushtimer;
QTextCursor c;
QProcess p;
bool error;
bool firstcall;
bool firstcall_push;
int flash_state;
int type;
QStringList list;
......@@ -58,6 +60,7 @@ private:
QString filename;
QString filepath;
QString tmp_folder;
QString abstemppath;
private slots:
void on_txt_out_textChanged();
......@@ -66,10 +69,11 @@ private slots:
void on_actionInfo_triggered();
void on_actionQuit_triggered();
void flash_device(void);
void push_files_timed(void);
int extract(void);
int detect_device(void);
int get_booted(void);
int push_files(void);
void push_files(void);
bool extract_zip(const QString&, const QString&, const QString&);
bool rmdir_recursive(const QString&);
};
......
/****************************************************************************
** Meta object code from reading C++ file 'detect.h'
**
** Created: Mon Jul 2 05:48:37 2012
** Created: Mon Jul 2 07:17:32 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 05:48:36 2012
** Created: Mon Jul 2 07:17:30 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 05:48:39 2012
** Created: Mon Jul 2 07:17:33 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
12, 14, // methods
13, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
......@@ -37,12 +37,13 @@ static const uint qt_meta_data_flasher[] = {
79, 8, 8, 8, 0x08,
105, 8, 8, 8, 0x08,
131, 8, 8, 8, 0x08,
150, 8, 146, 8, 0x08,
160, 8, 146, 8, 0x08,
176, 8, 146, 8, 0x08,
189, 8, 146, 8, 0x08,
210, 207, 202, 8, 0x08,
247, 8, 202, 8, 0x08,
146, 8, 8, 8, 0x08,
169, 8, 165, 8, 0x08,
179, 8, 165, 8, 0x08,
195, 8, 165, 8, 0x08,
208, 8, 8, 8, 0x08,
229, 226, 221, 8, 0x08,
266, 8, 221, 8, 0x08,
0 // eod
};
......@@ -52,9 +53,9 @@ static const char qt_meta_stringdata_flasher[] = {
"on_btn_start_clicked()\0on_btn_quit_clicked()\0"
"on_actionInfo_triggered()\0"
"on_actionQuit_triggered()\0flash_device()\0"
"int\0extract()\0detect_device()\0"
"get_booted()\0push_files()\0bool\0,,\0"
"extract_zip(QString,QString,QString)\0"
"push_files_timed()\0int\0extract()\0"
"detect_device()\0get_booted()\0push_files()\0"
"bool\0,,\0extract_zip(QString,QString,QString)\0"
"rmdir_recursive(QString)\0"
};
......@@ -93,21 +94,21 @@ int flasher::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
case 3: on_actionInfo_triggered(); break;
case 4: on_actionQuit_triggered(); break;
case 5: flash_device(); break;
case 6: { int _r = extract();
case 6: push_files_timed(); break;
case 7: { int _r = extract();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 7: { int _r = detect_device();
case 8: { int _r = detect_device();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 8: { int _r = get_booted();
case 9: { int _r = get_booted();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 9: { int _r = push_files();
if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break;
case 10: { bool _r = extract_zip((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])));
case 10: push_files(); break;
case 11: { bool _r = extract_zip((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 11: { bool _r = rmdir_recursive((*reinterpret_cast< const QString(*)>(_a[1])));
case 12: { bool _r = rmdir_recursive((*reinterpret_cast< const QString(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
default: ;
}
_id -= 12;
_id -= 13;
}
return _id;
}
......
/****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created: Mon Jul 2 05:48:34 2012
** Created: Mon Jul 2 07:17:29 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 05:48:40 2012
** Created: Mon Jul 2 07:17:35 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