All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stk: Handle more commands in proactive_command_handled_notify.
@ 2010-10-26  8:52 Andrzej Zaborowski
  2010-10-26  8:52 ` [PATCH] calypsomodem: Notify core about commands handled in modem Andrzej Zaborowski
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-10-26  8:52 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/src/stk.c b/src/stk.c
index 54994df..359f8e4 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -822,6 +822,7 @@ static gboolean handle_command_send_sms(const struct stk_command *cmd,
 	return FALSE;
 }
 
+/* Note: may be called from ofono_stk_proactive_command_handled_notify */
 static gboolean handle_command_set_idle_text(const struct stk_command *cmd,
 						struct stk_response *rsp,
 						struct ofono_stk *stk)
@@ -1041,6 +1042,7 @@ static gboolean handle_command_poll_interval(const struct stk_command *cmd,
 	return TRUE;
 }
 
+/* Note: may be called from ofono_stk_proactive_command_handled_notify */
 static gboolean handle_command_set_up_menu(const struct stk_command *cmd,
 						struct stk_response *rsp,
 						struct ofono_stk *stk)
@@ -2407,6 +2409,7 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
 						const unsigned char *pdu)
 {
 	struct stk_command *cmd;
+	struct stk_response dummyrsp;
 
 	stk_proactive_command_cancel(stk);
 
@@ -2431,6 +2434,30 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
 				&cmd->send_sms.text_attr,
 				&cmd->send_sms.icon_id);
 		break;
+
+	case STK_COMMAND_TYPE_SETUP_IDLE_MODE_TEXT:
+		handle_command_set_idle_text(cmd, &dummyrsp, stk);
+		break;
+
+	case STK_COMMAND_TYPE_SETUP_MENU:
+		handle_command_set_up_menu(cmd, &dummyrsp, stk);
+		break;
+
+	case STK_COMMAND_TYPE_SETUP_CALL:
+		/* TODO */
+		break;
+
+	case STK_COMMAND_TYPE_SEND_USSD:
+		stk_alpha_id_set(stk, cmd->send_ussd.alpha_id,
+				&cmd->send_ussd.text_attr,
+				&cmd->send_ussd.icon_id);
+		break;
+
+	case STK_COMMAND_TYPE_SEND_DTMF:
+		stk_alpha_id_set(stk, cmd->send_dtmf.alpha_id,
+				&cmd->send_dtmf.text_attr,
+				&cmd->send_dtmf.icon_id);
+		break;
 	}
 
 	stk_command_free(cmd);
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH] calypsomodem: Notify core about commands handled in modem.
  2010-10-26  8:52 [PATCH] stk: Handle more commands in proactive_command_handled_notify Andrzej Zaborowski
@ 2010-10-26  8:52 ` Andrzej Zaborowski
  2010-10-27 17:27   ` Denis Kenzior
  2010-10-26  8:52 ` [PATCH] mbmmodem: " Andrzej Zaborowski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-10-26  8:52 UTC (permalink / raw)
  To: ofono

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

---
 drivers/calypsomodem/stk.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/calypsomodem/stk.c b/drivers/calypsomodem/stk.c
index 052e1f9..7168fb0 100644
--- a/drivers/calypsomodem/stk.c
+++ b/drivers/calypsomodem/stk.c
@@ -209,13 +209,34 @@ static void sata_notify(GAtResult *result, gpointer user_data)
 
 static void satn_notify(GAtResult *result, gpointer user_data)
 {
+	struct ofono_stk *stk = user_data;
+	GAtResultIter iter;
+	const guint8 *pdu;
+	gint len;
+	gboolean ret;
+
 	DBG("");
 
+	/* Proactive command has been handled by the modem.  */
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "%SATN:"))
+		return;
+
+	ret = g_at_result_iter_next_hexstring(&iter, &pdu, &len);
+	if (!ret || len == 0)
+		return;
+
 	/*
-	 * Proactive command has been handled by the modem.  Should
-	 * the core be notified?  For now we just ignore it because
-	 * we must not respond to the command.
+	 * A proactive command starts with a Proactive UICC Command BER-TLV
+	 * short tag (0xd0) with optional pad bytes, a Terminal Response
+	 * starts with the Command Details CTLV tag (0x81).
 	 */
