Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."

Today's Topics:

   1. Saved SSID (Mauro Ziliani)
   2. RE: Saved SSID (Ryll, Jan (GED-SDD2))
   3. [PATCH 1/2] ofono: set network name from context name
      (Nicola Lunghi)
   4. [PATCH 2/2] ofono: store context apn value (Nicola Lunghi)


----------------------------------------------------------------------

Date: Tue, 3 Mar 2020 09:59:42 +0100
From: Mauro Ziliani <[email protected]>
Subject: Saved SSID
To: [email protected]
Message-ID: <[email protected]>
Content-Type: multipart/alternative;
        boundary="------------6B1732A52A877477E8ECD5EF"

This is a multi-part message in MIME format.
--------------6B1732A52A877477E8ECD5EF
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi all.

I'm working with Krogoth imx6dl and connmand 1.31 (via DBus)

There is the possibilities to known the list of saved ssid even if they=20
are not "visible"?


Best regards,

 =A0 MZ


--------------6B1732A52A877477E8ECD5EF
Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DISO=
-8859-15">
  </head>
  <body>
    <p><font size=3D"-1">Hi all.</font></p>
    <p><font size=3D"-1">I'm working with Krogoth imx6dl and connmand 1.3=
1
        (via DBus)</font></p>
    <p><font size=3D"-1">There is the possibilities to known the list of
        saved ssid even if they are not "visible"?</font></p>
    <p><font size=3D"-1"><br>
      </font></p>
    <p><font size=3D"-1">Best regards,</font></p>
    <p><font size=3D"-1">=A0 MZ</font><br>
    </p>
  </body>
</html>

--------------6B1732A52A877477E8ECD5EF--

------------------------------

Date: Tue, 3 Mar 2020 09:25:30 +0000
From: "Ryll, Jan (GED-SDD2)" <[email protected]>
Subject: RE: Saved SSID
To: Mauro Ziliani <[email protected]>, "[email protected]"
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: multipart/alternative;
        boundary="_000_c2eab2c89015468c800f61cb99f74a4bbshgcom_"

--_000_c2eab2c89015468c800f61cb99f74a4bbshgcom_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi Mauro,

I've written a patch for deleting unused networks. And there is also a meth=
od to list known networks also if these are not running anymore.
The patch is not applied yet. Try to send the patch in the next months.

Best regards
Jan

From: Mauro Ziliani <[email protected]>
Sent: Tuesday, March 3, 2020 10:00 AM
To: [email protected]
Subject: Saved SSID


Hi all.

I'm working with Krogoth imx6dl and connmand 1.31 (via DBus)

There is the possibilities to known the list of saved ssid even if they are=
 not "visible"?



Best regards,

  MZ

--_000_c2eab2c89015468c800f61cb99f74a4bbshgcom_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml"; xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"DE" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi Mauro,<=
o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp=
;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN=
-US">I&#8217;ve written a patch for deleting unused networks. And there is =
also a method to list known networks also if these are
 not running anymore.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN=
-US">The patch is not applied yet. Try to send the patch in the next months=
.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN=
-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN=
-US">Best regards<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:11.0pt;font-=
family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN=
-US">Jan<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US"><o:p>&nbs=
p;</o:p></span></p>
<div>
<div style=3D"border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm =
0cm 0cm">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:11.0pt;fo=
nt-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang=3D"EN-=
US" style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> =
Mauro Ziliani &lt;[email protected]&gt;
<br>
<b>Sent:</b> Tuesday, March 3, 2020 10:00 AM<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> Saved SSID<o:p></o:p></span></p>
</div>
</div>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p><span style=3D"font-size:10.0pt">Hi all.</span><o:p></o:p></p>
<p><span style=3D"font-size:10.0pt">I'm working with Krogoth imx6dl and con=
nmand 1.31 (via DBus)</span><o:p></o:p></p>
<p><span style=3D"font-size:10.0pt">There is the possibilities to known the=
 list of saved ssid even if they are not &quot;visible&quot;?</span><o:p></=
o:p></p>
<p><o:p>&nbsp;</o:p></p>
<p><span style=3D"font-size:10.0pt">Best regards,</span><o:p></o:p></p>
<p><span style=3D"font-size:10.0pt">&nbsp; MZ</span><o:p></o:p></p>
</div>
</body>
</html>

--_000_c2eab2c89015468c800f61cb99f74a4bbshgcom_--

------------------------------

Date: Tue,  3 Mar 2020 18:27:35 +0000
From: Nicola Lunghi <[email protected]>
Subject: [PATCH 1/2] ofono: set network name from context name
To: connman <[email protected]>
Message-ID: <[email protected]>

previously connman was setting the network name using the netreg Name property
that value doesn't permit to know what context we are connected to.

Set the network name from the context name instead

Signed-off-by: Nicola Lunghi <[email protected]>
---
 plugins/ofono.c | 79 ++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 41 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 82413b6..bb08cfd 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -132,6 +132,7 @@ static GHashTable *context_hash;
 
 struct network_context {
        char *path;
+       char *name;
        int index;
        struct connman_network *network;
 
@@ -293,6 +294,7 @@ static void network_context_unref(struct network_context 
*context)
                return;
 
        g_free(context->path);
+       g_free(context->name);
 
        connman_ipaddress_free(context->ipv4_address);
        g_free(context->ipv4_nameservers);
@@ -1116,7 +1118,10 @@ static void add_network(struct modem_data *modem,
        connman_network_set_string(context->network, "Path",
                                        context->path);
 
-       if (modem->name)
+       /* we try first to use the context name as name, then the modem name */
+       if (context->name)
+               connman_network_set_name(context->network, context->name);
+       else if (modem->name)
                connman_network_set_name(context->network, modem->name);
        else
                connman_network_set_name(context->network, "");
@@ -1152,6 +1157,23 @@ static void remove_network(struct modem_data *modem,
        context->network = NULL;
 }
 
+static int set_context_name(struct network_context *context,
+                               const char *name)
+{
+       if (!context || !name)
+               return -EINVAL;
+
+       g_free(context->name);
+       context->name = g_strdup(name);
+
+       if(!context->name)
+               return -ENOMEM;
+
+       DBG("%s Set context name to %s", context->path, context->name);
+
+       return 0;
+}
+
 static int set_context_ipconfig(struct network_context *context,
                                const char *protocol)
 {
@@ -1199,6 +1221,7 @@ static int add_cm_context(struct modem_data *modem, const 
char *context_path,
        struct network_context *context = NULL;
        dbus_bool_t active = FALSE;
        const char *ip_protocol = NULL;
+       const char *ctx_name = NULL;
 
        DBG("%s context path %s", modem->path, context_path);
 
@@ -1216,7 +1239,13 @@ static int add_cm_context(struct modem_data *modem, 
const char *context_path,
                dbus_message_iter_next(&entry);
                dbus_message_iter_recurse(&entry, &value);
 
-               if (g_str_equal(key, "Type")) {
+               if (g_str_equal(key, "Name") &&
+                       dbus_message_iter_get_arg_type(&value) == 
DBUS_TYPE_STRING ) {
+                       dbus_message_iter_get_basic(&value, &ctx_name);
+
+                       DBG("%s Got Context Name %s", modem->path, ctx_name);
+
+               } else if (g_str_equal(key, "Type")) {
                        dbus_message_iter_get_basic(&value, &context_type);
 
                        DBG("%s context %s type %s", modem->path,
@@ -1259,6 +1288,9 @@ static int add_cm_context(struct modem_data *modem, const 
char *context_path,
                return -EINVAL;
        }
 
+       if (ctx_name)
+               set_context_name(context, ctx_name);
+
        if (ip_protocol)
                set_context_ipconfig(context, ip_protocol);
 
@@ -1571,33 +1603,6 @@ static gboolean cm_context_removed(DBusConnection *conn,
        return TRUE;
 }
 
-static void netreg_update_name(struct modem_data *modem,
-                               DBusMessageIter* value)
-{
-       char *name;
-       GSList *list;
-
-       dbus_message_iter_get_basic(value, &name);
-
-       DBG("%s Name %s", modem->path, name);
-
-       g_free(modem->name);
-       modem->name = g_strdup(name);
-
-       if (!modem->context_list)
-               return;
-
-       /* For all the context */
-       for (list = modem->context_list; list; list = list->next) {
-               struct network_context *context = list->data;
-
-               if (context->network) {
-                       connman_network_set_name(context->network, modem->name);
-                       connman_network_update(context->network);
-               }
-       }
-}
-
 static void netreg_update_strength(struct modem_data *modem,
                                        DBusMessageIter *value)
 {
@@ -1747,9 +1752,7 @@ static gboolean netreg_changed(DBusConnection *conn, 
DBusMessage *message,
        dbus_message_iter_next(&iter);
        dbus_message_iter_recurse(&iter, &value);
 
-       if (g_str_equal(key, "Name"))
-               netreg_update_name(modem, &value);
-       else if (g_str_equal(key, "Strength"))
+       if (g_str_equal(key, "Strength"))
                netreg_update_strength(modem, &value);
        else if (g_str_equal(key, "Status"))
                netreg_update_status(modem, &value);
@@ -1776,9 +1779,7 @@ static void netreg_properties_reply(struct modem_data 
*modem,
                dbus_message_iter_next(&entry);
                dbus_message_iter_recurse(&entry, &value);
 
-               if (g_str_equal(key, "Name"))
-                       netreg_update_name(modem, &value);
-               else if (g_str_equal(key, "Strength"))
+               if (g_str_equal(key, "Strength"))
                        netreg_update_strength(modem, &value);
                else if (g_str_equal(key, "Status"))
                        netreg_update_status(modem, &value);
@@ -1869,9 +1870,7 @@ static gboolean cdma_netreg_changed(DBusConnection *conn,
        dbus_message_iter_next(&iter);
        dbus_message_iter_recurse(&iter, &value);
 
-       if (g_str_equal(key, "Name"))
-               netreg_update_name(modem, &value);
-       else if (g_str_equal(key, "Strength"))
+       if (g_str_equal(key, "Strength"))
                netreg_update_strength(modem, &value);
        else if (g_str_equal(key, "DataStrength"))
                netreg_update_datastrength(modem, &value);
@@ -1901,9 +1900,7 @@ static void cdma_netreg_properties_reply(struct 
modem_data *modem,
                dbus_message_iter_next(&entry);
                dbus_message_iter_recurse(&entry, &value);
 
-               if (g_str_equal(key, "Name"))
-                       netreg_update_name(modem, &value);
-               else if (g_str_equal(key, "Strength"))
+               if (g_str_equal(key, "Strength"))
                        netreg_update_strength(modem, &value);
                else if (g_str_equal(key, "DataStrength"))
                        netreg_update_datastrength(modem, &value);
-- 
2.20.1

------------------------------

Date: Tue,  3 Mar 2020 18:27:37 +0000
From: Nicola Lunghi <[email protected]>
Subject: [PATCH 2/2] ofono: store context apn value
To: connman <[email protected]>
Message-ID: <[email protected]>

Signed-off-by: Nicola Lunghi <[email protected]>
---
 plugins/ofono.c | 60 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 20 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index bb08cfd..e6e8827 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -133,6 +133,8 @@ static GHashTable *context_hash;
 struct network_context {
        char *path;
        char *name;
+       char *apn;
+
        int index;
        struct connman_network *network;
 
@@ -147,7 +149,6 @@ struct network_context {
        int refcount;
 
        bool active;
-       bool valid_apn; /* APN is 'valid' if length > 0 */
 };
 
 struct modem_data {
@@ -295,6 +296,7 @@ static void network_context_unref(struct network_context 
*context)
 
        g_free(context->path);
        g_free(context->name);
+       g_free(context->apn);
 
        connman_ipaddress_free(context->ipv4_address);
        g_free(context->ipv4_nameservers);
@@ -1174,6 +1176,29 @@ static int set_context_name(struct network_context 
*context,
        return 0;
 }
 
+static context_apn_is_valid(struct network_context *context)
+{
+       return ((context!=NULL) &&
+               (context->apn != NULL) &&
+               (strlen(context->apn) > 0));
+}
+
+static int set_context_apn(struct network_context *context, const char 
*apn_name)
+{
+       if (!context || !apn_name)
+               return -EINVAL;
+
+       g_free(context->apn);
+       context->apn = g_strdup(apn_name);
+
+       if(!context->apn)
+               return -ENOMEM;
+
+       DBG("%s Set context apn to %s", context->path, context->name);
+
+       return 0;
+}
+
 static int set_context_ipconfig(struct network_context *context,
                                const char *protocol)
 {
@@ -1222,6 +1247,7 @@ static int add_cm_context(struct modem_data *modem, const 
char *context_path,
        dbus_bool_t active = FALSE;
        const char *ip_protocol = NULL;
        const char *ctx_name = NULL;
+       const char *apn_name = NULL;
 
        DBG("%s context path %s", modem->path, context_path);
 
@@ -1262,16 +1288,10 @@ static int add_cm_context(struct modem_data *modem, 
const char *context_path,
                        dbus_message_iter_get_basic(&value, &active);
 
                        DBG("%s Active %d", modem->path, active);
-               } else if (g_str_equal(key, "AccessPointName")) {
-                       const char *apn;
-
-                       dbus_message_iter_get_basic(&value, &apn);
-                       if (apn && strlen(apn) > 0)
-                               context->valid_apn = true;
-                       else
-                               context->valid_apn = false;
-
-                       DBG("%s AccessPointName '%s'", modem->path, apn);
+               } else if (g_str_equal(key, "AccessPointName") &&
+                       dbus_message_iter_get_arg_type(&value) == 
DBUS_TYPE_STRING ) {
+                       dbus_message_iter_get_basic(&value, &apn_name);
+                       DBG("%s AccessPointName '%s'", modem->path, apn_name);
                }  else if (g_str_equal(key, "Protocol") &&
                        dbus_message_iter_get_arg_type(&value) == 
DBUS_TYPE_STRING ) {
 
@@ -1291,6 +1311,9 @@ static int add_cm_context(struct modem_data *modem, const 
char *context_path,
        if (ctx_name)
                set_context_name(context, ctx_name);
 
+       if (apn_name)
+               set_context_apn(context, apn_name);
+
        if (ip_protocol)
                set_context_ipconfig(context, ip_protocol);
 
@@ -1299,7 +1322,7 @@ static int add_cm_context(struct modem_data *modem, const 
char *context_path,
        modem->context_list = g_slist_prepend(modem->context_list, context);
        g_hash_table_replace(context_hash, g_strdup(context_path), modem);
 
-       if (context->valid_apn && modem->attached &&
+       if (context_apn_is_valid(context) && modem->attached &&
            has_interface(modem->interfaces, OFONO_API_NETREG))
                add_network(modem, context);
 
@@ -1410,15 +1433,14 @@ static gboolean context_changed(DBusConnection *conn,
                else
                        set_disconnected(context);
        } else if (g_str_equal(key, "AccessPointName")) {
-               const char *apn;
+               const char *apn = NULL;
 
                dbus_message_iter_get_basic(&value, &apn);
 
-               DBG("%s AccessPointName %s", modem->path, apn);
-
-               if (apn && strlen(apn) > 0) {
-                       context->valid_apn = true;
+               set_context_apn(context, apn);
 
+               if (context_apn_is_valid(context)) {
+                       DBG("%s AccessPointName %s", modem->path, context->apn);
                        if (context->network)
                                return TRUE;
 
@@ -1434,8 +1456,6 @@ static gboolean context_changed(DBusConnection *conn,
                        if (context->active)
                                set_connected(modem, context);
                } else {
-                       context->valid_apn = false;
-
                        if (!context->network)
                                return TRUE;
 
@@ -1804,7 +1824,7 @@ static void netreg_properties_reply(struct modem_data 
*modem,
        for (list = modem->context_list; list; list = list->next) {
                struct network_context *context = list->data;
 
-               if (context->valid_apn)
+               if (context_apn_is_valid(context))
                        add_network(modem, context);
                if (context->active)
                        set_connected(modem, context);
-- 
2.20.1

------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]


------------------------------

End of connman Digest, Vol 53, Issue 2
**************************************

Reply via email to