All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] add set_online interface to he910 modem
@ 2014-12-01 11:35 Alexey Mednyy
  2014-12-02 17:36 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Mednyy @ 2014-12-01 11:35 UTC (permalink / raw)
  To: ofono

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

Had to add set_online interface to he910 modem connman now, working
properly if disable he910 cellular (was not implemented error before).
---
 plugins/he910.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/plugins/he910.c b/plugins/he910.c
index 69362b8..add2243 100644
--- a/plugins/he910.c
+++ b/plugins/he910.c
@@ -322,6 +322,30 @@ static void he910_pre_sim(struct ofono_modem *modem)
        ofono_location_reporting_create(modem, 0, "telitmodem", data->chat);
 }
 
+
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer
user_data)
+{
+        struct cb_data *cbd = user_data;
+        ofono_modem_online_cb_t cb = cbd->cb;
+        struct ofono_error error;
+
+        decode_at_error(&error, g_at_result_final_response(result));
+        cb(&error, cbd->data);
+}
+
+static void he910_set_online(struct ofono_modem *modem, ofono_bool_t
online,
+                                ofono_modem_online_cb_t cb, void
*user_data)
+{
+        struct he910_data *data = ofono_modem_get_data(modem);
+        struct cb_data *cbd = cb_data_new(cb, user_data);
+        char const *command = online ? "AT+CFUN=1,0" : "AT+CFUN=4,0";
+
+        DBG("modem %p %s", modem, online ? "online" : "offline");
+
+        g_at_chat_send(data->chat, command, none_prefix, set_online_cb,
+                                                cbd, g_free);
+}
+
 static void he910_post_online(struct ofono_modem *modem)
 {
        struct he910_data *data = ofono_modem_get_data(modem);
@@ -388,6 +412,7 @@ static struct ofono_modem_driver he910_driver = {
        .enable         = he910_enable,
        .disable        = he910_disable,
        .pre_sim        = he910_pre_sim,
+        .set_online     = he910_set_online,
        .post_online    = he910_post_online,
 };
 
-- 
1.9.1



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

* Re: [PATCH 1/1] add set_online interface to he910 modem
  2014-12-01 11:35 [PATCH 1/1] add set_online interface to he910 modem Alexey Mednyy
@ 2014-12-02 17:36 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2014-12-02 17:36 UTC (permalink / raw)
  To: ofono

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

Hi Alexey,

On 12/01/2014 05:35 AM, Alexey Mednyy wrote:
> Had to add set_online interface to he910 modem connman now, working
> properly if disable he910 cellular (was not implemented error before).
> ---
>   plugins/he910.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>

Please be aware that HE910s are shipped with no support for online mode. 
  It was a feature added by later firmware.  On earlier firmware, the 
HE910 would turn off the SIM when CFUN=4 is sent.  This is obviously not 
what oFono expects.

By now this patch is probably okay to accept as the new firmware is more 
widely available.  However, you might want to double check that your 
firmware is recent enough and is working as expected.

> diff --git a/plugins/he910.c b/plugins/he910.c
> index 69362b8..add2243 100644
> --- a/plugins/he910.c
> +++ b/plugins/he910.c
> @@ -322,6 +322,30 @@ static void he910_pre_sim(struct ofono_modem *modem)
>          ofono_location_reporting_create(modem, 0, "telitmodem", data->chat);
>   }
>
> +
> +static void set_online_cb(gboolean ok, GAtResult *result, gpointer
> user_data)

Please re-read our coding style guidelines in doc/coding-style.txt.  In 
particular, pay attention to indentation rules and how to break up long 
lines (over 80 characters).

Regards,
-Denis

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

end of thread, other threads:[~2014-12-02 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 11:35 [PATCH 1/1] add set_online interface to he910 modem Alexey Mednyy
2014-12-02 17:36 ` 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.