Re: Reg: Supporting Operator Preferred List in oFono
Hi Denis, On Wed, Mar 23, 2011 at 7:56 PM, Denis Kenzior denk...@gmail.com wrote: Hi Sankar, On 03/23/2011 06:52 AM, Sankar wrote: Hi , I would like to know if there is any proposal to support the Operator Preferred List in oFono. This is being a key feature, allowing the user to add/delete/modify the PLMNSel, PLMNWact files on the card, which are used by the Baseband during the network registration procedures. This is not (and unlikely to be) a priority feature. These lists are mostly managed by the modem and do not need oFono's intervention. I agree lists are used by Modem, but definitely oFono's intervention is required if the user wants to modify this list. If you need this feature then I suggest you add a task to the TODO list and go about finding someone to implement it ;) I will explore this. I have not added any TODOs before. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] gatserver: add ATF command
--- gatchat/gatserver.c | 29 +++-- 1 files changed, 27 insertions(+), 2 deletions(-) diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c index 57cc58e..8266ead 100644 --- a/gatchat/gatserver.c +++ b/gatchat/gatserver.c @@ -274,7 +274,8 @@ static gboolean get_result_value(GAtServer *server, GAtResult *result, if (val min || val max) return FALSE; - *value = val; + if (value) + *value = val; return TRUE; } @@ -464,10 +465,33 @@ static void at_c108_cb(GAtServer *server, GAtServerRequestType type, at_template_cb(type, result, server, server-v250.c108, D, 0, 2, 2); } -static void at_z_cb(GAtServer *server, GAtServerRequestType type, +static void at_f_cb(GAtServer *server, GAtServerRequestType type, GAtResult *result, gpointer user_data) { + switch (type) { + case G_AT_SERVER_REQUEST_TYPE_SET: + if (!get_result_value(server, result, 0, 0, NULL)) { + g_at_server_send_final(server, + G_AT_SERVER_RESULT_ERROR); + return; + } + /* intentional fallback here */ + case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY: + /* default behavior on ATF same as ATZ */ + v250_settings_create(server-v250); + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break; + + default: + g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR); + break; + } +} + +static void at_z_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ switch (type) { case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY: v250_settings_create(server-v250); @@ -1134,6 +1158,7 @@ static void basic_command_register(GAtServer *server) g_at_server_register(server, C, at_c109_cb, NULL, NULL); g_at_server_register(server, D, at_c108_cb, NULL, NULL); g_at_server_register(server, Z, at_z_cb, NULL, NULL); + g_at_server_register(server, F, at_f_cb, NULL, NULL); } GAtServer *g_at_server_new(GIOChannel *io) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] emulator: add AT hook_control_cb() CB and register it
--- src/emulator.c | 44 +--- 1 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/emulator.c b/src/emulator.c index c84f0a9..586c7ec 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -177,6 +177,41 @@ error: g_at_server_send_final(em-server, G_AT_SERVER_RESULT_ERROR); } +static void hook_control_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ + struct ofono_emulator *em = user_data; + GAtResultIter iter; + int val; + + DBG(); + + if (type != G_AT_SERVER_REQUEST_TYPE_SET) + goto error; + + if (em-ppp == NULL) + goto error; + + g_at_result_iter_init(iter, result); + g_at_result_iter_next(iter, ); + + if (g_at_result_iter_next_number(iter, val) == FALSE) + goto error; + + if (val != 0) + goto error; + + g_at_ppp_unref(em-ppp); + em-ppp = NULL; + + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + + return; + +error: + g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR); +} + static void brsf_cb(GAtServer *server, GAtServerRequestType type, GAtResult *result, gpointer user_data) { @@ -466,10 +501,13 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd) __ofono_atom_register(em-atom, emulator_unregister); - if (em-type == OFONO_EMULATOR_TYPE_DUN) + if (em-type == OFONO_EMULATOR_TYPE_DUN) { g_at_server_register(em-server, D, dial_cb, em, NULL); - else if (em-type == OFONO_EMULATOR_TYPE_HFP) - g_at_server_set_echo(em-server, FALSE); + g_at_server_register(em-server, H, hook_control_cb, em, NULL); + } else { + if (em-type == OFONO_EMULATOR_TYPE_HFP) + g_at_server_set_echo(em-server, FALSE); + } } static void emulator_remove(struct ofono_atom *atom) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] gatserver: add v250 ATL and ATM commands
--- gatchat/gatserver.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c index 8266ead..0381723 100644 --- a/gatchat/gatserver.c +++ b/gatchat/gatserver.c @@ -94,6 +94,8 @@ struct v250_settings { int res_format; /* set by Xval */ int c109; /* set by Cval */ int c108; /* set by Dval */ + char l; /* set by Lval */ + char m; /* set by Mval */ }; /* AT command set that server supported */ @@ -296,6 +298,8 @@ static void v250_settings_create(struct v250_settings *v250) v250-res_format = 0; v250-c109 = 1; v250-c108 = 0; + v250-l = 0; + v250-m = 1; } static void s_template_cb(GAtServerRequestType type, GAtResult *result, @@ -360,6 +364,18 @@ static void at_s5_cb(GAtServer *server, GAtServerRequestType type, s_template_cb(type, result, server, server-v250.s5, S5, 0, 127); } +static void at_l_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ + s_template_cb(type, result, server, server-v250.s5, L, 0, 3); +} + +static void at_m_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ + s_template_cb(type, result, server, server-v250.m, M, 0, 2); +} + static void at_template_cb(GAtServerRequestType type, GAtResult *result, GAtServer *server, int *value, const char *prefix, @@ -1159,6 +1175,8 @@ static void basic_command_register(GAtServer *server) g_at_server_register(server, D, at_c108_cb, NULL, NULL); g_at_server_register(server, Z, at_z_cb, NULL, NULL); g_at_server_register(server, F, at_f_cb, NULL, NULL); + g_at_server_register(server, L, at_l_cb, NULL, NULL); + g_at_server_register(server, M, at_m_cb, NULL, NULL); } GAtServer *g_at_server_new(GIOChannel *io) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] isimodem/sim: added PIN and SIM state handling
From: Pekka Pessi pekka.pe...@nokia.com Using PN_SECURITY resource to obtain PIN statuses. Using ofono_sim_ready_notify() aka __ofono_sim_recheck_pin() to report the ready state. --- drivers/isimodem/debug.c | 59 + drivers/isimodem/debug.h |6 + drivers/isimodem/sim.c | 584 +- drivers/isimodem/sim.h | 50 - 4 files changed, 634 insertions(+), 65 deletions(-) diff --git a/drivers/isimodem/debug.c b/drivers/isimodem/debug.c index 38f97f9..6fb451f 100644 --- a/drivers/isimodem/debug.c +++ b/drivers/isimodem/debug.c @@ -34,6 +34,8 @@ #define OFONO_API_SUBJECT_TO_CHANGE #include ofono/log.h +#include ofono/modem.h +#include ofono/sim.h #include debug.h @@ -49,6 +51,7 @@ const char *pn_resource_name(int value) _(PN_CALL); _(PN_SMS); _(PN_SIM); + _(PN_SECURITY); _(PN_MTC); _(PN_GSS); _(PN_GPDS); @@ -572,18 +575,72 @@ const char *sim_message_id_name(enum sim_message_id value) _(SIM_IMSI_RESP_READ_IMSI); _(SIM_SERV_PROV_NAME_REQ); _(SIM_SERV_PROV_NAME_RESP); + _(SIM_DYNAMIC_FLAGS_REQ); + _(SIM_DYNAMIC_FLAGS_RESP); _(SIM_READ_FIELD_REQ); _(SIM_READ_FIELD_RESP); _(SIM_SMS_REQ); _(SIM_SMS_RESP); + _(SIM_STATUS_REQ); + _(SIM_STATUS_RESP); _(SIM_PB_REQ_SIM_PB_READ); _(SIM_PB_RESP_SIM_PB_READ); + _(SIM_SERVER_READY_IND); _(SIM_IND); _(SIM_COMMON_MESSAGE); } + return SIM_UNKNOWN; } +const char *sim_password_name(enum ofono_sim_password_type type) +{ + static const char *const passwd_name[] = { + [OFONO_SIM_PASSWORD_NONE] = none, + [OFONO_SIM_PASSWORD_SIM_PIN] = pin, + [OFONO_SIM_PASSWORD_SIM_PUK] = puk, + [OFONO_SIM_PASSWORD_PHSIM_PIN] = phone, + [OFONO_SIM_PASSWORD_PHFSIM_PIN] = firstphone, + [OFONO_SIM_PASSWORD_PHFSIM_PUK] = firstphonepuk, + [OFONO_SIM_PASSWORD_SIM_PIN2] = pin2, + [OFONO_SIM_PASSWORD_SIM_PUK2] = puk2, + [OFONO_SIM_PASSWORD_PHNET_PIN] = network, + [OFONO_SIM_PASSWORD_PHNET_PUK] = networkpuk, + [OFONO_SIM_PASSWORD_PHNETSUB_PIN] = netsub, + [OFONO_SIM_PASSWORD_PHNETSUB_PUK] = netsubpuk, + [OFONO_SIM_PASSWORD_PHSP_PIN] = service, + [OFONO_SIM_PASSWORD_PHSP_PUK] = servicepuk, + [OFONO_SIM_PASSWORD_PHCORP_PIN] = corp, + [OFONO_SIM_PASSWORD_PHCORP_PUK] = corppuk, + [OFONO_SIM_PASSWORD_INVALID] = invalid, + }; + + if (OFONO_SIM_PASSWORD_NONE = (int)type + type = OFONO_SIM_PASSWORD_PHCORP_PUK) + return passwd_name[type]; + else + return UNKNOWN; +} + +const char *sec_message_id_name(enum sec_message_id value) +{ + switch (value) { + _(SEC_CODE_STATE_REQ); + _(SEC_CODE_STATE_OK_RESP); + _(SEC_CODE_STATE_FAIL_RESP); + _(SEC_CODE_CHANGE_REQ); + _(SEC_CODE_CHANGE_OK_RESP); + _(SEC_CODE_CHANGE_FAIL_RESP); + _(SEC_CODE_VERIFY_REQ); + _(SEC_CODE_VERIFY_OK_RESP); + _(SEC_CODE_VERIFY_FAIL_RESP); + _(SEC_STATE_REQ); + _(SEC_STATE_RESP); + } + + return SEC_UNKNOWN; +} + const char *sim_subblock_name(enum sim_subblock value) { switch (value) { @@ -1272,6 +1329,8 @@ static const char *res_to_name(uint8_t res, uint8_t id) return ss_message_id_name(id); case PN_CALL: return call_message_id_name(id); + case PN_SECURITY: + return sec_message_id_name(id); case PN_SMS: return sms_message_id_name(id); case PN_SIM: diff --git a/drivers/isimodem/debug.h b/drivers/isimodem/debug.h index 5648f7a..3a273e9 100644 --- a/drivers/isimodem/debug.h +++ b/drivers/isimodem/debug.h @@ -61,6 +61,12 @@ const char *sim_isi_cause_name(enum sim_isi_cause value); const char *sim_message_id_name(enum sim_message_id value); const char *sim_subblock_name(enum sim_subblock value); +enum ofono_sim_password_type; + +const char *sim_password_name(enum ofono_sim_password_type value); + +const char *sec_message_id_name(enum sec_message_id value); + const char *info_isi_cause_name(enum info_isi_cause value); const char *info_message_id_name(enum info_message_id value); const char *info_subblock_name(enum info_subblock value); diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c index bfecbc9..3ffdceb 100644 --- a/drivers/isimodem/sim.c +++ b/drivers/isimodem/sim.c @@ -37,6 +37,8 @@ #include ofono/log.h #include
[PATCH 2/2] TODO: remove me from ofono_sim_ready_notify()
From: Pekka Pessi pekka.pe...@nokia.com __ofono_sim_recheck_pin() is fine by me --- TODO |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/TODO b/TODO index fc65b35..f8926a3 100644 --- a/TODO +++ b/TODO @@ -70,7 +70,6 @@ SIM / SIM File system Priority: High Complexity: C2 - Owner: Pekka Pessi pekka.pe...@nokia.com - Add support for CPHS Customer Service Profile (CSP). This task adds support for reading the EFcsp file and in particular, interpreting the PLMN mode bit -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 0/1] isimodem: fix network registration for older modems
Hi, Here's a patch to fix network registration with older ISI modems. Verified with N95. Claudio, could you give this a spin and let me know if this fixes the problem for your 6760? Br, MikaL [PATCH 1/1] isimodem: fix network registration for older modems drivers/isimodem/network-registration.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/1] isimodem: fix network registration for older modems
--- drivers/isimodem/network-registration.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/isimodem/network-registration.c b/drivers/isimodem/network-registration.c index a30fc8c..8bf2423 100644 --- a/drivers/isimodem/network-registration.c +++ b/drivers/isimodem/network-registration.c @@ -78,6 +78,7 @@ struct netreg_data { struct reg_info reg; struct gsm_info gsm; struct rat_info rat; + GIsiVersion version; char nitz_name[OFONO_MAX_OPERATOR_NAME_LENGTH + 1]; }; @@ -338,7 +339,8 @@ static void rat_resp_cb(const GIsiMessage *msg, void *data) goto error; } - if (g_isi_client_resource(nd-client) == PN_MODEM_NETWORK) + if (g_isi_client_resource(nd-client) == PN_MODEM_NETWORK || + nd-version.major 14) req[0] = NET_MODEM_REG_STATUS_GET_REQ; if (g_isi_client_send(nd-client, req, sizeof(req), @@ -649,7 +651,8 @@ static void isi_list_operators(struct ofono_netreg *netreg, if (cbd == NULL || nd == NULL) goto error; - if (g_isi_client_resource(nd-client) == PN_MODEM_NETWORK) + if (g_isi_client_resource(nd-client) == PN_MODEM_NETWORK || + nd-version.major 14) msg[0] = NET_MODEM_AVAILABLE_GET_REQ; if (g_isi_client_send_with_timeout(nd-client, msg, sizeof(msg), @@ -938,6 +941,9 @@ static void reachable_cb(const GIsiMessage *msg, void *data) if (nd == NULL) return; + nd-version.major = g_isi_msg_version_major(msg); + nd-version.minor = g_isi_msg_version_minor(msg); + g_isi_client_ind_subscribe(nd-client, NET_RSSI_IND, rssi_ind_cb, netreg); g_isi_client_ind_subscribe(nd-client, NET_NITZ_NAME_IND, name_ind_cb, -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] gprs: fix memory leak
--- src/gprs.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/gprs.c b/src/gprs.c index 00f6d6d..f9e327a 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -865,6 +865,7 @@ static void pri_activate_callback(const struct ofono_error *error, void *data) telephony_error_to_str(error)); __ofono_dbus_pending_reply(ctx-pending, __ofono_error_failed(ctx-pending)); + context_settings_free(ctx-context_driver-settings); release_context(ctx); return; } @@ -1841,6 +1842,7 @@ static void gprs_deactivate_for_remove(const struct ofono_error *error, return; } + pri_reset_context_settings(ctx); release_context(ctx); if (gprs-settings) { -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 0/2] GPRS patches
Hi, Here's a memory leak fix and a new test script for GPRS. Br, MikaL [PATCH 1/2] gprs: fix memory leak [PATCH 2/2] test: add a script to set any GPRS context property Makefile.am |3 ++- src/gprs.c|2 ++ test/set-context-property | 38 ++ 3 files changed, 42 insertions(+), 1 deletions(-) ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/2] test: add a script to set any GPRS context property
--- Makefile.am |3 ++- test/set-context-property | 38 ++ 2 files changed, 40 insertions(+), 1 deletions(-) create mode 100755 test/set-context-property diff --git a/Makefile.am b/Makefile.am index b0cbcd7..fce9cd8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -506,7 +506,8 @@ test_scripts = test/backtrace \ test/test-sms \ test/test-message-waiting \ test/cdma-connman-disable \ - test/cdma-connman-enable + test/cdma-connman-enable \ + test/set-context-property if TEST testdir = $(pkglibdir)/test diff --git a/test/set-context-property b/test/set-context-property new file mode 100755 index 000..8ea0e3a --- /dev/null +++ b/test/set-context-property @@ -0,0 +1,38 @@ +#!/usr/bin/python + +import sys +import dbus + +if len(sys.argv) 4: + print Usage: set-context-property context name value + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +modems = manager.GetModems() + +for path, properties in modems: + if org.ofono.ConnectionManager not in properties[Interfaces]: + continue + + connman = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.ConnectionManager') + + contexts = connman.GetContexts() + + if (len(contexts) == 0): + print No context available + sys.exit(1) + + path = contexts[int(sys.argv[1])][0] + context = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.ConnectionContext') + + try: + context.SetProperty(sys.argv[2], sys.argv[3]) + except dbus.DBusException, e: + print Error setting context %s property %s: %s % (path, sys.argv[2], str(e)) + exit(2) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: Reg: Supporting Operator Preferred List in oFono
Hi Sankar, I would like to know if there is any proposal to support the Operator Preferred List in oFono. This is being a key feature, allowing the user to add/delete/modify the PLMNSel, PLMNWact files on the card, which are used by the Baseband during the network registration procedures. This is not (and unlikely to be) a priority feature. These lists are mostly managed by the modem and do not need oFono's intervention. I agree lists are used by Modem, but definitely oFono's intervention is required if the user wants to modify this list. so this is the point, where I clearly have to ask, why does the end user wants to modify this list? And which smartphone shipped in the last 2 years give access to this list to the end user? For me this list needs to be managed by the operator and not the end user. Since a normal end user has no idea what he/she would be doing with this list anyway. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/1] isimodem: fix network registration for older modems
Hi Mika, 2011/3/24 Mika Liljeberg mika.liljeb...@nokia.com: --- drivers/isimodem/network-registration.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) Patch has been pushed. Thanks. Cheers, Aki ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] isimodem/sim: added PIN and SIM state handling
Hi Pekka, 2011/3/24 pekka.pe...@nokia.com: From: Pekka Pessi pekka.pe...@nokia.com Using PN_SECURITY resource to obtain PIN statuses. Using ofono_sim_ready_notify() aka __ofono_sim_recheck_pin() to report the ready state. --- drivers/isimodem/debug.c | 59 + drivers/isimodem/debug.h | 6 + drivers/isimodem/sim.c | 584 +- drivers/isimodem/sim.h | 50 - 4 files changed, 634 insertions(+), 65 deletions(-) Patch has been pushed. Thanks. Cheers, Aki ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 00/12] Basic E911 support
Hi, This is third attempt to provide implementation for basic E911 support. Br, Jarko Jarko Poutiainen (12): dbus: add gnss interface definition include: add gnss.h file src: add atom type for gnss src: add gnss atom and agent implementation gatchat: introduce send for +CPOS gatchat: new hint to handle +CPOS gatchat: implementation for +CPOS send gatchat: fix gatsyntax to support +CPOS atmodem: add gnss driver ste: add support for gnss ofono.conf: add positioning agent interface test: add test-gnss Makefile.am | 12 +- drivers/atmodem/atmodem.c |2 + drivers/atmodem/atmodem.h |3 + drivers/atmodem/gnss.c| 282 + gatchat/gatchat.c | 37 - gatchat/gatchat.h |8 + gatchat/gatsyntax.c | 27 +++ gatchat/gatsyntax.h |3 +- include/dbus.h|2 + include/gnss.h| 69 plugins/ste.c |8 +- src/gnss.c| 386 + src/gnssagent.c | 158 ++ src/gnssagent.h | 43 + src/ofono.conf|1 + src/ofono.h |2 + test/test-gnss| 91 +++ 17 files changed, 1123 insertions(+), 11 deletions(-) create mode 100644 drivers/atmodem/gnss.c create mode 100644 include/gnss.h create mode 100644 src/gnss.c create mode 100644 src/gnssagent.c create mode 100644 src/gnssagent.h create mode 100755 test/test-gnss ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 01/12] dbus: add gnss interface definition
--- include/dbus.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/dbus.h b/include/dbus.h index 38864fb..4dd9db5 100644 --- a/include/dbus.h +++ b/include/dbus.h @@ -56,6 +56,8 @@ extern C { #define OFONO_STK_INTERFACE OFONO_SERVICE .SimToolkit #define OFONO_SIM_APP_INTERFACE OFONO_SERVICE .SimToolkitAgent #define OFONO_LOCATION_REPORTING_INTERFACE OFONO_SERVICE .LocationReporting +#define OFONO_GNSS_INTERFACE org.ofono.AssistedSatelliteNavigation +#define OFONO_GNSS_POSR_AGENT_INTERFACE org.ofono.PositioningRequestAgent /* CDMA Interfaces */ #define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE org.ofono.cdma.VoiceCallManager -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 02/12] include: add gnss.h file
--- Makefile.am|3 +- include/gnss.h | 69 2 files changed, 71 insertions(+), 1 deletions(-) create mode 100644 include/gnss.h diff --git a/Makefile.am b/Makefile.am index b0cbcd7..bff2374 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,8 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \ include/cdma-sms.h include/sim-auth.h \ include/gprs-provision.h include/emulator.h \ include/location-reporting.h \ - include/cdma-connman.h + include/cdma-connman.h \ + include/gnss.h nodist_pkginclude_HEADERS = include/version.h diff --git a/include/gnss.h b/include/gnss.h new file mode 100644 index 000..c8ff310 --- /dev/null +++ b/include/gnss.h @@ -0,0 +1,69 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. + * Copyright (C) 2011 ST-Ericsson AB. + * + * 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 + * + */ + +#ifndef __OFONO_GNSS_H +#define __OFONO_GNSS_H + +#ifdef __cplusplus +extern C { +#endif + +#include ofono/types.h + +struct ofono_gnss; + +typedef void (*ofono_gnss_cb_t)(const struct ofono_error *error, void *data); + +struct ofono_gnss_driver { + const char *name; + int (*probe)(struct ofono_gnss *gnss, unsigned int vendor, void *data); + void (*remove)(struct ofono_gnss *gnss); + void (*send_element)(struct ofono_gnss *gnss, + const char *xml, + ofono_gnss_cb_t cb, void *data); + void (*set_position_reporting)(struct ofono_gnss *gnss, + ofono_bool_t enable, + ofono_gnss_cb_t cb, + void *data); +}; + +void ofono_gnss_notify_posr_request(struct ofono_gnss *gnss, const char *xml); +void ofono_gnss_notify_posr_reset(struct ofono_gnss *gnss); +int ofono_gnss_driver_register(const struct ofono_gnss_driver *d); +void ofono_gnss_driver_unregister(const struct ofono_gnss_driver *d); + +struct ofono_gnss *ofono_gnss_create(struct ofono_modem *modem, + unsigned int vendor, + const char *driver, void *data); + +void ofono_gnss_register(struct ofono_gnss *gnss); +void ofono_gnss_remove(struct ofono_gnss *gnss); + +void ofono_gnss_set_data(struct ofono_gnss *gnss, void *data); +void *ofono_gnss_get_data(struct ofono_gnss *gnss); + + +#ifdef __cplusplus +} +#endif + +#endif /* __OFONO_GNSS_H */ -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 04/12] src: add gnss atom and agent implementation
--- Makefile.am |3 +- src/gnss.c | 386 +++ src/gnssagent.c | 158 +++ src/gnssagent.h | 43 ++ 4 files changed, 589 insertions(+), 1 deletions(-) create mode 100644 src/gnss.c create mode 100644 src/gnssagent.c create mode 100644 src/gnssagent.h diff --git a/Makefile.am b/Makefile.am index bff2374..8d127af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -385,7 +385,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \ src/cdma-voicecall.c src/sim-auth.c \ src/message.h src/message.c src/gprs-provision.c \ src/emulator.c src/location-reporting.c \ - src/cdma-connman.c + src/cdma-connman.c src/gnss.c \ + src/gnssagent.c src/gnssagent.h src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl diff --git a/src/gnss.c b/src/gnss.c new file mode 100644 index 000..e0c17e6 --- /dev/null +++ b/src/gnss.c @@ -0,0 +1,386 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. + * Copyright (C) 2011 ST-Ericsson AB. + * + * 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 stdio.h +#include stdlib.h +#include stdint.h + +#include glib.h +#include gdbus.h +#include errno.h + +#include ofono.h + +#include common.h +#include gnssagent.h + +static GSList *g_drivers = NULL; + +struct ofono_gnss { + const struct ofono_gnss_driver *driver; + void *driver_data; + struct ofono_atom *atom; + DBusMessage *pending; + struct gnss_agent *posr_agent; + ofono_bool_t enabled; +}; + +static void gnss_unregister_agent_cb(const struct ofono_error *error, + void *data) +{ + DBusMessage *reply; + struct ofono_gnss *gnss = data; + + DBG(); + + if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { + ofono_error(Disabling Location Reporting Failed); + reply = __ofono_error_failed(gnss-pending); + __ofono_dbus_pending_reply(gnss-pending, reply); + return; + } + + gnss-enabled = FALSE; + + if (gnss-posr_agent) + gnss_agent_free(gnss-posr_agent); + + if (gnss-posr_agent) { + ofono_error(Releasing agent failed); + reply = __ofono_error_failed(gnss-pending); + __ofono_dbus_pending_reply(gnss-pending, reply); + return; + } + + if (gnss-pending) { + reply = dbus_message_new_method_return(gnss-pending); + __ofono_dbus_pending_reply(gnss-pending, reply); + } +} + +static void gnss_register_agent_cb(const struct ofono_error *error, + void *data) +{ + DBusMessage *reply; + struct ofono_gnss *gnss = data; + + DBG(); + + if (error-type != OFONO_ERROR_TYPE_NO_ERROR) { + ofono_error(Enabling Location Reporting Failed); + reply = __ofono_error_failed(gnss-pending); + + if (gnss-posr_agent) + gnss_agent_free(gnss-posr_agent); + + __ofono_dbus_pending_reply(gnss-pending, reply); + return; + } + + if (gnss-posr_agent) { + gnss-enabled = TRUE; + reply = dbus_message_new_method_return(gnss-pending); + __ofono_dbus_pending_reply(gnss-pending, reply); + } else + gnss-driver-set_position_reporting(gnss, FALSE, + gnss_unregister_agent_cb, + gnss); +} + +static void gnss_agent_notify(gpointer user_data) +{ + struct ofono_gnss *gnss = user_data; + + if (gnss-enabled) + gnss-driver-set_position_reporting(gnss, FALSE, + gnss_unregister_agent_cb, + gnss); + + gnss-posr_agent = NULL; +} + +static DBusMessage *gnss_register_agent(DBusConnection *conn, +
[PATCH 03/12] src: add atom type for gnss
--- src/ofono.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/ofono.h b/src/ofono.h index b9ca314..81570fe 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -132,6 +132,7 @@ enum ofono_atom_type { OFONO_ATOM_TYPE_EMULATOR_DUN, OFONO_ATOM_TYPE_EMULATOR_HFP, OFONO_ATOM_TYPE_LOCATION_REPORTING, + OFONO_ATOM_TYPE_GNSS, }; enum ofono_atom_watch_condition { @@ -454,3 +455,4 @@ void __ofono_gprs_provision_free_settings( int count); #include ofono/emulator.h +#include ofono/gnss.h -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 06/12] gatchat: new hint to handle +CPOS
--- gatchat/gatsyntax.h |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/gatchat/gatsyntax.h b/gatchat/gatsyntax.h index afc0bd3..2580ec6 100644 --- a/gatchat/gatsyntax.h +++ b/gatchat/gatsyntax.h @@ -29,7 +29,8 @@ extern C { enum _GAtSyntaxExpectHint { G_AT_SYNTAX_EXPECT_PDU, G_AT_SYNTAX_EXPECT_MULTILINE, - G_AT_SYNTAX_EXPECT_PROMPT + G_AT_SYNTAX_EXPECT_PROMPT, + G_AT_SYNTAX_EXPECT_SHORT_PROMPT }; typedef enum _GAtSyntaxExpectHint GAtSyntaxExpectHint; -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 07/12] gatchat: implementation for +CPOS send
--- gatchat/gatchat.c | 37 + 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 3fd564d..eeb8d24 100644 --- a/gatchat/gatchat.c +++ b/gatchat/gatchat.c @@ -53,6 +53,7 @@ struct at_command { GAtNotifyFunc listing; gpointer user_data; GDestroyNotify notify; + gboolean short_prompt; }; struct at_notify_node { @@ -725,9 +726,18 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data) unsigned char *buf = ring_buffer_read_ptr(rbuf, p-read_so_far); GAtSyntaxResult result; + struct at_command *cmd; p-in_read_handler = TRUE; + cmd = g_queue_peek_head(p-command_queue); + if (cmd) + if (cmd-short_prompt + !g_strcmp0(*cmd-prefixes, +CPOS:) + p-syntax-set_hint) + p-syntax-set_hint(p-syntax, + G_AT_SYNTAX_EXPECT_SHORT_PROMPT); + while (p-suspended == FALSE (p-read_so_far len)) { gsize rbytes = MIN(len - p-read_so_far, wrap - p-read_so_far); result = p-syntax-feed(p-syntax, (char *)buf, rbytes); @@ -754,6 +764,12 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data) break; case G_AT_SYNTAX_RESULT_PROMPT: + if (cmd) + if (cmd-short_prompt + !g_strcmp0(*cmd-prefixes, + +CPOS:)) + cmd-short_prompt = FALSE; + chat_wakeup_writer(p); ring_buffer_drain(rbuf, p-read_so_far); break; @@ -995,7 +1011,8 @@ static guint at_chat_send_common(struct at_chat *chat, guint gid, GAtNotifyFunc listing, GAtResultFunc func, gpointer user_data, - GDestroyNotify notify) + GDestroyNotify notify, + gboolean short_prompt) { struct at_command *c; @@ -1007,6 +1024,7 @@ static guint at_chat_send_common(struct at_chat *chat, guint gid, if (c == NULL) return 0; + c-short_prompt = short_prompt; c-id = chat-next_cmd_id++; g_queue_push_tail(chat-command_queue, c); @@ -1439,7 +1457,7 @@ guint g_at_chat_send(GAtChat *chat, const char *cmd, { return at_chat_send_common(chat-parent, chat-group, cmd, prefix_list, FALSE, NULL, - func, user_data, notify); + func, user_data, notify, FALSE); } guint g_at_chat_send_listing(GAtChat *chat, const char *cmd, @@ -1452,7 +1470,8 @@ guint g_at_chat_send_listing(GAtChat *chat, const char *cmd, return at_chat_send_common(chat-parent, chat-group, cmd, prefix_list, FALSE, - listing, func, user_data, notify); + listing, func, user_data, notify, + FALSE); } guint g_at_chat_send_pdu_listing(GAtChat *chat, const char *cmd, @@ -1465,7 +1484,17 @@ guint g_at_chat_send_pdu_listing(GAtChat *chat, const char *cmd, return at_chat_send_common(chat-parent, chat-group, cmd, prefix_list, TRUE, - listing, func, user_data, notify); + listing, func, user_data, notify, + FALSE); +} + +guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd, + const char **prefix_list, GAtResultFunc func, + gpointer user_data, GDestroyNotify notify) +{ + return at_chat_send_common(chat-parent, chat-group, + cmd, prefix_list, FALSE, NULL, + func, user_data, notify, TRUE); } gboolean g_at_chat_cancel(GAtChat *chat, guint id) -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 05/12] gatchat: introduce send for +CPOS
--- gatchat/gatchat.h |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h index 8cbb559..eb82daa 100644 --- a/gatchat/gatchat.h +++ b/gatchat/gatchat.h @@ -124,6 +124,14 @@ guint g_at_chat_send_pdu_listing(GAtChat *chat, const char *cmd, GAtNotifyFunc listing, GAtResultFunc func, gpointer user_data, GDestroyNotify notify); +/*! + * Same as g_at_chat_send except parser will know to expect short prompt syntax + * used with +CPOS. + */ +guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd, + const char **valid_resp, GAtResultFunc func, + gpointer user_data, GDestroyNotify notify); + gboolean g_at_chat_cancel(GAtChat *chat, guint id); gboolean g_at_chat_cancel_all(GAtChat *chat); -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 08/12] gatchat: fix gatsyntax to support +CPOS
--- gatchat/gatsyntax.c | 27 +++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/gatchat/gatsyntax.c b/gatchat/gatsyntax.c index 2fc70b8..469ffc3 100644 --- a/gatchat/gatsyntax.c +++ b/gatchat/gatsyntax.c @@ -44,6 +44,7 @@ enum GSMV1_STATE { GSMV1_STATE_PROMPT, GSMV1_STATE_ECHO, GSMV1_PPP_DATA, + GSMV1_STATE_SHORT_PROMPT, }; enum GSM_PERMISSIVE_STATE { @@ -53,6 +54,7 @@ enum GSM_PERMISSIVE_STATE { GSM_PERMISSIVE_STATE_GUESS_PDU, GSM_PERMISSIVE_STATE_PDU, GSM_PERMISSIVE_STATE_PROMPT, + GSM_PERMISSIVE_STATE_SHORT_PROMPT, }; static void gsmv1_hint(GAtSyntax *syntax, GAtSyntaxExpectHint hint) @@ -64,6 +66,9 @@ static void gsmv1_hint(GAtSyntax *syntax, GAtSyntaxExpectHint hint) case G_AT_SYNTAX_EXPECT_MULTILINE: syntax-state = GSMV1_STATE_GUESS_MULTILINE_RESPONSE; break; + case G_AT_SYNTAX_EXPECT_SHORT_PROMPT: + syntax-state = GSMV1_STATE_SHORT_PROMPT; + break; default: break; }; @@ -200,6 +205,16 @@ static GAtSyntaxResult gsmv1_feed(GAtSyntax *syntax, syntax-state = GSMV1_STATE_RESPONSE; return G_AT_SYNTAX_RESULT_UNSURE; + case GSMV1_STATE_SHORT_PROMPT: + if (byte == '\r') + break; + else if (byte == '\n') { + syntax-state = GSMV1_STATE_IDLE; + i += 1; + res = G_AT_SYNTAX_RESULT_PROMPT; + goto out; + } + case GSMV1_STATE_ECHO: /* This handles the case of echo of the PDU terminated * by CtrlZ character @@ -239,6 +254,8 @@ static void gsm_permissive_hint(GAtSyntax *syntax, GAtSyntaxExpectHint hint) { if (hint == G_AT_SYNTAX_EXPECT_PDU) syntax-state = GSM_PERMISSIVE_STATE_GUESS_PDU; + else if (hint == G_AT_SYNTAX_EXPECT_SHORT_PROMPT) + syntax-state = GSM_PERMISSIVE_STATE_SHORT_PROMPT; } static GAtSyntaxResult gsm_permissive_feed(GAtSyntax *syntax, @@ -303,6 +320,16 @@ static GAtSyntaxResult gsm_permissive_feed(GAtSyntax *syntax, syntax-state = GSM_PERMISSIVE_STATE_RESPONSE; return G_AT_SYNTAX_RESULT_UNSURE; + case GSM_PERMISSIVE_STATE_SHORT_PROMPT: + if (byte == '\r') + break; + else if (byte == '\n') { + syntax-state = GSM_PERMISSIVE_STATE_IDLE; + i += 1; + res = G_AT_SYNTAX_RESULT_PROMPT; + goto out; + } + default: break; }; -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 10/12] ste: add support for gnss
--- plugins/ste.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/ste.c b/plugins/ste.c index 36b3148..f7fe2b4 100644 --- a/plugins/ste.c +++ b/plugins/ste.c @@ -57,6 +57,7 @@ #include ofono/gprs-context.h #include ofono/radio-settings.h #include ofono/stk.h +#include ofono/gnss.h #include drivers/atmodem/atutil.h #include drivers/atmodem/vendor.h @@ -64,17 +65,18 @@ #include drivers/stemodem/caif_socket.h #include drivers/stemodem/if_caif.h -#define NUM_CHAT 5 +#define NUM_CHAT 6 #define AT_DEFAULT 0 #define AT_NET 1 #define AT_VOICE 2 #define AT_GPRS3 #define AT_SIM 4 +#define AT_GNSS5 #define MAX_PDP_CONTEXTS 4 static char *chat_prefixes[NUM_CHAT] = { Default: , Net: , Voice: , - GPRS: , SIM: }; +GPRS: , SIM: , GNSS: }; struct ste_data { GAtChat *chat[NUM_CHAT]; @@ -471,6 +473,8 @@ static void ste_post_online(struct ofono_modem *modem) ofono_call_barring_create(modem, 0, atmodem, data-chat[AT_DEFAULT]); ofono_call_volume_create(modem, 0, atmodem, data-chat[AT_DEFAULT]); ofono_cbs_create(modem, 0, atmodem, data-chat[AT_DEFAULT]); + ofono_gnss_create(modem, OFONO_VENDOR_STE, atmodem, + data-chat[AT_GNSS]); gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM, atmodem, data-chat[AT_GPRS]); -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 11/12] ofono.conf: add positioning agent interface
--- src/ofono.conf |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/ofono.conf b/src/ofono.conf index 0dfa038..8a83cd0 100644 --- a/src/ofono.conf +++ b/src/ofono.conf @@ -13,6 +13,7 @@ allow send_interface=org.ofono.SimToolkitAgent/ allow send_interface=org.ofono.PushNotificationAgent/ allow send_interface=org.ofono.SmartMessagingAgent/ +allow send_interface=org.ofono.PositioningRequestAgent/ /policy policy at_console=true -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 09/12] atmodem: add gnss driver
--- Makefile.am |3 +- drivers/atmodem/atmodem.c |2 + drivers/atmodem/atmodem.h |3 + drivers/atmodem/gnss.c| 282 + 4 files changed, 289 insertions(+), 1 deletions(-) create mode 100644 drivers/atmodem/gnss.c diff --git a/Makefile.am b/Makefile.am index 8d127af..b5a3d6e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -180,7 +180,8 @@ builtin_sources += $(gatchat_sources) \ drivers/atmodem/atutil.c \ drivers/atmodem/gprs.c \ drivers/atmodem/gprs-context.c \ - drivers/atmodem/sim-auth.c + drivers/atmodem/sim-auth.c \ + drivers/atmodem/gnss.c builtin_modules += nwmodem builtin_sources += drivers/atmodem/atutil.h \ diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c index ce6c10a..be93f41 100644 --- a/drivers/atmodem/atmodem.c +++ b/drivers/atmodem/atmodem.c @@ -51,6 +51,7 @@ static int atmodem_init(void) at_gprs_init(); at_gprs_context_init(); at_sim_auth_init(); + at_gnss_init(); return 0; } @@ -74,6 +75,7 @@ static void atmodem_exit(void) at_call_volume_exit(); at_gprs_exit(); at_gprs_context_exit(); + at_gnss_exit(); } OFONO_PLUGIN_DEFINE(atmodem, AT modem driver, VERSION, diff --git a/drivers/atmodem/atmodem.h b/drivers/atmodem/atmodem.h index a6720d1..41f480f 100644 --- a/drivers/atmodem/atmodem.h +++ b/drivers/atmodem/atmodem.h @@ -71,3 +71,6 @@ extern void at_gprs_context_exit(void); extern void at_sim_auth_init(void); extern void at_sim_auth_exit(void); + +extern void at_gnss_init(void); +extern void at_gnss_exit(void); diff --git a/drivers/atmodem/gnss.c b/drivers/atmodem/gnss.c new file mode 100644 index 000..f2ed0a7 --- /dev/null +++ b/drivers/atmodem/gnss.c @@ -0,0 +1,282 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. + * Copyright (C) 2011 ST-Ericsson AB. + * + * 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/gnss.h + +#include gatchat.h +#include gatresult.h + +#include atmodem.h +#include vendor.h + +struct gnss_data { + GAtChat *chat; + unsigned int vendor; +}; + +static const char *none_prefix[] = { NULL }; +static const char *cpos_prefix[] = { +CPOS:, NULL }; +static const char *cposr_prefix[] = { +CPOSR:, NULL }; + +static void gnss_pr_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct cb_data *cbd = user_data; + ofono_gnss_cb_t cb = cbd-cb; + struct ofono_error error; + + DBG(); + + decode_at_error(error, g_at_result_final_response(result)); + + cb(error, cbd-data); +} + +static void at_gnss_position_reporting(struct ofono_gnss *gnss, + ofono_bool_t enable, + ofono_gnss_cb_t cb, + void *data) +{ + struct gnss_data *ad = ofono_gnss_get_data(gnss); + struct cb_data *cbd = cb_data_new(cb, data); + + DBG(); + + if (enable) { + g_at_chat_send(ad-chat, AT+CPOSR=1, + cposr_prefix, gnss_pr_cb, cbd, g_free); + + if (ad-vendor == OFONO_VENDOR_STE) + g_at_chat_send(ad-chat, AT*EPOSADRR=1, + NULL, NULL, NULL, NULL); + } else { + g_at_chat_send(ad-chat, AT+CPOSR=0, + cposr_prefix, gnss_pr_cb, cbd, g_free); + + if (ad-vendor == OFONO_VENDOR_STE) + g_at_chat_send(ad-chat, AT*EPOSADRR=0, + NULL, NULL, NULL, NULL); + } +} + +static void gnss_se_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct cb_data *cbd = user_data; + ofono_gnss_cb_t cb = cbd-cb; + struct ofono_error error; + + DBG(); + + decode_at_error(error,
[PATCH 12/12] test: add test-gnss
--- Makefile.am|3 +- test/test-gnss | 91 2 files changed, 93 insertions(+), 1 deletions(-) create mode 100755 test/test-gnss diff --git a/Makefile.am b/Makefile.am index b5a3d6e..626a310 100644 --- a/Makefile.am +++ b/Makefile.am @@ -509,7 +509,8 @@ test_scripts = test/backtrace \ test/test-sms \ test/test-message-waiting \ test/cdma-connman-disable \ - test/cdma-connman-enable + test/cdma-connman-enable \ + test/test-gnss if TEST testdir = $(pkglibdir)/test diff --git a/test/test-gnss b/test/test-gnss new file mode 100755 index 000..d7d9027 --- /dev/null +++ b/test/test-gnss @@ -0,0 +1,91 @@ +#!/usr/bin/python + +import gobject +import sys +import os + +import dbus +import dbus.service +import dbus.mainloop.glib + +class PositioningAgent(dbus.service.Object): + @dbus.service.method(org.ofono.PositioningRequestAgent, + in_signature=, out_signature=) + def Release(self): + print Release + mainloop.quit() + + @dbus.service.method(org.ofono.PositioningRequestAgent, + in_signature=s, out_signature=) + def Request(self, xml): + print positioning data: %s % (xml) + + @dbus.service.method(org.ofono.PositioningRequestAgent, + in_signature=, out_signature=) + def ResetAssistanceData(self): + print Reset Assistance Data request received + +def print_menu(): + print Select test case + print --- + print [0] SendPositioningElement + print [1] RegisterPositioningRequestAgent + print [2] UnregisterPositioningRequestAgent + print [x] Exit + print --- + +def stdin_handler(fd, condition, positioning, path): + + in_key = os.read(fd.fileno(), 8).rstrip() + if in_key == '0': + xml = raw_input('type the element and press enter: ') + try: + positioning.SendPositioningElement(dbus.String(xml)) + print ok + except dbus.DBusException, e: + print Unable to send positioning element + + elif in_key == '1': + try: + positioning.RegisterPositioningRequestAgent(/test/posagent) + print ok + except dbus.DBusException, e: + print Unable to register positioning agent + + elif in_key == '2': + try: + positioning.UnregisterPositioningRequestAgent(path) + print ok + except dbus.DBusException, e: + print Unable to unregister positioning agent + elif in_key == 'x': + sys.exit(1) + + return True + +if __name__ == __main__: + + if len(sys.argv) 1: + sys.exit(1) + + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + bus = dbus.SystemBus() + manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + + modems = manager.GetModems() + for path, properties in modems: + if org.ofono.AssistedSatelliteNavigation not in properties[Interfaces]: + continue + + positioning = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.AssistedSatelliteNavigation') + + path = /test/posagent + agent = PositioningAgent(bus, path) + + print_menu() + + gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler, positioning, path) + mainloop = gobject.MainLoop() + mainloop.run() -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 5/6] stkutil: Complete the TLV parsing/builder to support BIP commands
Hi Philippe, struct stk_network_access_name { -unsigned char name[127]; +unsigned char name[100]; unsigned char len; This part really makes no sense. Since you parse it into a string, might as well just use that. All the above comments are just relevant. Thank you for having spent time to point all these remarks and especially all the coding style noncompliances. I will apply your comments in a new patch and separate cleaning/typo modifications in another dedicated patch. Here, the apn string is indeed extracted from the encoded buffer. As the encoded apn just can't exceeed 100 bytes as per the spec and as the extracted string is lesser than 100 bytes since we are removing the octet length field , I considered that the string buffer was better sized with 100 bytes than 127. But perhaps, I'm over thinking here... Then just remove this structure and use a static buffer for the apn/nan... }; @@ -1250,6 +1298,21 @@ struct stk_command_launch_browser { char *text_passwd; }; +struct stk_command_open_channel { +char *alpha_id; +struct stk_icon_id icon_id; +struct stk_bearer_description bearer_desc; +unsigned short buf_size; +struct stk_network_access_name network_name; E.g. char *network_name; e.g. char name[100] here. +/* The number of bytes remaining in the Rx buffer */ +unsigned int data_left_length; So maybe rx_remaining is a better name? +/* + * The number of bytes of empty space available + * in the Tx buffer + */ +unsigned int empty_data_length; And tx_avail here? Then you don't need the comments ;) Also, why do you use unsigned int instead of unsigned char? In practice, the size (rx_remaining or tx_avail) can reach 65535 as the buffer size it self given by the UICC is encoded by 2 bytes. I could consider indeed to use at least an unsigned short, but to be homogeneous with the type of the buffer size given by data.len, I preferred to go with an unsigned int. Stick with actual datatypes used on the wire. If this is an 8 bit sequence with FF used to mean 255 bytes or more, then use that. The logic that fills this structure will have to take care of that. Besides, you use unsigned char in stk_response_receive_data and stk_response_send_data, so might as well be consistent. Use of unsigned int should be limited to the length field of the TLV, and even then we might have to change this later for fields that are short. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/6] stk-api.txt: Describe new d-bus APIs related to BIP commands.
Hi Philippe, boolean ConfirmCallSetup(string information, byte icon_id) @@ -245,6 +252,7 @@ Methodsbyte RequestSelection(string title, byte icon_id, Possible Errors: [service].Error.SimToolkit.EndSession void DisplayActionInformation(string text, byte icon_id) +[noreply] Why are you marking this noreply when we do actually expect one? In practice, this API is called once an alpha Id is provided by the proactive commands SEND SS, SEND SMS, SEND USSD. For such proactive commands, no user answer is expected. That's why the error code [service].Error.SimToolkit.EndSession is even not allowed. And that's the reason why I added the criteria [No reply] Ok fair enough. Now, I just realized that I missed the proactive command SEND DTMF for which this API is also relevant and for which the user can indeed request to end the session. So, the criteria [noreply] is indeed not fair. Send DTMF is a little bit more subtle. The problem is that it is usually handled by the modem side and we have no control over the terminal response. So the current Send DTMF implementation will likely work magically everywhere anyway. We probably should split up this implementation into two paths: - If the command is notified via ofono_stk_proactive_command_handled_notify, then do as we do now, e.g. using DisplayActionInformation - If the command is notified via ofono_stk_proactive_command_notify, then we should probably call a different function. But, the reason for which I introduced the new API DisplayChannelActivity was to distinguish precisely when the STK agent could allow the user to end the session (typically when the button Cancel could be displayed). And that makes sense to me now Now, to handle correctly the case SEND DTMF, I presume that it would be better to refactor this API 'DisplayActionInformation' in order to address all the proactive commands which require simply to display an alpha ID. But this requires I guess to introduce a new argument like a boolean end_session_allowed. I think a separate function makes sense. Perhaps DisplayAbortableActionInfo or feel free to come up with a better name. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] dun: Add ATX command in emulator (X0 only)
--- src/emulator.c | 57 +++- 1 files changed, 56 insertions(+), 1 deletions(-) diff --git a/src/emulator.c b/src/emulator.c index c84f0a9..101d6b8 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -177,6 +177,59 @@ error: g_at_server_send_final(em-server, G_AT_SERVER_RESULT_ERROR); } +static gboolean get_result_value(GAtServer *server, GAtResult *result, + int min, int max, int *value) +{ + GAtResultIter iter; + int val; + + g_at_result_iter_init(iter, result); + + if (!g_at_result_iter_next(iter, )) + return FALSE; + + if (!g_at_result_iter_next_number(iter, val)) + return FALSE; + + if (val min || val max) + return FALSE; + + if (value != NULL) + *value = val; + + return TRUE; +} + +static void at_x_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ + switch (type) { + case G_AT_SERVER_REQUEST_TYPE_SET: + if (!get_result_value(server, result, 0, 0, NULL)) { + g_at_server_send_final(server, + G_AT_SERVER_RESULT_ERROR); + return; + } + /* the value is not stored, as there's only one choice */ + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break; + + case G_AT_SERVER_REQUEST_TYPE_QUERY: + g_at_server_send_info(server, 000, TRUE); + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break; + + case G_AT_SERVER_REQUEST_TYPE_SUPPORT: + g_at_server_send_info(server, X: (0-0), TRUE); + g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break; + + default: + g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR); + break; + } +} + static void brsf_cb(GAtServer *server, GAtServerRequestType type, GAtResult *result, gpointer user_data) { @@ -466,8 +519,10 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd) __ofono_atom_register(em-atom, emulator_unregister); - if (em-type == OFONO_EMULATOR_TYPE_DUN) + if (em-type == OFONO_EMULATOR_TYPE_DUN) { g_at_server_register(em-server, D, dial_cb, em, NULL); + g_at_server_register(em-server, X, at_x_cb, em, NULL); + } else if (em-type == OFONO_EMULATOR_TYPE_HFP) g_at_server_set_echo(em-server, FALSE); } -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] build: Add gatchat to core sources
Otherwise, --disable-atmodem breaks build. --- Makefile.am |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index b0cbcd7..39d8962 100644 --- a/Makefile.am +++ b/Makefile.am @@ -154,8 +154,7 @@ endif if ATMODEM builtin_modules += atmodem -builtin_sources += $(gatchat_sources) \ - drivers/atmodem/atmodem.h \ +builtin_sources += drivers/atmodem/atmodem.h \ drivers/atmodem/atmodem.c \ drivers/atmodem/call-settings.c \ drivers/atmodem/sms.c \ @@ -365,9 +364,9 @@ builtin_sources += plugins/push-notification.c sbin_PROGRAMS = src/ofonod -src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \ - src/main.c src/ofono.h src/log.c src/plugin.c \ - src/modem.c src/common.h src/common.c \ +src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) $(gatchat_sources) \ + src/ofono.ver src/main.c src/ofono.h src/log.c \ + src/plugin.c src/modem.c src/common.h src/common.c \ src/manager.c src/dbus.c src/util.h src/util.c \ src/network.c src/voicecall.c src/ussd.c src/sms.c \ src/call-settings.c src/call-forwarding.c \ -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] doc: Complete possible errors
--- doc/stk-api.txt |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/doc/stk-api.txt b/doc/stk-api.txt index 529c734..f8a115e 100644 --- a/doc/stk-api.txt +++ b/doc/stk-api.txt @@ -96,6 +96,7 @@ Methods byte RequestSelection(string title, byte icon_id, an error given below. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession Implementation notes: @@ -111,6 +112,7 @@ Methods byte RequestSelection(string title, byte icon_id, cleared prior to the display of this text. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession [service].Error.SimToolkit.Busy Implementation notes: @@ -154,6 +156,7 @@ Methods byte RequestSelection(string title, byte icon_id, should be opaque. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession Implementation notes: @@ -171,6 +174,7 @@ Methods byte RequestSelection(string title, byte icon_id, are expected. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession string RequestKey(string alpha, byte icon_id) @@ -179,6 +183,7 @@ Methods byte RequestSelection(string title, byte icon_id, for the request. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession string RequestDigit(string alpha, byte icon_id) @@ -186,12 +191,14 @@ Methods byte RequestSelection(string title, byte icon_id, expected. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession boolean RequestConfirmation(string alpha, byte icon_id) Asks the agent to get confirmation from the user. Possible Errors: [service].Error.SimToolkit.GoBack +[service].Error.SimToolkit.EndSession boolean ConfirmCallSetup(string information, byte icon_id) -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] doc: Complete possible errors
Hi Philippe, On 03/24/2011 11:42 AM, Philippe Nunes wrote: --- doc/stk-api.txt |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] voicecall: fix voicecalls_release_queue
voicecalls_release_queue uses struct ofono_call instead of struct voicecall (which is used in calls list parameter and function voicecalls_release_next) --- src/voicecall.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 4932ffa..b1d5586 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -1070,7 +1070,7 @@ static void voicecalls_emit_call_added(struct ofono_voicecall *vc, static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls) { GSList *l; - struct ofono_call *call; + struct voicecall *call; g_slist_free(vc-release_list); vc-release_list = NULL; @@ -1078,7 +1078,7 @@ static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls) for (l = calls; l; l = l-next) { call = l-data; - if (call-status == CALL_STATUS_WAITING) + if (call-call-status == CALL_STATUS_WAITING) continue; vc-release_list = g_slist_prepend(vc-release_list, l-data); -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] gprs: fix memory leak
Hi Mika, On 03/24/2011 07:32 AM, Mika Liljeberg wrote: --- src/gprs.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) Good catch. Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] test: add a script to set any GPRS context property
Hi Mika, On 03/24/2011 07:32 AM, Mika Liljeberg wrote: --- Makefile.am |3 ++- test/set-context-property | 38 ++ 2 files changed, 40 insertions(+), 1 deletions(-) create mode 100755 test/set-context-property Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] TODO: remove me from ofono_sim_ready_notify()
Hi Pekka, On 03/24/2011 06:45 AM, pekka.pe...@nokia.com wrote: From: Pekka Pessi pekka.pe...@nokia.com __ofono_sim_recheck_pin() is fine by me --- TODO |1 - 1 files changed, 0 insertions(+), 1 deletions(-) Applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] gatserver: add ATF command
Hi Olivier, On 03/24/2011 05:03 AM, Olivier Guiter wrote: --- gatchat/gatserver.c | 29 +++-- 1 files changed, 27 insertions(+), 2 deletions(-) Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] gatserver: add v250 ATL and ATM commands
Hi Olivier, +static void at_l_cb(GAtServer *server, GAtServerRequestType type, + GAtResult *result, gpointer user_data) +{ + s_template_cb(type, result, server, server-v250.s5, L, 0, 3); Copy paste error? I presume you mean v250.l here Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] Set owner CSSU/CSSI support task
--- TODO |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/TODO b/TODO index ed644c9..6769906 100644 --- a/TODO +++ b/TODO @@ -21,3 +21,7 @@ Call Management - Add support for +CSSU / +CSSI notifications. These can be used to simulate the remote party putting the call on hold, retrieving or creating an mpty call. + + Priority: Low + Complexity: C1 + Owner: Nicolas Bertrand nicolas.bertr...@linux.intel.com \ No newline at end of file -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] voicecall: fix voicecalls_release_queue
Hi Frédéric, On 03/24/2011 12:43 PM, Frédéric Danis wrote: voicecalls_release_queue uses struct ofono_call instead of struct voicecall (which is used in calls list parameter and function voicecalls_release_next) --- src/voicecall.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Good spot, patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono