[PATCH v2] SpeedUp: enable online/offline

2012-04-10 Thread Bertrand Aygon
Add speedup_set_online.
Add a polling mechanism since most speedup dongles failed in couple of
AT commands following the CFUN=1 when they are offline.
Cleanup online polling in case modem is removed during online process.

---
 plugins/speedup.c |  115 +
 1 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/plugins/speedup.c b/plugins/speedup.c
index ca6ed13..5b8de4b 100644
--- a/plugins/speedup.c
+++ b/plugins/speedup.c
@@ -47,12 +47,16 @@
 #include drivers/atmodem/atutil.h
 #include drivers/atmodem/vendor.h
 
+static const char *creg_prefix[] = { +CREG:, NULL };
 static const char *none_prefix[] = { NULL };
 
 struct speedup_data {
GAtChat *modem;
GAtChat *aux;
gboolean have_sim;
+   guint online_poll_source;
+   guint online_poll_count;
+   struct cb_data *online_cbd;
struct at_util_sim_state_query *sim_state_query;
 };
 
@@ -232,12 +236,122 @@ static int speedup_disable(struct ofono_modem *modem)
g_at_chat_cancel_all(data-aux);
g_at_chat_unregister_all(data-aux);
 
+   /* Cleanup potential online enable polling */
+   if (data-online_poll_source  0) {
+   g_source_remove(data-online_poll_source);
+   data-online_poll_source = 0;
+
+   g_free(data-online_cbd);
+   data-online_cbd = NULL;
+   }
+
g_at_chat_send(data-aux, AT+CFUN=0, NULL,
cfun_disable, modem, NULL);
 
return -EINPROGRESS;
 }
 
