iface-location: allow enabling without SIM

When the modem is in a failed state because of a SIM-related error,
like a missing SIM, or if the modem is SIM-locked, allow the
Location interface to initialize and be enabled anyway.

This allows someone without a SIM to use the GPS, which does not
particularly require a phone subscription. It also allows
someone with a SIM to use the GPS even if the SIM is still
locked.

This patch was reworked, while keeping the original idea, by:
Aleksander Morgado <aleksander@aleksander.es>

Fixes #183
This commit is contained in:
Raphaël Jakse
2023-12-11 12:37:42 +00:00
committed by Aleksander Morgado
parent 224c04065d
commit 63dd4ad263
5 changed files with 108 additions and 132 deletions
-5
View File
@@ -254,11 +254,6 @@ context_free (void)
static void
ensure_modem_location (void)
{
if (mm_modem_get_state (mm_object_peek_modem (ctx->object)) < MM_MODEM_STATE_ENABLED) {
g_printerr ("error: modem not enabled yet\n");
exit (EXIT_FAILURE);
}
if (!ctx->modem_location) {
g_printerr ("error: modem has no location capabilities\n");
exit (EXIT_FAILURE);