Re: [PATCH_v0 2/3] sim: Don't use sim file system for CDMA sim
Hi Guillaume, On 11/16/2011 08:49 AM, Guillaume Zajac wrote: > --- > src/sim.c | 66 > 1 files changed, 57 insertions(+), 9 deletions(-) > > diff --git a/src/sim.c b/src/sim.c > index d1d55c5..9ba3483 100644 > --- a/src/sim.c > +++ b/src/sim.c > @@ -102,6 +102,8 @@ struct ofono_sim { > unsigned char *iidf_image; > unsigned int *iidf_watch_ids; > > + gboolean cdma_sim; > + > DBusMessage *pending; > const struct ofono_sim_driver *driver; > void *driver_data; > @@ -1380,7 +1382,8 @@ static void sim_set_ready(struct ofono_sim *sim) > > sim->state = OFONO_SIM_STATE_READY; > > - sim_fs_check_version(sim->simfs); > + if (sim->simfs) > + sim_fs_check_version(sim->simfs); > > call_state_watches(sim); > } > @@ -2527,6 +2530,47 @@ struct ofono_sim *ofono_sim_create(struct ofono_modem > *modem, > return sim; > } > > +struct ofono_sim *ofono_cdma_sim_create(struct ofono_modem *modem, > + unsigned int vendor, > + const char *driver, > + void *data) > +{ > + struct ofono_sim *sim; > + GSList *l; > + int i; > + > + if (driver == NULL) > + return NULL; > + > + sim = g_try_new0(struct ofono_sim, 1); > + > + if (sim == NULL) > + return NULL; > + > + sim->cdma_sim = TRUE; > + sim->phase = OFONO_SIM_PHASE_UNKNOWN; > + sim->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_SIM, > + sim_remove, sim); > + > + for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) > + sim->pin_retries[i] = -1; > + > + for (l = g_drivers; l; l = l->next) { > + const struct ofono_sim_driver *drv = l->data; > + > + if (g_strcmp0(drv->name, driver)) > + continue; > + > + if (drv->probe(sim, vendor, data) < 0) > + continue; > + > + sim->driver = drv; > + break; > + } > + > + return sim; > +} > + > static void emulator_cnum_cb(struct ofono_emulator *em, > struct ofono_emulator_request *req, void *userdata) > { > @@ -2591,19 +2635,23 @@ void ofono_sim_register(struct ofono_sim *sim) > } > > ofono_modem_add_interface(modem, OFONO_SIM_MANAGER_INTERFACE); > - sim->state_watches = __ofono_watchlist_new(g_free); > - sim->simfs = sim_fs_new(sim, sim->driver); > > + sim->state_watches = __ofono_watchlist_new(g_free); > __ofono_atom_register(sim->atom, sim_unregister); > > - ofono_sim_add_state_watch(sim, sim_ready, sim, NULL); > + if (sim->cdma_sim == FALSE) { > + sim->simfs = sim_fs_new(sim, sim->driver); > > - if (sim->state > OFONO_SIM_STATE_NOT_PRESENT) > - sim_initialize(sim); > + ofono_sim_add_state_watch(sim, sim_ready, sim, NULL); > + > + if (sim->state > OFONO_SIM_STATE_NOT_PRESENT) > + sim_initialize(sim); > > - sim->hfp_watch = __ofono_modem_add_atom_watch(modem, > - OFONO_ATOM_TYPE_EMULATOR_HFP, > - emulator_hfp_watch, sim, NULL); > + sim->hfp_watch = __ofono_modem_add_atom_watch(modem, > + OFONO_ATOM_TYPE_EMULATOR_HFP, > + emulator_hfp_watch, sim, NULL); > + } else > + sim_retrieve_imsi(sim); I am really unhappy with this approach. The public API is pretty much dead on arrival long term, and doesn't even handle immediate issues (e.g. what if the PIN is locked?). Perhaps implementing a huawei cdma specific sim driver with only the IMSI operation implemented might be a better 'hack' at this point. However, ideally the core should be able to figure out the SIM type from simply reading the relevant EFs. > } > > void ofono_sim_remove(struct ofono_sim *sim) Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH v2 2/6] tools: Add utility for looking CDMA network name from database
Hi Philippe, On 11/17/2011 10:21 AM, Philippe Nunes wrote: > --- > Makefile.am |7 +++- > tools/lookup-provider-name.c | 100 > ++ > 2 files changed, 106 insertions(+), 1 deletions(-) > create mode 100644 tools/lookup-provider-name.c > Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH v2 1/6] mbpi: Add mbpi_lookup_cdma_provider_name API
Hi Philippe, On 11/17/2011 10:20 AM, Philippe Nunes wrote: > --- > plugins/mbpi.c | 146 > > plugins/mbpi.h |2 + > 2 files changed, 148 insertions(+), 0 deletions(-) > Patch has been applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH v2 6/6] cdmamodem: Add serving system identifier support
Hi Philippe, On 11/17/2011 10:21 AM, Philippe Nunes wrote: > --- > drivers/cdmamodem/network-registration.c | 78 > ++ > include/cdma-netreg.h|7 +++ > 2 files changed, 85 insertions(+), 0 deletions(-) > So the obvious comment is that this patch should be split into two, one for adding new driver API and one for the driver changes. I would also like to see how you're planning to use this information in the core, before reviewing this patch in detail. Do note that after taking a quick peek at Huawei CDMA manuals and ModemManager, I very much doubt that +CSS is what you want to use in the first place. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH v2 5/6] cdmamodem: Add CDMA network-registration support
--- Makefile.am |6 +- drivers/cdmamodem/cdmamodem.c|2 + drivers/cdmamodem/cdmamodem.h|2 + drivers/cdmamodem/network-registration.c | 201 ++ plugins/huaweicdma.c |5 +- 5 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 drivers/cdmamodem/network-registration.c diff --git a/Makefile.am b/Makefile.am index 4c3ca84..6002eb0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -269,11 +269,13 @@ endif if CDMAMODEM builtin_modules += cdmamodem -builtin_sources += drivers/cdmamodem/cdmamodem.h \ +builtin_sources += drivers/atmodem/atutil.h \ + drivers/cdmamodem/cdmamodem.h \ drivers/cdmamodem/cdmamodem.c \ drivers/cdmamodem/voicecall.c \ drivers/cdmamodem/devinfo.c \ - drivers/cdmamodem/connman.c + drivers/cdmamodem/connman.c \ + drivers/cdmamodem/network-registration.c endif builtin_modules += g1 diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c index 50908e3..1548102 100644 --- a/drivers/cdmamodem/cdmamodem.c +++ b/drivers/cdmamodem/cdmamodem.c @@ -37,6 +37,7 @@ static int cdmamodem_init(void) cdma_voicecall_init(); cdma_devinfo_init(); cdma_connman_init(); + cdma_netreg_init(); return 0; } @@ -46,6 +47,7 @@ static void cdmamodem_exit(void) cdma_voicecall_exit(); cdma_devinfo_exit(); cdma_connman_exit(); + cdma_netreg_exit(); } OFONO_PLUGIN_DEFINE(cdmamodem, "CDMA AT modem driver", VERSION, diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h index 3554705..d496214 100644 --- a/drivers/cdmamodem/cdmamodem.h +++ b/drivers/cdmamodem/cdmamodem.h @@ -27,3 +27,5 @@ extern void cdma_devinfo_init(void); extern void cdma_devinfo_exit(void); extern void cdma_connman_init(void); extern void cdma_connman_exit(void); +extern void cdma_netreg_init(void); +extern void cdma_netreg_exit(void); diff --git a/drivers/cdmamodem/network-registration.c b/drivers/cdmamodem/network-registration.c new file mode 100644 index 000..a34db91 --- /dev/null +++ b/drivers/cdmamodem/network-registration.c @@ -0,0 +1,201 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2011 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 +#endif + +#define _GNU_SOURCE +#include +#include + +#include +#include +#include + +#include "gatchat.h" + +#include "cdmamodem.h" +#include + +static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL }; + +static gboolean parse_sysinfo(GAtResult *result, gint *status) +{ + GAtResultIter iter; + gint srv_status; + gint srv_domain; + gint roaming_status; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "^SYSINFO:")) + return FALSE; + + if (!g_at_result_iter_next_number(&iter, &srv_status)) + return FALSE; + + if (!g_at_result_iter_next_number(&iter, &srv_domain)) + return FALSE; + + if (!g_at_result_iter_next_number(&iter, &roaming_status)) + return FALSE; + + DBG("%d, %d, %d", srv_status, srv_domain, roaming_status); + + switch (srv_status) { + case 1: /* Restricted service */ + case 2: /* Service valid */ + case 3: /* Restricted region service */ + if (roaming_status) + *status = CDMA_NETWORK_REGISTRATION_STATUS_ROAMING; + else + *status = CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED; + break; + case 0: /* No service */ + case 4: /* Not registered */ + default: + *status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED; + break; + } + + switch (srv_domain) { + case 0: /* No service */ + case 255: /* CDMA not supported */ + *status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED; + break; + case 1: /* Only CS */ + case 2: /* Only PS */ + case 3: /* CS PS */ + case 4: /* CS registered, PS in searc
[PATCH v2 6/6] cdmamodem: Add serving system identifier support
--- drivers/cdmamodem/network-registration.c | 78 ++ include/cdma-netreg.h|7 +++ 2 files changed, 85 insertions(+), 0 deletions(-) diff --git a/drivers/cdmamodem/network-registration.c b/drivers/cdmamodem/network-registration.c index a34db91..fe8b4f2 100644 --- a/drivers/cdmamodem/network-registration.c +++ b/drivers/cdmamodem/network-registration.c @@ -24,6 +24,7 @@ #endif #define _GNU_SOURCE +#include #include #include @@ -108,6 +109,67 @@ static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data) ofono_cdma_netreg_status_notify(netreg, status); } +static gboolean parse_css(GAtResult *result, const char **sid) +{ + GAtResultIter iter; + /* + * According TIA/EIA/IS-707, CSS query returns , but + * according TIA/EIA/IS-707-A , it returns ,, + * PREV field which has been added afterward is ignored + */ + + g_at_result_iter_init(&iter, result); + + g_at_result_iter_next(&iter, NULL); + + /* Skip first field since we are not interested in this */ + if (!g_at_result_iter_skip_next(&iter)) + return FALSE; + + if (!g_at_result_iter_next_unquoted_string(&iter, sid)) + return FALSE; + /* + * As CSS answer may differ according which revision of TIA/EIA/IS-707 + * the modem is compliant, we need to check if this field is Band or SID + */ + if (*sid[0] >= 'A' && *sid[0] <= 'F') { + /* This is the band field, the next field is the SID*/ + if (!g_at_result_iter_next_unquoted_string(&iter, sid)) + return FALSE; + } + + if (!strcmp(*sid, "9")) + /* The mobile station is not registered.*/ + return FALSE; + + return TRUE; +} + +static void serving_system_cb(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct cb_data *cbd = user_data; + ofono_cdma_netreg_serving_system_cb_t cb = cbd->cb; + struct ofono_error error; + const char* sid; + + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) { + cb(&error, NULL, cbd->data); + return; + } + + if (parse_css(result, &sid) == FALSE) { + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); + return; + } + + DBG("serving system: SID %s", sid); + + cb(&error, sid, cbd->data); +} + static void mode_notify(GAtResult *result, gpointer user_data) { struct ofono_cdma_netreg *netreg = user_data; @@ -184,10 +246,26 @@ static void cdma_netreg_remove(struct ofono_cdma_netreg *netreg) g_at_chat_unref(chat); } +static void cdma_netreg_serving_system(struct ofono_cdma_netreg *netreg, + ofono_cdma_netreg_serving_system_cb_t cb, void *data) +{ + GAtChat *chat = ofono_cdma_netreg_get_data(netreg); + struct cb_data *cbd = cb_data_new(cb, data); + + if (g_at_chat_send(chat, "AT+CSS=?", NULL, serving_system_cb, cbd, + g_free) > 0) + return; + + g_free(cbd); + + CALLBACK_WITH_FAILURE(cb, NULL, data); +} + static struct ofono_cdma_netreg_driver driver = { .name = "cdmamodem", .probe = cdma_netreg_probe, .remove = cdma_netreg_remove, + .serving_system = cdma_netreg_serving_system, }; void cdma_netreg_init(void) diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h index 31ed289..529dab5 100644 --- a/include/cdma-netreg.h +++ b/include/cdma-netreg.h @@ -36,12 +36,19 @@ enum cdma_netreg_status { struct ofono_cdma_netreg; +typedef void (*ofono_cdma_netreg_serving_system_cb_t)( + const struct ofono_error *error, + const char *sid, + void *data); + struct ofono_cdma_netreg_driver { const char *name; int (*probe)(struct ofono_cdma_netreg *cdma_netreg, unsigned int vendor, void *data); void (*remove)(struct ofono_cdma_netreg *cdma_netreg); + void (*serving_system)(struct ofono_cdma_netreg *cdma_netreg, + ofono_cdma_netreg_serving_system_cb_t cb, void *data); }; void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *netreg, -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH v2 4/6] huaweicdmamodem: Merge this driver with cdmamodem driver
--- drivers/huaweicdmamodem/huaweicdmamodem.c | 45 -- drivers/huaweicdmamodem/huaweicdmamodem.h | 23 --- drivers/huaweicdmamodem/network-registration.c | 199 3 files changed, 0 insertions(+), 267 deletions(-) delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.c delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.h delete mode 100644 drivers/huaweicdmamodem/network-registration.c diff --git a/drivers/huaweicdmamodem/huaweicdmamodem.c b/drivers/huaweicdmamodem/huaweicdmamodem.c deleted file mode 100644 index 4e9c400..000 --- a/drivers/huaweicdmamodem/huaweicdmamodem.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * oFono - Open Source Telephony - * - * Copyright (C) 2008-2011 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 -#endif - -#define OFONO_API_SUBJECT_TO_CHANGE -#include - -#include "huaweicdmamodem.h" - -static int huaweicdmamodem_init(void) -{ - huaweicdma_netreg_init(); - - return 0; -} - -static void huaweicdmamodem_exit(void) -{ - huaweicdma_netreg_exit(); -} - -OFONO_PLUGIN_DEFINE(huaweicdmamodem, "Huawei CDMA modem driver", VERSION, - OFONO_PLUGIN_PRIORITY_DEFAULT, - huaweicdmamodem_init, huaweicdmamodem_exit) diff --git a/drivers/huaweicdmamodem/huaweicdmamodem.h b/drivers/huaweicdmamodem/huaweicdmamodem.h deleted file mode 100644 index 799d3a8..000 --- a/drivers/huaweicdmamodem/huaweicdmamodem.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * oFono - Open Source Telephony - * - * Copyright (C) 2008-2011 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 - * - */ - -extern void huaweicdma_netreg_init(void); -extern void huaweicdma_netreg_exit(void); diff --git a/drivers/huaweicdmamodem/network-registration.c b/drivers/huaweicdmamodem/network-registration.c deleted file mode 100644 index 25c6291..000 --- a/drivers/huaweicdmamodem/network-registration.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * - * oFono - Open Source Telephony - * - * Copyright (C) 2008-2011 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 -#endif - -#define _GNU_SOURCE -#include -#include - -#include -#include -#include - -#include "gatchat.h" - -#include "huaweicdmamodem.h" - -static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL }; - -static gboolean parse_sysinfo(GAtResult *result, gint *status) -{ - GAtResultIter iter; - gint srv_status; - gint srv_domain; - gint roaming_status; - - g_at_result_iter_init(&iter, result); - - if (!g_at_result_iter_next(&iter, "^SYSINFO:")) - return FALSE; - - if (!g_at_result_iter_next_number(&iter, &srv_status)) - return FALSE; - - if (!g_at_result_iter_next_number(&iter, &srv_domain)) - return FALSE; - - if (!g_at_result_iter_next_number(&iter, &roaming_status)) - return FALSE; - -
[PATCH v2 2/6] tools: Add utility for looking CDMA network name from database
--- Makefile.am |7 +++- tools/lookup-provider-name.c | 100 ++ 2 files changed, 106 insertions(+), 1 deletions(-) create mode 100644 tools/lookup-provider-name.c diff --git a/Makefile.am b/Makefile.am index a28f790..337aeb7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -627,7 +627,8 @@ TESTS = $(unit_tests) if TOOLS noinst_PROGRAMS += tools/huawei-audio tools/auto-enable \ - tools/get-location tools/lookup-apn + tools/get-location tools/lookup-apn \ + tools/lookup-provider-name tools_huawei_audio_SOURCES = $(gdbus_sources) tools/huawei-audio.c tools_huawei_audio_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @@ -640,6 +641,10 @@ tools_get_location_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ tools_lookup_apn_SOURCES = plugins/mbpi.c plugins/mbpi.h tools/lookup-apn.c tools_lookup_apn_LDADD = @GLIB_LIBS@ + +tools_lookup_provider_name_SOURCES = plugins/mbpi.c plugins/mbpi.h \ + tools/lookup-provider-name.c +tools_lookup_provider_name_LDADD = @GLIB_LIBS@ endif noinst_PROGRAMS += gatchat/gsmdial gatchat/test-server gatchat/test-qcdm diff --git a/tools/lookup-provider-name.c b/tools/lookup-provider-name.c new file mode 100644 index 000..596b6c1 --- /dev/null +++ b/tools/lookup-provider-name.c @@ -0,0 +1,100 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2011 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 +#endif + +#include + +#include + +#define OFONO_API_SUBJECT_TO_CHANGE +#include +#include + +#include "plugins/mbpi.h" + +static void lookup_cdma_provider_name(const char *match_sid) +{ + GError *error = NULL; + char *name; + + g_print("Searching for serving network name with SID: %s\n", match_sid); + + name = mbpi_lookup_cdma_provider_name(match_sid, &error); + + if (name == NULL) { + if (error != NULL) { + g_printerr("Lookup failed: %s\n", error->message); + g_error_free(error); + } else + g_printerr("Not found\n"); + + return; + } + + g_print("CDMA provider name: %s\n", name); + + g_free(name); +} + +static gboolean option_version = FALSE; + +static GOptionEntry options[] = { + { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version, + "Show version information and exit" }, + { NULL }, +}; + +int main(int argc, char **argv) +{ + GOptionContext *context; + GError *error = NULL; + + context = g_option_context_new(NULL); + g_option_context_add_main_entries(context, options, NULL); + + if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) { + if (error != NULL) { + g_printerr("%s\n", error->message); + g_error_free(error); + } else + g_printerr("An unknown error occurred\n"); + exit(1); + } + + g_option_context_free(context); + + if (option_version == TRUE) { + g_print("%s\n", VERSION); + exit(0); + } + + if (argc < 1) { + g_printerr("Missing parameters\n"); + exit(1); + } + + lookup_cdma_provider_name(argv[1]); + + return 0; +} -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH v2 3/6] Huaweicdmamodem: remove this specific driver
--- Makefile.am |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 337aeb7..4c3ca84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -274,12 +274,6 @@ builtin_sources += drivers/cdmamodem/cdmamodem.h \ drivers/cdmamodem/voicecall.c \ drivers/cdmamodem/devinfo.c \ drivers/cdmamodem/connman.c - -builtin_modules += huaweicdmamodem -builtin_sources += drivers/huaweicdmamodem/huaweicdmamodem.h \ - drivers/huaweicdmamodem/huaweicdmamodem.c \ - drivers/huaweicdmamodem/network-registration.c - endif builtin_modules += g1 -- 1.7.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH v2 1/6] mbpi: Add mbpi_lookup_cdma_provider_name API
--- plugins/mbpi.c | 146 plugins/mbpi.h |2 + 2 files changed, 148 insertions(+), 0 deletions(-) diff --git a/plugins/mbpi.c b/plugins/mbpi.c index 1e41ecb..415633f 100644 --- a/plugins/mbpi.c +++ b/plugins/mbpi.c @@ -58,6 +58,12 @@ struct gsm_data { gboolean allow_duplicates; }; +struct cdma_data { + const char *match_sid; + char *provider_name; + gboolean match_found; +}; + const char *mbpi_ap_type(enum ofono_gprs_context_type type) { switch (type) { @@ -281,6 +287,32 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm, g_markup_parse_context_push(context, &apn_parser, ap); } +static void sid_handler(GMarkupParseContext *context, + struct cdma_data *cdma, + const gchar **attribute_names, + const gchar **attribute_values, + GError **error) +{ + const char *sid = NULL; + int i; + + for (i = 0; attribute_names[i]; i++) + if (g_str_equal(attribute_names[i], "value") == TRUE) { + sid = attribute_values[i]; + break; + } + + if (sid == NULL) { + mbpi_g_set_error(context, error, G_MARKUP_ERROR, + G_MARKUP_ERROR_MISSING_ATTRIBUTE, + "Missing attribute: sid"); + return; + } + + if (g_str_equal(sid, cdma->match_sid)) + cdma->match_found = TRUE; +} + static void gsm_start(GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, @@ -347,6 +379,71 @@ static const GMarkupParser gsm_parser = { NULL, }; +static void cdma_start(GMarkupParseContext *context, const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer userdata, GError **error) +{ + if (g_str_equal(element_name, "sid")) { + struct cdma_data *cdma = userdata; + /* +* For entries with multiple sid elements, don't bother +* searching if we already have a match +*/ + if (cdma->match_found == TRUE) + return; + + sid_handler(context, cdma, attribute_names, attribute_values, + error); + } +} + +static const GMarkupParser cdma_parser = { + cdma_start, + NULL, + NULL, + NULL, + NULL, +}; + +static void provider_start(GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer userdata, GError **error) +{ + if (g_str_equal(element_name, "name")) { + struct cdma_data *cdma = userdata; + + g_free(cdma->provider_name); + cdma->provider_name = NULL; + g_markup_parse_context_push(context, &text_parser, + &cdma->provider_name); + } else if (g_str_equal(element_name, "gsm")) + g_markup_parse_context_push(context, &skip_parser, NULL); + else if (g_str_equal(element_name, "cdma")) + g_markup_parse_context_push(context, &cdma_parser, userdata); +} + +static void provider_end(GMarkupParseContext *context, + const gchar *element_name, + gpointer userdata, GError **error) +{ + if (g_str_equal(element_name, "name") || + g_str_equal(element_name, "gsm") || + g_str_equal(element_name, "cdma")) + g_markup_parse_context_pop(context); + +} + +static const GMarkupParser provider_parser = { + provider_start, + provider_end, + NULL, + NULL, + NULL, +}; + static void toplevel_gsm_start(GMarkupParseContext *context, const gchar *element_name, const gchar **atribute_names, @@ -379,6 +476,40 @@ static const GMarkupParser toplevel_gsm_parser = { NULL, }; +static void toplevel_cdma_start(GMarkupParseContext *context, + const gchar *element_name, + const gchar **atribute_names, + const gchar **attribute_values, + gpointer userdata, GError **error) +{ + struct cdma_data *cdma = userdata; + + if (g_str_equal(element_name, "p
[PATCH v2 0/6] Add a parser to retrieve the CDMA network name
- Fix according Denis review (remove unnecessary checking, fix coding style issues). - Add the serving system query based on the standard CDMA AT command AT+CSS?. - Merge the huaweicdmamodem driver with cdmamodem driver. Philippe Nunes (6): mbpi: Add mbpi_lookup_cdma_provider_name API tools: Add utility for looking CDMA network name from database Huaweicdmamodem: remove this specific driver huaweicdmamodem: Merge this driver with cdmamodem driver cdmamodem: Add CDMA network-registration support cdmamodem: Add serving system identifier support Makefile.am| 19 +- drivers/cdmamodem/cdmamodem.c |2 + drivers/cdmamodem/cdmamodem.h |2 + drivers/cdmamodem/network-registration.c | 279 drivers/huaweicdmamodem/huaweicdmamodem.c | 45 drivers/huaweicdmamodem/huaweicdmamodem.h | 23 -- drivers/huaweicdmamodem/network-registration.c | 199 - include/cdma-netreg.h |7 + plugins/huaweicdma.c |5 +- plugins/mbpi.c | 146 plugins/mbpi.h |2 + tools/lookup-provider-name.c | 100 + 12 files changed, 552 insertions(+), 277 deletions(-) create mode 100644 drivers/cdmamodem/network-registration.c delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.c delete mode 100644 drivers/huaweicdmamodem/huaweicdmamodem.h delete mode 100644 drivers/huaweicdmamodem/network-registration.c create mode 100644 tools/lookup-provider-name.c ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] udevng: Add support of SU-7300
Add setup_speedupcdma in order to support the specificities of cdma modems --- plugins/udevng.c | 44 +++- 1 files changed, 43 insertions(+), 1 deletions(-) diff --git a/plugins/udevng.c b/plugins/udevng.c index e0f5fd8..35f8c1e 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -289,6 +289,48 @@ static gboolean setup_huawei(struct modem_info *modem) return TRUE; } +static gboolean setup_speedupcdma(struct modem_info *modem) +{ + const char *aux = NULL, *mdm = NULL; + GSList *list; + + DBG("%s", modem->syspath); + + for (list = modem->devices; list; list = list->next) { + struct device_info *info = list->data; + + DBG("%s %s %s %s", info->devnode, info->interface, + info->number, info->label); + + if (g_strcmp0(info->label, "aux") == 0) { + aux = info->devnode; + if (mdm != NULL) + break; + } else if (g_strcmp0(info->label, "modem") == 0) { + mdm = info->devnode; + if (aux != NULL) + break; + } else if (g_strcmp0(info->interface, "255/255/255") == 0) { + if (g_strcmp0(info->number, "00") == 0) + mdm = info->devnode; + else if (g_strcmp0(info->number, "02") == 0) + aux = info->devnode; + else if (g_strcmp0(info->number, "03") == 0) + aux = info->devnode; + } + } + + if (aux == NULL || mdm == NULL) + return FALSE; + + DBG("aux=%s modem=%s", aux, mdm); + + ofono_modem_set_string(modem->modem, "Aux", aux); + ofono_modem_set_string(modem->modem, "Modem", mdm); + + return TRUE; +} + static gboolean setup_speedup(struct modem_info *modem) { const char *aux = NULL, *mdm = NULL; @@ -614,7 +656,7 @@ static struct { { "sierra", setup_sierra}, { "huawei", setup_huawei}, { "huaweicdma", setup_huawei}, - { "speedupcdma",setup_speedup }, + { "speedupcdma",setup_speedupcdma}, { "speedup",setup_speedup }, { "linktop",setup_linktop }, { "alcatel",setup_alcatel }, -- 1.7.4.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCHv2 5/6] gatppp: Add IPv6 CP connect, disconnect callbacks
Hello Denis, On 11/15/2011 03:43 PM, Denis Kenzior wrote: That sounds fine, basically we need a single TUN interface to handle both IPv6 and IPv4 packets. We can probably get by with simply checking the state of each NCP inside ppp_drop_packet on the rx side. On the tx side we most likely need to peek inside the IP packet to figure out and set the protocol accordingly. OK, will make it so. Thanks for the idea! Regards, Oleg -- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCHv2 2/6] gatppp: Add IPv6 CP hooks
Hello Denis, On 11/15/2011 03:59 PM, Denis Kenzior wrote: There are some interesting ideas here, but I want to keep the API changes and the impact on existing code minimal for now. This means not touching the original API if possible. Besides, we simply don't know if we need all this flexibility, so lets just consider the ipv4 only, ipv6 only and both ipv4 and ipv6 being required as use cases we want to address. Sure, let's keep it simple then. I will prepare another patch. Regards, Oleg -- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono