mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Entire USB stack working
This commit is contained in:
parent
a217545fd6
commit
378b592370
3 changed files with 27 additions and 81 deletions
91
settings.cpp
91
settings.cpp
|
@ -435,76 +435,7 @@ void settings::on_requestLeaseBtn_clicked()
|
|||
|
||||
void settings::on_usbmsBtn_clicked()
|
||||
{
|
||||
string_writeconfig("/tmp/in_usbms", "true");
|
||||
QTimer::singleShot(1500, this, SLOT(brightnessDown()));
|
||||
|
||||
QString umount_prog ("umount");
|
||||
QStringList umount_args;
|
||||
umount_args << "/dev/loop0";
|
||||
QProcess *umount_proc = new QProcess();
|
||||
umount_proc->start(umount_prog, umount_args);
|
||||
umount_proc->waitForFinished();
|
||||
umount_proc->deleteLater();
|
||||
|
||||
QString rmmod ("rmmod");
|
||||
QStringList rmmod_args;
|
||||
rmmod_args << "g_ether.ko";
|
||||
QProcess *rmmod_proc = new QProcess();
|
||||
rmmod_proc->start(rmmod, rmmod_args);
|
||||
rmmod_proc->waitForFinished();
|
||||
rmmod_proc->deleteLater();
|
||||
|
||||
QString prog ("insmod");
|
||||
QStringList args;
|
||||
args << "/external_root/modules/arcotg_udc.ko";
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished();
|
||||
proc->deleteLater();
|
||||
|
||||
QString prog_1 ("insmod");
|
||||
QStringList args_1;
|
||||
args_1 << "/external_root/modules/g_mass_storage.ko" << "file=/external_root/opt/storage/onboard" << "removable=y" << "stall=0";
|
||||
QProcess *proc_1 = new QProcess();
|
||||
proc_1->start(prog_1, args_1);
|
||||
proc_1->waitForFinished();
|
||||
proc_1->deleteLater();
|
||||
|
||||
usbmsWindow = new usbms_splash();
|
||||
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||
usbmsWindow->show();
|
||||
|
||||
QTimer *usbms_t = new QTimer(this);
|
||||
usbms_t->setInterval(1000);
|
||||
connect(usbms_t, &QTimer::timeout, [&]() {
|
||||
QString prog ("mass_storage.sh");
|
||||
QStringList args;
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished();
|
||||
proc->deleteLater();
|
||||
|
||||
QFile modules("/tmp/usbevent");
|
||||
modules.open(QIODevice::ReadWrite);
|
||||
QTextStream in (&modules);
|
||||
const QString content = in.readAll();
|
||||
string contentstr = content.toStdString();
|
||||
modules.close();
|
||||
if(contentstr.find("1") != std::string::npos) {
|
||||
QString reboot_prog ("/sbin/reboot");
|
||||
QStringList reboot_args;
|
||||
reboot_args << "no_splash";
|
||||
QProcess *reboot_proc = new QProcess();
|
||||
reboot_proc->start(reboot_prog, reboot_args);
|
||||
reboot_proc->waitForFinished();
|
||||
reboot_proc->deleteLater();
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
} );
|
||||
usbms_t->start();
|
||||
usbms_launch();
|
||||
}
|
||||
|
||||
// Now I know that QStackedWidgets exist... ;p
|
||||
|
@ -917,3 +848,23 @@ void settings::showToastNative(QString messageToDisplay) {
|
|||
void settings::closeIndefiniteToastNative() {
|
||||
emit closeIndefiniteToast();
|
||||
}
|
||||
|
||||
void settings::usbms_launch()
|
||||
{
|
||||
global::usbms::launchUsbms = true;
|
||||
|
||||
usbmsWindow = new usbms_splash();
|
||||
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
||||
usbmsWindow->show();
|
||||
}
|
||||
|
||||
void settings::quit_restart() {
|
||||
// If existing, cleaning bookconfig_mount mountpoint
|
||||
string_writeconfig("/opt/ibxd", "bookconfig_unmount\n");
|
||||
|
||||
// Restarting InkBox
|
||||
QProcess process;
|
||||
process.startDetached("inkbox", QStringList());
|
||||
qApp->quit();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ private slots:
|
|||
void openUpdateDialogOTA(bool open);
|
||||
void showToastNative(QString messageToDisplay);
|
||||
void closeIndefiniteToastNative();
|
||||
void usbms_launch();
|
||||
void quit_restart();
|
||||
|
||||
signals:
|
||||
void showToast(QString messageToDisplay);
|
||||
|
|
|
@ -76,15 +76,7 @@ void usbms_splash::usbms_launch()
|
|||
QThread::msleep(500);
|
||||
|
||||
string_writeconfig("/opt/ibxd", "usbnet_stop\n");
|
||||
QThread::msleep(200);
|
||||
|
||||
QString prog ("insmod");
|
||||
QStringList args;
|
||||
args << "/external_root/modules/arcotg_udc.ko";
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished();
|
||||
proc->deleteLater();
|
||||
QThread::msleep(1000);
|
||||
|
||||
QString prog_1 ("insmod");
|
||||
QStringList args_1;
|
||||
|
@ -130,10 +122,11 @@ void usbms_splash::usbms_launch()
|
|||
proc->waitForFinished();
|
||||
proc->deleteLater();
|
||||
|
||||
// NOTE: USBNet is only started if required conditions are met (see https://github.com/Kobo-InkBox/rootfs/blob/master/etc/init.d/usbnet.sh)
|
||||
// NOTE: USBNet is only started if required conditions are met (see https://github.com/Kobo-InkBox/rootfs/blob/master/etc/init.d/usbnet)
|
||||
string_writeconfig("/opt/ibxd", "usbnet_start\n");
|
||||
QThread::msleep(1000);
|
||||
string_writeconfig("/opt/ibxd", "onboard_mount\n");
|
||||
QThread::msleep(500);
|
||||
QThread::msleep(1000);
|
||||
|
||||
quit_restart();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue