Enable back USBMS prompt

Really, I could've just checked the battery state to know whether an USB
cable was plugged in...
This commit is contained in:
Nicolas Mailloux 2021-06-29 10:19:21 -04:00
parent 46dd4bd8f0
commit 3e0183a170
4 changed files with 21 additions and 15 deletions

View file

@ -316,11 +316,15 @@ MainWindow::MainWindow(QWidget *parent)
connect(usbmsPrompt, &QTimer::timeout, [&]() {
if(checkconfig("/opt/inkbox_genuine") == true) {
if(global::usbms::showUsbmsDialog != true) {
;
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
if(usbmsStatus != checkconfig_str_val) {
global::usbms::showUsbmsDialog = true;
}
}
else {
string_checkconfig_ro("/sys/devices/platform/fsl-usb2-udc/gadget/suspended");
if(checkconfig_str_val != "0\n") {
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
usbmsStatus = checkconfig_str_val;
if(usbmsStatus != "Charging\n") {
// Loop again...
;
}
@ -335,13 +339,7 @@ MainWindow::MainWindow(QWidget *parent)
;
}
} );
// **** FEATURE WARNING ****
// Due to the fsl-usb2-udc/gadget/suspended 'file' which really only changes after a real plug/unplug of the USB cable, further development on this feature is no longer possible and is abandoned unless a fix is found.
// Problem encontered: it would prompt to connect after a fresh reboot even if no USB cable was plugged in.
//
// usbmsPrompt->start();
//
// **** FEATURE WARNING ****
usbmsPrompt->start();
// We set the brightness level saved in the config file
QTimer::singleShot(2000, this, SLOT(setInitialBrightness()));

View file

@ -42,6 +42,7 @@ public:
bool reboot_after_update = false;
int timerTime = 0;
QString relative_path;
QString usbmsStatus;
void openLowBatteryDialog();
void openCriticalBatteryAlertWindow();

View file

@ -344,10 +344,17 @@ reader::reader(QWidget *parent) :
writeconfig_pagenumber();
}
else {
// Retrieve split_total from tmpfs
string_checkconfig("/tmp/inkboxPageNumber");
split_total = checkconfig_str_val.toInt();
setup_book(book_file, 0, true);
// TEMPORARY [
if(global::reader::bookIsEpub == true) {
quit_restart();
}
// TEMPORARY ]
else {
// Retrieve split_total from tmpfs
string_checkconfig("/tmp/inkboxPageNumber");
split_total = checkconfig_str_val.toInt();
setup_book(book_file, 0, true);
}
}
// Get text; no need to do it multiple times for ePUB books

View file

@ -64,7 +64,7 @@ usbms_splash::usbms_splash(QWidget *parent) :
void usbms_splash::usbms_launch()
{
zeroBrightness();
cinematicBrightness(0, 1);
QString umount_prog ("umount");
QStringList umount_args;