iface-modem-location: fix zeroing capabilities on reinitialization
The modem location interface loads modem location capabilities only during the very first initialization of this interface. On each later reinitialization it skips loading these capabilities from modem, however it still goes through the whole interface initialization state machine. This state machine uses its own "ctx->capabilities" field for temporary capabilities storage, which is set to MM_MODEM_LOCATION_SOURCE_NONE at the start of the initialization process. However, if we aren't actually loading modem location capabilities because we're only reinitializing the interface we still need to set this "ctx->capabilities" field to the existing (previously loaded) modem location capabilities. Otherwise the next interface initialization step (validation) will permanently disable the whole location interface.
This commit is contained in:
@@ -1746,6 +1746,7 @@ interface_initialization_step (GTask *task)
|
||||
{
|
||||
MMIfaceModemLocation *self;
|
||||
InitializationContext *ctx;
|
||||
MMModemLocationSource existing_capabilities;
|
||||
|
||||
/* Don't run new steps if we're cancelled */
|
||||
if (g_task_return_error_if_cancelled (task)) {
|
||||
@@ -1765,8 +1766,10 @@ interface_initialization_step (GTask *task)
|
||||
/* Location capabilities value is meant to be loaded only once during
|
||||
* the whole lifetime of the modem. Therefore, if we already have it
|
||||
* loaded, don't try to load it again. */
|
||||
if (!mm_gdbus_modem_location_get_capabilities (ctx->skeleton) &&
|
||||
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_capabilities &&
|
||||
existing_capabilities = mm_gdbus_modem_location_get_capabilities (ctx->skeleton);
|
||||
if (existing_capabilities != MM_MODEM_LOCATION_SOURCE_NONE) {
|
||||
ctx->capabilities = existing_capabilities;
|
||||
} else if (MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_capabilities &&
|
||||
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_capabilities_finish) {
|
||||
MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->load_capabilities (
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user