mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 07:12:08 +02:00
Merge branch 'master' into 'master'
Add a 100ms delay before PWRKEY sequence See merge request mobian1/devices/eg25-manager!11
This commit is contained in:
@@ -3,6 +3,9 @@ need_libusb = true
|
||||
usb_vid = 0x2c7c
|
||||
usb_pid = 0x0125
|
||||
|
||||
# Delay between setting GPIO and PWRKEY sequence, set in microseconds
|
||||
poweron_delay = 100000
|
||||
|
||||
# Uncomment the following if you need to change the modem detection timeout on
|
||||
# resume and/or the time during which suspend is blocked after modem boot
|
||||
#[suspend]
|
||||
|
@@ -3,6 +3,9 @@ need_libusb = true
|
||||
usb_vid = 0x2c7c
|
||||
usb_pid = 0x0125
|
||||
|
||||
# Delay between setting GPIO and PWRKEY sequence, set in microseconds
|
||||
poweron_delay = 100000
|
||||
|
||||
# Uncomment the following if you need to change the modem detection timeout on
|
||||
# resume and/or the time during which suspend is blocked after modem boot
|
||||
#[suspend]
|
||||
|
@@ -1,3 +1,7 @@
|
||||
[manager]
|
||||
# Delay between setting GPIO and PWRKEY sequence, set in microseconds
|
||||
poweron_delay = 100000
|
||||
|
||||
# Uncomment the following if you need to change the modem detection timeout on
|
||||
# resume and/or the time during which suspend is blocked after modem boot
|
||||
#[suspend]
|
||||
|
@@ -88,6 +88,9 @@ static gboolean modem_start(struct EG25Manager *manager)
|
||||
|
||||
if (should_boot) {
|
||||
g_message("Starting modem...");
|
||||
// Modem might crash on boot (especially with worn battery) if we don't delay here
|
||||
if (manager->poweron_delay > 0)
|
||||
g_usleep(manager->poweron_delay);
|
||||
gpio_sequence_poweron(manager);
|
||||
manager->modem_state = EG25_STATE_POWERED;
|
||||
} else {
|
||||
@@ -310,6 +313,17 @@ int main(int argc, char *argv[])
|
||||
toml_value = toml_int_in(toml_manager, "usb_pid");
|
||||
if (toml_value.ok)
|
||||
manager.usb_pid = toml_value.u.i;
|
||||
|
||||
toml_value = toml_int_in(toml_manager, "poweron_delay");
|
||||
if (toml_value.ok) {
|
||||
if (toml_value.u.i >= 0 && toml_value.u.i <= G_MAXULONG) {
|
||||
// Safe to cast into gulong
|
||||
manager.poweron_delay = (gulong) toml_value.u.i;
|
||||
} else {
|
||||
// Changed from initialized default value but not in range
|
||||
g_message("Configured poweron_delay out of range, using default");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
at_init(&manager, toml_table_in(toml_config, "at"));
|
||||
|
@@ -40,6 +40,7 @@ struct EG25Manager {
|
||||
gboolean use_libusb;
|
||||
guint usb_vid;
|
||||
guint usb_pid;
|
||||
gulong poweron_delay;
|
||||
|
||||
int at_fd;
|
||||
guint at_source;
|
||||
|
Reference in New Issue
Block a user