Skip to content

Commit

Permalink
Add a simple impl to set boot order
Browse files Browse the repository at this point in the history
  • Loading branch information
Inokinoki committed Jun 27, 2021
1 parent 11c3703 commit 9bc775d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions qefientrystaticlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <QUuid>
#include <iostream>

#include <QDebug>

QByteArray qefi_get_variable(QUuid uuid, QString name);
quint16 qefi_get_variable_uint16(QUuid uuid, QString name);
void qefi_set_variable_uint16(QUuid uuid, QString name, quint16 value);
Expand Down Expand Up @@ -100,3 +103,18 @@ void QEFIEntryStaticList::setBootNext(const quint16 &next)
qefi_set_variable_uint16(QUuid("8be4df61-93ca-11d2-aa0d-00e098032b8c"),
QStringLiteral("BootNext"), next);
}

void QEFIEntryStaticList::setBootOrder(const QList<quint16> &newOrder)
{
// TODO: Maybe do validation
qDebug() << "New order is " << newOrder;

QByteArray orderBuffer(newOrder.size() * 2, 0);
quint16 *p = (quint16 *)orderBuffer.data();
for (int i = 0; i < newOrder.size(); i++, p++) {
*p = newOrder[i];
}
qefi_set_variable(QUuid("8be4df61-93ca-11d2-aa0d-00e098032b8c"),
QStringLiteral("BootOrder"), orderBuffer);
// TODO: Sync the order in this class
}
1 change: 1 addition & 0 deletions qefientrystaticlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class QEFIEntryStaticList
QMap<quint16, QEFIEntry> entries() const;

void setBootNext(const quint16 &next);
void setBootOrder(const QList<quint16> &newOrder);
};

#endif // QEFIENTRYSTATICLIST_H
3 changes: 3 additions & 0 deletions qefientryview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ void QEFIEntryView::resetClicked(bool checked)

void QEFIEntryView::saveClicked(bool checked)
{
qDebug() << "[EFIEntryView] Save button is clicked";
// TODO: Retrieve from m_order, serialize and save them
// TODO: Check if there is any changes
QEFIEntryStaticList::instance()->setBootOrder(m_order);
}

void QEFIEntryView::setCurrentClicked(bool checked)
Expand Down

0 comments on commit 9bc775d

Please sign in to comment.