Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH] stk: Handle Refresh if also performed by modem.
@ 2011-02-19 10:00 Andrzej Zaborowski
  2011-02-19 10:00 ` [PATCH] Deduplicate AUTHORS Andrzej Zaborowski
  2011-03-03  5:30 ` [PATCH] stk: Handle Refresh if also performed by modem Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Andrzej Zaborowski @ 2011-02-19 10:00 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2898 bytes --]

---
 src/stk.c |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index bc46b2f..c35f457 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1981,6 +1981,7 @@ static void free_idle_mode_text(struct ofono_stk *stk)
 	memset(&stk->idle_mode_icon, 0, sizeof(stk->idle_mode_icon));
 }
 
+/* Note: may be called from ofono_stk_proactive_command_handled_notify */
 static gboolean handle_command_refresh(const struct stk_command *cmd,
 					struct stk_response *rsp,
 					struct ofono_stk *stk)
@@ -2025,7 +2026,8 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 
 	default:
 		ofono_info("Undefined Refresh qualifier: %d", cmd->qualifier);
-		rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+		if (rsp != NULL)
+			rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
 		return TRUE;
 	}
 
@@ -2048,11 +2050,18 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 		sim = __ofono_atom_get_data(sim_atom);
 
 	if (sim == NULL) {
-		rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+		if (rsp != NULL)
+			rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
 		return TRUE;
 	}
 
-	if (cmd->qualifier < 4) {
+	/*
+	 * For now we can handle the Refresh types that don't require
+	 * a SIM reset except if that part of the task has been already
+	 * handled by modem firmware (indicated by rsp == NULL) in which
+	 * case we just restart our SIM initialisation.
+	 */
+	if (cmd->qualifier < 4 || rsp == NULL) {
 		int qualifier = stk->pending_cmd->qualifier;
 		GSList *file_list = stk->pending_cmd->refresh.file_list;
 
@@ -2062,10 +2071,15 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 		/*
 		 * Queue the TERMINAL RESPONSE before triggering potential
 		 * file accesses.
+		 *
+		 * TODO: Find out if we need to send the "Refresh performed
+		 * with additional EFs read" response.
 		 */
-		err = stk_respond(stk, rsp, stk_command_cb);
-		if (err)
-			stk_command_cb(&failure, stk);
+		if (rsp != NULL) {
+			err = stk_respond(stk, rsp, stk_command_cb);
+			if (err)
+				stk_command_cb(&failure, stk);
+		}
 
 		/* TODO: use the alphaId / icon */
 		/* TODO: if AID is supplied, check its value */
@@ -2084,6 +2098,9 @@ static gboolean handle_command_refresh(const struct stk_command *cmd,
 			break;
 		case 2:
 		case 3:
+		case 4:
+		case 5:
+		case 6:
 			free_idle_mode_text(stk);
 			__ofono_sim_refresh(sim, file_list, FALSE, TRUE);
 			break;
@@ -2779,6 +2796,10 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
 				&cmd->send_dtmf.text_attr,
 				&cmd->send_dtmf.icon_id);
 		break;
+
+	case STK_COMMAND_TYPE_REFRESH:
+		handle_command_refresh(stk->pending_cmd, NULL, stk);
+		break;
 	}
 
 	stk_command_free(cmd);
-- 
1.7.1.86.g0e460.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-03  5:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-19 10:00 [PATCH] stk: Handle Refresh if also performed by modem Andrzej Zaborowski
2011-02-19 10:00 ` [PATCH] Deduplicate AUTHORS Andrzej Zaborowski
2011-02-19 22:06   ` Denis Kenzior
2011-03-03  5:30 ` [PATCH] stk: Handle Refresh if also performed by modem Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox