[PATCH 1/2] sim-qmi: remove unused variables

2017-08-03 Thread Ben Chan
---
 src/mm-sim-qmi.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/src/mm-sim-qmi.c b/src/mm-sim-qmi.c
index 2ae15147..725e073e 100644
--- a/src/mm-sim-qmi.c
+++ b/src/mm-sim-qmi.c
@@ -480,9 +480,6 @@ dms_uim_verify_pin_ready (QmiClientDms *client,
 {
 QmiMessageDmsUimVerifyPinOutput *output = NULL;
 GError *error = NULL;
-MMSimQmi *self;
-
-self = g_task_get_source_object (task);
 
 output = qmi_client_dms_uim_verify_pin_finish (client, res, );
 if (!output) {
@@ -642,9 +639,6 @@ dms_uim_unblock_pin_ready (QmiClientDms *client,
 {
 QmiMessageDmsUimUnblockPinOutput *output = NULL;
 GError *error = NULL;
-MMSimQmi *self;
-
-self = g_task_get_source_object (task);
 
 output = qmi_client_dms_uim_unblock_pin_finish (client, res, );
 if (!output) {
@@ -812,9 +806,6 @@ dms_uim_change_pin_ready (QmiClientDms *client,
 {
 QmiMessageDmsUimChangePinOutput *output = NULL;
 GError *error = NULL;
-MMSimQmi *self;
-
-self = g_task_get_source_object (task);
 
 output = qmi_client_dms_uim_change_pin_finish (client, res, );
 if (!output) {
@@ -981,9 +972,6 @@ dms_uim_set_pin_protection_ready (QmiClientDms *client,
 {
 QmiMessageDmsUimSetPinProtectionOutput *output = NULL;
 GError *error = NULL;
-MMSimQmi *self;
-
-self = g_task_get_source_object (task);
 
 output = qmi_client_dms_uim_set_pin_protection_finish (client, res, 
);
 if (!output) {
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH v2] location-gps-nmea: fix memory leaks

2017-08-03 Thread Ben Chan
There are potential memory leaks in MMLocationGpsNmea:

- When the `trace' string provided to location_gps_nmea_take_trace() isn't
  added to the hash table, its ownership is still considered transferred.
  It should thus be freed. Similarly, the `trace_type' string isn't
  added the hash table and should thus be freed.

- mm_location_gps_nmea_add_trace() duplicates a given trace string and
  then passes the trace copy to location_gps_nmea_take_trace(). When
  location_gps_nmea_take_trace() returns FALSE, the ownership of the
  copy isn't transferred. mm_location_gps_nmea_add_trace() should thus
  free the copy.

This patch fixes the above memory leaks by having
location_gps_nmea_take_trace() always take the ownership of the `trace'
string and internally free `trace' and `trace_type' when necessary.
---
 libmm-glib/mm-location-gps-nmea.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libmm-glib/mm-location-gps-nmea.c 
b/libmm-glib/mm-location-gps-nmea.c
index 08ec97ff..9b4f9daf 100644
--- a/libmm-glib/mm-location-gps-nmea.c
+++ b/libmm-glib/mm-location-gps-nmea.c
@@ -77,8 +77,10 @@ location_gps_nmea_take_trace (MMLocationGpsNmea *self,
 gchar *trace_type;
 
 i = strchr (trace, ',');
-if (!i || i == trace)
+if (!i || i == trace) {
+g_free (trace);
 return FALSE;
+}
 
 trace_type = g_malloc (i - trace + 1);
 memcpy (trace_type, trace, i - trace);
@@ -96,8 +98,11 @@ location_gps_nmea_take_trace (MMLocationGpsNmea *self,
 gchar *sequence;
 
 /* Skip the trace if we already have it there */
-if (strstr (previous, trace))
+if (strstr (previous, trace)) {
+g_free (trace_type);
+g_free (trace);
 return TRUE;
+}
 
 sequence = g_strdup_printf ("%s%s%s",
 previous,
@@ -222,8 +227,7 @@ mm_location_gps_nmea_new_from_string_variant (GVariant 
*string,
 self = mm_location_gps_nmea_new ();
 
 for (i = 0; split[i]; i++) {
-if (!location_gps_nmea_take_trace (self, split[i]))
-g_free (split[i]);
+location_gps_nmea_take_trace (self, split[i]);
 }
 
 /* Note that the strings in the array of strings were already taken
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH] broadband-modem: fix an ineffective `g_assert (equip_id)'

2017-08-03 Thread Ben Chan
This patch fixes an ineffective `g_assert (equip_id)' in
modem_load_equipment_identifier_finish(). After mm_parse_gsn() succeeds,
`equip_id' is freed but not reset to NULL, so `g_assert (equip_id)' will
never assert even if `imei', `meid', and `esn' are all NULL (though that
shouldn't happen when mm_parse_gsn() succeeds).
---
 src/mm-broadband-modem.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 2bfc3382..3e30aa90 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -901,7 +901,7 @@ modem_load_equipment_identifier_finish (MMIfaceModem *self,
 
 /* Modems put all sorts of things into the GSN response; sanitize it */
 if (mm_parse_gsn (equip_id, , , )) {
-g_free (equip_id);
+g_clear_pointer (_id, g_free);
 
 if (imei)
 equip_id = g_strdup (imei);
@@ -909,11 +909,12 @@ modem_load_equipment_identifier_finish (MMIfaceModem 
*self,
 equip_id = g_strdup (meid);
 else if (esn)
 equip_id = g_strdup (esn);
+else
+g_assert_not_reached ();
+
 g_free (esn);
 g_free (meid);
 g_free (imei);
-
-g_assert (equip_id);
 } else {
 /* Leave whatever the modem returned alone */
 }
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH v2] broadband-modem-qmi: fix potential use-after-freed issues

2017-08-03 Thread Ben Chan
This patch fixes some potential use-after-freed issues in
dms_get_ids_ready(). When an invalid ESN / MEID is retrieved,
`ctx->self->priv->esn' / `ctx->self->priv->meid' is freed but not reset
to NULL. If no IMEI is retrieved, `str' can be set to the already freed
`ctx->self->priv->esn' / `ctx->self->priv->meid' and then propagated to
a GSimpleAsyncResult object.
---
 src/mm-broadband-modem-qmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 38356426..3a04e993 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -1231,7 +1231,7 @@ dms_get_ids_ready (QmiClientDms *client,
 
 if (qmi_message_dms_get_ids_output_get_esn (output, , NULL) &&
 str[0] != '\0') {
-g_free (ctx->self->priv->esn);
+g_clear_pointer (>self->priv->esn, g_free);
 len = strlen (str);
 if (len == 7)
 ctx->self->priv->esn = g_strdup_printf ("0%s", str);  /* zero-pad 
to 8 chars */
@@ -1243,7 +1243,7 @@ dms_get_ids_ready (QmiClientDms *client,
 
 if (qmi_message_dms_get_ids_output_get_meid (output, , NULL) &&
 str[0] != '\0') {
-g_free (ctx->self->priv->meid);
+g_clear_pointer (>self->priv->meid, g_free);
 len = strlen (str);
 if (len == 14)
 ctx->self->priv->meid = g_strdup (str);
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH] mm-broadband-modem-mbim: reprobe on mbim-proxy death

2017-08-03 Thread Eric Caruso
In case mbim-proxy crashes, ModemManager needs to be able to
recognize this and respawn the proxy so we don't lose access
to the modem. Do this by subscribing to the device removal
signal on MbimDevice and reprobing the modem when we lose the
connection to mbim-proxy.

We can't just restart mbim-proxy because the reopened mbim-proxy
will give us a different client ID, and so unsolicitied
notifications will fail and MM otherwise gets very confused.
---
 src/mm-broadband-modem-mbim.c | 104 --
 1 file changed, 100 insertions(+), 4 deletions(-)

diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index c69893f6..33f58302 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -90,6 +90,9 @@ struct _MMBroadbandModemMbimPrivate {
 MbimDataClass highest_available_data_class;

 MbimSubscriberReadyState last_ready_state;
+
+/* For notifying when the mbim-proxy connection is dead */
+gulong mbim_device_removed_id;
 };
 
 /*/
@@ -1583,6 +1586,87 @@ parent_initialization_started (GTask *task)
 }
 
 static void
+mbim_device_removed_disable_ready (MMBaseModem *self,
+   GAsyncResult *res,
+   gpointer unused)
+{
+GError *error = NULL;
+
+if (!mm_base_modem_disable_finish (self, res, )) {
+mm_warn ("Failed to disable modem %s: %s",
+ mm_base_modem_get_device (self), error->message);
+g_error_free (error);
+}
+
+mm_base_modem_set_valid (self, FALSE);
+}
+
+static void
+mbim_device_removed_cb (MbimDevice *device,
+MMBroadbandModemMbim *self)
+{
+/* We have to do a full re-probe here because simply reopening the device
+ * and restarting mbim-proxy will leave us without MBIM notifications. */
+mm_info ("Connection to mbim-proxy for %s lost, reprobing",
+ mbim_device_get_path_display (device));
+
+g_signal_handler_disconnect (device,
+ self->priv->mbim_device_removed_id);
+self->priv->mbim_device_removed_id = 0;
+
+mm_base_modem_set_reprobe (MM_BASE_MODEM (self), TRUE);
+mm_base_modem_disable (MM_BASE_MODEM (self),
+   (GAsyncReadyCallback) 
mbim_device_removed_disable_ready,
+   NULL);
+}
+
+static void
+mbim_device_connect_to_signal (MMPortMbim *mbim,
+   GTask *task)
+{
+MMBroadbandModemMbim *self;
+MbimDevice *device;
+
+self = MM_BROADBAND_MODEM_MBIM (g_task_get_source_object (task));
+device = mm_port_mbim_peek_device (mbim);
+if (device) {
+/* Register removal handler so we can handle mbim-proxy crashes */
+self->priv->mbim_device_removed_id = g_signal_connect (
+device,
+MBIM_DEVICE_SIGNAL_REMOVED,
+G_CALLBACK (mbim_device_removed_cb),
+self);
+} else {
+mm_err ("MBIM port for %s not actually open?",
+mm_port_get_device (MM_PORT (mbim)));
+}
+
+/* Done we are, launch parent's callback */
+parent_initialization_started (task);
+}
+
+static void
+mbim_device_disconnect_from_signal (MMBroadbandModemMbim *self)
+{
+MMPortMbim *mbim;
+MbimDevice *device;
+
+if (self->priv->mbim_device_removed_id == 0)
+return;
+
+mbim = mm_base_modem_peek_port_mbim (MM_BASE_MODEM (self));
+if (!mbim)
+return;
+
+device = mm_port_mbim_peek_device (mbim);
+if (!device)
+return;
+
+g_signal_handler_disconnect (device, self->priv->mbim_device_removed_id);
+self->priv->mbim_device_removed_id = 0;
+}
+
+static void
 mbim_port_open_ready (MMPortMbim *mbim,
   GAsyncResult *res,
   GTask *task)
@@ -1595,8 +1679,9 @@ mbim_port_open_ready (MMPortMbim *mbim,
 return;
 }
 
-/* Done we are, launch parent's callback */
-parent_initialization_started (task);
+/* Make sure we know if mbim-proxy dies on us, and then do the parent's
+ * initialization */
+mbim_device_connect_to_signal (mbim, task);
 }
 
 static void
@@ -1624,8 +1709,9 @@ initialization_started (MMBroadbandModem *self,
 }
 
 if (mm_port_mbim_is_open (ctx->mbim)) {
-/* Nothing to be done, just launch parent's callback */
-parent_initialization_started (task);
+/* Nothing to be done, just connect to a signal and launch parent's
+ * callback */
+mbim_device_connect_to_signal (ctx->mbim, task);
 return;
 }
 
@@ -3167,6 +3253,15 @@ mm_broadband_modem_mbim_init (MMBroadbandModemMbim *self)
 }
 
 static void
+dispose (GObject *object)
+{
+/* Disconnect signal handler for mbim-proxy disappearing, if it exists */
+mbim_device_disconnect_from_signal (MM_BROADBAND_MODEM_MBIM (object));
+
+G_OBJECT_CLASS 

Re: [PATCH] broadband-modem-qmi: fix potential use-after-freed issues

2017-08-03 Thread Dan Williams
On Thu, 2017-08-03 at 13:25 -0700, Ben Chan wrote:
> This patch fixes some potential use-after-freed issues in
> dms_get_ids_ready(). When an invalid ESN / MEID is retrieved,
> `ctx->self->priv->esn' / `ctx->self->priv->meid' is freed but not
> reset
> to NULL. If no IMEI is retrieved, `str' can be set to the already
> freed
> `ctx->self->priv->esn' / `ctx->self->priv->meid' and then propagated
> to
> a GSimpleAsyncResult object.
> ---
>  src/mm-broadband-modem-qmi.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-
> qmi.c
> index 38356426..bd4d2b6c 100644
> --- a/src/mm-broadband-modem-qmi.c
> +++ b/src/mm-broadband-modem-qmi.c
> @@ -1237,8 +1237,10 @@ dms_get_ids_ready (QmiClientDms *client,
>  ctx->self->priv->esn = g_strdup_printf ("0%s", str);  /*
> zero-pad to 8 chars */
>  else if (len == 8)
>  ctx->self->priv->esn = g_strdup (str);
> -else
> +else {
>  mm_dbg ("Invalid ESN reported: '%s' (unexpected
> length)", str);
> +ctx->self->priv->esn = NULL;

i'm tempted to say that just above here we should just do:

g_clear_pointer (>self->priv->esn, g_free);

and the same for MEID.  Then we don't forget some time later if we add
more error paths or something.  I'm a big fan of free-and-clear in one
place.  We could also make a macro/inline for this if we want, like
"mm_clear_pointer()" that just does the above.

Dan

> +}
>  }
>  
>  if (qmi_message_dms_get_ids_output_get_meid (output, , NULL)
> &&
> @@ -1247,8 +1249,10 @@ dms_get_ids_ready (QmiClientDms *client,
>  len = strlen (str);
>  if (len == 14)
>  ctx->self->priv->meid = g_strdup (str);
> -else
> +else {
>  mm_dbg ("Invalid MEID reported: '%s' (unexpected
> length)", str);
> +ctx->self->priv->meid = NULL;
> +}
>  }
>  
>  if (ctx->self->priv->imei)
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] bearer-mbim: avoid accessing invalid session_id and nw_error

2017-08-03 Thread Dan Williams
On Thu, 2017-08-03 at 13:24 -0700, Ben Chan wrote:
> This patch fixes an issue in disconnect_set_ready(). If
> mbim_message_connect_response_parse(), `session_id' and `nw_error'
> are
> not set to a valid value, and thus shouldn't be used.

LGTM; kinda convoluted function, but I can't think of a better way to
do it.

Dan

> ---
>  src/mm-bearer-mbim.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
> index 63bb0579..b6f4bd72 100644
> --- a/src/mm-bearer-mbim.c
> +++ b/src/mm-bearer-mbim.c
> @@ -1119,11 +1119,15 @@ disconnect_set_ready (MbimDevice *device,
>  } else if (g_error_matches (error,
>  MBIM_STATUS_ERROR,
>  MBIM_STATUS_ERROR_CONTEXT_NOT_AC
> TIVATED)) {
> -mm_dbg ("Session ID '%u' already disconnected.",
> session_id);
> +if (parsed_result)
> +mm_dbg ("Session ID '%u' already disconnected.",
> session_id);
> +else
> +mm_dbg ("Session ID '' already
> disconnected.");
> +
>  g_clear_error ();
>  g_clear_error (_error);
>  } else if (g_error_matches (error, MBIM_STATUS_ERROR,
> MBIM_STATUS_ERROR_FAILURE)) {
> -if (nw_error) {
> +if (parsed_result && nw_error != 0) {
>  g_error_free (error);
>  error = mm_mobile_equipment_error_from_mbim_nw_error
> (nw_error);
>  }
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH] huawei: remove redundant call to huawei_parse_auth_type()

2017-08-03 Thread Ben Chan
This patch removes a redundant `encoded_auth = huawei_parse_auth_type (auth)`
in connect_3gpp_context_step().
---
 plugins/huawei/mm-broadband-bearer-huawei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c 
b/plugins/huawei/mm-broadband-bearer-huawei.c
index 175fe5b6..2230e74a 100644
--- a/plugins/huawei/mm-broadband-bearer-huawei.c
+++ b/plugins/huawei/mm-broadband-bearer-huawei.c
@@ -389,7 +389,7 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
 encoded_auth = huawei_parse_auth_type (auth);
 
 /* Default to no authentication if not specified */
-if ((encoded_auth = huawei_parse_auth_type (auth)) == 
MM_BEARER_HUAWEI_AUTH_UNKNOWN)
+if (encoded_auth == MM_BEARER_HUAWEI_AUTH_UNKNOWN)
 encoded_auth = MM_BEARER_HUAWEI_AUTH_NONE;
 
 if (!user && !passwd)
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: ModemManager and Iridium 9522b

2017-08-03 Thread Aleksander Morgado
Hey

>
> I am trying to get my Iridium 9522b modem recognized using mmcli.  It is
> connected on /dev/ttyUSB2 with 19200, 8, N, 1.  I can successfully
> communicate via AT commands through pyserial or minicom, so I'm confident
> that it is functioning.
>
> Below are the scan and list outputs from mmcli as well as lsusb.  The
> usb-serial cable connected to the Iridium is Bus001 Device005.
>
> pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ sudo mmcli -S
> successfully requested to scan devices
> pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ mmcli -L
>
> No modems were found
>
> pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ lsusb
> Bus 001 Device 006: ID 0403:6001 Future Technology Devices International,
> Ltd FT232 USB-Serial (UART) IC
> Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial
> Port
> Bus 001 Device 004: ID 0403:6001 Future Technology Devices International,
> Ltd FT232 USB-Serial (UART) IC
> Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514
> Fast Ethernet Adapter
> Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $
>
> I know that there is a plugin for Iridium modems, specifically this 9522b
> that I am using.  Is there something I need to do to get it to detect it?
>

Can you update the baudrate configuration in the modem itself to be 57600bps?

Also, could you run ModemManager in debug mode to get full debug logs? See:
https://www.freedesktop.org/wiki/Software/ModemManager/Debugging/


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


ModemManager and Iridium 9522b

2017-08-03 Thread Eric Younkin - NOAA Federal
Hello,

I am trying to get my Iridium 9522b modem recognized using mmcli.  It is
connected on /dev/ttyUSB2 with 19200, 8, N, 1.  I can successfully
communicate via AT commands through pyserial or minicom, so I'm confident
that it is functioning.

Below are the scan and list outputs from mmcli as well as lsusb.  The
usb-serial cable connected to the Iridium is Bus001 Device005.

pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ sudo mmcli -S
successfully requested to scan devices
pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ mmcli -L

No modems were found

pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $ lsusb
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International,
Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial
Port
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International,
Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514
Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/ModemManager $

I know that there is a plugin for Iridium modems, specifically this 9522b
that I am using.  Is there something I need to do to get it to detect it?

Thanks,
Eric

-- 
Eric Younkin
Physical Scientist
NOAA OCS, Hydrographic Systems and Technology Branch
1315 East-West Highway
N/CS11, Room 7854
Silver Spring, MD 20910
Office: 301-713-2809 x139
Cell: 828-331-8197
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Sending SMS in PDU mode fails.

2017-08-03 Thread José
I was not register in the network : (

Working now, thanks!

I think I have a different problem with the XBee US version, but I
will let you know if I cannot solve that.

On Thu, Aug 3, 2017 at 1:13 PM, Aleksander Morgado
 wrote:
> On 03/08/17 11:04, José  wrote:
>> I am using the 3G XBee Cellular (uses U-Blox SARA-U200 modem) and
>> ModemManager from master (d41d717112e6a183a0df510c210e80a86fc11060).
>>
>> I am trying to send an SMS with the following commands:
>>
>> $ mmcli -m 0 --messaging-create-sms="text='Hello world',number='+627XX"
>> Successfully created new SMS:
>> /org/freedesktop/ModemManager1/SMS/10 (unknown)
>>
>> $ mmcli -s 10 --send
>> error: couldn't send the SMS:
>> 'GDBus.Error:org.freedesktop.ModemManager1.Error.Message.Unknown:
>> Unknown error'
>>
>>
>> The log shows:
>>
>>  [1501676070.461276]
>> [../../git/src/mm-iface-modem-messaging.c:511] sms_added(): Added
>> local SMS at '/org/freedesktop/ModemManager1/SMS/8'
>>  [1501676078.360084] [../../git/src/mm-base-sms.c:178]
>> generate_3gpp_submit_pdus():   Processing chunk '0' of text with '11'
>> bytes
>>  [1501676078.371070] [../../git/src/mm-base-sms.c:208]
>> generate_3gpp_submit_pdus(): Created SMS part for singlepart SMS
>>  [1501676078.374057] [../../git/src/mm-sms-part-3gpp.c:805]
>> mm_sms_part_3gpp_get_submit_pdu(): Creating PDU for part...
>>  [1501676078.377048] [../../git/src/mm-sms-part-3gpp.c:892]
>> mm_sms_part_3gpp_get_submit_pdu():   using GSM7 encoding...
>>  [1501676078.379982] [../../git/src/mm-sms-part-3gpp.c:957]
>> mm_sms_part_3gpp_get_submit_pdu():   user data length is '11' septets
>> (without UDH)
>>  [1501676078.382961] [../../git/src/mm-port-serial.c:1250]
>> mm_port_serial_open(): (ttymxc4) device open count is 2 (open)
>>  [1501676078.386006] [../../git/src/mm-port-serial-at.c:459]
>> debug_log(): (ttymxc4): --> 'AT+CMGS=22'
>>  [1501676078.431257] [../../git/src/mm-port-serial-at.c:459]
>> debug_log(): (ttymxc4): <-- '> '
>>  [1501676078.435569] [../../git/src/mm-port-serial.c:1250]
>> mm_port_serial_open(): (ttymxc4) device open count is 3 (open)
>>  [1501676078.438554] [../../git/src/mm-port-serial.c:1307]
>> _close_internal(): (ttymxc4) device open count is 2 (close)
>>  [1501676078.441551] [../../git/src/mm-port-serial-at.c:459]
>> debug_log(): (ttymxc4): -->
>> '00010009912637F10BC8329BFD06DDDF723619\26'
>>  [1501676078.573891] [../../git/src/mm-port-serial-at.c:459]
>> debug_log(): (ttymxc4): <-- '+CMS ERROR: 38'
>>  [1501676078.597195] [../../git/src/mm-error-helpers.c:218]
>> mm_message_error_for_code(): Invalid message error code: 38
>>  [1501676078.600884] [../../git/src/mm-serial-parsers.c:364]
>> mm_serial_parser_v1_parse(): Got failure code 500: Unknown error
>>  [1501676078.604622] [../../git/src/mm-port-serial.c:1307]
>> _close_internal(): (ttymxc4) device open count is 1 (close)
>>
>> However if I use a serial console and the following AT commands, the
>> SMS is properly sent:
>>
>> ATZ
>> OK
>> AT+CMGF=1
>> OK
>> AT+CMGS="+627XX"
>>> Hello world
>> +CMGS: 193
>>
>> OK
>>
>>
>> a) Could you give any information about why is PDU mode failing?
>> According to U-Blox documentation (1) it should be working
>>
>
> I'm assuming that if you send the PDU manually using a serial console it also 
> doesn't work, did you try that?
> +CMS error 38 is "Network out of order", but I'm not sure why text mode would 
> work without error while PDU mode gives error 38.
>
>> b) Is there a way to tell ModemManager to use text mode when sending SMSs?
>
> No; text mode is only used by default when PDU mode isn't supported. PDU mode 
> is always preferred really.
>
> Also, which are your SMSC settings? E.g.:
>   AT+CSCA?
>
> --
> Aleksander
> https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] altair-lte: don't use send-delay=0

2017-08-03 Thread Aleksander Morgado
On Thu, Aug 3, 2017 at 4:24 PM, Ben Chan  wrote:
>
>
> On Aug 3, 2017 3:35 AM, "Aleksander Morgado" 
> wrote:
>
> On 02/08/17 07:16, Ben Chan wrote:
>> As observed on some modems, send-delay=0 seems to break port probing.
>> ---
>>  plugins/altair/mm-plugin-altair-lte.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>
> But the port probing with send delay 0 here should only happen when the
> Altair LTE modem is the one being probed. Does this mean this modem
> (0x216f:0x0047) doesn't like send-delay 0?
>
>
>  I tested on two variants of the modem (same chipset, same VID:PID,
> different modules; both support LTE band 13, one also supports band 4). The
> newer one, which supports band 4+13,  doesn't like send-delay 0 :(
>

Could you clarify that in the commit message? I think it would be
valuable for future reference.


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] altair-lte: don't use send-delay=0

2017-08-03 Thread Ben Chan
On Aug 3, 2017 3:35 AM, "Aleksander Morgado" 
wrote:

On 02/08/17 07:16, Ben Chan wrote:
> As observed on some modems, send-delay=0 seems to break port probing.
> ---
>  plugins/altair/mm-plugin-altair-lte.c | 1 -
>  1 file changed, 1 deletion(-)
>

But the port probing with send delay 0 here should only happen when the
Altair LTE modem is the one being probed. Does this mean this modem
(0x216f:0x0047) doesn't like send-delay 0?


 I tested on two variants of the modem (same chipset, same VID:PID,
different modules; both support LTE band 13, one also supports band 4). The
newer one, which supports band 4+13,  doesn't like send-delay 0 :(


> diff --git a/plugins/altair/mm-plugin-altair-lte.c
b/plugins/altair/mm-plugin-altair-lte.c
> index 2338502b..7f6a7c0b 100644
> --- a/plugins/altair/mm-plugin-altair-lte.c
> +++ b/plugins/altair/mm-plugin-altair-lte.c
> @@ -83,7 +83,6 @@ mm_plugin_create (void)
>MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
>MM_PLUGIN_ALLOWED_SINGLE_AT,   TRUE,
>MM_PLUGIN_SEND_LF, TRUE,
> -  MM_PLUGIN_SEND_DELAY,  0,
>NULL));
>  }
>
>


--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Sending SMS in PDU mode fails.

2017-08-03 Thread Aleksander Morgado
On 03/08/17 11:04, José  wrote:
> I am using the 3G XBee Cellular (uses U-Blox SARA-U200 modem) and
> ModemManager from master (d41d717112e6a183a0df510c210e80a86fc11060).
> 
> I am trying to send an SMS with the following commands:
> 
> $ mmcli -m 0 --messaging-create-sms="text='Hello world',number='+627XX"
> Successfully created new SMS:
> /org/freedesktop/ModemManager1/SMS/10 (unknown)
> 
> $ mmcli -s 10 --send
> error: couldn't send the SMS:
> 'GDBus.Error:org.freedesktop.ModemManager1.Error.Message.Unknown:
> Unknown error'
> 
> 
> The log shows:
> 
>  [1501676070.461276]
> [../../git/src/mm-iface-modem-messaging.c:511] sms_added(): Added
> local SMS at '/org/freedesktop/ModemManager1/SMS/8'
>  [1501676078.360084] [../../git/src/mm-base-sms.c:178]
> generate_3gpp_submit_pdus():   Processing chunk '0' of text with '11'
> bytes
>  [1501676078.371070] [../../git/src/mm-base-sms.c:208]
> generate_3gpp_submit_pdus(): Created SMS part for singlepart SMS
>  [1501676078.374057] [../../git/src/mm-sms-part-3gpp.c:805]
> mm_sms_part_3gpp_get_submit_pdu(): Creating PDU for part...
>  [1501676078.377048] [../../git/src/mm-sms-part-3gpp.c:892]
> mm_sms_part_3gpp_get_submit_pdu():   using GSM7 encoding...
>  [1501676078.379982] [../../git/src/mm-sms-part-3gpp.c:957]
> mm_sms_part_3gpp_get_submit_pdu():   user data length is '11' septets
> (without UDH)
>  [1501676078.382961] [../../git/src/mm-port-serial.c:1250]
> mm_port_serial_open(): (ttymxc4) device open count is 2 (open)
>  [1501676078.386006] [../../git/src/mm-port-serial-at.c:459]
> debug_log(): (ttymxc4): --> 'AT+CMGS=22'
>  [1501676078.431257] [../../git/src/mm-port-serial-at.c:459]
> debug_log(): (ttymxc4): <-- '> '
>  [1501676078.435569] [../../git/src/mm-port-serial.c:1250]
> mm_port_serial_open(): (ttymxc4) device open count is 3 (open)
>  [1501676078.438554] [../../git/src/mm-port-serial.c:1307]
> _close_internal(): (ttymxc4) device open count is 2 (close)
>  [1501676078.441551] [../../git/src/mm-port-serial-at.c:459]
> debug_log(): (ttymxc4): -->
> '00010009912637F10BC8329BFD06DDDF723619\26'
>  [1501676078.573891] [../../git/src/mm-port-serial-at.c:459]
> debug_log(): (ttymxc4): <-- '+CMS ERROR: 38'
>  [1501676078.597195] [../../git/src/mm-error-helpers.c:218]
> mm_message_error_for_code(): Invalid message error code: 38
>  [1501676078.600884] [../../git/src/mm-serial-parsers.c:364]
> mm_serial_parser_v1_parse(): Got failure code 500: Unknown error
>  [1501676078.604622] [../../git/src/mm-port-serial.c:1307]
> _close_internal(): (ttymxc4) device open count is 1 (close)
> 
> However if I use a serial console and the following AT commands, the
> SMS is properly sent:
> 
> ATZ
> OK
> AT+CMGF=1
> OK
> AT+CMGS="+627XX"
>> Hello world
> +CMGS: 193
> 
> OK
> 
> 
> a) Could you give any information about why is PDU mode failing?
> According to U-Blox documentation (1) it should be working
> 

I'm assuming that if you send the PDU manually using a serial console it also 
doesn't work, did you try that?
+CMS error 38 is "Network out of order", but I'm not sure why text mode would 
work without error while PDU mode gives error 38.

> b) Is there a way to tell ModemManager to use text mode when sending SMSs?

No; text mode is only used by default when PDU mode isn't supported. PDU mode 
is always preferred really.

Also, which are your SMSC settings? E.g.:
  AT+CSCA?

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] huawei: ensure MMBearerConnectResult populated into GSimpleAsyncResult

2017-08-03 Thread Aleksander Morgado
On 02/08/17 02:01, Ben Chan wrote:
> During the CONNECT_3GPP_CONTEXT_STEP_LAST step,
> connect_3gpp_context_step() conditionally creates and populates a
> MMBearerConnectResult object into the GSimpleAsyncResult object when the
> ipv4_config field of the Connect3gppContext struct is set. That assumes
> the ipv4_config field is always initialized in
> connect_dhcp_check_ready() during the
> CONNECT_3GPP_CONTEXT_STEP_IP_CONFIG step. Instead of having such an
> assumption, this patch modifies connect_3gpp to always initialize
> the ipv4_config field, such that connect_3gpp_context_step() always
> populates a MMBearerConnectResult object into the GSimpleAsyncResult
> object.
> ---

Pushed to git master, thanks.

>  plugins/huawei/mm-broadband-bearer-huawei.c | 20 
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c 
> b/plugins/huawei/mm-broadband-bearer-huawei.c
> index 124b8ed1..175fe5b6 100644
> --- a/plugins/huawei/mm-broadband-bearer-huawei.c
> +++ b/plugins/huawei/mm-broadband-bearer-huawei.c
> @@ -129,10 +129,6 @@ connect_dhcp_check_ready (MMBaseModem *modem,
>  /* Balance refcount */
>  g_object_unref (self);
>  
> -/* Default to automatic/DHCP addressing */
> -ctx->ipv4_config = mm_bearer_ip_config_new ();
> -mm_bearer_ip_config_set_method (ctx->ipv4_config, 
> MM_BEARER_IP_METHOD_DHCP);
> -
>  /* Cache IPv4 details if available, otherwise clients will have to use 
> DHCP */
>  response = mm_base_modem_at_command_full_finish (modem, res, );
>  if (response) {
> @@ -482,14 +478,10 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
>  ctx->self->priv->connect_pending = NULL;
>  
>  /* Setup result */
> -{
> -if (ctx->ipv4_config) {
> -g_simple_async_result_set_op_res_gpointer (
> -ctx->result,
> -mm_bearer_connect_result_new (ctx->data, 
> ctx->ipv4_config, NULL),
> -(GDestroyNotify)mm_bearer_connect_result_unref);
> -}
> -}
> +g_simple_async_result_set_op_res_gpointer (
> +ctx->result,
> +mm_bearer_connect_result_new (ctx->data, ctx->ipv4_config, NULL),
> +(GDestroyNotify)mm_bearer_connect_result_unref);
>  
>  connect_3gpp_context_complete_and_free (ctx);
>  return;
> @@ -540,6 +532,10 @@ connect_3gpp (MMBroadbandBearer *self,
>  /* Get correct dial port to use */
>  ctx->primary = get_dial_port (MM_BROADBAND_MODEM_HUAWEI (ctx->modem), 
> ctx->data, primary);
>  
> +/* Default to automatic/DHCP addressing */
> +ctx->ipv4_config = mm_bearer_ip_config_new ();
> +mm_bearer_ip_config_set_method (ctx->ipv4_config, 
> MM_BEARER_IP_METHOD_DHCP);
> +
>  /* Run! */
>  connect_3gpp_context_step (ctx);
>  }
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] altair-lte: don't use send-delay=0

2017-08-03 Thread Aleksander Morgado
On 02/08/17 07:16, Ben Chan wrote:
> As observed on some modems, send-delay=0 seems to break port probing.
> ---
>  plugins/altair/mm-plugin-altair-lte.c | 1 -
>  1 file changed, 1 deletion(-)
> 

But the port probing with send delay 0 here should only happen when the Altair 
LTE modem is the one being probed. Does this mean this modem (0x216f:0x0047) 
doesn't like send-delay 0?

> diff --git a/plugins/altair/mm-plugin-altair-lte.c 
> b/plugins/altair/mm-plugin-altair-lte.c
> index 2338502b..7f6a7c0b 100644
> --- a/plugins/altair/mm-plugin-altair-lte.c
> +++ b/plugins/altair/mm-plugin-altair-lte.c
> @@ -83,7 +83,6 @@ mm_plugin_create (void)
>MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
>MM_PLUGIN_ALLOWED_SINGLE_AT,   TRUE,
>MM_PLUGIN_SEND_LF, TRUE,
> -  MM_PLUGIN_SEND_DELAY,  0,
>NULL));
>  }
>  
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] libmm-glib,firmware: fix unique_id checks

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> The following checks in mm_modem_firmware_select() and
> mm_modem_firmware_select_sync() could result in a NULL pointer
> dereference if `unique_id' is NULL:
> 
>   g_return_if_fail (unique_id != NULL || unique_id[0] == '\0')
>   g_return_val_if_fail (unique_id != NULL || unique_id[0] == '\0', FALSE)
> 
> This patch fixes the checks to properly verify that `unique_id' is
> neither NULL nor an empty string.
> ---

Pushed to git master, mm-1-6, mm-1-4 and mm-1-2, thanks!

>  libmm-glib/mm-modem-firmware.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libmm-glib/mm-modem-firmware.c b/libmm-glib/mm-modem-firmware.c
> index 0bc6c6bd..734b8959 100644
> --- a/libmm-glib/mm-modem-firmware.c
> +++ b/libmm-glib/mm-modem-firmware.c
> @@ -128,7 +128,7 @@ mm_modem_firmware_select (MMModemFirmware *self,
>gpointer user_data)
>  {
>  g_return_if_fail (MM_IS_MODEM_FIRMWARE (self));
> -g_return_if_fail (unique_id != NULL || unique_id[0] == '\0');
> +g_return_if_fail (unique_id != NULL && unique_id[0] != '\0');
>  
>  mm_gdbus_modem_firmware_call_select (MM_GDBUS_MODEM_FIRMWARE (self), 
> unique_id, cancellable, callback, user_data);
>  }
> @@ -157,7 +157,7 @@ mm_modem_firmware_select_sync (MMModemFirmware *self,
> GError **error)
>  {
>  g_return_val_if_fail (MM_IS_MODEM_FIRMWARE (self), FALSE);
> -g_return_val_if_fail (unique_id != NULL || unique_id[0] == '\0', FALSE);
> +g_return_val_if_fail (unique_id != NULL && unique_id[0] != '\0', FALSE);
>  
>  return mm_gdbus_modem_firmware_call_select_sync (MM_GDBUS_MODEM_FIRMWARE 
> (self), unique_id, cancellable, error);
>  }
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] broadband-modem-mbim: remove unused variable

2017-08-03 Thread Aleksander Morgado
On 03/08/17 09:58, Ben Chan wrote:
> ---
>  src/mm-broadband-modem-mbim.c | 2 --
>  1 file changed, 2 deletions(-)
> 

Pushed to git master, thanks.

> diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
> index 7f5d2fc8..815f5455 100644
> --- a/src/mm-broadband-modem-mbim.c
> +++ b/src/mm-broadband-modem-mbim.c
> @@ -1547,11 +1547,9 @@ parent_initialization_started_ready (MMBroadbandModem 
> *self,
>   GAsyncResult *res,
>   GTask *task)
>  {
> -InitializationStartedContext *ctx;
>  gpointer parent_ctx;
>  GError *error = NULL;
>  
> -ctx = g_task_get_task_data (task);
>  parent_ctx = MM_BROADBAND_MODEM_CLASS 
> (mm_broadband_modem_mbim_parent_class)->initialization_started_finish (
>  self,
>  res,
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] sms-part-cdma: add missing break statements in cause_code_to_delivery_state

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> This patch fixes cause_code_to_delivery_state() by adding two missing
> break statements for the case ERROR_CLASS_TEMPORARY and
> ERROR_CLASS_PERMANENT in the `switch (error_class)` statement. Without
> the break statements, the switch always falls through to the default and
> returns MM_SMS_DELIVERY_STATE_UNKNOWN for an `error_class' of value
> ERROR_CLASS_TEMPORARY or ERROR_CLASS_PERMANENT.
> ---

Pushed to git master, mm-1-6, mm-1-4 and mm-1-2, thanks!

>  src/mm-sms-part-cdma.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/mm-sms-part-cdma.c b/src/mm-sms-part-cdma.c
> index 3aa6b455..8d76bcec 100644
> --- a/src/mm-sms-part-cdma.c
> +++ b/src/mm-sms-part-cdma.c
> @@ -273,8 +273,10 @@ cause_code_to_delivery_state (guint8 error_class,
>  return MM_SMS_DELIVERY_STATE_COMPLETED_RECEIVED;
>  case ERROR_CLASS_TEMPORARY:
>  delivery_state += 0x300;
> +break;
>  case ERROR_CLASS_PERMANENT:
>  delivery_state += 0x200;
> +break;
>  default:
>  return MM_SMS_DELIVERY_STATE_UNKNOWN;
>  }
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH 3/5] call-list: remove unused variables

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> ---
>  src/mm-call-list.c | 15 +--
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 

Pushed to git master, thanks.

> diff --git a/src/mm-call-list.c b/src/mm-call-list.c
> index 9457bb2b..3ca46bcc 100644
> --- a/src/mm-call-list.c
> +++ b/src/mm-call-list.c
> @@ -88,9 +88,8 @@ MMBaseCall* mm_call_list_get_new_incoming(MMCallList *self)
>  {
>  MMBaseCall *call = NULL;
>  GList *l;
> -guint i;
>  
> -for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
> +for (l = self->priv->list; l && !call; l = g_list_next (l)) {
>  
>  MMCallState state;
>  MMCallStateReason   reason;
> @@ -118,9 +117,8 @@ MMBaseCall* 
> mm_call_list_get_first_ringing_call(MMCallList *self)
>  {
>  MMBaseCall *call = NULL;
>  GList *l;
> -guint i;
>  
> -for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
> +for (l = self->priv->list; l && !call; l = g_list_next (l)) {
>  
>  MMCallState state;
>  
> @@ -143,9 +141,8 @@ MMBaseCall* 
> mm_call_list_get_first_outgoing_dialing_call(MMCallList *self)
>  {
>  MMBaseCall *call = NULL;
>  GList *l;
> -guint i;
>  
> -for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
> +for (l = self->priv->list; l && !call; l = g_list_next (l)) {
>  
>  MMCallState state;
>  MMCallDirection direct;
> @@ -170,9 +167,8 @@ MMBaseCall* 
> mm_call_list_get_first_non_terminated_call(MMCallList *self)
>  {
>  MMBaseCall *call = NULL;
>  GList *l;
> -guint i;
>  
> -for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
> +for (l = self->priv->list; l && !call; l = g_list_next (l)) {
>  
>  MMCallState state;
>  
> @@ -193,9 +189,8 @@ gboolean 
> mm_call_list_send_dtmf_to_active_calls(MMCallList *self, gchar *dtmf)
>  {
>  gboolean signaled = FALSE;
>  GList *l;
> -guint i;
>  
> -for (i = 0, l = self->priv->list; l; l = g_list_next (l)) {
> +for (l = self->priv->list; l; l = g_list_next (l)) {
>  
>  MMCallState state;
>  
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH] novatel: avoid calling qcdm_result_unref on NULL QcdmResult

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> ---
>  plugins/novatel/mm-broadband-modem-novatel.c | 1 -
>  1 file changed, 1 deletion(-)
> 

Pushed to git master, thanks.

> diff --git a/plugins/novatel/mm-broadband-modem-novatel.c 
> b/plugins/novatel/mm-broadband-modem-novatel.c
> index 88f0c36d..9c251573 100644
> --- a/plugins/novatel/mm-broadband-modem-novatel.c
> +++ b/plugins/novatel/mm-broadband-modem-novatel.c
> @@ -444,7 +444,6 @@ nw_snapshot_old_ready (MMPortSerialQcdm *port,
>  result = qcdm_cmd_nw_subsys_modem_snapshot_cdma_result ((const gchar *) 
> response->data, response->len, NULL);
>  g_byte_array_unref (response);
>  if (!result) {
> -qcdm_result_unref (result);
>  mm_dbg ("Failed to get QCDM Novatel Modem MSM6500 snapshot: %s", 
> error->message);
>  g_task_return_error (task, error);
>  g_object_unref (task);
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH 4/5] plugin-manager: remove unused variable

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> ---
>  src/mm-plugin-manager.c | 4 
>  1 file changed, 4 deletions(-)
> 

Pushed to git master, thanks.

> diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c
> index 47d162fb..65ccbebf 100644
> --- a/src/mm-plugin-manager.c
> +++ b/src/mm-plugin-manager.c
> @@ -1100,12 +1100,8 @@ device_context_run_port_context (DeviceContext 
> *device_context,
>  static gboolean
>  device_context_min_wait_time_elapsed (DeviceContext *device_context)
>  {
> -MMPluginManager *self;
>  GList   *l;
>  
> -/* Recover plugin manager */
> -self = MM_PLUGIN_MANAGER (device_context->self);
> -
>  device_context->min_wait_time_id = 0;
>  mm_dbg ("[plugin manager] task %s: min wait time elapsed", 
> device_context->name);
>  
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [PATCH 2/5] broadband-modem: remove unused variables

2017-08-03 Thread Aleksander Morgado
On 03/08/17 06:53, Ben Chan wrote:
> ---
>  src/mm-broadband-modem.c | 12 
>  1 file changed, 12 deletions(-)
> 

Pushed to git master, thanks.

> diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
> index eb127b58..2bfc3382 100644
> --- a/src/mm-broadband-modem.c
> +++ b/src/mm-broadband-modem.c
> @@ -1775,7 +1775,6 @@ signal_quality_csq_ready (MMBroadbandModem *self,
>GAsyncResult *res,
>GTask *task)
>  {
> -SignalQualityContext *ctx;
>  GError *error = NULL;
>  GVariant *result;
>  const gchar *result_str;
> @@ -1787,8 +1786,6 @@ signal_quality_csq_ready (MMBroadbandModem *self,
>  return;
>  }
>  
> -ctx = g_task_get_task_data (task);
> -
>  result_str = g_variant_get_string (result, NULL);
>  if (result_str) {
>  /* Got valid reply */
> @@ -1956,7 +1953,6 @@ signal_quality_qcdm_ready (MMPortSerialQcdm *port,
> GAsyncResult *res,
> GTask *task)
>  {
> -SignalQualityContext *ctx;
>  QcdmResult *result;
>  guint32 num = 0, quality = 0, i;
>  gfloat best_db = -28;
> @@ -1971,8 +1967,6 @@ signal_quality_qcdm_ready (MMPortSerialQcdm *port,
>  return;
>  }
>  
> -ctx = g_task_get_task_data (task);
> -
>  /* Parse the response */
>  result = qcdm_cmd_pilot_sets_result ((const gchar *) response->data,
>   response->len,
> @@ -6439,7 +6433,6 @@ list_parts_lock_storages_ready (MMBroadbandModem *self,
>  GAsyncResult *res,
>  GTask *task)
>  {
> -ListPartsContext *ctx;
>  GError *error = NULL;
>  
>  if (!mm_broadband_modem_lock_sms_storages_finish (self, res, )) {
> @@ -6450,8 +6443,6 @@ list_parts_lock_storages_ready (MMBroadbandModem *self,
>  return;
>  }
>  
> -ctx = g_task_get_task_data (task);
> -
>  /* Storage now set and locked */
>  
>  /* Get SMS parts from ALL types.
> @@ -8743,7 +8734,6 @@ enabling_modem_init_ready (MMBroadbandModem *self,
> GAsyncResult *res,
> GTask *task)
>  {
> -EnablingStartedContext *ctx;
>  GError *error = NULL;
>  
>  if (!MM_BROADBAND_MODEM_GET_CLASS (self)->enabling_modem_init_finish 
> (self, res, )) {
> @@ -8752,8 +8742,6 @@ enabling_modem_init_ready (MMBroadbandModem *self,
>  return;
>  }
>  
> -ctx = g_task_get_task_data (task);
> -
>  /* Specify that the modem init was run once */
>  self->priv->modem_init_run = TRUE;
>  
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Sending SMS in PDU mode fails.

2017-08-03 Thread José
I am using the 3G XBee Cellular (uses U-Blox SARA-U200 modem) and
ModemManager from master (d41d717112e6a183a0df510c210e80a86fc11060).

I am trying to send an SMS with the following commands:

$ mmcli -m 0 --messaging-create-sms="text='Hello world',number='+627XX"
Successfully created new SMS:
/org/freedesktop/ModemManager1/SMS/10 (unknown)

$ mmcli -s 10 --send
error: couldn't send the SMS:
'GDBus.Error:org.freedesktop.ModemManager1.Error.Message.Unknown:
Unknown error'


The log shows:

 [1501676070.461276]
[../../git/src/mm-iface-modem-messaging.c:511] sms_added(): Added
local SMS at '/org/freedesktop/ModemManager1/SMS/8'
 [1501676078.360084] [../../git/src/mm-base-sms.c:178]
generate_3gpp_submit_pdus():   Processing chunk '0' of text with '11'
bytes
 [1501676078.371070] [../../git/src/mm-base-sms.c:208]
generate_3gpp_submit_pdus(): Created SMS part for singlepart SMS
 [1501676078.374057] [../../git/src/mm-sms-part-3gpp.c:805]
mm_sms_part_3gpp_get_submit_pdu(): Creating PDU for part...
 [1501676078.377048] [../../git/src/mm-sms-part-3gpp.c:892]
mm_sms_part_3gpp_get_submit_pdu():   using GSM7 encoding...
 [1501676078.379982] [../../git/src/mm-sms-part-3gpp.c:957]
mm_sms_part_3gpp_get_submit_pdu():   user data length is '11' septets
(without UDH)
 [1501676078.382961] [../../git/src/mm-port-serial.c:1250]
mm_port_serial_open(): (ttymxc4) device open count is 2 (open)
 [1501676078.386006] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttymxc4): --> 'AT+CMGS=22'
 [1501676078.431257] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttymxc4): <-- '> '
 [1501676078.435569] [../../git/src/mm-port-serial.c:1250]
mm_port_serial_open(): (ttymxc4) device open count is 3 (open)
 [1501676078.438554] [../../git/src/mm-port-serial.c:1307]
_close_internal(): (ttymxc4) device open count is 2 (close)
 [1501676078.441551] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttymxc4): -->
'00010009912637F10BC8329BFD06DDDF723619\26'
 [1501676078.573891] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttymxc4): <-- '+CMS ERROR: 38'
 [1501676078.597195] [../../git/src/mm-error-helpers.c:218]
mm_message_error_for_code(): Invalid message error code: 38
 [1501676078.600884] [../../git/src/mm-serial-parsers.c:364]
mm_serial_parser_v1_parse(): Got failure code 500: Unknown error
 [1501676078.604622] [../../git/src/mm-port-serial.c:1307]
_close_internal(): (ttymxc4) device open count is 1 (close)

However if I use a serial console and the following AT commands, the
SMS is properly sent:

ATZ
OK
AT+CMGF=1
OK
AT+CMGS="+627XX"
> Hello world
+CMGS: 193

OK


a) Could you give any information about why is PDU mode failing?
According to U-Blox documentation (1) it should be working

b) Is there a way to tell ModemManager to use text mode when sending SMSs?

Thanks


(1) 
https://www.u-blox.com/sites/default/files/u-blox-ATCommands_Manual_(UBX-13002752).pdf
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH] broadband-modem-mbim: remove unused variable

2017-08-03 Thread Ben Chan
---
 src/mm-broadband-modem-mbim.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 7f5d2fc8..815f5455 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -1547,11 +1547,9 @@ parent_initialization_started_ready (MMBroadbandModem 
*self,
  GAsyncResult *res,
  GTask *task)
 {
-InitializationStartedContext *ctx;
 gpointer parent_ctx;
 GError *error = NULL;
 
-ctx = g_task_get_task_data (task);
 parent_ctx = MM_BROADBAND_MODEM_CLASS 
(mm_broadband_modem_mbim_parent_class)->initialization_started_finish (
 self,
 res,
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel