* [PATCH 0/3] ZTE: Create a modem driver to enable radio settings
@ 2012-03-23 11:01 Bertrand Aygon
2012-03-23 11:01 ` [PATCH 1/3] Add ZTE modem driver Bertrand Aygon
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Bertrand Aygon @ 2012-03-23 11:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]
- Create ZTE modem driver
- Add radio settings support to ZTE modem driver
- Enable radio settings in ZTE plugin
Bertrand Aygon (3):
Add ZTE modem driver
ztemodem: Add radio settings support
zte: Add support for radio settings
Makefile.am | 6 +
drivers/ztemodem/radio-settings.c | 212 +++++++++++++++++++++++++++++++++++++
drivers/ztemodem/ztemodem.c | 49 +++++++++
drivers/ztemodem/ztemodem.h | 25 +++++
plugins/zte.c | 3 +
5 files changed, 295 insertions(+), 0 deletions(-)
create mode 100644 drivers/ztemodem/radio-settings.c
create mode 100644 drivers/ztemodem/ztemodem.c
create mode 100644 drivers/ztemodem/ztemodem.h
--
1.7.5.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Add ZTE modem driver
2012-03-23 11:01 [PATCH 0/3] ZTE: Create a modem driver to enable radio settings Bertrand Aygon
@ 2012-03-23 11:01 ` Bertrand Aygon
2012-03-23 11:01 ` [PATCH 2/3] ztemodem: Add radio settings support Bertrand Aygon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Bertrand Aygon @ 2012-03-23 11:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3960 bytes --]
---
Makefile.am | 5 ++++
drivers/ztemodem/ztemodem.c | 46 +++++++++++++++++++++++++++++++++++++++++++
drivers/ztemodem/ztemodem.h | 22 ++++++++++++++++++++
3 files changed, 73 insertions(+), 0 deletions(-)
create mode 100644 drivers/ztemodem/ztemodem.c
create mode 100644 drivers/ztemodem/ztemodem.h
diff --git a/Makefile.am b/Makefile.am
index 760b62b..5c48222 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -191,6 +191,11 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/swmodem/swmodem.c \
drivers/swmodem/gprs-context.c
+builtin_modules += ztemodem
+builtin_sources += drivers/atmodem/atutil.h \
+ drivers/ztemodem/ztemodem.h \
+ drivers/ztemodem/ztemodem.c
+
builtin_modules += huaweimodem
builtin_sources += drivers/atmodem/atutil.h \
drivers/huaweimodem/huaweimodem.h \
diff --git a/drivers/ztemodem/ztemodem.c b/drivers/ztemodem/ztemodem.c
new file mode 100644
index 0000000..729e911
--- /dev/null
+++ b/drivers/ztemodem/ztemodem.c
@@ -0,0 +1,46 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2012 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <gatchat.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/types.h>
+
+#include "ztemodem.h"
+
+static int ztemodem_init(void)
+{
+ return 0;
+}
+
+static void ztemodem_exit(void)
+{
+}
+
+OFONO_PLUGIN_DEFINE(ztemodem, "ZTE modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ ztemodem_init, ztemodem_exit)
diff --git a/drivers/ztemodem/ztemodem.h b/drivers/ztemodem/ztemodem.h
new file mode 100644
index 0000000..d88fb94
--- /dev/null
+++ b/drivers/ztemodem/ztemodem.h
@@ -0,0 +1,22 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2012 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <drivers/atmodem/atutil.h>
--
1.7.5.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] ztemodem: Add radio settings support
2012-03-23 11:01 [PATCH 0/3] ZTE: Create a modem driver to enable radio settings Bertrand Aygon
2012-03-23 11:01 ` [PATCH 1/3] Add ZTE modem driver Bertrand Aygon
@ 2012-03-23 11:01 ` Bertrand Aygon
2012-03-23 11:01 ` [PATCH 3/3] zte: Add support for radio settings Bertrand Aygon
2012-03-26 21:51 ` [PATCH 0/3] ZTE: Create a modem driver to enable " Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Bertrand Aygon @ 2012-03-23 11:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7668 bytes --]
---
Makefile.am | 3 +-
drivers/ztemodem/radio-settings.c | 212 +++++++++++++++++++++++++++++++++++++
drivers/ztemodem/ztemodem.c | 3 +
drivers/ztemodem/ztemodem.h | 3 +
4 files changed, 220 insertions(+), 1 deletions(-)
create mode 100644 drivers/ztemodem/radio-settings.c
diff --git a/Makefile.am b/Makefile.am
index 5c48222..af3c5a2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -194,7 +194,8 @@ builtin_sources += drivers/atmodem/atutil.h \
builtin_modules += ztemodem
builtin_sources += drivers/atmodem/atutil.h \
drivers/ztemodem/ztemodem.h \
- drivers/ztemodem/ztemodem.c
+ drivers/ztemodem/ztemodem.c \
+ drivers/ztemodem/radio-settings.c
builtin_modules += huaweimodem
builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/ztemodem/radio-settings.c b/drivers/ztemodem/radio-settings.c
new file mode 100644
index 0000000..dab03e1
--- /dev/null
+++ b/drivers/ztemodem/radio-settings.c
@@ -0,0 +1,212 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2012 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/radio-settings.h>
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "ztemodem.h"
+
+static const char *none_prefix[] = { NULL };
+static const char *zsnt_prefix[] = { "+ZSNT:", NULL };
+
+struct radio_settings_data {
+ GAtChat *chat;
+};
+
+static void zsnt_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
+ enum ofono_radio_access_mode mode;
+ struct ofono_error error;
+ GAtResultIter iter;
+ int value;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (!ok) {
+ cb(&error, -1, cbd->data);
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ if (g_at_result_iter_next(&iter, "+ZSNT:") == FALSE)
+ goto error;
+
+ if (g_at_result_iter_next_number(&iter, &value) == FALSE)
+ goto error;
+
+ switch (value) {
+ case 0:
+ mode = OFONO_RADIO_ACCESS_MODE_ANY;
+ break;
+ case 1:
+ mode = OFONO_RADIO_ACCESS_MODE_GSM;
+ break;
+ case 2:
+ mode = OFONO_RADIO_ACCESS_MODE_UMTS;
+ break;
+ default:
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+ return;
+ }
+
+ cb(&error, mode, cbd->data);
+
+ return;
+
+error:
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+}
+
+static void zte_query_rat_mode(struct ofono_radio_settings *rs,
+ ofono_radio_settings_rat_mode_query_cb_t cb,
+ void *data)
+{
+ struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+ struct cb_data *cbd = cb_data_new(cb, data);
+
+ if (g_at_chat_send(rsd->chat, "AT+ZSNT?", zsnt_prefix,
+ zsnt_query_cb, cbd, g_free) == 0) {
+ CALLBACK_WITH_FAILURE(cb, -1, data);
+ g_free(cbd);
+ }
+}
+
+static void zsnt_modify_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_radio_settings_rat_mode_set_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 zte_set_rat_mode(struct ofono_radio_settings *rs,
+ enum ofono_radio_access_mode mode,
+ ofono_radio_settings_rat_mode_set_cb_t cb,
+ void *data)
+{
+ struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ char buf[20];
+ int value;
+
+ switch (mode) {
+ case OFONO_RADIO_ACCESS_MODE_ANY:
+ value = 0;
+ break;
+ case OFONO_RADIO_ACCESS_MODE_GSM:
+ value = 1;
+ break;
+ case OFONO_RADIO_ACCESS_MODE_UMTS:
+ value = 2;
+ break;
+ case OFONO_RADIO_ACCESS_MODE_LTE:
+ goto error;
+ }
+
+ snprintf(buf, sizeof(buf), "AT+ZSNT=%u,0,0", value);
+
+ if (g_at_chat_send(rsd->chat, buf, none_prefix,
+ zsnt_modify_cb, cbd, g_free) > 0)
+ return;
+
+error:
+ CALLBACK_WITH_FAILURE(cb, data);
+ g_free(cbd);
+}
+
+static void zsnt_support_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_radio_settings *rs = user_data;
+
+ if (!ok)
+ return;
+
+ ofono_radio_settings_register(rs);
+}
+
+static int zte_radio_settings_probe(struct ofono_radio_settings *rs,
+ unsigned int vendor, void *data)
+{
+ GAtChat *chat = data;
+ struct radio_settings_data *rsd;
+
+ rsd = g_try_new0(struct radio_settings_data, 1);
+ if (rsd == NULL)
+ return -ENOMEM;
+
+ rsd->chat = g_at_chat_clone(chat);
+
+ ofono_radio_settings_set_data(rs, rsd);
+
+ g_at_chat_send(rsd->chat, "AT+ZSNT=?", none_prefix,
+ zsnt_support_cb, rs, NULL);
+
+ return 0;
+}
+
+static void zte_radio_settings_remove(struct ofono_radio_settings *rs)
+{
+ struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
+
+ ofono_radio_settings_set_data(rs, NULL);
+
+ g_at_chat_unref(rsd->chat);
+ g_free(rsd);
+}
+
+static struct ofono_radio_settings_driver driver = {
+ .name = "ztemodem",
+ .probe = zte_radio_settings_probe,
+ .remove = zte_radio_settings_remove,
+ .query_rat_mode = zte_query_rat_mode,
+ .set_rat_mode = zte_set_rat_mode
+};
+
+void zte_radio_settings_init(void)
+{
+ ofono_radio_settings_driver_register(&driver);
+}
+
+void zte_radio_settings_exit(void)
+{
+ ofono_radio_settings_driver_unregister(&driver);
+}
diff --git a/drivers/ztemodem/ztemodem.c b/drivers/ztemodem/ztemodem.c
index 729e911..09a69d2 100644
--- a/drivers/ztemodem/ztemodem.c
+++ b/drivers/ztemodem/ztemodem.c
@@ -34,11 +34,14 @@
static int ztemodem_init(void)
{
+ zte_radio_settings_init();
+
return 0;
}
static void ztemodem_exit(void)
{
+ zte_radio_settings_exit();
}
OFONO_PLUGIN_DEFINE(ztemodem, "ZTE modem driver", VERSION,
diff --git a/drivers/ztemodem/ztemodem.h b/drivers/ztemodem/ztemodem.h
index d88fb94..675f176 100644
--- a/drivers/ztemodem/ztemodem.h
+++ b/drivers/ztemodem/ztemodem.h
@@ -20,3 +20,6 @@
*/
#include <drivers/atmodem/atutil.h>
+
+extern void zte_radio_settings_init(void);
+extern void zte_radio_settings_exit(void);
--
1.7.5.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] zte: Add support for radio settings
2012-03-23 11:01 [PATCH 0/3] ZTE: Create a modem driver to enable radio settings Bertrand Aygon
2012-03-23 11:01 ` [PATCH 1/3] Add ZTE modem driver Bertrand Aygon
2012-03-23 11:01 ` [PATCH 2/3] ztemodem: Add radio settings support Bertrand Aygon
@ 2012-03-23 11:01 ` Bertrand Aygon
2012-03-26 21:51 ` [PATCH 0/3] ZTE: Create a modem driver to enable " Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Bertrand Aygon @ 2012-03-23 11:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]
---
plugins/zte.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/plugins/zte.c b/plugins/zte.c
index 9a1b9e9..3a83c8b 100644
--- a/plugins/zte.c
+++ b/plugins/zte.c
@@ -41,6 +41,7 @@
#include <ofono/ussd.h>
#include <ofono/gprs.h>
#include <ofono/gprs-context.h>
+#include <ofono/radio-settings.h>
#include <ofono/phonebook.h>
#include <ofono/log.h>
@@ -351,6 +352,8 @@ static void zte_post_sim(struct ofono_modem *modem)
ofono_phonebook_create(modem, 0, "atmodem", data->aux);
+ ofono_radio_settings_create(modem, 0, "ztemodem", data->aux);
+
ofono_sms_create(modem, OFONO_VENDOR_ZTE, "atmodem", data->aux);
gprs = ofono_gprs_create(modem, OFONO_VENDOR_ZTE, "atmodem", data->aux);
--
1.7.5.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] ZTE: Create a modem driver to enable radio settings
2012-03-23 11:01 [PATCH 0/3] ZTE: Create a modem driver to enable radio settings Bertrand Aygon
` (2 preceding siblings ...)
2012-03-23 11:01 ` [PATCH 3/3] zte: Add support for radio settings Bertrand Aygon
@ 2012-03-26 21:51 ` Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2012-03-26 21:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
Hi Bertrand,
On 03/23/2012 06:01 AM, Bertrand Aygon wrote:
> - Create ZTE modem driver
> - Add radio settings support to ZTE modem driver
> - Enable radio settings in ZTE plugin
>
> Bertrand Aygon (3):
> Add ZTE modem driver
> ztemodem: Add radio settings support
> zte: Add support for radio settings
>
> Makefile.am | 6 +
> drivers/ztemodem/radio-settings.c | 212 +++++++++++++++++++++++++++++++++++++
> drivers/ztemodem/ztemodem.c | 49 +++++++++
> drivers/ztemodem/ztemodem.h | 25 +++++
> plugins/zte.c | 3 +
> 5 files changed, 295 insertions(+), 0 deletions(-)
> create mode 100644 drivers/ztemodem/radio-settings.c
> create mode 100644 drivers/ztemodem/ztemodem.c
> create mode 100644 drivers/ztemodem/ztemodem.h
>
All three patches have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-26 21:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-23 11:01 [PATCH 0/3] ZTE: Create a modem driver to enable radio settings Bertrand Aygon
2012-03-23 11:01 ` [PATCH 1/3] Add ZTE modem driver Bertrand Aygon
2012-03-23 11:01 ` [PATCH 2/3] ztemodem: Add radio settings support Bertrand Aygon
2012-03-23 11:01 ` [PATCH 3/3] zte: Add support for radio settings Bertrand Aygon
2012-03-26 21:51 ` [PATCH 0/3] ZTE: Create a modem driver to enable " 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.