stk: Handle more commands in proactive_command_handled_notify.
PATCH 1/1 stk: Handle more commands in proactive_command_handled_notify.
--- src/stk.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
src/stk.c +27 -0
@@ -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);
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 1/1 calypsomodem: Notify core about commands handled in modem.
--- drivers/calypsomodem/stk.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-)
drivers/calypsomodem/stk.c +24 -3
@@ -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,
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 1/1 mbmmodem: Notify core about commands handled in modem.
In reply to Andrzej Zaborowski--- drivers/mbmmodem/stk.c | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-)
drivers/mbmmodem/stk.c +25 -3
@@ -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)
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 1/1 ifxmodem: Notify core about commands handled in modem.
In reply to Andrzej Zaborowski--- drivers/ifxmodem/stk.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/ifxmodem/stk.c +14 -0
@@ -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)
Signature · 1 line
1.7.1.86.g0e460.dirty
Re: [PATCH] ifxmodem: Notify core about commands handled in modem.
Hi Andrew,
drivers/ifxmodem/stk.c static void satn_notify(GAtResult *result, gpointer user_data) · line 233
Quoted 9 lines
drivers/ifxmodem/stk.c +9
-0+/* +* 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
Hi Andrew,
Quoted 3 lines · Andrzej Zaborowski
--- src/stk.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
Patch has been applied, thanks.
Regards,
-Denis
Re: [PATCH] calypsomodem: Notify core about commands handled in modem.
In reply to Andrzej ZaborowskiHi Andrew,
drivers/calypsomodem/stk.c static void sata_notify(GAtResult *result, gpointer user_data) · line 240
Quoted 13 lines
drivers/calypsomodem/stk.c +7
-3/* -* 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