Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH] ifxmodem: Adding fast dormancy support to Infineon modem
@ 2010-11-17 19:29 Robertino Benis
  2010-11-18  3:47 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Robertino Benis @ 2010-11-17 19:29 UTC (permalink / raw)
  To: ofono

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

Initial patch to add fast dormancy to Infineon modem. Timeout is not
supported yet.

Thanks,
-- r.

---
 drivers/ifxmodem/radio-settings.c |   40 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/drivers/ifxmodem/radio-settings.c b/drivers/ifxmodem/radio-settings.c
index 89e97e7..68077db 100644
--- a/drivers/ifxmodem/radio-settings.c
+++ b/drivers/ifxmodem/radio-settings.c
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <errno.h>
 
 #include <glib.h>
@@ -45,6 +46,7 @@ static const char *xrat_prefix[] = { "+XRAT:", NULL };
 
 struct radio_settings_data {
 	GAtChat *chat;
+	uint16_t fast_dormancy;
 };
 
 static void xrat_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -196,12 +198,48 @@ static void ifx_radio_settings_remove(struct ofono_radio_settings *rs)
 	g_free(rsd);
 }
 
+static void update_fast_dormancy(struct radio_settings_data *rsd)
+{
+	char buf[20];
+
+	snprintf(buf, sizeof(buf), "AT+XFDOR=%u", rsd->fast_dormancy);
+
+	if (g_at_chat_send(rsd->chat, buf, NULL, NULL, NULL, NULL) > 0)
+		DBG("3G fast dormancy %s.",
+			rsd->fast_dormancy ? "enabled" : "disabled");
+	else
+		DBG("3G fast dormancy unchanged.");
+}
+
+static void ifx_set_fast_dormancy(struct ofono_radio_settings *rs,
+				int enable,
+				ofono_radio_settings_fast_dormancy_set_cb_t cb,
+				void *data)
+{
+	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+	rsd->fast_dormancy = enable ? 1 : 0;
+	update_fast_dormancy(rsd);
+	CALLBACK_WITH_SUCCESS(cb, data);
+}
+
+static void ifx_query_fast_dormancy(struct ofono_radio_settings *rs,
+			ofono_radio_settings_fast_dormancy_query_cb_t cb,
+			void *data)
+{
+	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+
+	/* there is no read AT command */
+	CALLBACK_WITH_SUCCESS(cb, rsd->fast_dormancy, data);
+}
+
 static struct ofono_radio_settings_driver driver = {
 	.name			= "ifxmodem",
 	.probe			= ifx_radio_settings_probe,
 	.remove			= ifx_radio_settings_remove,
 	.query_rat_mode		= ifx_query_rat_mode,
-	.set_rat_mode		= ifx_set_rat_mode
+	.set_rat_mode		= ifx_set_rat_mode,
+	.query_fast_dormancy	= ifx_query_fast_dormancy,
+	.set_fast_dormancy	= ifx_set_fast_dormancy
 };
 
 void ifx_radio_settings_init()
-- 
1.7.0.4


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

end of thread, other threads:[~2010-11-19  6:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17 19:29 [PATCH] ifxmodem: Adding fast dormancy support to Infineon modem Robertino Benis
2010-11-18  3:47 ` Marcel Holtmann
2010-11-18  6:15   ` Benis, Robertino
2010-11-18 20:18     ` Bastian, Waldo
2010-11-19  6:58       ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox