phonesim: Don't use VENDOR_PHONESIM for Calypso.
PATCH 1/6 phonesim: Don't use VENDOR_PHONESIM for Calypso.
Also move the STK initialisation to post-sim because it is more logical there (even if it makes no difference under phonesim).
I'm not sure if there's any user of the "calypso" mode in phonesim driver now, perhaps it can be removed.
--- plugins/phonesim.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
plugins/phonesim.c +4 -2
@@ -289,8 +289,6 @@ static void phonesim_pre_sim(struct ofono_modem *modem)else ofono_voicecall_create (modem,0 ,"atmodem" , data->chat); -ofono_stk_create (modem,OFONO_VENDOR_PHONESIM ,"atmodem" , data->chat); -if (sim)ofono_sim_inserted_notify (sim, TRUE); }
@@ -304,6 +302,10 @@ static void phonesim_post_sim(struct ofono_modem *modem)DBG ("%p" , modem); +if (!data->calypso) +ofono_stk_create (modem,OFONO_VENDOR_PHONESIM , +"atmodem" , data->chat); +ofono_ussd_create (modem,0 ,"atmodem" , data->chat);ofono_call_forwarding_create (modem,0 ,"atmodem" , data->chat);ofono_call_settings_create (modem,0 ,"atmodem" , data->chat);
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 2/6 calypso: Check if SIM is present on modem startup.
Like in case of MBM modem, the SIM slot is not easily accessible while the device is running so we assume there's no need to check for SIM presence after startup.
--- plugins/calypso.c | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-)
plugins/calypso.c +33 -3
@@ -82,8 +82,11 @@ struct calypso_data {enum powercycle_state state;gboolean phonebook_added;gboolean sms_added; +gboolean have_sim; }; +static const char *cpin_prefix[] = {"+CPIN:" ,NULL }; +static void calypso_debug (const char *str,void *data) {guint dlc =GPOINTER_TO_UINT (data);
@@ -217,6 +220,34 @@ static void cfun_set_on_cb(gboolean ok, GAtResult *result, gpointer user_data)ofono_modem_set_powered (modem, ok); } +static void simpin_check_cb (gboolean ok,GAtResult *result,gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct calypso_data *data =ofono_modem_get_data (modem); + +DBG ("" ); + +/* Modem returns ERROR if there is no SIM in slot. */ + data->have_sim = ok; + +g_at_chat_send (data->dlcs[SETUP_DLC ],"AT+CFUN=1" ,NULL , + cfun_set_on_cb, modem,NULL ); +} + +static void init_simpin_check (struct ofono_modem *modem) +{ +struct calypso_data *data =ofono_modem_get_data (modem); + +/* +* Check for SIM presence by seeing if AT+CPIN? succeeds. +* The SIM can not be practically inserted/removed without +* restarting the device so there's no need to check more +* than once. +*/ +g_at_chat_send (data->dlcs[SETUP_DLC ],"AT+CPIN?" , cpin_prefix, + simpin_check_cb, modem,NULL ); +} +static void mux_setup (GAtMux *mux,gpointer user_data) {struct ofono_modem *modem = user_data;
@@ -254,8 +285,7 @@ static void mux_setup(GAtMux *mux, gpointer user_data)g_at_chat_set_wakeup_command (data->dlcs[i],"AT\r" ,500 ,5000 ); } -g_at_chat_send (data->dlcs[SETUP_DLC ],"AT+CFUN=1" ,NULL , - cfun_set_on_cb, modem,NULL ); +init_simpin_check (modem); }static void modem_initialize (struct ofono_modem *modem)
@@ -437,7 +467,7 @@ static void calypso_pre_sim(struct ofono_modem *modem) sim =ofono_sim_create (modem,0 ,"atmodem" , data->dlcs[AUX_DLC ]);ofono_voicecall_create (modem,0 ,"calypsomodem" , data->dlcs[VOICE_DLC ]); -if (sim) +if (data->have_sim && sim)ofono_sim_inserted_notify (sim, TRUE); }
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 3/6 calypsomodem: Add a Calypso STK driver.
In reply to Andrzej Zaborowski--- Makefile.am | 3 +- drivers/calypsomodem/calypsomodem.c | 2 + drivers/calypsomodem/calypsomodem.h | 5 + drivers/calypsomodem/stk.c | 277 +++++++++++++++++++++++++++++++++++ 4 files changed, 286 insertions(+), 1 deletions(-) create mode 100644 drivers/calypsomodem/stk.c
Makefile.am +2 -1
@@ -169,7 +169,8 @@ builtin_modules += calypsomodem builtin_sources += drivers/atmodem/atutil.h \ drivers/calypsomodem/calypsomodem.h \ drivers/calypsomodem/calypsomodem.c \ - drivers/calypsomodem/voicecall.c + drivers/calypsomodem/voicecall.c \ + drivers/calypsomodem/stk.c builtin_modules += hfpmodem builtin_sources += drivers/atmodem/atutil.h \
drivers/calypsomodem/calypsomodem.c +2 -0
@@ -35,12 +35,14 @@static int calypsomodem_init (void ) {calypso_voicecall_init (); +calypso_stk_init ();return 0 ; }static void calypsomodem_exit (void ) { +calypso_stk_exit ();calypso_voicecall_exit (); }
drivers/calypsomodem/calypsomodem.h +5 -0
@@ -20,6 +20,11 @@*/ #include <drivers/atmodem/atutil.h> +#include <modem.h> +#include <stk.h> extern void calypso_voicecall_init ();extern void calypso_voicecall_exit (); + +extern void calypso_stk_init (); +extern void calypso_stk_exit ();
drivers/calypsomodem/stk.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 4/6 calypso: Enable AT extended error codes.
In reply to Andrzej ZaborowskiThe STK driver tries to interpret the codes.
--- plugins/calypso.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
plugins/calypso.c +2 -0
@@ -178,6 +178,8 @@ static void setup_modem(struct ofono_modem *modem)g_at_chat_send (data->dlcs[i],"ATE0" ,NULL ,NULL ,NULL ,NULL );g_at_chat_send (data->dlcs[i],"AT%CUNS=0" ,NULL ,NULL ,NULL ,NULL ); +g_at_chat_send (data->dlcs[i],"AT+CMEE=1" , +NULL ,NULL ,NULL ,NULL ); }/* CSTAT tells us when SMS & Phonebook are ready to be used */
Signature · 1 line
1.7.1.86.g0e460.dirty
Hi Andrew,
Quoted 5 lines · Andrzej Zaborowski
Also move the STK initialisation to post-sim because it is more logical there (even if it makes no difference under phonesim).
I'm not sure if there's any user of the "calypso" mode in phonesim driver now, perhaps it can be removed.
Could you please do me a favor and put 'comment' paragraphs in the git-send-email block specifically designated for this? These are fairly context specific questions and make no sense to be included in the commit history. I have to git --amend and take them out manually.
To answer your question, we use 'calypso' driver for phonesim when using the Freerunner modem over TCP. This way oFono can be quickly run and tested without the need to cross-compile. This part is still useful in certain circumstances, so it is safe to leave it in for now...
All patches in this series have been applied.
Regards,
-Denis
Re: [PATCH 3/6] calypsomodem: Add a Calypso STK driver.
In reply to Andrzej ZaborowskiHi Andrew,
drivers/calypsomodem/calypsomodem.h line 24
Quoted 10 lines
drivers/calypsomodem/calypsomodem.h +2
-0@@ -20,6 +20,11 @@*/ #include <drivers/atmodem/atutil.h> +#include <modem.h> +#include <stk.h>
I removed these includes in a later commit as they didn't seem necessary.
Regards,
-Denis
Re: [PATCH 3/6] calypsomodem: Add a Calypso STK driver.
Quoted 4 lines · Denis Kenzior
drivers/calypsomodem/calypsomodem.h line 24
Quoted 2 lines
drivers/calypsomodem/calypsomodem.h +2
-0+#include <modem.h> +#include <stk.h> I removed these includes in a later commit as they didn't seem necessary.
Thanks for catching this, they were leftovers from the previous version where I had a "inject %SATI" additional call.
Regards,
Andrew