All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] modem: Support modem property "AlwaysOnline"
@ 2013-03-28 21:00 Forest Bond
  2013-04-02  2:43 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Forest Bond @ 2013-03-28 21:00 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]

From: Forest Bond <forest.bond@rapidrollout.com>

This can be set by the modem driver to indicate that the device is
always in the online state when it is enabled.  This is useful for
modem drivers that handle both CDMA and GSM devices.
---
 src/modem.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index 0f12f5a..49913a9 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -595,6 +595,17 @@ static gboolean modem_has_sim(struct ofono_modem *modem)
 	return FALSE;
 }
 
+static gboolean modem_is_always_online(struct ofono_modem *modem)
+{
+	if (modem->driver->set_online == NULL)
+		return TRUE;
+
+	if (ofono_modem_get_boolean(modem, "AlwaysOnline") == TRUE)
+		return TRUE;
+
+	return FALSE;
+}
+
 static void common_online_cb(const struct ofono_error *error, void *data)
 {
 	struct ofono_modem *modem = data;
@@ -702,11 +713,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
 	case OFONO_SIM_STATE_READY:
 		modem_change_state(modem, MODEM_STATE_OFFLINE);
 
-		/*
-		 * If we don't have the set_online method, also proceed
-		 * straight to the online state
-		 */
-		if (modem->driver->set_online == NULL)
+		/* Modem is always online, proceed to online state. */
+		if (modem_is_always_online(modem) == TRUE)
 			set_online(modem, TRUE);
 
 		if (modem->online == TRUE)
@@ -745,7 +753,7 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
 	if (ofono_modem_get_emergency_mode(modem) == TRUE)
 		return __ofono_error_emergency_active(msg);
 
-	if (driver->set_online == NULL)
+	if (modem_is_always_online(modem) == TRUE)
 		return __ofono_error_not_implemented(msg);
 
 	modem->pending = dbus_message_ref(msg);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] modem: Support modem property "AlwaysOnline"
  2013-03-28 21:00 [PATCH 1/2] modem: Support modem property "AlwaysOnline" Forest Bond
@ 2013-04-02  2:43 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2013-04-02  2:43 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

Hi Forest,

On 03/28/2013 04:00 PM, Forest Bond wrote:
> From: Forest Bond<forest.bond@rapidrollout.com>
>
> This can be set by the modem driver to indicate that the device is
> always in the online state when it is enabled.  This is useful for
> modem drivers that handle both CDMA and GSM devices.
> ---
>   src/modem.c |   20 ++++++++++++++------
>   1 files changed, 14 insertions(+), 6 deletions(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-02  2:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 21:00 [PATCH 1/2] modem: Support modem property "AlwaysOnline" Forest Bond
2013-04-02  2:43 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.