+static gboolean creg_online_check(gpointer user_data);
+
+static void creg_online_cb(gboolean ok, GAtResult *result,
+   gpointer user_data)
+{
+   struct speedup_data *data = user_data;
+   ofono_modem_online_cb_t cb = data-online_cbd-cb;
+
+   if (ok) {
+   CALLBACK_WITH_SUCCESS(cb, data-online_cbd-data);
+   goto done;
+   }
+
+   data-online_poll_count++;
+
+   if (data-online_poll_count  15)
+   goto failure;
+
+   data-online_poll_source = g_timeout_add_seconds(2,
+   creg_online_check, data);
+   return;
+
+failure:
+   CALLBACK_WITH_FAILURE(cb, data-online_cbd-data);
+
+done:
+   g_free(data-online_cbd);
+   data-online_cbd = NULL;
+}
+
+static gboolean creg_online_check(gpointer user_data)
+{
+   struct speedup_data *data = user_data;
+
+   data-online_poll_source = 0;
+
+   g_at_chat_send(data-aux, AT+CREG=?, creg_prefix,
+   creg_online_cb, data, NULL);
+
+   return FALSE;
+}
+
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct speedup_data *data = ofono_modem_get_data(modem);
+
+   if (!ok) {
+   ofono_modem_online_cb_t cb = data-online_cbd-cb;
+
+   CALLBACK_WITH_FAILURE(cb, data-online_cbd-data);
+
+   g_free(data-online_cbd);
+   data-online_cbd = NULL;
+   return;
+   }
+
+   data-online_poll_count = 0;
+
+   creg_online_check(data);
+}
+
+static void set_offline_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_modem_online_cb_t cb = cbd-cb;
+   struct ofono_error error;
+
+   decode_at_error(error, g_at_result_final_response(result));
+   cb(error, cbd-data);
+}
+
+static void speedup_set_online(struct ofono_modem *modem, ofono_bool_t online,
+   ofono_modem_online_cb_t cb, void *user_data)
+{
+   struct speedup_data *data = ofono_modem_get_data(modem);
+
+   DBG(modem %p %s, modem, online ? online : offline);
+
+   if (online == TRUE) {
+   data-online_cbd = cb_data_new(cb, user_data);
+
+   if (g_at_chat_send(data-aux, AT+CFUN=1, none_prefix,
+   set_online_cb, modem, NULL)  0)
+   return;
+
+   g_free(data-online_cbd);
+   data-online_cbd = NULL;
+   } else {
+   struct cb_data *cbd = cb_data_new(cb, user_data);
+
+   if (g_at_chat_send(data-aux, AT+CFUN=4,
+   none_prefix, set_offline_cb, cbd, g_free)  0)
+   return;
+
+   g_free(cbd);
+   }
+
+   CALLBACK_WITH_FAILURE(cb, user_data);
+}
+
 static void speedup_pre_sim(struct ofono_modem *modem)
 {
struct speedup_data *data = ofono_modem_get_data(modem);
@@ -292,6 +406,7 @@ static struct ofono_modem_driver speedup_driver = {
.remove = speedup_remove,
.enable = speedup_enable,
.disable= speedup_disable,
+   .set_online = speedup_set_online,
.pre_sim= speedup_pre_sim,
.post_sim   = speedup_post_sim,
.post_online= 

[PATCHv4 00/13] Call forwarding state handling change

2012-04-10 Thread Oleg Zhurakivskyy
Hello,

Please find the changes in order to correct call forwarding states.

Changes from v3:

- Re-run conditional queries on cfu removal and mark cached.
- End querying once cfu is active.
- Handle the caching on supplementary services path
  cfs modifications.

Regards,
Oleg

Oleg Zhurakivskyy (13):
  call-forwarding: Refactor cf_condition_compare()
  call-forwarding: Refactor cf_condition_find_with_cls()
  call-forwarding: Get rid of extra variable
  call-forwarding: Streamline number assignment
  call-forwarding: Streamline cf_find_timeout() logic
  call-forwarding: Refactor cf_find_unconditional()
  call-forwarding: Streamline set_query_cf_callback()
  call-forwarding: Remove unneeded variable
  call-forwarding: End querying once cfu is active
  call-forwarding: CFU unset, update conditionals
  call-forwarding: Re-run ss path queries on CFU unset
  call-forwarding: Cache ss TYPE_ALL modifications
  TODO: Remove completed call forwarding state task

 TODO  |   17 -
 src/call-forwarding.c |  168 -
 2 files changed, 68 insertions(+), 117 deletions(-)

-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 01/13] call-forwarding: Refactor cf_condition_compare()

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   13 +++--
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 8b6659a..2b91250 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -86,18 +86,12 @@ static void get_query_next_cf_cond(struct 
ofono_call_forwarding *cf);
 static void set_query_next_cf_cond(struct ofono_call_forwarding *cf);
 static void ss_set_query_next_cf_cond(struct ofono_call_forwarding *cf);
 
-static gint cf_condition_compare(gconstpointer a, gconstpointer b)
+static gint cf_cond_compare(gconstpointer a, gconstpointer b)
 {
const struct ofono_call_forwarding_condition *ca = a;
const struct ofono_call_forwarding_condition *cb = b;
 
-   if (ca-cls  cb-cls)
-   return -1;
-
-   if (ca-cls  cb-cls)
-   return 1;
-
-   return 0;
+   return ca-cls - cb-cls;
 }
 
 static gint cf_condition_find_with_cls(gconstpointer a, gconstpointer b)
@@ -175,8 +169,7 @@ static GSList *cf_cond_list_create(int total,
sizeof(struct ofono_call_forwarding_condition));
cond-cls = j;
 
-   l = g_slist_insert_sorted(l, cond,
-   cf_condition_compare);
+   l = g_slist_insert_sorted(l, cond, cf_cond_compare);
}
}
 
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 02/13] call-forwarding: Refactor cf_condition_find_with_cls()

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   56 ++--
 1 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 2b91250..beae53b 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -94,33 +94,25 @@ static gint cf_cond_compare(gconstpointer a, gconstpointer 
b)
return ca-cls - cb-cls;
 }
 
-static gint cf_condition_find_with_cls(gconstpointer a, gconstpointer b)
+static struct ofono_call_forwarding_condition *cf_cond_find(GSList *l, int cls)
 {
-   const struct ofono_call_forwarding_condition *c = a;
-   int cls = GPOINTER_TO_INT(b);
+   for (; l; l = l-next)
+   if (((struct ofono_call_forwarding_condition *)
+   (l-data))-cls == cls)
+   return l-data;
 
-   if (c-cls  cls)
-   return -1;
-
-   if (c-cls  cls)
-   return 1;
-
-   return 0;
+   return NULL;
 }
 
 static int cf_find_timeout(GSList *cf_list, int cls)
 {
-   GSList *l;
struct ofono_call_forwarding_condition *c;
 
-   l = g_slist_find_custom(cf_list, GINT_TO_POINTER(cls),
-   cf_condition_find_with_cls);
+   c = cf_cond_find(cf_list, cls);
 
-   if (l == NULL)
+   if (c == NULL)
return DEFAULT_NO_REPLY_TIMEOUT;
 
-   c = l-data;
-
return c-time;
 }
 
