|
|
@ -1,4 +1,3 @@ |
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
#include <unistd.h> |
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <cstdlib> |
|
|
|
#include <cstdlib> |
|
|
@ -11,6 +10,7 @@ |
|
|
|
#include <QTimer> |
|
|
|
#include <QTimer> |
|
|
|
#include <QVBoxLayout> |
|
|
|
#include <QVBoxLayout> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "common/util.h" |
|
|
|
#include "selfdrive/ui/installer/installer.h" |
|
|
|
#include "selfdrive/ui/installer/installer.h" |
|
|
|
#include "selfdrive/ui/qt/util.h" |
|
|
|
#include "selfdrive/ui/qt/util.h" |
|
|
|
#include "selfdrive/ui/qt/qt_window.h" |
|
|
|
#include "selfdrive/ui/qt/qt_window.h" |
|
|
@ -36,14 +36,6 @@ const QString CACHE_PATH = "/data/openpilot.cache"; |
|
|
|
extern const uint8_t str_continue[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_start"); |
|
|
|
extern const uint8_t str_continue[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_start"); |
|
|
|
extern const uint8_t str_continue_end[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_end"); |
|
|
|
extern const uint8_t str_continue_end[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_end"); |
|
|
|
|
|
|
|
|
|
|
|
bool time_valid() { |
|
|
|
|
|
|
|
time_t rawtime; |
|
|
|
|
|
|
|
time(&rawtime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct tm * sys_time = gmtime(&rawtime); |
|
|
|
|
|
|
|
return (1900 + sys_time->tm_year) >= 2020; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void run(const char* cmd) { |
|
|
|
void run(const char* cmd) { |
|
|
|
int err = std::system(cmd); |
|
|
|
int err = std::system(cmd); |
|
|
|
assert(err == 0); |
|
|
|
assert(err == 0); |
|
|
@ -103,7 +95,7 @@ void Installer::updateProgress(int percent) { |
|
|
|
|
|
|
|
|
|
|
|
void Installer::doInstall() { |
|
|
|
void Installer::doInstall() { |
|
|
|
// wait for valid time
|
|
|
|
// wait for valid time
|
|
|
|
while (!time_valid()) { |
|
|
|
while (!util::system_time_valid()) { |
|
|
|
usleep(500 * 1000); |
|
|
|
usleep(500 * 1000); |
|
|
|
qDebug() << "Waiting for valid time"; |
|
|
|
qDebug() << "Waiting for valid time"; |
|
|
|
} |
|
|
|
} |
|
|
|