mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 07:12:08 +02:00
Merge branch 'handle-sim-unlock' into 'master'
gnss: handle locked SIM See merge request mobian1/devices/eg25-manager!25
This commit is contained in:
16
src/gnss.c
16
src/gnss.c
@@ -14,20 +14,30 @@
|
||||
|
||||
static void gnss_step(struct EG25Manager *manager);
|
||||
|
||||
void gnss_upload_assistance_data(struct EG25Manager *manager)
|
||||
gboolean gnss_upload_assistance_data(struct EG25Manager *manager)
|
||||
{
|
||||
if (!manager->gnss_assistance_enabled) {
|
||||
g_message("GNSS assistance is disabled!");
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (manager->gnss_assistance_step < EG25_GNSS_STEP_LAST) {
|
||||
g_warning("GNSS assistance data upload already in process (%d/%d)",
|
||||
manager->gnss_assistance_step, EG25_GNSS_STEP_LAST);
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* ModemManager's Location is only available after unlocking */
|
||||
if(!manager->mm_location) {
|
||||
g_message ("Rescheduling upload since Location interface is not available, in %ds",
|
||||
RESCHEDULE_IN_SECS);
|
||||
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
manager->gnss_assistance_step = EG25_GNSS_STEP_FIRST;
|
||||
gnss_step(manager);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void gnss_init(struct EG25Manager *manager, toml_table_t *config)
|
||||
|
@@ -13,4 +13,4 @@
|
||||
|
||||
void gnss_init(struct EG25Manager *manager, toml_table_t *config);
|
||||
void gnss_destroy(struct EG25Manager *manager);
|
||||
void gnss_upload_assistance_data(struct EG25Manager *manager);
|
||||
gboolean gnss_upload_assistance_data(struct EG25Manager *manager);
|
||||
|
@@ -73,8 +73,8 @@ int gpio_sequence_wake(struct EG25Manager *manager)
|
||||
{
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0);
|
||||
|
||||
/* Give the modem 5ms to wake from soft sleep */
|
||||
usleep(5000);
|
||||
/* Give the modem 200ms to wake from soft sleep */
|
||||
usleep(200000);
|
||||
|
||||
g_message("Executed soft wake sequence");
|
||||
|
||||
|
@@ -32,10 +32,7 @@ static void add_modem(struct EG25Manager *manager, GDBusObject *object)
|
||||
|
||||
g_assert(MM_IS_OBJECT (object));
|
||||
manager->mm_modem = mm_object_get_modem(MM_OBJECT(object));
|
||||
manager->mm_location = mm_object_get_modem_location(MM_OBJECT(object));
|
||||
g_assert_nonnull(manager->mm_modem);
|
||||
g_assert_nonnull(manager->mm_location);
|
||||
|
||||
|
||||
if (manager->modem_state == EG25_STATE_RESUMING) {
|
||||
if (manager->modem_recovery_timer) {
|
||||
@@ -63,6 +60,16 @@ static void add_modem(struct EG25Manager *manager, GDBusObject *object)
|
||||
g_signal_connect(gdbus_modem, "state-changed", G_CALLBACK(state_changed_cb), manager);
|
||||
}
|
||||
|
||||
static void add_modem_location(struct EG25Manager *manager, GDBusObject *object)
|
||||
{
|
||||
const gchar *path;
|
||||
|
||||
path = g_dbus_object_get_object_path(object);
|
||||
g_message("Adding new modem with location capabilities `%s'", path);
|
||||
manager->mm_location = mm_object_get_modem_location(MM_OBJECT(object));
|
||||
g_assert_nonnull(manager->mm_location);
|
||||
}
|
||||
|
||||
static void interface_added_cb (struct EG25Manager *manager,
|
||||
GDBusObject *object,
|
||||
GDBusInterface *interface)
|
||||
@@ -75,6 +82,9 @@ static void interface_added_cb (struct EG25Manager *manager,
|
||||
|
||||
if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM) == 0)
|
||||
add_modem(manager, object);
|
||||
|
||||
if (g_strcmp0(info->name, MM_DBUS_INTERFACE_MODEM_LOCATION) == 0)
|
||||
add_modem_location(manager, object);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user