+	if (pdu[0] != 0x81)
+		ofono_stk_proactive_command_handled_notify(stk, len, pdu);
+	else
+		ofono_stk_terminal_response_sent_notify(stk, len, pdu);
 }
 
 static void calypso_stk_register(gboolean ok, GAtResult *result,
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH] mbmmodem: Notify core about commands handled in modem.
  2010-10-26  8:52 [PATCH] stk: Handle more commands in proactive_command_handled_notify Andrzej Zaborowski
  2010-10-26  8:52 ` [PATCH] calypsomodem: Notify core about commands handled in modem Andrzej Zaborowski
@ 2010-10-26  8:52 ` Andrzej Zaborowski
  2010-10-26  8:52 ` [PATCH] ifxmodem: " Andrzej Zaborowski
  2010-10-27 17:01 ` [PATCH] stk: Handle more commands in proactive_command_handled_notify Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-10-26  8:52 UTC (permalink / raw)
  To: ofono

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

---
 drivers/mbmmodem/stk.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index f279057..a7633ee 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -179,12 +179,34 @@ static void stki_notify(GAtResult *result, gpointer user_data)
 
 static void stkn_notify(GAtResult *result, gpointer user_data)
 {
+	struct ofono_stk *stk = user_data;
+	GAtResultIter iter;
+	const guint8 *pdu;
+	gint len;
+	gboolean ret;
+
 	DBG("");
 
-	/* Proactive command has been handled by the modem.  Should
-	 * the core be notified?  For now we just ignore it because
-	 * we must not respond to the command.
+	/* Proactive command has been handled by the modem.  */
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "*STKN:"))
+		return;
+
+	ret = g_at_result_iter_next_hexstring(&iter, &pdu, &len);
+	if (!ret || len == 0)
+		return;
+
+	/*
+	 * A proactive command starts with a Proactive UICC Command BER-TLV
+	 * short tag (0xd0) with optional pad bytes, a Terminal Response
+	 * starts with the Command Details CTLV tag (0x81).
 	 */
+	if (pdu[0] != 0x81)
+		ofono_stk_proactive_command_handled_notify(stk, len, pdu);
+	else
+		ofono_stk_terminal_response_sent_notify(stk, len, pdu);
 }
 
 static void stkend_notify(GAtResult *result, gpointer user_data)
-- 
1.7.1.86.g0e460.dirty


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

* [PATCH] ifxmodem: Notify core about commands handled in modem.
  2010-10-26  8:52 [PATCH] stk: Handle more commands in proactive_command_handled_notify Andrzej Zaborowski
  2010-10-26  8:52 ` [PATCH] calypsomodem: Notify core about commands handled in modem Andrzej Zaborowski
  2010-10-26  8:52 ` [PATCH] mbmmodem: " Andrzej Zaborowski
@ 2010-10-26  8:52 ` Andrzej Zaborowski
  2010-10-26 22:03   ` Marcel Holtmann
  2010-10-27 17:01 ` [PATCH] stk: Handle more commands in proactive_command_handled_notify Denis Kenzior
  3 siblings, 1 reply; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-10-26  8:52 UTC (permalink / raw)
  To: ofono

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

---
 drivers/ifxmodem/stk.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index a7ca089..3b620a4 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -197,6 +197,7 @@ static void sati_notify(GAtResult *result, gpointer user_data)
 
 static void satn_notify(GAtResult *result, gpointer user_data)
 {
+	struct ofono_stk *stk = user_data;
 	GAtResultIter iter;
 	const guint8 *pdu;
 	gint len;
@@ -217,6 +218,19 @@ static void satn_notify(GAtResult *result, gpointer user_data)
 	 * command was for Setup Call then a response with AT+SATD
 	 * is required.  This is not handled properly yet.
 	 */
+
+	if (len == 0)
+		return;
+
+	/*
+	 * A proactive command starts with a Proactive UICC Command BER-TLV
+	 * short tag (0xd0) with optional pad bytes, a Terminal Response
+	 * starts with the Command Details CTLV tag (0x81).
+	 */
+	if (pdu[0] != 0x81)
+		ofono_stk_proactive_command_handled_notify(stk, len, pdu);
+	else
+		ofono_stk_terminal_response_sent_notify(stk, len, pdu);
 }
 
 static void satf_notify(GAtResult *result, gpointer user_data)
-- 
1.7.1.86.g0e460.dirty


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

* Re: [PATCH] ifxmodem: Notify core about commands handled in modem.
  2010-10-26  8:52 ` [PATCH] ifxmodem: " Andrzej Zaborowski
@ 2010-10-26 22:03   ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2010-10-26 22:03 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

> +	/*
> +	 * A proactive command starts with a Proactive UICC Command BER-TLV
> +	 * short tag (0xd0) with optional pad bytes, a Terminal Response
> +	 * starts with the Command Details CTLV tag (0x81).
> +	 */
> +	if (pdu[0] != 0x81)
> +		ofono_stk_proactive_command_handled_notify(stk, len, pdu);
> +	else
> +		ofono_stk_terminal_response_sent_notify(stk, len, pdu);

why are we duplicating this in every driver? Can we just not give the
whole PDU back to core and let the core separate it?

Regards

Marcel



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

* Re: [PATCH] stk: Handle more commands in proactive_command_handled_notify.
  2010-10-26  8:52 [PATCH] stk: Handle more commands in proactive_command_handled_notify Andrzej Zaborowski
                   ` (2 preceding siblings ...)
  2010-10-26  8:52 ` [PATCH] ifxmodem: " Andrzej Zaborowski
@ 2010-10-27 17:01 ` Denis Kenzior
  3 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-10-27 17:01 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

On 10/26/2010 03:52 AM, Andrzej Zaborowski wrote:
> ---
>  src/stk.c |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH] calypsomodem: Notify core about commands handled in modem.
  2010-10-26  8:52 ` [PATCH] calypsomodem: Notify core about commands handled in modem Andrzej Zaborowski
@ 2010-10-27 17:27   ` Denis Kenzior
  0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-10-27 17:27 UTC (permalink / raw)
  To: ofono

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

Hi Andrew,

>  	/*
> -	 * Proactive command has been handled by the modem.  Should
> -	 * the core be notified?  For now we just ignore it because
> -	 * we must not respond to the command.
> +	 * A proactive command starts with a Proactive UICC Command BER-TLV
> +	 * short tag (0xd0) with optional pad bytes, a Terminal Response
> +	 * starts with the Command Details CTLV tag (0x81).
>  	 */
> +	if (pdu[0] != 0x81)
> +		ofono_stk_proactive_command_handled_notify(stk, len, pdu);
> +	else
> +		ofono_stk_terminal_response_sent_notify(stk, len, pdu);
>  }

I removed terminal_response_sent_notify from the API and took care of
this in the core.  I also went ahead and fixed up the three drivers in
question.  Can you double check that I didn't screw this up?

Thanks,
-Denis

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

end of thread, other threads:[~2010-10-27 17:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26  8:52 [PATCH] stk: Handle more commands in proactive_command_handled_notify Andrzej Zaborowski
2010-10-26  8:52 ` [PATCH] calypsomodem: Notify core about commands handled in modem Andrzej Zaborowski
2010-10-27 17:27   ` Denis Kenzior
2010-10-26  8:52 ` [PATCH] mbmmodem: " Andrzej Zaborowski
2010-10-26  8:52 ` [PATCH] ifxmodem: " Andrzej Zaborowski
2010-10-26 22:03   ` Marcel Holtmann
2010-10-27 17:01 ` [PATCH] stk: Handle more commands in proactive_command_handled_notify Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.