[PATCH] tests: use memcmp() instead of g_assert_cmpmem() for now

2018-11-07 Thread Ben Chan
g_assert_cmpmem() isn't available until glib 2.46, while the minimum
glib version required by ModemManager is 2.36. This patch replaces the
uses of g_assert_cmpmem() with memcmp() instead.
---
 libmm-glib/tests/test-pco.c  | 3 +--
 plugins/altair/tests/test-modem-helpers-altair-lte.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libmm-glib/tests/test-pco.c b/libmm-glib/tests/test-pco.c
index c25606fc..086ce3ba 100644
--- a/libmm-glib/tests/test-pco.c
+++ b/libmm-glib/tests/test-pco.c
@@ -76,8 +76,7 @@ test_pco_list_add (void)
 pco_data = mm_pco_get_data (pco, _data_size);
 g_assert (pco_data != NULL);
 g_assert_cmpuint (pco_data_size, ==, expected_pco->pco_data_size);
-g_assert_cmpmem (pco_data, pco_data_size,
- expected_pco->pco_data, expected_pco->pco_data_size);
+g_assert_cmpint (memcmp (pco_data, expected_pco->pco_data, 
pco_data_size), ==, 0);
 }
 
 mm_pco_list_free (list);
diff --git a/plugins/altair/tests/test-modem-helpers-altair-lte.c 
b/plugins/altair/tests/test-modem-helpers-altair-lte.c
index ec25e5f8..da9eaf32 100644
--- a/plugins/altair/tests/test-modem-helpers-altair-lte.c
+++ b/plugins/altair/tests/test-modem-helpers-altair-lte.c
@@ -164,8 +164,7 @@ test_parse_vendor_pco_info (void)
 pco_data = mm_pco_get_data (pco, _data_size);
 g_assert (pco_data != NULL);
 g_assert_cmpuint (pco_data_size, ==, good_pco_infos[i].pco_data_size);
-g_assert_cmpmem (pco_data, pco_data_size,
- good_pco_infos[i].pco_data, 
good_pco_infos[i].pco_data_size);
+g_assert_cmpint (memcmp (pco_data, good_pco_infos[i].pco_data, 
pco_data_size), ==, 0);
 g_object_unref (pco);
 }
 
-- 
2.19.1.930.g4563a0d9d0-goog

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


Telit LE910 V2, cdc_ncm and systemd

2018-11-07 Thread Stelling2 Carsten
Hi,

This is the first time I'm using ModemManager.
The type of the modem is Telit LE910 V2 (product ID = 0036), providing cdc_acm, 
and cdc_ncm ports.
I'm working on an embedded system, running kernel version 4.9.26.
The Init-system is systemd version 232.
Actually I've installed MM version 1.6.4 (which comes with Yocto 2.3).

I can successfully establish a connection to the bearer.

The command mmcli -b 0 outputs:

--
Status     |    connected: 'yes'
       |    suspended: 'no'
       |    interface: 'ttyACM0'
       |   IP timeout: '20'
--
Properties     |      apn: ''
   |  roaming: 'allowed'
   |  IP type: 'ipv4'
   |     user: ''
   | password: ''
   |   number: 'none'
   |     user: ''
   |  Rm protocol: 'unknown'
--
IPv4 configuration |   method: 'ppp'
   |  address: 'unknown'
   |   prefix: '0'
   |  gateway: 'unknown'
   |      DNS: 'none'
--
IPv6 configuration |   method: 'unknown'
--
Stats  |      duration: '300'
   |    Bytes received: 'N/A'
   | Bytes transmitted: 'N/A'

If I start my ppp-on script immediately (within the same second) after issuing 
the command mmcli -m 0 -c -b 0, and receiving the message 'successfully 
connected the bearer', the PPP connection can be established, and the 
configured interface ppp0 comes up. The IP connection works fine.

