Sure, I didn't see the other error. I'll update the patch<br> <br><br>Il venerdì 24 marzo 2017, Aleksander Morgado <<a href="mailto:aleksander@aleksander.es">aleksander@aleksander.es</a>> ha scritto:<br>> Hey Carlo,<br>><br>> On Fri, Mar 24, 2017 at 12:48 PM, Carlo Lobrano <<a href="mailto:c.lobrano@gmail.com">c.lobrano@gmail.com</a>> wrote:<br>>> Let modem_messaging_set_default_storage returns with error<br>>> if current_sms_mem1_storage is MM_SMS_STORAGE_UNKNOWN<br>>><br>>> ---<br>>><br>>> I updated the patch according the code review, moreover I'd like<br>>> to note a little difference respect the previous version:<br>>><br>>> currently, even if +CPMS fails because of the wrong value for<br>>> mem1, we do store "storage" as the current_sms_mem2_storage value.<br>>><br>>>      self->priv->current_sms_mem2_storage = storage;<br>>><br>>> In this patch I preferred to change this behaviour and setting default<br>>> storage for SMS mem2 only if we are actually going to set<br>>> this value on the modem.<br>>><br>><br>> That is a good change, yes.<br>><br>>> What do you think about it?<br>>><br>><br>> The same issue happens in mm_broadband_modem_lock_sms_storages();<br>> where we may end up using "self->priv->current_sms_mem1_storage"<br>> without checking it is UNKNOWN first. Could you also update that<br>> method with the same logic? i.e. return an error if we end up there<br>> with UNKNOWN in "current_sms_mem1_storage".<br>><br>> Also see comments below.<br>><br>>> ---<br>>>  src/mm-broadband-modem.c       | 29 +++++++++++++++++++----------<br>>>  src/mm-iface-modem-messaging.c |  2 +-<br>>>  2 files changed, 20 insertions(+), 11 deletions(-)<br>>><br>>> diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c<br>>> index 17b3253..0bbf626 100644<br>>> --- a/src/mm-broadband-modem.c<br>>> +++ b/src/mm-broadband-modem.c<br>>> @@ -5590,22 +5590,31 @@ modem_messaging_set_default_storage (MMIfaceModemMessaging *_self,<br>>>      gchar *mem1_str;<br>>>      gchar *mem_str;<br>>><br>>> -    result = g_simple_async_result_new (G_OBJECT (self),<br>>> -                                        callback,<br>>> -                                        user_data,<br>>> -                                        modem_messaging_set_default_storage);<br>>> +    /* We provide the current sms storage for mem1 if not UNKNOWN */<br>>> +    if (self->priv->current_sms_mem1_storage == MM_SMS_STORAGE_UNKNOWN) {<br>>> +        g_simple_async_report_error_in_idle (G_OBJECT (self),<br>>> +                                             callback,<br>>> +                                             user_data,<br>>> +                                             MM_CORE_ERROR,<br>>> +                                             MM_CORE_ERROR_INVALID_ARGS,<br>>> +                                             "Current SMS MEM1 storage is UNKNOWN (SIM busy?)");<br>>> +        return;<br>>> +    }<br>>><br>>>      /* Set defaults as current */<br>>>      self->priv->current_sms_mem2_storage = storage;<br>>><br>>> -    /* We provide the current sms storage for mem1 if not UNKNOWN */<br>>>      mem1_str = g_ascii_strup (mm_sms_storage_get_string (self->priv->current_sms_mem1_storage), -1);<br>>> -<br>>>      mem_str = g_ascii_strup (mm_sms_storage_get_string (storage), -1);<br>>> -    cmd = g_strdup_printf ("+CPMS=\"%s\",\"%s\",\"%s\"",<br>>> -                           mem1_str ? mem1_str : "",<br>>> -                           mem_str,<br>>> -                           mem_str);<br>>> +<br>>> +    cmd = g_strdup_printf ("+CPMS=\"%s\",\"%s\",\"%s\"", mem1_str, mem_str, mem_str);<br>>> +<br>>> +    result = g_simple_async_result_new (G_OBJECT (self),<br>>> +                                        callback,<br>>> +                                        user_data,<br>>> +                                        modem_messaging_set_default_storage);<br>>> +<br>>> +<br>><br>> Just a single whiteline here.<br>><br>>>      mm_base_modem_at_command (MM_BASE_MODEM (self),<br>>>                                cmd,<br>>>                                3,<br>>> diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c<br>>> index 0cff1f2..01a30f0 100644<br>>> --- a/src/mm-iface-modem-messaging.c<br>>> +++ b/src/mm-iface-modem-messaging.c<br>>> @@ -789,7 +789,7 @@ set_default_storage_ready (MMIfaceModemMessaging *self,<br>>>      GError *error = NULL;<br>>><br>>>      if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->set_default_storage_finish (self, res, &error)) {<br>>> -        mm_dbg ("Couldn't set default storage: '%s'", error->message);<br>>> +        mm_warn ("Could not set default storage: '%s'", error->message);<br>>>          g_error_free (error);<br>>>      }<br>>><br>>> --<br>>> 2.9.3<br>>><br>>> _______________________________________________<br>>> ModemManager-devel mailing list<br>>> <a href="mailto:ModemManager-devel@lists.freedesktop.org">ModemManager-devel@lists.freedesktop.org</a><br>>> <a href="https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel">https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel</a><br>><br>><br>><br>> --<br>> Aleksander<br>> <a href="https://aleksander.es">https://aleksander.es</a><br>>