Skip to content

Commit

Permalink
bootmenutimeout delays sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
procount committed Sep 28, 2018
1 parent 70e1a0d commit bb98e24
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
42 changes: 25 additions & 17 deletions recovery/bootselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ extern "C" {

extern CecListener * cec;

BootSelectionDialog::BootSelectionDialog(const QString &drive, const QString &defaultPartition, bool stickyBoot, bool dsi, QWidget *parent) :
BootSelectionDialog::BootSelectionDialog(
const QString &drive, //PINN drive where boot partitions are stored for DSI mod
const QString &defaultPartition, //Could be provided on cmdline. Only used if no previoous OS had been used.
bool stickyBoot, //Use Stickyboot i.e. when NOT going through recovery menu
bool dsi, //Adapt config.txt according to fitted monitor
QWidget *parent) :
QDialog(parent),
_countdown(11),
_dsi(dsi),
Expand Down Expand Up @@ -125,6 +130,20 @@ BootSelectionDialog::BootSelectionDialog(const QString &drive, const QString &de
#endif
}

//Check for bootmenutimeout override (default==11)
QStringList args = cmdline.split(QChar(' '),QString::SkipEmptyParts);
foreach (QString s, args)
{
if (s.contains("bootmenutimeout"))
{
stickyBoot=false;
QStringList params = s.split(QChar('='));
_countdown = params.at(1).toInt() +1;
}
}



if (ui->list->count() != 0)
{
// If default boot partition set then boot to that after 5 seconds
Expand All @@ -138,18 +157,6 @@ BootSelectionDialog::BootSelectionDialog(const QString &drive, const QString &de
{
cec->clearKeyPressed();

//Check for bootmenutimeout override (default==11)
QString cmdline = getFileContents("/proc/cmdline");
QStringList args = cmdline.split(QChar(' '),QString::SkipEmptyParts);
foreach (QString s, args)
{
if (s.contains("bootmenutimeout"))
{
QStringList params = s.split(QChar('='));
_countdown = params.at(1).toInt() +1;
}
}

// Start timer
qDebug() << "Starting " << _countdown-1 << " second timer before booting into partition" << partition;

Expand Down Expand Up @@ -209,7 +216,7 @@ BootSelectionDialog::~BootSelectionDialog()
delete ui;
}

void BootSelectionDialog::bootPartition()
void BootSelectionDialog::bootPartition() //Boots whatever partition is set in default_partition_to_boot
{
QSettings settings("/settings/noobs.conf", QSettings::IniFormat, this);
QByteArray partition = settings.value("default_partition_to_boot", 800).toByteArray();
Expand All @@ -227,10 +234,11 @@ void BootSelectionDialog::accept()
return;

QSettings settings("/settings/noobs.conf", QSettings::IniFormat, this);

QVariantMap m = item->data(Qt::UserRole).toMap();
QByteArray partition = m.value("partitions").toList().first().toByteArray();

int partitionNr = extractPartitionNumber(partition);
int partitionNr = extractPartitionNumber(partition); //Handle the int/hex partition number issue

int oldpartitionNr = settings.value("default_partition_to_boot", 0).toInt();

Expand All @@ -243,7 +251,7 @@ void BootSelectionDialog::accept()
QProcess::execute("mount -o remount,ro /settings");
}

/* Identify if any sticky checks have been set */
/* Identify if any sticky checks have been set or changed */
int count = ui->list->count();
int stickyBoot = 800;
for (int i=0; i<count; i++)
Expand Down Expand Up @@ -358,7 +366,7 @@ void BootSelectionDialog::countdown(int count)

void BootSelectionDialog::countdownExpired()
{
bootPartition();
QTimer::singleShot(1, this, SLOT(accept()));
}

void BootSelectionDialog::updateConfig4dsi(QByteArray partition)
Expand Down
2 changes: 1 addition & 1 deletion recovery/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_H

/* Version number displayed in the title bar */
#define VERSION_NUMBER "2.8.5.4"
#define VERSION_NUMBER "2.8.5.4b"

/* Color of the background */
// #define BACKGROUND_COLOR Qt::white
Expand Down

0 comments on commit bb98e24

Please sign in to comment.