But, when waiting several seconds (5 seconds or more) between mmcli -m 0 -c -b 
0 ('successfully connected the bearer') and starting the ppp-on script, the PPP 
connect attempt always fails. Within /var/log/syslog, I can see the following 
messages:
pppd[493]: pppd 2.4.7 started by root, uid 0
pppd[493]: using channel 1
pppd[493]: Using interface ppp0
pppd[493]: Connect: ppp0 <--> /dev/ttyACM0
pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: sent [LCP ConfReq id=0x1

pppd[493]: LCP timeout sending Config-Requests

In this case, when opening /dev/ttyACM0 with minicom, I can send AT and get 
back OK from the modem. That surprise me. I would expect that ttyACM0 is a 
transparent channel for PPP, and not an AT interface, when successfully 
connected to the bearer. At the same time, I can see MM communicating with the 
modem via ttyACM3 (as expected).

I can't see any dependency to the output of mmcli -b 0 Status IP timeout: '20'. 
Where is this timeout set? Is this the intended behavior of MM or do I miss 
something?

Another question I have, is there a way to automatically configure the wwan0 
(NCM) interface directly, using only systemd mechanisms (no NetworkManager 
involved)? Telit suggests to use the NCM protocol in conjunction with LTE 
connections. Is PPP really a bottleneck for LTE connections?

I've tried
[Match]
Name=wwan0

[Network]
DHCP=ipv4

but this does not work. Most probably, because the modem LE910 V2 does not 
support DHCP (neither QMI or MBIM). ip shows the wwan0 interface, but it is 
neither configured nor up. 
Does anybody have a working systemd configuration or an idea how to achieve 
this (without NetworkManager)?

At least, I miss settings for the PDP context ID to use for a specific bearer. 
With a Vodafone SIM, we have to use a specific PDP context ID to access a 
private APN. Furthermore, the PDP context is different for 2G and 4G. Is this 
an undocumented feature of MM?

Thank you for providing this awesome software.
Any help would be very appreciated.

Best regards,

Carsten

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


Re: [PATCH] broadband-modem-mbim: update ms-basic-connect-extensions naming

2018-11-07 Thread Aleksander Morgado
On Tue, Nov 6, 2018 at 10:40 PM Ben Chan  wrote:
>
> libmbim 1.17.4 (commit 3eeaa4248b98 "ms-basic-connect-extensions: rename
> service") added a MS prefix to the Basic Connectivity Extensions
> service. This patch updates the MMBroadbandModemMbim code accordingly.
> ---

Pushed, thanks

>  configure.ac  |  2 +-
>  src/mm-broadband-modem-mbim.c | 22 +++---
>  2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index f6623eab..964cb523 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -317,7 +317,7 @@ 
> dnl-
>  dnl MBIM support (enabled by default)
>  dnl
>
> -LIBMBIM_VERSION=1.17.3
> +LIBMBIM_VERSION=1.17.4
>
>  AC_ARG_WITH(mbim, AS_HELP_STRING([--without-mbim], [Build without MBIM 
> support]), [], [with_mbim=yes])
>  AM_CONDITIONAL(WITH_MBIM, test "x$with_mbim" = "xyes")
> diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
> index 8f95e60e..4f92a7c0 100644
> --- a/src/mm-broadband-modem-mbim.c
> +++ b/src/mm-broadband-modem-mbim.c
> @@ -2009,9 +2009,9 @@ query_device_services_ready (MbimDevice   *device,
>  service = mbim_uuid_to_service 
> (_services[i]->device_service_id);
>
>  switch (service) {
> -case MBIM_SERVICE_BASIC_CONNECT_EXTENSIONS:
> +case MBIM_SERVICE_MS_BASIC_CONNECT_EXTENSIONS:
>  for (j = 0; j < device_services[i]->cids_count; j++) {
> -if (device_services[i]->cids[j] == 
> MBIM_CID_BASIC_CONNECT_EXTENSIONS_PCO) {
> +if (device_services[i]->cids[j] == 
> MBIM_CID_MS_BASIC_CONNECT_EXTENSIONS_PCO) {
>  mm_dbg ("PCO is supported");
>  self->priv->is_pco_supported = TRUE;
>  break;
> @@ -2754,7 +2754,7 @@ sms_notification (MMBroadbandModemMbim *self,
>  }
>
>  static void
> -basic_connect_extensions_notification_pco (MMBroadbandModemMbim *self,
> +ms_basic_connect_extensions_notification_pco (MMBroadbandModemMbim *self,
> MbimMessage *notification)
>  {
>  MbimPcoValue *pco_value;
> @@ -2762,7 +2762,7 @@ basic_connect_extensions_notification_pco 
> (MMBroadbandModemMbim *self,
>  gchar *pco_data_hex;
>  MMPco *pco;
>
> -if (!mbim_message_basic_connect_extensions_pco_notification_parse (
> +if (!mbim_message_ms_basic_connect_extensions_pco_notification_parse (
>  notification,
>  _value,
>  )) {
> @@ -2796,13 +2796,13 @@ basic_connect_extensions_notification_pco 
> (MMBroadbandModemMbim *self,
>  }
>
>  static void
> -basic_connect_extensions_notification (MMBroadbandModemMbim *self,
> +ms_basic_connect_extensions_notification (MMBroadbandModemMbim *self,
> MbimMessage *notification)
>  {
>  switch (mbim_message_indicate_status_get_cid (notification)) {
> -case MBIM_CID_BASIC_CONNECT_EXTENSIONS_PCO:
> +case MBIM_CID_MS_BASIC_CONNECT_EXTENSIONS_PCO:
>  if (self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_PCO)
> -basic_connect_extensions_notification_pco (self, notification);
> +ms_basic_connect_extensions_notification_pco (self, 
> notification);
>  break;
>  default:
>  /* Ignore */
> @@ -2846,8 +2846,8 @@ device_notification_cb (MbimDevice *device,
>  case MBIM_SERVICE_BASIC_CONNECT:
>  basic_connect_notification (self, notification);
>  break;
> -case MBIM_SERVICE_BASIC_CONNECT_EXTENSIONS:
> -basic_connect_extensions_notification (self, notification);
> +case MBIM_SERVICE_MS_BASIC_CONNECT_EXTENSIONS:
> +ms_basic_connect_extensions_notification (self, notification);
>  break;
>  case MBIM_SERVICE_SMS:
>  sms_notification (self, notification);
> @@ -3083,10 +3083,10 @@ common_enable_disable_unsolicited_events 
> (MMBroadbandModemMbim *self,
>  /* Basic connect extensions service */
>  if (self->priv->enable_flags & PROCESS_NOTIFICATION_FLAG_PCO) {
>  entries[n_entries] = g_new (MbimEventEntry, 1);
> -memcpy (&(entries[n_entries]->device_service_id), 
> MBIM_UUID_BASIC_CONNECT_EXTENSIONS, sizeof (MbimUuid));
> +memcpy (&(entries[n_entries]->device_service_id), 
> MBIM_UUID_MS_BASIC_CONNECT_EXTENSIONS, sizeof (MbimUuid));
>  entries[n_entries]->cids_count = 1;
>  entries[n_entries]->cids = g_new0 (guint32, 1);
> -entries[n_entries]->cids[0] = MBIM_CID_BASIC_CONNECT_EXTENSIONS_PCO;
> +entries[n_entries]->cids[0] = 
> MBIM_CID_MS_BASIC_CONNECT_EXTENSIONS_PCO;
>  n_entries++;
>  }
>
> --
> 2.19.1.930.g4563a0d9d0-goog
>


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list

Re: g_assert_cmpmem and glib 2.46

2018-11-07 Thread Aleksander Morgado
Hey,

> The PCO patches I submitted earlier on used g_assert_cmpmem(), which I
> just realized that it is available in glib 2.46 or later.
> ModemManager requires glib 2.36 or later.   Given that glib 2.45 was
> released about 3 years ago, I wonder if it's time to bump the minimum
> glib version. Otherwise, I can update the code not to use
> g_assert_cmpmem(). WDYT?
>

I keep thinking that we should maintain compatibility with Ubuntu
14.04, which isn't EOL yet. Ubuntu 14.04 has GLib 2.40. Maybe we
should keep the same deps until MM 1.10 is released and then just go
on and bump deps to newer versions. There are a bunch of GLib features
that I wouldn't mind to start using, truth be told...

For this specific patch, I think that we should skip using
g_assert_cmpmem() if possible, or otherwise just #ifdef it under a
GLIB_CHECK_VERSION() check.

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