@@ -323,12 +315,8 @@ static void set_new_cond_list(struct ofono_call_forwarding 
*cf,
if (type == CALL_FORWARDING_TYPE_NO_REPLY)
snprintf(tattr, sizeof(tattr), %sTimeout, attr);
 
-   o = g_slist_find_custom(old, GINT_TO_POINTER(lc-cls),
-   cf_condition_find_with_cls);
-
-   if (o) { /* On the old list, must be active */
-   oc = o-data;
-
+   oc = cf_cond_find(old, lc-cls);
+   if (oc) { /* On the old list, must be active */
if (oc-phone_number.type != lc-phone_number.type ||
strcmp(oc-phone_number.number,
lc-phone_number.number)) {
@@ -349,8 +337,8 @@ static void set_new_cond_list(struct ofono_call_forwarding 
*cf,
timeout);
 
/* Remove from the old list */
-   g_free(o-data);
-   old = g_slist_remove(old, o-data);
+   old = g_slist_remove(old, oc);
+   g_free(oc);
} else {
number = phone_number_to_string(lc-phone_number);
 
@@ -428,19 +416,14 @@ static void set_new_cond_list(struct 
ofono_call_forwarding *cf,
if (i == CALL_FORWARDING_TYPE_UNCONDITIONAL)
continue;
 
-   l = g_slist_find_custom(cf-cf_conditions[i],
-   GINT_TO_POINTER(BEARER_CLASS_VOICE),
-   cf_condition_find_with_cls);
-
-   if (l == NULL)
+   lc = cf_cond_find(cf-cf_conditions[i],
+   BEARER_CLASS_VOICE);
+   if (lc == NULL)
continue;
 
if (new_cfu)
number = ;
else {
-   lc = l-data;
-
-   number = phone_number_to_string(
lc-phone_number);
}
 
@@ -789,7 +772,6 @@ static DBusMessage *cf_set_property(DBusConnection *conn, 
DBusMessage *msg,
 
if (cf_condition_timeout_property(property, cls)) {
dbus_uint16_t timeout;
-   GSList *l;
struct ofono_call_forwarding_condition *c;
 
type = CALL_FORWARDING_TYPE_NO_REPLY;
@@ -802,15 +784,11 @@ static DBusMessage *cf_set_property(DBusConnection *conn, 
DBusMessage *msg,
if (timeout  1 || timeout  30)
return __ofono_error_invalid_format(msg);
 
-   l = g_slist_find_custom(cf-cf_conditions[type],
-   GINT_TO_POINTER(cls),
-   cf_condition_find_with_cls);
 
-   if (l == NULL)
+   c = cf_cond_find(cf-cf_conditions[type], cls);
+   if (c == NULL)
return __ofono_error_failed(msg);
 
-   c = l-data;
-
return set_property_request(cf, msg, type, cls,
c-phone_number, timeout);
} else if (cf_condition_enabled_property(cf, property, type, cls)) {
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org

[PATCHv4 03/13] call-forwarding: Get rid of extra variable

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index beae53b..cda54e7 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -116,12 +116,11 @@ static int cf_find_timeout(GSList *cf_list, int cls)
return c-time;
 }
 
-static void cf_cond_list_print(GSList *list)
+static void cf_cond_list_print(GSList *l)
 {
-   GSList *l;
struct ofono_call_forwarding_condition *cond;
 
-   for (l = list; l; l = l-next) {
+   for (; l ; l = l-next) {
cond = l-data;
 
DBG(CF Condition status: %d, class: %d, number: %s,
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 04/13] call-forwarding: Streamline number assignment

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index cda54e7..5e68bba 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -420,11 +420,8 @@ static void set_new_cond_list(struct ofono_call_forwarding 
*cf,
if (lc == NULL)
continue;
 
-   if (new_cfu)
-   number = ;
-   else {
+   number = new_cfu ?  : phone_number_to_string(
lc-phone_number);
-   }
 
ofono_dbus_signal_property_changed(conn, path,
OFONO_CALL_FORWARDING_INTERFACE,
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 06/13] call-forwarding: Refactor cf_find_unconditional()

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   22 --
 1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 424b111..49398c9 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -193,26 +193,12 @@ static void sim_cphs_cff_update_cb(int ok, void *data)
ofono_info(Failed to update EFcphs-cff);
 }
 
-static struct ofono_call_forwarding_condition *cf_find_unconditional(
+static inline struct ofono_call_forwarding_condition *cf_find_unconditional(
struct ofono_call_forwarding *cf)
 {
-   GSList *l = cf-cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL];
-   struct ofono_call_forwarding_condition *cond;
-
-   /*
-* For now we only support Voice, although Fax  all Data
-* basic services are applicable as well.
-*/
-   for (; l; l = l-next) {
-   cond = l-data;
-
-   if (cond-cls  BEARER_CLASS_VOICE)
-   continue;
-
-   return cond;
-   }
-
-   return NULL;
+   return cf_cond_find(
+   cf-cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL],
+   BEARER_CLASS_VOICE);
 }
 
 static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 05/13] call-forwarding: Streamline cf_find_timeout() logic

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 5e68bba..424b111 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -104,16 +104,11 @@ static struct ofono_call_forwarding_condition 
*cf_cond_find(GSList *l, int cls)
return NULL;
 }
 
-static int cf_find_timeout(GSList *cf_list, int cls)
+static int cf_cond_find_timeout(GSList *l, int cls)
 {
-   struct ofono_call_forwarding_condition *c;
+   struct ofono_call_forwarding_condition *cond = cf_cond_find(l, cls);
 
-   c = cf_cond_find(cf_list, cls);
-
-   if (c == NULL)
-   return DEFAULT_NO_REPLY_TIMEOUT;
-
-   return c-time;
+   return cond ? cond-time : DEFAULT_NO_REPLY_TIMEOUT;
 }
 
 static void cf_cond_list_print(GSList *l)
@@ -813,7 +808,7 @@ static DBusMessage *cf_set_property(DBusConnection *conn, 
DBusMessage *msg,
if (number[0] != '\0')
string_to_phone_number(number, ph);
 
-   timeout = cf_find_timeout(cf-cf_conditions[type], cls);
+   timeout = cf_cond_find_timeout(cf-cf_conditions[type], cls);
 
return set_property_request(cf, msg, type, cls, ph,
timeout);
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 07/13] call-forwarding: Streamline set_query_cf_callback()

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   27 ---
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 49398c9..20a510b 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -639,32 +639,29 @@ static void set_query_cf_callback(const struct 
ofono_error *error, int total,
void *data)
 {
struct ofono_call_forwarding *cf = data;
-   GSList *l;
-   DBusMessage *reply;
 
if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error(Setting succeeded, but query failed);
cf-flags = ~CALL_FORWARDING_FLAG_CACHED;
-   reply = __ofono_error_failed(cf-pending);
-   __ofono_dbus_pending_reply(cf-pending, reply);
+   __ofono_dbus_pending_reply(cf-pending,
+   __ofono_error_failed(cf-pending));
return;
}
 
-   if (cf-query_next == cf-query_end) {
-   reply = dbus_message_new_method_return(cf-pending);
-   __ofono_dbus_pending_reply(cf-pending, reply);
-   }
+   if (cf-query_next == cf-query_end)
+   __ofono_dbus_pending_reply(cf-pending,
+   dbus_message_new_method_return(cf-pending));
 
-   l = cf_cond_list_create(total, list);
-   set_new_cond_list(cf, cf-query_next, l);
+   set_new_cond_list(cf, cf-query_next, cf_cond_list_create(total, list));
 
DBG(%s conditions:, cf_type_lut[cf-query_next]);
-   cf_cond_list_print(l);
+   cf_cond_list_print(cf-cf_conditions[cf-query_next]);
 
-   if (cf-query_next != cf-query_end) {
-   cf-query_next++;
-   set_query_next_cf_cond(cf);
-   }
+   if (cf-query_next == cf-query_end)
+   return;
+
+   cf-query_next++;
+   set_query_next_cf_cond(cf);
 }
 
 static void set_query_next_cf_cond(struct ofono_call_forwarding *cf)
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 08/13] call-forwarding: Remove unneeded variable

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 20a510b..ba52609 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -539,8 +539,8 @@ static void get_query_cf_callback(const struct ofono_error 
*error, int total,
}
 
if (cf-query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) {
-   DBusMessage *reply = cf_get_properties_reply(cf-pending, cf);
-   __ofono_dbus_pending_reply(cf-pending, reply);
+   __ofono_dbus_pending_reply(cf-pending,
+   cf_get_properties_reply(cf-pending, cf));
return;
}
 
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 10/13] call-forwarding: CFU unset, update conditionals

2012-04-10 Thread Oleg Zhurakivskyy
Also set the cached flag on CFU activation and
re-querying of the conditionals.
---
 src/call-forwarding.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 786d163..aa1ece7 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -659,6 +659,16 @@ static void set_query_cf_callback(const struct ofono_error 
*error, int total,
DBG(%s conditions:, cf_type_lut[cf-query_next]);
cf_cond_list_print(cf-cf_conditions[cf-query_next]);
 
+   if (cf-query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL) {
+   cf-flags |= CALL_FORWARDING_FLAG_CACHED;
+
+   /*
+* CFU has been disabled, conditionals need to be updated
+*/
+   if (is_cfu_enabled(cf) == FALSE)
+   cf-query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
+   }
+
if (cf-query_next == cf-query_end)
return;
 
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 12/13] call-forwarding: Cache ss TYPE_ALL modifications

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 204ecc7..a22fb1f 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -1184,6 +1184,7 @@ static gboolean cf_ss_control(int type, const char *sc,
 
switch (cf-ss_req-cf_type) {
case CALL_FORWARDING_TYPE_ALL:
+   cf-flags |= CALL_FORWARDING_FLAG_CACHED;
cf-query_next = CALL_FORWARDING_TYPE_UNCONDITIONAL;
cf-query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
break;
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 11/13] call-forwarding: Re-run ss path queries on CFU unset

2012-04-10 Thread Oleg Zhurakivskyy
---
 src/call-forwarding.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index aa1ece7..204ecc7 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -1004,6 +1004,16 @@ static void ss_set_query_cf_callback(const struct 
ofono_error *error, int total,
 
set_new_cond_list(cf, cf-query_next, l);
 
+   if (cf-query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL 
+   cf-query_next == cf-query_end) {
+   cf-flags |= CALL_FORWARDING_FLAG_CACHED;
+   /*
+* CFU has been disabled, conditionals need to be updated
+*/
+   if (is_cfu_enabled(cf) == FALSE)
+   cf-query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
+   }
+
if (cf-query_next != cf-query_end) {
cf-query_next++;
ss_set_query_next_cf_cond(cf);
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv4 13/13] TODO: Remove completed call forwarding state task

2012-04-10 Thread Oleg Zhurakivskyy
---
 TODO |   17 -
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/TODO b/TODO
index 1fef651..9948117 100644
--- a/TODO
+++ b/TODO
@@ -213,23 +213,6 @@ Supplementary Services
   Priority: Low
   Complexity: C8
 
-- Call forwarding state handling change
-
-  At the moment call forwarding states are not always correct. Any active
-  conditional call forwarding should become quiescent while unconditional call
-  forwarding is activate. If call forwarding unconditional is subsequently
-  deactivated, all the quiescent forwardings should become operative again.
-  I.e. No conditional call forwarding string should be returned while
-  unconditional call forwarding is active even if they exist.
-
-  If there is an successful attempt to activate/deactivate conditional call
-  forwarding while unconditional call forwarding is active the conditional 
cache
-  flag should cleared.
-
-  Priority: High
-  Complexity: C1
-  Owner: Nicolas Bertrand nicolas.bertr...@linux.intel.com
-
 
 Voicecall
 =
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/2] ussd fixes

2012-04-10 Thread Nicolas Bertrand
Fix some issues with ussd:
- Crash with speedup dongles
- Crash with ZTE dongles

Nicolas Bertrand (2):
  ussd: rise up buffer lenght for ussd strings
  ussd: Fix speedup ussd encoding

 drivers/atmodem/ussd.c |   15 +++
 plugins/speedup.c  |2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/2] ussd: Fix speedup ussd encoding

2012-04-10 Thread Nicolas Bertrand
Speedup dongles encode USSD strings in GSM7
packed, so we don't have to pack it ourselves.
---
 drivers/atmodem/ussd.c |   13 ++---
 plugins/speedup.c  |2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index f5b38e2..e90db11 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -136,9 +136,15 @@ static void cusd_parse(GAtResult *result, struct 
ofono_ussd *ussd)
case SMS_CHARSET_7BIT:
switch (data-charset) {
case AT_UTIL_CHARSET_GSM:
-   msg_ptr = pack_7bit_own_buf((const guint8 *) content,
-   -1, 0, TRUE, msg_len,
-   0, msg);
+   if (data-vendor == OFONO_VENDOR_SPEEDUP)
+   msg_ptr = decode_hex_own_buf(content, -1,
+   msg_len,
+   0, msg);
+   else
+   msg_ptr = pack_7bit_own_buf((const guint8 *)
+   content, -1, 0,
+   TRUE, msg_len,
+   0, msg);
break;
 
case AT_UTIL_CHARSET_UTF8:
@@ -242,6 +248,7 @@ static void cusd_cancel_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
switch (data-vendor) {
case OFONO_VENDOR_GOBI:
case OFONO_VENDOR_QUALCOMM_MSM:
+   case OFONO_VENDOR_SPEEDUP:
/* All errors and notifications arrive unexpected and
 * thus just reset the state here. This is safer than
 * getting stuck in a dead-lock. */
diff --git a/plugins/speedup.c b/plugins/speedup.c
index ca6ed13..5cc380f 100644
--- a/plugins/speedup.c
+++ b/plugins/speedup.c
@@ -282,7 +282,7 @@ static void speedup_post_online(struct ofono_modem *modem)
 
ofono_cbs_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
atmodem, data-aux);
-   ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
+   ofono_ussd_create(modem, OFONO_VENDOR_SPEEDUP,
atmodem, data-aux);
 }
 
-- 
1.7.5.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH v2] SpeedUp: enable online/offline

2012-04-10 Thread Denis Kenzior
Hi Bertrand,

 @@ -232,12 +236,122 @@ static int speedup_disable(struct ofono_modem *modem)
   g_at_chat_cancel_all(data-aux);
   g_at_chat_unregister_all(data-aux);
  
 + /* Cleanup potential online enable polling */
 + if (data-online_poll_source  0) {
 + g_source_remove(data-online_poll_source);
 + data-online_poll_source = 0;
 +
 + g_free(data-online_cbd);
 + data-online_cbd = NULL;
 + }
 +

This looks fine, but it is actually in the wrong place.  The core
doesn't allow concurrent online and disable operations.  This really
belongs in speedup_remove so that you take care of the case where the
modem is physically yanked out.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 2/2] ussd: Fix speedup ussd encoding

2012-04-10 Thread Denis Kenzior
Hi Nicolas,

On 04/10/2012 10:35 AM, Nicolas Bertrand wrote:
 Speedup dongles encode USSD strings in GSM7
 packed, so we don't have to pack it ourselves.
 ---
  drivers/atmodem/ussd.c |   13 ++---
  plugins/speedup.c  |2 +-
  2 files changed, 11 insertions(+), 4 deletions(-)
 

Patch looks good, but please split it into two in accordance with our
patch submission guidelines.  See HACKING document, 'Submitting patches'
section.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: hfp voicecall fails to register in ofono with iPhone voicemail

2012-04-10 Thread Mike
On Fri, Apr 6, 2012 at 10:53 AM, Mike puffy.t...@gmail.com wrote:
 Hi Denis,

 On Fri, Apr 6, 2012 at 9:36 AM, Denis Kenzior denk...@gmail.com wrote:
 Hi Mike,

 On 04/05/2012 11:28 PM, Mike wrote:
 I'm experiencing an issue where the +CLCC response provided by an
 iPhone is ignored in the case of a user utilizing visual voicemail.
 The problem here is that the AT+CLCC is being sent in response to a
 +CIEV indicating call setup, but by the time the +CLCC response comes
 back, the call status is active.  This is a problem because the
 callback, sync_dialing_cb, is specifically looking for calls in the
 dialing state.  It looks like at least some bits from clcc_poll_cb
 should be copied into sync_dialing_cb (or a helper function) because I
 would think any time we get a +CLCC we would want to completely update
 our call list (and therefore fix the issue I'm encountering).  I'm
 still digging into this, but as I'm not familiar with all the quirks
 of devices out there, I'm throwing this out there in case anyone has
 some ideas on this.

 Are you dialing from the HF or the AG side?  And yes, the logic in
 find_dialing() might indeed need to be changed to also find single
 active calls.

 Dialing is on the AG side.

It looks like simply addingclcc_poll_cb(ok, result, user_data); to
the end of sync_dialing_cb fixes this problem.  We end up parsing the
result twice, but it was an easy test.  Does that seem like the right
path?

Mike
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/2] ussd: rise up buffer lenght for ussd strings

2012-04-10 Thread Denis Kenzior
Hi Nicolas,

On 04/10/2012 10:35 AM, Nicolas Bertrand wrote:
 Some ZTE modems used to convert any ussd strings in UCS2,
 and so the buffer length is double. Considering the limit of
 182 characters, 364 will avoid crash.
 ---
  drivers/atmodem/ussd.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
 index 443251a..f5b38e2 100644
 --- a/drivers/atmodem/ussd.c
 +++ b/drivers/atmodem/ussd.c
 @@ -106,7 +106,7 @@ static void cusd_parse(GAtResult *result, struct 
 ofono_ussd *ussd)
   const char *content;
   int dcs;
   enum sms_charset charset;
 - unsigned char msg[160];
 + unsigned char msg[364];

Actually I'm not happy with this since the core is still expecting raw
160 byte PDUs.  If ZTE reports all USSDs as unpacked UCS2 data, then we
need to pack that back up into packed GSM 7 bit.  This probably requires
a custom driver for ZTE modems.

Alternatively you can see whether ZTE provides some way to modify the
USSD reporting behavior, similar to what Huawei did with ^USSDMODE.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: hfp voicecall fails to register in ofono with iPhone voicemail

2012-04-10 Thread Denis Kenzior
Hi Mike,

On 04/10/2012 05:53 PM, Mike wrote:
 On Fri, Apr 6, 2012 at 10:53 AM, Mike puffy.t...@gmail.com wrote:
 Hi Denis,

 On Fri, Apr 6, 2012 at 9:36 AM, Denis Kenzior denk...@gmail.com wrote:
 Hi Mike,

 On 04/05/2012 11:28 PM, Mike wrote:
 I'm experiencing an issue where the +CLCC response provided by an
 iPhone is ignored in the case of a user utilizing visual voicemail.
 The problem here is that the AT+CLCC is being sent in response to a
 +CIEV indicating call setup, but by the time the +CLCC response comes
 back, the call status is active.  This is a problem because the
 callback, sync_dialing_cb, is specifically looking for calls in the
 dialing state.  It looks like at least some bits from clcc_poll_cb
 should be copied into sync_dialing_cb (or a helper function) because I
 would think any time we get a +CLCC we would want to completely update
 our call list (and therefore fix the issue I'm encountering).  I'm
 still digging into this, but as I'm not familiar with all the quirks
 of devices out there, I'm throwing this out there in case anyone has
 some ideas on this.

 Are you dialing from the HF or the AG side?  And yes, the logic in
 find_dialing() might indeed need to be changed to also find single
 active calls.

 Dialing is on the AG side.
 
 It looks like simply adding  clcc_poll_cb(ok, result, user_data); to
 the end of sync_dialing_cb fixes this problem.  We end up parsing the
 result twice, but it was an easy test.  Does that seem like the right
 path?
 

Yes, sync_dialing_cb was likely a holdover from when we didn't think
we'd need the expensive clcc polling logic.  Hence a somewhat optimized
version that doesn't seem to work in case a call skips the alerting stage.

Removing sync_dialing_cb and using clcc_poll_cb seems reasonable to me.
 Care to test this theory and submit a patch?

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono