[PATCH] Simcom support
by Anthony Viallard
Add SIMCOM support.
I developped this with the SIM5216E chipset and ofono 1.12.
- SMS and GPRS work (in the same time) ;
- SIM card presence check ;
- No voice part because I can't test it ;
- Use default characters set instead GSM because it works like that
for what I'm doing (SMS+GPRS) (by default, the set is IRA for SIM5216E).
Also, the SIMCOM doc affraids me about problems when using GSM
(this setting causes easily software flow control (XON /XOFF) problems.).
Signed-off-by: Anthony Viallard <homer242 at gmail.com>
--- ofono-1.12.orig/Makefile.am 2012-04-20 21:06:29.000000000 +0200
+++ ofono-1.12/Makefile.am 2013-01-21 17:17:48.089627277 +0100
@@ -371,6 +371,9 @@ builtin_sources += plugins/samsung.c
builtin_modules += sim900
builtin_sources += plugins/sim900.c
+builtin_modules += simcom
+builtin_sources += plugins/simcom.c
+
if BLUETOOTH
builtin_modules += bluetooth
builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
--- ofono-1.12.orig/drivers/atmodem/sms.c 2012-04-20 21:06:29.000000000 +0200
+++ ofono-1.12/drivers/atmodem/sms.c 2013-01-21 16:48:44.460627485 +0100
@@ -805,6 +807,7 @@ static gboolean build_cnmi_string(char *
case OFONO_VENDOR_NOVATEL:
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_ZTE:
+ case OFONO_VENDOR_SIMCOM:
/* MSM devices advertise support for mode 2, but return an
* error if we attempt to actually use it. */
mode = "1";
diff -pruN ofono-1.12.orig/drivers/atmodem/sim.c ofono-1.12/drivers/atmodem/sim.c
--- ofono-1.12.orig/drivers/atmodem/sim.c 2013-01-23 11:38:22.959609087 +0100
+++ ofono-1.12/drivers/atmodem/sim.c 2013-01-23 11:57:52.602608948 +0100
@@ -1023,12 +1023,18 @@ static void at_pin_send_cb(gboolean ok,
FALSE, cbd, g_free);
return;
case OFONO_VENDOR_ZTE:
case OFONO_VENDOR_ALCATEL:
case OFONO_VENDOR_HUAWEI:
+ case OFONO_VENDOR_SIMCOM:
/*
* On ZTE modems, after pin is entered, SIM state is checked
* by polling CPIN as their modem doesn't provide unsolicited
* notification of SIM readiness.
+ *
+ * On SIMCOM modems, SIM is busy after pin is entered (we've
+ * got an "+CME ERROR: 14" at "AT+CPIN?" request) and ofono
+ * don't catch the "+CPIN: READY" message sent by the modem
+ * when SIM is ready. So, use extra CPIN to check the state.
*/
sd->sim_state_query = at_util_sim_state_query_new(sd->chat,
2, 20, sim_state_cb, cbd,
diff -purN ofono-1.12/drivers/atmodem/network-registration.c ofono-patched/drivers/atmodem/network-registration.c
--- ofono-1.12/drivers/atmodem/network-registration.c 2013-01-18 15:04:03.598659165 +0100
+++ ofono-patched/drivers/atmodem/network-registration.c 2013-01-18 14:54:03.256659236 +0100
@@ -1411,6 +1411,14 @@ static void at_creg_set_cb(gboolean ok,
}
switch (nd->vendor) {
+ case OFONO_VENDOR_SIMCOM:
+ /* Register for CSQ changes */
+ g_at_chat_send(nd->chat, "AT+AUTOCSQ=1,1", none_prefix,
+ NULL, NULL, NULL);
+
+ g_at_chat_register(nd->chat, "+CSQ:",
+ csq_notify, FALSE, netreg, NULL);
+ break;
case OFONO_VENDOR_PHONESIM:
g_at_chat_register(nd->chat, "+CSQ:",
csq_notify, FALSE, netreg, NULL);
@@ -1534,7 +1537,6 @@ static void at_creg_set_cb(gboolean ok,
break;
case OFONO_VENDOR_NOKIA:
case OFONO_VENDOR_SAMSUNG:
- case OFONO_VENDOR_SIMCOM:
/* Signal strength reporting via CIND is not supported */
break;
default:
--- /dev/null 2013-01-28 10:34:59.843091650 +0100
+++ ofono-1.12/plugins/simcom.c 2013-02-15 16:16:38.058552544 +0100
@@ -0,0 +1,401 @@
+/*
+ *
+ * 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 <config.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <glib.h>
+#include <gatchat.h>
+#include <gattty.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/modem.h>
+#include <ofono/devinfo.h>
+#include <ofono/netreg.h>
+#include <ofono/sim.h>
+#include <ofono/cbs.h>
+#include <ofono/sms.h>
+#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>
+
+#include <drivers/atmodem/atutil.h>
+#include <drivers/atmodem/vendor.h>
+
+#define MAX_IGNITION_POOL_CALL 7
+
+#define CMEERR_SIMBUSY 14
+
+static const char *none_prefix[] = { NULL };
+
+struct simcom_data {
+ GAtChat *modem;
+ GAtChat *data;
+ guint ignition_pool;
+ unsigned int ignition_pool_call;
+ unsigned int at_ignition_pending;
+ ofono_bool_t have_sim;
+};
+
+/* Callback and helpers functions */
+static void simcom_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+
+ ofono_info("%s%s", prefix, str);
+}
+
+static gboolean simcom_ignition(gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ ++data->ignition_pool_call;
+
+ if(data->at_ignition_pending > 0)
+ {
+ if(data->ignition_pool_call > MAX_IGNITION_POOL_CALL)
+ {
+ ofono_error("Ignition timeout");
+ return FALSE;
+ }
+
+ /* Waiting reply of AT commands */
+ DBG("Waiting AT reply...");
+ return TRUE;
+ }
+
+ ofono_modem_set_powered(modem, TRUE);
+
+ return FALSE;
+}
+
+static void simcom_sim_status(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ofono_error error;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ --data->at_ignition_pending;
+
+ if(!ok)
+ {
+ decode_at_error(&error, g_at_result_final_response(result));
+ if(error.type == OFONO_ERROR_TYPE_CME)
+ {
+ if(error.error == CMEERR_SIMBUSY)
+ {
+ DBG("System is busy. Retry...");
+ g_at_chat_send(data->data, "AT+CPIN?",
+ none_prefix,
+ simcom_sim_status, modem,
+ NULL);
+ ++data->at_ignition_pending;
+ return;
+ }
+ }
+
+ data->have_sim = FALSE;
+ return;
+ }
+
+ /* If doesn't have an "fatal" error on AT+CPIN request,
+ * we can guess there a SIM card ...
+ */
+ data->have_sim = TRUE;
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ if (!ok) {
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+
+ g_at_chat_unref(data->data);
+ data->data = NULL;
+
+ ofono_modem_set_powered(modem, FALSE);
+ return;
+ }
+
+ /* Get model and sim card status */
+ data->at_ignition_pending = 0;
+
+ g_at_chat_send(data->data, "AT+CPIN?", none_prefix,
+ simcom_sim_status, modem, NULL);
+ ++data->at_ignition_pending;
+
+ data->ignition_pool = g_timeout_add_seconds(1,
+ simcom_ignition,
+ modem);
+}
+
+static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ g_at_chat_unref(data->data);
+ data->data = NULL;
+
+ if (ok)
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+ const char *key,
+ char *debug)
+{
+ const char *device;
+ GIOChannel *channel;
+ GAtSyntax *syntax;
+ GAtChat *chat;
+ /* GHashTable *options; */
+
+ device = ofono_modem_get_string(modem, key);
+ if (device == NULL)
+ {
+ ofono_error("Failed to get modem '%s'", key);
+ return NULL;
+ }
+
+ DBG("%s %s", key, device);
+
+ /* options = g_hash_table_new(g_str_hash, g_str_equal); */
+ /* if (options == NULL) */
+ /* return NULL; */
+
+ /* g_hash_table_insert(options, "Baud", "115200"); */
+ /* g_hash_table_insert(options, "Parity", "none"); */
+ /* g_hash_table_insert(options, "StopBits", "1"); */
+ /* g_hash_table_insert(options, "DataBits", "8"); */
+ /* g_hash_table_insert(options, "XonXoff", "off"); */
+ /* g_hash_table_insert(options, "RtsCts", "on"); */
+ /* g_hash_table_insert(options, "Local", "on"); */
+ /* g_hash_table_insert(options, "Read", "on"); */
+
+ channel = g_at_tty_open(device, NULL);
+
+ /* g_hash_table_destroy(options); */
+
+ if (channel == NULL)
+ {
+ ofono_error("Failed to get tty for '%s'", key);
+ return NULL;
+ }
+
+ syntax = g_at_syntax_new_gsm_permissive();
+ chat = g_at_chat_new(channel, syntax);
+ g_at_syntax_unref(syntax);
+
+ g_io_channel_unref(channel);
+
+ if (chat == NULL)
+ {
+ ofono_error("Failed to get chat for '%s'", key);
+ return NULL;
+ }
+
+ //if (getenv("OFONO_AT_DEBUG"))
+ g_at_chat_set_debug(chat, simcom_debug, debug);
+
+ return chat;
+}
+
+/* Modem interface function */
+static int simcom_probe(struct ofono_modem *modem)
+{
+ struct simcom_data *data;
+
+ DBG("%p", modem);
+
+ data = g_try_new0(struct simcom_data, 1);
+ if (data == NULL)
+ return -ENOMEM;
+
+ ofono_modem_set_data(modem, data);
+
+ return 0;
+}
+
+static void simcom_remove(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ if(data->ignition_pool > 0)
+ {
+ g_source_remove(data->ignition_pool);
+ data->ignition_pool = 0;
+ }
+
+ ofono_modem_set_data(modem, NULL);
+
+ /* Cleanup after hot-unplug */
+ g_at_chat_unref(data->data);
+
+ g_free(data);
+}
+
+static int simcom_enable(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ data->modem = open_device(modem, "Modem", "Modem: ");
+ if (data->modem == NULL)
+ return -EINVAL;
+
+ data->data = open_device(modem, "Data", "Data: ");
+ if (data->data == NULL) {
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ return -EIO;
+ }
+
+ g_at_chat_set_slave(data->modem, data->data);
+
+ g_at_chat_blacklist_terminator(data->data,
+ G_AT_CHAT_TERMINATOR_NO_CARRIER);
+
+ /* init modem */
+ g_at_chat_send(data->modem, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
+ g_at_chat_send(data->data, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
+
+ g_at_chat_send(data->data, "AT+CFUN=1", none_prefix,
+ cfun_enable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static int simcom_disable(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ g_at_chat_cancel_all(data->modem);
+ g_at_chat_unregister_all(data->modem);
+
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+
+ g_at_chat_cancel_all(data->data);
+ g_at_chat_unregister_all(data->data);
+
+ g_at_chat_send(data->data, "AT+CFUN=4", none_prefix,
+ cfun_disable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void simcom_pre_sim(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+ struct ofono_sim *sim;
+
+ DBG("%p", modem);
+
+ ofono_devinfo_create(modem, 0, "atmodem", data->data);
+ sim = ofono_sim_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+ data->data);
+
+ if (sim)
+ ofono_sim_inserted_notify(sim, data->have_sim);
+}
+
+static void simcom_post_sim(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+ struct ofono_message_waiting *mw;
+ struct ofono_gprs *gprs;
+ struct ofono_gprs_context *gc;
+
+ DBG("%p", modem);
+
+ ofono_phonebook_create(modem, 0, "atmodem", data->data);
+
+ ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+ data->data);
+
+ /* gprs things */
+ gprs = ofono_gprs_create(modem, 0, "atmodem", data->data);
+ gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
+
+ if(gprs && gc)
+ {
+ ofono_gprs_add_context(gprs, gc);
+ }
+}
+
+static void simcom_post_online(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ ofono_netreg_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->data);
+ ofono_cbs_create(modem, 0, "atmodem", data->data);
+ ofono_ussd_create(modem, 0, "atmodem", data->data);
+}
+
+static struct ofono_modem_driver simcom_driver = {
+ .name = "simcom",
+ .probe = simcom_probe,
+ .remove = simcom_remove,
+ .enable = simcom_enable,
+ .disable = simcom_disable,
+ .pre_sim = simcom_pre_sim,
+ .post_sim = simcom_post_sim,
+ .post_online = simcom_post_online,
+};
+
+static int simcom_init(void)
+{
+ return ofono_modem_driver_register(&simcom_driver);
+}
+
+static void simcom_exit(void)
+{
+ ofono_modem_driver_unregister(&simcom_driver);
+}
+
+OFONO_PLUGIN_DEFINE(simcom, "SIMCOM modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ simcom_init, simcom_exit)
2 weeks, 5 days
[PATCH_v4 0/5] Private network request to ConnMan
by Guillaume Zajac
Hi,
Changelog from v3 is:
- Add private-network source/include
- ConnMan plugin is independant from emulator
- Each application that need VPN will pass a callback as argument
when private network is requested. This callback will contain the
private network settings.
Guillaume Zajac (5):
gatppp: Add new contructor to use external fd
private-network: add callback typedef drivers and settings
private-network: add request/release functions and new feature to
Makefile.am
emulator: add request/release private network calls
connman: add plugin in oFono to request request/release private
network
Makefile.am | 10 +-
gatchat/gatppp.c | 33 +++++-
gatchat/gatppp.h | 1 +
gatchat/ppp.h | 2 +-
gatchat/ppp_net.c | 40 ++++---
include/private-network.h | 59 +++++++++
plugins/connman.c | 297 +++++++++++++++++++++++++++++++++++++++++++++
src/emulator.c | 49 ++++++--
src/ofono.h | 6 +
src/private-network.c | 89 ++++++++++++++
10 files changed, 556 insertions(+), 30 deletions(-)
create mode 100644 include/private-network.h
create mode 100644 plugins/connman.c
create mode 100644 src/private-network.c
3 weeks
Business
by Daser Jnr.
Hi all
>From a business point of view, can some one tell me what i can do with ofono
Cheers
Daser S.
2 months, 2 weeks
[PATCH] sim: change pin_retries array to unsigned char
by Cedric Jehasse
From: Cedric Jehasse <cedric.jehasse(a)softathome.com>
Had a problem on mips, the Retries dict in org.ofono.SimManager was 0
for all pin-types.
The problem is int* are passed to dbus-functions, while the type is
DBUS_TYPE_BYTE. Changed the type of pin_retries throughout the code to
match the byte type.
---
drivers/atmodem/sim.c | 24 ++++++++++++------------
drivers/isimodem/uicc.c | 2 +-
drivers/qmimodem/sim-legacy.c | 2 +-
drivers/qmimodem/sim.c | 2 +-
include/sim.h | 2 +-
src/sim.c | 13 +++++++------
6 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index c128e33..0f64602 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -479,7 +479,7 @@ static struct {
#define BUILD_PIN_RETRIES_ARRAY(passwd_types, passwd_types_cnt, retry) \
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) \
- retry[i] = -1; \
+ retry[i] = 0xff; \
\
for (i = 0; i < passwd_types_cnt; i++) { \
int val; \
@@ -500,7 +500,7 @@ static void huawei_cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PUK,
@@ -547,7 +547,7 @@ static void pinnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -587,7 +587,7 @@ static void zpinpuk_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -625,7 +625,7 @@ static void xpincnt_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -664,7 +664,7 @@ static void oercn_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -704,7 +704,7 @@ static void cpnnum_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *line;
int num;
char **entries;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
decode_at_error(&error, final);
@@ -760,7 +760,7 @@ static void at_epin_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -798,7 +798,7 @@ static void at_cpinr_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_sim_pin_retries_cb_t cb = cbd->cb;
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t len = sizeof(at_sim_name) / sizeof(*at_sim_name);
size_t i;
@@ -843,7 +843,7 @@ static void at_spic_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
@@ -887,7 +887,7 @@ static void at_pct_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
enum ofono_sim_password_type pin_type;
@@ -939,7 +939,7 @@ static void at_pnnm_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *final = g_at_result_final_response(result);
GAtResultIter iter;
struct ofono_error error;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
size_t i;
static enum ofono_sim_password_type password_types[] = {
OFONO_SIM_PASSWORD_SIM_PIN,
diff --git a/drivers/isimodem/uicc.c b/drivers/isimodem/uicc.c
index 0a5121d..a075d27 100644
--- a/drivers/isimodem/uicc.c
+++ b/drivers/isimodem/uicc.c
@@ -926,7 +926,7 @@ static void uicc_query_pin_retries_resp(const GIsiMessage *msg, void *opaque)
{
struct isi_cb_data *cbd = opaque;
ofono_sim_pin_retries_cb_t cb = cbd->cb;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
GIsiSubBlockIter iter;
uint8_t num_sb = 0;
diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c
index 318b1ae..5b1bb5e 100644
--- a/drivers/qmimodem/sim-legacy.c
+++ b/drivers/qmimodem/sim-legacy.c
@@ -38,7 +38,7 @@
struct sim_data {
struct qmi_service *dms;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
};
static void qmi_read_file_info(struct ofono_sim *sim, int fileid,
diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c
index 197da50..f7ccd06 100644
--- a/drivers/qmimodem/sim.c
+++ b/drivers/qmimodem/sim.c
@@ -44,7 +44,7 @@ struct sim_data {
uint8_t card_state;
uint8_t app_type;
uint8_t passwd_state;
- int retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID];
};
static int create_fileid_data(uint8_t app_type, int fileid,
diff --git a/include/sim.h b/include/sim.h
index ed850f9..f66bb93 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -113,7 +113,7 @@ typedef void (*ofono_sim_passwd_cb_t)(const struct ofono_error *error,
void *data);
typedef void (*ofono_sim_pin_retries_cb_t)(const struct ofono_error *error,
- int retries[OFONO_SIM_PASSWORD_INVALID], void *data);
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID], void *data);
typedef void (*ofono_sim_lock_unlock_cb_t)(const struct ofono_error *error,
void *data);
diff --git a/src/sim.c b/src/sim.c
index edae5eb..fe871a0 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -62,7 +62,7 @@ struct ofono_sim {
enum ofono_sim_password_type pin_type;
gboolean locked_pins[OFONO_SIM_PASSWORD_SIM_PUK]; /* Number of PINs */
- int pin_retries[OFONO_SIM_PASSWORD_INVALID];
+ unsigned char pin_retries[OFONO_SIM_PASSWORD_INVALID];
enum ofono_sim_phase phase;
unsigned char mnc_length;
@@ -273,7 +273,7 @@ static void **get_pin_retries(struct ofono_sim *sim)
void **ret;
for (i = 1, nelem = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) {
- if (sim->pin_retries[i] == -1)
+ if (sim->pin_retries[i] == 0xff)
continue;
nelem += 1;
@@ -282,7 +282,7 @@ static void **get_pin_retries(struct ofono_sim *sim)
ret = g_new0(void *, nelem * 2 + 1);
for (i = 1, nelem = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) {
- if (sim->pin_retries[i] == -1)
+ if (sim->pin_retries[i] == 0xff)
continue;
ret[nelem++] = (void *) sim_passwd_name(i);
@@ -431,7 +431,7 @@ done:
}
static void sim_pin_retries_query_cb(const struct ofono_error *error,
- int retries[OFONO_SIM_PASSWORD_INVALID],
+ unsigned char retries[OFONO_SIM_PASSWORD_INVALID],
void *data)
{
struct ofono_sim *sim = data;
@@ -450,6 +450,7 @@ static void sim_pin_retries_query_cb(const struct ofono_error *error,
memcpy(sim->pin_retries, retries, sizeof(sim->pin_retries));
pin_retries = get_pin_retries(sim);
+
ofono_dbus_signal_dict_property_changed(conn, path,
OFONO_SIM_MANAGER_INTERFACE, "Retries",
DBUS_TYPE_BYTE, &pin_retries);
@@ -2372,7 +2373,7 @@ static void sim_free_main_state(struct ofono_sim *sim)
int i;
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
- sim->pin_retries[i] = -1;
+ sim->pin_retries[i] = 0xff;
memset(sim->locked_pins, 0, sizeof(sim->locked_pins));
@@ -2881,7 +2882,7 @@ struct ofono_sim *ofono_sim_create(struct ofono_modem *modem,
sim_remove, sim);
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
- sim->pin_retries[i] = -1;
+ sim->pin_retries[i] = 0xff;
for (l = g_drivers; l; l = l->next) {
const struct ofono_sim_driver *drv = l->data;
--
1.9.2
7 years, 5 months
[PATCH 1/2] sms: Option HSO modem can't really do CNMA
by Neil Jerram
It appears the Option HSO modem can't really do CNMA, so ignore the
fact that it returns 1 for the 'service' value in its response to
AT+CSMS?
---
drivers/atmodem/sms.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index f93dd23..2eab58e 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -1178,6 +1178,7 @@ static void at_csms_status_cb(gboolean ok, GAtResult *result,
switch (data->vendor) {
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_NOVATEL:
+ case OFONO_VENDOR_OPTION_HSO:
g_at_result_iter_skip_next(&iter);
service = 0;
break;
--
2.1.1
7 years, 5 months
disabling gprs
by Ernast Sevo
Hello all,
At the moment I am attempting to disable gprs and I see a signal from
ConnectionManager indicating that the powered value has become false but
seconds later after I query ConnectionManager for its properties I see that
the powered value is now true. Is this intended behaviour from ofono?
Thanks,
Ernast
7 years, 5 months
Problem with hangup of multiple calls
by Georg Chini
Hello,
I am using ofono (compiled from git) and bluez 5.21 to access
my old Nokia 6230i. I have a problem, when I call two parties.
When one call is ended, I do not receive a dbus signal. As soon
as I hangup the second call, I get "CallRemoved" messages for
both calls, so the first signal is delayed until the second call is
finished.
Any idea why this happens or how to debug it further?
Regards
Georg
7 years, 6 months
ICCID not requested when PIN is locked
by Enrico Sau
Hi all,
I have a problem with SimManager interface.
When I start ofono with pin locked it starts to read the sim file manager
but the first message fails:
ofonod[29427]: Aux: > AT+CRSM=192,12258\r
ofonod[29427]: Aux: < \r\n+CME ERROR: 4\r\n
The callback of this message contains the following call which would
success but it is never called because of the error.
This results in the problem that ICCID is never retried even if I enter the
pin.
How can I solve this problem?
Thank you!
Enrico
7 years, 6 months