In the IRC, we talked use Powered to take the modem enable/disable actions,
but in fact we always need to powered the modem first else we can't
communicate with the modem anymore. Also when we disable the modem, we set
the Powered state to False, this may lead the device is removed and we can't
enable it again, then I use online interface for disable/enable modem.

Thanks
Arron

>-----Original Message-----
>From: Wang, Arron
>Sent: Friday, December 16, 2011 4:12 PM
>To: [email protected]
>Cc: Wang, Arron
>Subject: [PATCH 2/4] ofono: Enable and disable the modem through online
>interface
>
>---
> plugins/ofono.c |   12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
>diff --git a/plugins/ofono.c b/plugins/ofono.c
>index fbb5191..61d3eff 100644
>--- a/plugins/ofono.c
>+++ b/plugins/ofono.c
>@@ -580,14 +580,14 @@ static void modem_set_online_reply(struct
>modem_data *modem,
>               return;
>       }
>
>-      modem->set_online = FALSE;
>+      modem->set_online = !modem->set_online;
> }
>
>-static int modem_set_online(struct modem_data *modem)
>+static int modem_set_online(struct modem_data *modem, connman_bool_t
>online)
> {
>       DBG("%s", modem->path);
>
>-      modem->set_online = TRUE;
>+      modem->set_online = online;
>
>       return set_property(modem, modem->path,
>                               OFONO_MODEM_INTERFACE,
>@@ -1878,7 +1878,7 @@ static void sim_properties_reply(struct modem_data
>*modem,
>                       update_sim_imsi(modem, imsi);
>
>                       if (modem->online == FALSE) {
>-                              modem_set_online(modem);
>+                              modem_set_online(modem, TRUE);
>                               break;
>                       }
>
>@@ -2337,6 +2337,8 @@ static int modem_enable(struct connman_device
>*device)
>
>       DBG("%s device %p", modem->path, device);
>
>+      modem_set_online(modem, TRUE);
>+
>       return 0;
> }
>
>@@ -2346,6 +2348,8 @@ static int modem_disable(struct connman_device
>*device)
>
>       DBG("%s device %p", modem->path, device);
>
>+      modem_set_online(modem, FALSE);
>+
>       return 0;
> }
>
>--
>1.7.2.2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to