* [PATCH 1/8] telit: notify sim inserted when sim ready @ 2012-08-13 13:16 Christopher Vogl 2012-08-13 13:23 ` Denis Kenzior 0 siblings, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-13 13:16 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 4312 bytes --] Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only inserted but ready to be used. Remove sim_inserted_source and sim_inserted_timeout_cb which are not needed anymore as a consequence. By the way the 1 second timeout was an ugly hack. Don't query current SIM status in cfun_enable_cb() as the SIM is disabled due to prior AT+CFUN=4. Remove telit_qss_cb() which was used as a callback for querying the current SIM status. --- plugins/telit.c | 44 ++++++++++---------------------------------- 1 files changed, 10 insertions(+), 34 deletions(-) diff --git a/plugins/telit.c b/plugins/telit.c index 6ae7249..853fd44 100644 --- a/plugins/telit.c +++ b/plugins/telit.c @@ -68,7 +68,6 @@ struct telit_data { GAtChat *chat; GAtChat *aux; struct ofono_sim *sim; - guint sim_inserted_source; struct ofono_modem *sap_modem; GIOChannel *bt_io; GIOChannel *hw_io; @@ -211,20 +210,6 @@ static GAtChat *open_device(struct ofono_modem *modem, return chat; } -static gboolean sim_inserted_timeout_cb(gpointer user_data) -{ - struct ofono_modem *modem = user_data; - struct telit_data *data = ofono_modem_get_data(modem); - - DBG("%p", modem); - - data->sim_inserted_source = 0; - - ofono_sim_inserted_notify(data->sim, TRUE); - - return FALSE; -} - static void switch_sim_state_status(struct ofono_modem *modem, int status) { struct telit_data *data = ofono_modem_get_data(modem); @@ -238,16 +223,13 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status) break; case 1: DBG("SIM inserted"); - /* We need to sleep a bit */ - data->sim_inserted_source = g_timeout_add_seconds(1, - sim_inserted_timeout_cb, - modem); break; case 2: DBG("SIM inserted and PIN unlocked"); break; case 3: DBG("SIM inserted and ready"); + ofono_sim_inserted_notify(data->sim, TRUE); break; } } @@ -270,6 +252,13 @@ static void telit_qss_notify(GAtResult *result, gpointer user_data) switch_sim_state_status(modem, status); } +/* + * This function was used as a callback for querying the current SIM status + * with 'AT#QSS?'. As this was done in cfun_enable_cb(), in a state where the + * SIM is disabled because of 'AT+CFUN=4', the querying was removed. + * As soon as the modem is set online with 'AT+CFUN=1' (SIM is enabled again), + * we will start receiving QSS notifications - which makes querying the SIM + * status redundant. static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; @@ -288,6 +277,7 @@ static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) switch_sim_state_status(modem, status); } +*/ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) { @@ -308,15 +298,11 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) ofono_modem_set_powered(m, TRUE); /* Enable sim state notification */ - g_at_chat_send(data->chat, "AT#QSS=1", none_prefix, NULL, NULL, NULL); + g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL); /* Follow sim state */ g_at_chat_register(data->chat, "#QSS:", telit_qss_notify, FALSE, modem, NULL); - - /* Query current sim state */ - g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, - telit_qss_cb, modem, NULL); } static int telit_enable(struct ofono_modem *modem) @@ -397,9 +383,6 @@ static void cfun_disable_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_unref(data->chat); data->chat = NULL; - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - if (ok) ofono_modem_set_powered(modem, FALSE); @@ -650,18 +633,11 @@ static int telit_probe(struct ofono_modem *modem) static void telit_remove(struct ofono_modem *modem) { - struct telit_data *data = ofono_modem_get_data(modem); - DBG("%p", modem); bluetooth_sap_client_unregister(modem); ofono_modem_set_data(modem, NULL); - - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - - g_free(data); } static struct ofono_modem_driver telit_driver = { -- 1.7.7.6 -- Scanned by MailScanner. ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/8] telit: notify sim inserted when sim ready 2012-08-13 13:16 [PATCH 1/8] telit: notify sim inserted when sim ready Christopher Vogl @ 2012-08-13 13:23 ` Denis Kenzior 2012-08-20 14:34 ` Christopher Vogl 0 siblings, 1 reply; 17+ messages in thread From: Denis Kenzior @ 2012-08-13 13:23 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 5323 bytes --] Hi Christopher, On 08/13/2012 08:16 AM, Christopher Vogl wrote: > Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only > inserted but ready to be used. > > Remove sim_inserted_source and sim_inserted_timeout_cb which are not > needed anymore as a consequence. > By the way the 1 second timeout was an ugly hack. > > Don't query current SIM status in cfun_enable_cb() as the SIM is > disabled due to prior AT+CFUN=4. > > Remove telit_qss_cb() which was used as a callback for querying the > current SIM status. > --- > plugins/telit.c | 44 ++++++++++---------------------------------- > 1 files changed, 10 insertions(+), 34 deletions(-) > > diff --git a/plugins/telit.c b/plugins/telit.c > index 6ae7249..853fd44 100644 > --- a/plugins/telit.c > +++ b/plugins/telit.c > @@ -68,7 +68,6 @@ struct telit_data { > GAtChat *chat; > GAtChat *aux; > struct ofono_sim *sim; > - guint sim_inserted_source; > struct ofono_modem *sap_modem; > GIOChannel *bt_io; > GIOChannel *hw_io; > @@ -211,20 +210,6 @@ static GAtChat *open_device(struct ofono_modem *modem, > return chat; > } > > -static gboolean sim_inserted_timeout_cb(gpointer user_data) > -{ > - struct ofono_modem *modem = user_data; > - struct telit_data *data = ofono_modem_get_data(modem); > - > - DBG("%p", modem); > - > - data->sim_inserted_source = 0; > - > - ofono_sim_inserted_notify(data->sim, TRUE); > - > - return FALSE; > -} > - > static void switch_sim_state_status(struct ofono_modem *modem, int status) > { > struct telit_data *data = ofono_modem_get_data(modem); > @@ -238,16 +223,13 @@ static void switch_sim_state_status(struct ofono_modem *modem, int status) > break; > case 1: > DBG("SIM inserted"); > - /* We need to sleep a bit */ > - data->sim_inserted_source = g_timeout_add_seconds(1, > - sim_inserted_timeout_cb, > - modem); > break; > case 2: > DBG("SIM inserted and PIN unlocked"); > break; > case 3: > DBG("SIM inserted and ready"); > + ofono_sim_inserted_notify(data->sim, TRUE); > break; > } According to Telit documentation 1 is inserted, 2 is inserted and pin unlocked, 3 is unlocked and phonebook ready. How do you plan on handling PIN-locked SIMs? You can't run commands such as EnterPin until the sim is at least inserted. You might need to do the same thing as we did for e.g. IFX and STE. notify sim insertion on #QSS: 1, and only return from CPIN once #QSS: 3 has been sent. See drivers/atmodem/sim.c at_epev_notify() or at_xsim_notify() for an example. > } > @@ -270,6 +252,13 @@ static void telit_qss_notify(GAtResult *result, gpointer user_data) > switch_sim_state_status(modem, status); > } > > +/* > + * This function was used as a callback for querying the current SIM status > + * with 'AT#QSS?'. As this was done in cfun_enable_cb(), in a state where the > + * SIM is disabled because of 'AT+CFUN=4', the querying was removed. > + * As soon as the modem is set online with 'AT+CFUN=1' (SIM is enabled again), > + * we will start receiving QSS notifications - which makes querying the SIM > + * status redundant. > static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) > { > struct ofono_modem *modem = user_data; > @@ -288,6 +277,7 @@ static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) > > switch_sim_state_status(modem, status); > } > +*/ Please don't comment out functions. We should not have dead code in the source. This comment can go into the patch description. The git history will preserve it for posterity. > > static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) > { > @@ -308,15 +298,11 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) > ofono_modem_set_powered(m, TRUE); > > /* Enable sim state notification */ > - g_at_chat_send(data->chat, "AT#QSS=1", none_prefix, NULL, NULL, NULL); > + g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL); > > /* Follow sim state */ > g_at_chat_register(data->chat, "#QSS:", telit_qss_notify, > FALSE, modem, NULL); > - > - /* Query current sim state */ > - g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, > - telit_qss_cb, modem, NULL); > } > > static int telit_enable(struct ofono_modem *modem) > @@ -397,9 +383,6 @@ static void cfun_disable_cb(gboolean ok, GAtResult *result, gpointer user_data) > g_at_chat_unref(data->chat); > data->chat = NULL; > > - if (data->sim_inserted_source> 0) > - g_source_remove(data->sim_inserted_source); > - > if (ok) > ofono_modem_set_powered(modem, FALSE); > > @@ -650,18 +633,11 @@ static int telit_probe(struct ofono_modem *modem) > > static void telit_remove(struct ofono_modem *modem) > { > - struct telit_data *data = ofono_modem_get_data(modem); > - > DBG("%p", modem); > > bluetooth_sap_client_unregister(modem); > > ofono_modem_set_data(modem, NULL); > - > - if (data->sim_inserted_source> 0) > - g_source_remove(data->sim_inserted_source); > - > - g_free(data); > } > > static struct ofono_modem_driver telit_driver = { Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/8] telit: notify sim inserted when sim ready 2012-08-13 13:23 ` Denis Kenzior @ 2012-08-20 14:34 ` Christopher Vogl 2012-08-20 14:50 ` Denis Kenzior 0 siblings, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-20 14:34 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2113 bytes --] Hi Denis, On 13/08/12 15:23, Denis Kenzior wrote: > Hi Christopher, > > On 08/13/2012 08:16 AM, Christopher Vogl wrote: >> >> static void switch_sim_state_status(struct ofono_modem *modem, int >> status) >> { >> struct telit_data *data = ofono_modem_get_data(modem); >> @@ -238,16 +223,13 @@ static void switch_sim_state_status(struct >> ofono_modem *modem, int status) >> break; >> case 1: >> DBG("SIM inserted"); >> - /* We need to sleep a bit */ >> - data->sim_inserted_source = g_timeout_add_seconds(1, >> - sim_inserted_timeout_cb, >> - modem); >> break; >> case 2: >> DBG("SIM inserted and PIN unlocked"); >> break; >> case 3: >> DBG("SIM inserted and ready"); >> + ofono_sim_inserted_notify(data->sim, TRUE); >> break; >> } > > According to Telit documentation 1 is inserted, 2 is inserted and pin > unlocked, 3 is unlocked and phonebook ready. How do you plan on > handling PIN-locked SIMs? You can't run commands such as EnterPin > until the sim is at least inserted. Yes you are perfectly right, I can't do it that way. Working with an unlocked PIN is not always a good idea. > > You might need to do the same thing as we did for e.g. IFX and STE. > notify sim insertion on #QSS: 1, and only return from CPIN once #QSS: > 3 has been sent. See drivers/atmodem/sim.c at_epev_notify() or > at_xsim_notify() for an example. This works fine in case the PIN is locked, but has the unpleasant side effect that I receive a timeout when calling the D-Bus method to enter the PIN because #QSS: 3 takes so long (e.g. 32 seconds from entering the PIN until a #QSS: 3). If the PIN is unlocked I will never get to at_pin_send_cb(), where +XSIM, *EPEV or #QSS are registered, and ofono will step to post-sim phase (where sms and phonebook atoms are created) immediately without waiting for #QSS: 3. Regards, Christopher -- Scanned by MailScanner. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/8] telit: notify sim inserted when sim ready 2012-08-20 14:34 ` Christopher Vogl @ 2012-08-20 14:50 ` Denis Kenzior 2012-08-20 15:20 ` Christopher Vogl 0 siblings, 1 reply; 17+ messages in thread From: Denis Kenzior @ 2012-08-20 14:50 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1225 bytes --] Hi Christopher, <snip> >> >> You might need to do the same thing as we did for e.g. IFX and STE. >> notify sim insertion on #QSS: 1, and only return from CPIN once #QSS: >> 3 has been sent. See drivers/atmodem/sim.c at_epev_notify() or >> at_xsim_notify() for an example. > > This works fine in case the PIN is locked, but has the unpleasant side > effect that I receive a timeout when calling the D-Bus method to enter > the PIN because #QSS: 3 takes so long (e.g. 32 seconds from entering the > PIN until a #QSS: 3). Feel free to extend the timeout on the enter-pin script. Also, you can in theory wait until #QSS: 2 and not 3 right? From what I remember QSS: 3 pertains to Phonebook and SMS being ready. For those you can add a quirk that queries / waits for QSS:3 See how we handled this in plugins/calypso.c and %CSTAT. Alternatively we can try to do this inside the individual drivers using a vendor quirk. > If the PIN is unlocked I will never get to at_pin_send_cb(), where > +XSIM, *EPEV or #QSS are registered, and ofono will step to post-sim > phase (where sms and phonebook atoms are created) immediately without > waiting for #QSS: 3. See above ;) Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/8] telit: notify sim inserted when sim ready 2012-08-20 14:50 ` Denis Kenzior @ 2012-08-20 15:20 ` Christopher Vogl 2012-08-20 15:42 ` Denis Kenzior 0 siblings, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-20 15:20 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1418 bytes --] Hi Denis, On 20/08/12 16:50, Denis Kenzior wrote: > Hi Christopher, > > <snip> > >>> >>> You might need to do the same thing as we did for e.g. IFX and STE. >>> notify sim insertion on #QSS: 1, and only return from CPIN once #QSS: >>> 3 has been sent. See drivers/atmodem/sim.c at_epev_notify() or >>> at_xsim_notify() for an example. >> >> This works fine in case the PIN is locked, but has the unpleasant side >> effect that I receive a timeout when calling the D-Bus method to enter >> the PIN because #QSS: 3 takes so long (e.g. 32 seconds from entering the >> PIN until a #QSS: 3). > > Feel free to extend the timeout on the enter-pin script. Also, you > can in theory wait until #QSS: 2 and not 3 right? > From what I remember QSS: 3 pertains to Phonebook and SMS being ready. That's right! > For those you can add a quirk that queries / waits for QSS:3 See how > we handled this in plugins/calypso.c and %CSTAT. Thanks for the hint! I was thinking about a solution like that but thought that I was not ment to move the creation of atoms elsewhere. > Alternatively we can try to do this inside the individual drivers > using a vendor quirk. I like the %CSTAT way because I think it is a clean and easy to follow solution. In that case I also don't have to work with QSS in drivers/atmodem/sim.c anymore. Regards, Christopher -- Scanned by MailScanner. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/8] telit: notify sim inserted when sim ready 2012-08-20 15:20 ` Christopher Vogl @ 2012-08-20 15:42 ` Denis Kenzior 2012-08-22 14:24 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Christopher Vogl 0 siblings, 1 reply; 17+ messages in thread From: Denis Kenzior @ 2012-08-20 15:42 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1678 bytes --] Hi Christopher, On 08/20/2012 10:20 AM, Christopher Vogl wrote: > Hi Denis, > > On 20/08/12 16:50, Denis Kenzior wrote: >> Hi Christopher, >> >> <snip> >> >>>> >>>> You might need to do the same thing as we did for e.g. IFX and STE. >>>> notify sim insertion on #QSS: 1, and only return from CPIN once #QSS: >>>> 3 has been sent. See drivers/atmodem/sim.c at_epev_notify() or >>>> at_xsim_notify() for an example. >>> >>> This works fine in case the PIN is locked, but has the unpleasant side >>> effect that I receive a timeout when calling the D-Bus method to enter >>> the PIN because #QSS: 3 takes so long (e.g. 32 seconds from entering the >>> PIN until a #QSS: 3). >> >> Feel free to extend the timeout on the enter-pin script. Also, you can >> in theory wait until #QSS: 2 and not 3 right? From what I remember >> QSS: 3 pertains to Phonebook and SMS being ready. > That's right! > >> For those you can add a quirk that queries / waits for QSS:3 See how >> we handled this in plugins/calypso.c and %CSTAT. > Thanks for the hint! I was thinking about a solution like that but > thought that I was not ment to move the creation of atoms elsewhere. > >> Alternatively we can try to do this inside the individual drivers >> using a vendor quirk. > I like the %CSTAT way because I think it is a clean and easy to follow > solution. > In that case I also don't have to work with QSS in drivers/atmodem/sim.c > anymore. > Well you might still need to wait for #QSS: 2 in drivers/atmodem/sim.c. Many modems have the nasty habit of returning SIM busy errors when the CPIN state is queried right after PIN entry. Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] sim: return from CPIN when SIM unlocked for telit 2012-08-20 15:42 ` Denis Kenzior @ 2012-08-22 14:24 ` Christopher Vogl 2012-08-22 14:24 ` [PATCH] telit: sim status notification without polling Christopher Vogl 2012-08-22 23:44 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Denis Kenzior 0 siblings, 2 replies; 17+ messages in thread From: Christopher Vogl @ 2012-08-22 14:24 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1850 bytes --] Only return from CPIN when the modem informs that the SIM is unlocked. --- drivers/atmodem/sim.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c index d480185..cf3345c 100644 --- a/drivers/atmodem/sim.c +++ b/drivers/atmodem/sim.c @@ -1084,6 +1084,36 @@ static void at_epev_notify(GAtResult *result, gpointer user_data) sd->ready_id = 0; } +static void at_qss_notify(GAtResult *result, gpointer user_data) +{ + struct cb_data *cbd = user_data; + struct sim_data *sd = cbd->user; + ofono_sim_lock_unlock_cb_t cb = cbd->cb; + struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR }; + GAtResultIter iter; + int state; + + g_at_result_iter_init(&iter, result); + + if (!g_at_result_iter_next(&iter, "#QSS:")) + return; + + if (!g_at_result_iter_next_number(&iter, &state)) + return; + + switch (state) { + case 2: /* PIN unlocked */ + break; + default: + return; + } + + cb(&error, cbd->data); + + g_at_chat_unregister(sd->chat, sd->ready_id); + sd->ready_id = 0; +} + static void sim_state_cb(gboolean present, gpointer user_data) { struct cb_data *cbd = user_data; @@ -1133,6 +1163,16 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result, at_epev_notify, FALSE, cbd, g_free); return; + case OFONO_VENDOR_TELIT: + /* + * On the Telit modem, AT+CPIN? can return READY too + * early and so use #QSS notification to detect + * the ready state of the SIM. + */ + sd->ready_id = g_at_chat_register(sd->chat, "#QSS", + at_qss_notify, + FALSE, cbd, g_free); + return; case OFONO_VENDOR_ZTE: /* * On ZTE modems, after pin is entered, SIM state is checked -- 1.7.7.6 -- Scanned by MailScanner. ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] telit: sim status notification without polling 2012-08-22 14:24 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Christopher Vogl @ 2012-08-22 14:24 ` Christopher Vogl 2012-08-23 14:21 ` Denis Kenzior 2012-08-22 23:44 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Denis Kenzior 1 sibling, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-22 14:24 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 6388 bytes --] Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only inserted but also when PIN is unlocked and when SMS + phonebook are ready to be used. Disable sim state notification in telit_enable() so that we sure get a notification when we enable it later again. This way we don't have to query the state the first time. Without this the Telit modem does not always send an URC when AT#QSS=2 is sent. Remove sim_inserted_source and sim_inserted_timeout_cb which are not needed anymore as a consequence. By the way the 1 second timeout was an ugly hack. Don't query current SIM status in cfun_enable_cb() as the SIM is disabled due to prior AT+CFUN=4. Register '#QSS:' before enabling sim state notifications. Remove telit_qss_cb() which was used as a callback for querying the current SIM status. --- plugins/telit.c | 96 +++++++++++++++++++----------------------------------- 1 files changed, 34 insertions(+), 62 deletions(-) diff --git a/plugins/telit.c b/plugins/telit.c index ec57f01..c8a5d72 100644 --- a/plugins/telit.c +++ b/plugins/telit.c @@ -68,7 +68,8 @@ struct telit_data { GAtChat *chat; /* AT chat */ GAtChat *modem; /* Data port */ struct ofono_sim *sim; - guint sim_inserted_source; + ofono_bool_t have_sim; + ofono_bool_t sms_phonebook_added; struct ofono_modem *sap_modem; GIOChannel *bt_io; GIOChannel *hw_io; @@ -211,43 +212,36 @@ static GAtChat *open_device(struct ofono_modem *modem, return chat; } -static gboolean sim_inserted_timeout_cb(gpointer user_data) -{ - struct ofono_modem *modem = user_data; - struct telit_data *data = ofono_modem_get_data(modem); - - DBG("%p", modem); - - data->sim_inserted_source = 0; - - ofono_sim_inserted_notify(data->sim, TRUE); - - return FALSE; -} - static void switch_sim_state_status(struct ofono_modem *modem, int status) { struct telit_data *data = ofono_modem_get_data(modem); - DBG("%p", modem); + DBG("%p, SIM status: %d", modem, status); switch (status) { - case 0: - DBG("SIM not inserted"); - ofono_sim_inserted_notify(data->sim, FALSE); + case 0: /* SIM not inserted */ + if (data->have_sim == TRUE) { + ofono_sim_inserted_notify(data->sim, FALSE); + data->have_sim = FALSE; + data->sms_phonebook_added == FALSE; + } break; - case 1: - DBG("SIM inserted"); - /* We need to sleep a bit */ - data->sim_inserted_source = g_timeout_add_seconds(1, - sim_inserted_timeout_cb, - modem); + case 1: /* SIM inserted */ + case 2: /* SIM inserted and PIN unlocked */ + if (data->have_sim == FALSE) { + ofono_sim_inserted_notify(data->sim, TRUE); + data->have_sim = TRUE; + } break; - case 2: - DBG("SIM inserted and PIN unlocked"); + case 3: /* SIM inserted, SMS and phonebook ready */ + if (data->sms_phonebook_added == FALSE) { + ofono_phonebook_create(modem, 0, "atmodem", data->chat); + ofono_sms_create(modem, 0, "atmodem", data->chat); + data->sms_phonebook_added == TRUE; + } break; - case 3: - DBG("SIM inserted and ready"); + default: + ofono_warn("Unknown SIM state %d received", status); break; } } @@ -270,25 +264,6 @@ static void telit_qss_notify(GAtResult *result, gpointer user_data) switch_sim_state_status(modem, status); } -static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) -{ - struct ofono_modem *modem = user_data; - int mode; - int status; - GAtResultIter iter; - g_at_result_iter_init(&iter, result); - - DBG("%p", modem); - - if (!g_at_result_iter_next(&iter, "#QSS:")) - return; - - g_at_result_iter_next_number(&iter, &mode); - g_at_result_iter_next_number(&iter, &status); - - switch_sim_state_status(modem, status); -} - static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; @@ -312,6 +287,9 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) */ g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL); + data->have_sim = FALSE; + data->sms_phonebook_added = FALSE; + ofono_modem_set_powered(m, TRUE); /* @@ -321,16 +299,12 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix, NULL, NULL, NULL); - /* Enable sim state notification */ - g_at_chat_send(data->chat, "AT#QSS=1", none_prefix, NULL, NULL, NULL); - /* Follow sim state */ g_at_chat_register(data->chat, "#QSS:", telit_qss_notify, FALSE, modem, NULL); - /* Query current sim state */ - g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, - telit_qss_cb, modem, NULL); + /* Enable sim state notification */ + g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL); } static int telit_enable(struct ofono_modem *modem) @@ -359,6 +333,12 @@ static int telit_enable(struct ofono_modem *modem) g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix, NULL, NULL, NULL); + /* + * Disable sim state notification so that we sure get a notification + * when we enable it again later and don't have to query it. + */ + g_at_chat_send(data->chat, "AT#QSS=0", none_prefix, NULL, NULL, NULL); + /* Set phone functionality */ g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix, cfun_enable_cb, modem, NULL); @@ -418,9 +398,6 @@ static void cfun_disable_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_unref(data->chat); data->chat = NULL; - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - if (ok) ofono_modem_set_powered(modem, FALSE); @@ -583,8 +560,6 @@ static void telit_post_sim(struct ofono_modem *modem) DBG("%p", modem); - ofono_sms_create(modem, 0, "atmodem", data->chat); - gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem", data->chat); gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem); @@ -675,9 +650,6 @@ static void telit_remove(struct ofono_modem *modem) ofono_modem_set_data(modem, NULL); - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - /* Cleanup after hot-unplug */ g_at_chat_unref(data->chat); g_at_chat_unref(data->modem); -- 1.7.7.6 -- Scanned by MailScanner. ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-22 14:24 ` [PATCH] telit: sim status notification without polling Christopher Vogl @ 2012-08-23 14:21 ` Denis Kenzior 2012-08-23 16:00 ` Christopher Vogl 0 siblings, 1 reply; 17+ messages in thread From: Denis Kenzior @ 2012-08-23 14:21 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1802 bytes --] Hi Christopher, On 08/22/2012 09:24 AM, Christopher Vogl wrote: > Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only > inserted but also when PIN is unlocked and when SMS + phonebook are > ready to be used. > > Disable sim state notification in telit_enable() so that we sure get a > notification when we enable it later again. This way we don't have to > query the state the first time. Without this the Telit modem does not > always send an URC when AT#QSS=2 is sent. > > Remove sim_inserted_source and sim_inserted_timeout_cb which are not > needed anymore as a consequence. > By the way the 1 second timeout was an ugly hack. > > Don't query current SIM status in cfun_enable_cb() as the SIM is > disabled due to prior AT+CFUN=4. > > Register '#QSS:' before enabling sim state notifications. > > Remove telit_qss_cb() which was used as a callback for querying the > current SIM status. > --- > plugins/telit.c | 96 +++++++++++++++++++----------------------------------- > 1 files changed, 34 insertions(+), 62 deletions(-) > Patch looks good to me overall, however: cc1: warnings being treated as errors plugins/telit.c: In function ‘switch_sim_state_status’: plugins/telit.c:226:4: error: statement with no effect plugins/telit.c:240:4: error: statement with no effect plugins/telit.c: At top level: plugins/telit.c:64:20: error: ‘qss_prefix’ defined but not used Also, one other thing I'm concerned about is the CFUN=4 usage when we try to set the modem offline. Your comments indicate that the Telit modem resets the SIM when we issue CFUN=4. Going from Online True -> False we don't actually want to reset the SIM. Does CFUN take an extra parameter to turn SIM reset off by any chance? Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-23 14:21 ` Denis Kenzior @ 2012-08-23 16:00 ` Christopher Vogl 2012-08-23 17:37 ` Denis Kenzior 0 siblings, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-23 16:00 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2542 bytes --] Hi Denis, On 23/08/12 16:21, Denis Kenzior wrote: > Hi Christopher, > > On 08/22/2012 09:24 AM, Christopher Vogl wrote: >> Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only >> inserted but also when PIN is unlocked and when SMS + phonebook are >> ready to be used. >> >> Disable sim state notification in telit_enable() so that we sure get a >> notification when we enable it later again. This way we don't have to >> query the state the first time. Without this the Telit modem does not >> always send an URC when AT#QSS=2 is sent. >> >> Remove sim_inserted_source and sim_inserted_timeout_cb which are not >> needed anymore as a consequence. >> By the way the 1 second timeout was an ugly hack. >> >> Don't query current SIM status in cfun_enable_cb() as the SIM is >> disabled due to prior AT+CFUN=4. >> >> Register '#QSS:' before enabling sim state notifications. >> >> Remove telit_qss_cb() which was used as a callback for querying the >> current SIM status. >> --- >> plugins/telit.c | 96 >> +++++++++++++++++++----------------------------------- >> 1 files changed, 34 insertions(+), 62 deletions(-) >> > > Patch looks good to me overall, however: > > cc1: warnings being treated as errors > plugins/telit.c: In function ‘switch_sim_state_status’: > plugins/telit.c:226:4: error: statement with no effect > plugins/telit.c:240:4: error: statement with no effect > plugins/telit.c: At top level: > plugins/telit.c:64:20: error: ‘qss_prefix’ defined but not used Sorry, it is getting embarrassing now. > Also, one other thing I'm concerned about is the CFUN=4 usage when we > try to set the modem offline. Your comments indicate that the Telit > modem resets the SIM when we issue CFUN=4. Going from Online True -> > False we don't actually want to reset the SIM. Does CFUN take an extra > parameter to turn SIM reset off by any chance? Telit documentation says that +CFUN supports a second parameter which should turn reset off. AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0) AT reference manual: "reset flag 0 - do not reset the ME before setting it to <fun> functionality level" But the modem keeps returning +CME ERROR: 4 when I try it (no matter which CFUN level). The modem behaves very strange sometimes. I kept getting timeouts when setting AT+CFUN=4. I once tried it manually and it took 26 seconds until I got an OK. Currently it works fine again. Regards, Christopher -- Scanned by MailScanner. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-23 16:00 ` Christopher Vogl @ 2012-08-23 17:37 ` Denis Kenzior 2012-08-24 10:26 ` Christopher Vogl 2012-08-28 15:19 ` Christopher Vogl 0 siblings, 2 replies; 17+ messages in thread From: Denis Kenzior @ 2012-08-23 17:37 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1339 bytes --] Hi Christopher, >> Also, one other thing I'm concerned about is the CFUN=4 usage when we >> try to set the modem offline. Your comments indicate that the Telit >> modem resets the SIM when we issue CFUN=4. Going from Online True -> >> False we don't actually want to reset the SIM. Does CFUN take an extra >> parameter to turn SIM reset off by any chance? > > Telit documentation says that +CFUN supports a second parameter which > should turn reset off. > AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0) > AT reference manual: "reset flag 0 - do not reset the ME before setting > it to <fun> functionality level" > > But the modem keeps returning +CME ERROR: 4 when I try it (no matter > which CFUN level). That is funny. Maybe the modem does not support a true 'offline' or 'airplane' mode. In which case the driver might need to be modified somewhat. This is something we will need to solve in the future. If not fixed, I'm guessing that going Online then Offline will reset the SIM and cause all kinds of funny behavior. > > The modem behaves very strange sometimes. I kept getting timeouts when > setting AT+CFUN=4. I once tried it manually and it took 26 seconds until > I got an OK. > Currently it works fine again. > Is there a newer firmware available by any chance? Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-23 17:37 ` Denis Kenzior @ 2012-08-24 10:26 ` Christopher Vogl 2012-08-28 15:19 ` Christopher Vogl 1 sibling, 0 replies; 17+ messages in thread From: Christopher Vogl @ 2012-08-24 10:26 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1805 bytes --] Hi Denis, On 23/08/12 19:37, Denis Kenzior wrote: > Hi Christopher, > >>> Also, one other thing I'm concerned about is the CFUN=4 usage when we >>> try to set the modem offline. Your comments indicate that the Telit >>> modem resets the SIM when we issue CFUN=4. Going from Online True -> >>> False we don't actually want to reset the SIM. Does CFUN take an extra >>> parameter to turn SIM reset off by any chance? >> >> Telit documentation says that +CFUN supports a second parameter which >> should turn reset off. >> AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0) >> AT reference manual: "reset flag 0 - do not reset the ME before setting >> it to <fun> functionality level" >> >> But the modem keeps returning +CME ERROR: 4 when I try it (no matter >> which CFUN level). > > That is funny. Maybe the modem does not support a true 'offline' or > 'airplane' mode. In which case the driver might need to be modified > somewhat. > > This is something we will need to solve in the future. If not fixed, > I'm guessing that going Online then Offline will reset the SIM and > cause all kinds of funny behavior. > >> >> The modem behaves very strange sometimes. I kept getting timeouts when >> setting AT+CFUN=4. I once tried it manually and it took 26 seconds until >> I got an OK. >> Currently it works fine again. >> > > Is there a newer firmware available by any chance? > I'm currently using firmware version 08.01.107. Apparently there is a 08.01.108 version. I contacted the Telit support and they said they are testing this version, so I don't know if it is available now. I hope we are getting an official Telit support with the possibility for updates soon - will know more on Tuesday. Regards, Christopher -- Scanned by MailScanner. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-23 17:37 ` Denis Kenzior 2012-08-24 10:26 ` Christopher Vogl @ 2012-08-28 15:19 ` Christopher Vogl 2012-08-28 14:53 ` Denis Kenzior 1 sibling, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-28 15:19 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1914 bytes --] Hi Denis, On 23/08/12 19:37, Denis Kenzior wrote: > Hi Christopher, > >>> Also, one other thing I'm concerned about is the CFUN=4 usage when we >>> try to set the modem offline. Your comments indicate that the Telit >>> modem resets the SIM when we issue CFUN=4. Going from Online True -> >>> False we don't actually want to reset the SIM. Does CFUN take an extra >>> parameter to turn SIM reset off by any chance? >> >> Telit documentation says that +CFUN supports a second parameter which >> should turn reset off. >> AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0) >> AT reference manual: "reset flag 0 - do not reset the ME before setting >> it to <fun> functionality level" >> >> But the modem keeps returning +CME ERROR: 4 when I try it (no matter >> which CFUN level). > > That is funny. Maybe the modem does not support a true 'offline' or > 'airplane' mode. In which case the driver might need to be modified > somewhat. > > This is something we will need to solve in the future. If not fixed, > I'm guessing that going Online then Offline will reset the SIM and > cause all kinds of funny behavior. > >> >> The modem behaves very strange sometimes. I kept getting timeouts when >> setting AT+CFUN=4. I once tried it manually and it took 26 seconds until >> I got an OK. >> Currently it works fine again. >> > > Is there a newer firmware available by any chance? Telit support was so kind to send me a firmware version (08.01.108-B006) which supports +CFUN without resetting. I suppose this is not an official version yet and if I adapt the code in the telit plugin I will probably be the only one who can use it. Is it ok if I send a corrected version of this patch and change the offline/online mode handling in a further patch when it is sure supported by an official firmware version? Regards, Christopher -- Scanned by MailScanner. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: sim status notification without polling 2012-08-28 15:19 ` Christopher Vogl @ 2012-08-28 14:53 ` Denis Kenzior 2012-08-29 15:01 ` [PATCH] telit: enable extended sim status notification Christopher Vogl 0 siblings, 1 reply; 17+ messages in thread From: Denis Kenzior @ 2012-08-28 14:53 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2180 bytes --] Hi Christopher, On 08/28/2012 10:19 AM, Christopher Vogl wrote: > Hi Denis, > > On 23/08/12 19:37, Denis Kenzior wrote: >> Hi Christopher, >> >>>> Also, one other thing I'm concerned about is the CFUN=4 usage when we >>>> try to set the modem offline. Your comments indicate that the Telit >>>> modem resets the SIM when we issue CFUN=4. Going from Online True -> >>>> False we don't actually want to reset the SIM. Does CFUN take an extra >>>> parameter to turn SIM reset off by any chance? >>> >>> Telit documentation says that +CFUN supports a second parameter which >>> should turn reset off. >>> AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0) >>> AT reference manual: "reset flag 0 - do not reset the ME before setting >>> it to <fun> functionality level" >>> >>> But the modem keeps returning +CME ERROR: 4 when I try it (no matter >>> which CFUN level). >> >> That is funny. Maybe the modem does not support a true 'offline' or >> 'airplane' mode. In which case the driver might need to be modified >> somewhat. >> >> This is something we will need to solve in the future. If not fixed, >> I'm guessing that going Online then Offline will reset the SIM and >> cause all kinds of funny behavior. >> >>> >>> The modem behaves very strange sometimes. I kept getting timeouts when >>> setting AT+CFUN=4. I once tried it manually and it took 26 seconds until >>> I got an OK. >>> Currently it works fine again. >>> >> >> Is there a newer firmware available by any chance? > > Telit support was so kind to send me a firmware version (08.01.108-B006) > which supports +CFUN without resetting. > I suppose this is not an official version yet and if I adapt the code in > the telit plugin I will probably be the only one who can use it. > Is it ok if I send a corrected version of this patch and change the > offline/online mode handling in a further patch when it is sure > supported by an official firmware version? > Just send it in, their official docs do mention the reset parameter, so if the modem rejects it then that is a firmware bug. The end-user will have to upgrade the firmware in that case. Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] telit: enable extended sim status notification 2012-08-28 14:53 ` Denis Kenzior @ 2012-08-29 15:01 ` Christopher Vogl 2012-08-30 14:46 ` Denis Kenzior 0 siblings, 1 reply; 17+ messages in thread From: Christopher Vogl @ 2012-08-29 15:01 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 7298 bytes --] Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only inserted but also when PIN is unlocked and when SMS + phonebook are ready to be used. Disable sim state notification in telit_enable() so that we sure get a notification when we enable it later again. This way we don't have to query the state the first time. Without this the Telit modem does not always send an URC when AT#QSS=2 is sent. Remove sim_inserted_source and sim_inserted_timeout_cb which are not needed anymore as a consequence. By the way the 1 second timeout was an ugly hack. Don't query current SIM status in cfun_enable_cb() as the SIM is disabled due to prior AT+CFUN=4. Register '#QSS:' before enabling sim state notifications. Remove telit_qss_cb() which was used as a callback for querying the current SIM status. Move sms atom creation into switch_sim_state_status() and add creation of phonebook atom. These are created when QSS: 3 is received. Avoid a reset when switching between online and offline (airplane) mode in telit_set_online(). +CFUN accepts a second parameter (0), which disables a reset: AT+CFUN=x,0. --- plugins/telit.c | 99 +++++++++++++++++++----------------------------------- 1 files changed, 35 insertions(+), 64 deletions(-) diff --git a/plugins/telit.c b/plugins/telit.c index ec57f01..fe2ccd6 100644 --- a/plugins/telit.c +++ b/plugins/telit.c @@ -61,14 +61,14 @@ #include "bluetooth.h" static const char *none_prefix[] = { NULL }; -static const char *qss_prefix[] = { "#QSS:", NULL }; static const char *rsen_prefix[]= { "#RSEN:", NULL }; struct telit_data { GAtChat *chat; /* AT chat */ GAtChat *modem; /* Data port */ struct ofono_sim *sim; - guint sim_inserted_source; + ofono_bool_t have_sim; + ofono_bool_t sms_phonebook_added; struct ofono_modem *sap_modem; GIOChannel *bt_io; GIOChannel *hw_io; @@ -211,43 +211,36 @@ static GAtChat *open_device(struct ofono_modem *modem, return chat; } -static gboolean sim_inserted_timeout_cb(gpointer user_data) -{ - struct ofono_modem *modem = user_data; - struct telit_data *data = ofono_modem_get_data(modem); - - DBG("%p", modem); - - data->sim_inserted_source = 0; - - ofono_sim_inserted_notify(data->sim, TRUE); - - return FALSE; -} - static void switch_sim_state_status(struct ofono_modem *modem, int status) { struct telit_data *data = ofono_modem_get_data(modem); - DBG("%p", modem); + DBG("%p, SIM status: %d", modem, status); switch (status) { - case 0: - DBG("SIM not inserted"); - ofono_sim_inserted_notify(data->sim, FALSE); + case 0: /* SIM not inserted */ + if (data->have_sim == TRUE) { + ofono_sim_inserted_notify(data->sim, FALSE); + data->have_sim = FALSE; + data->sms_phonebook_added = FALSE; + } break; - case 1: - DBG("SIM inserted"); - /* We need to sleep a bit */ - data->sim_inserted_source = g_timeout_add_seconds(1, - sim_inserted_timeout_cb, - modem); + case 1: /* SIM inserted */ + case 2: /* SIM inserted and PIN unlocked */ + if (data->have_sim == FALSE) { + ofono_sim_inserted_notify(data->sim, TRUE); + data->have_sim = TRUE; + } break; - case 2: - DBG("SIM inserted and PIN unlocked"); + case 3: /* SIM inserted, SMS and phonebook ready */ + if (data->sms_phonebook_added == FALSE) { + ofono_phonebook_create(modem, 0, "atmodem", data->chat); + ofono_sms_create(modem, 0, "atmodem", data->chat); + data->sms_phonebook_added = TRUE; + } break; - case 3: - DBG("SIM inserted and ready"); + default: + ofono_warn("Unknown SIM state %d received", status); break; } } @@ -270,25 +263,6 @@ static void telit_qss_notify(GAtResult *result, gpointer user_data) switch_sim_state_status(modem, status); } -static void telit_qss_cb(gboolean ok, GAtResult *result, gpointer user_data) -{ - struct ofono_modem *modem = user_data; - int mode; - int status; - GAtResultIter iter; - g_at_result_iter_init(&iter, result); - - DBG("%p", modem); - - if (!g_at_result_iter_next(&iter, "#QSS:")) - return; - - g_at_result_iter_next_number(&iter, &mode); - g_at_result_iter_next_number(&iter, &status); - - switch_sim_state_status(modem, status); -} - static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct ofono_modem *modem = user_data; @@ -312,6 +286,9 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) */ g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL); + data->have_sim = FALSE; + data->sms_phonebook_added = FALSE; + ofono_modem_set_powered(m, TRUE); /* @@ -321,16 +298,12 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix, NULL, NULL, NULL); - /* Enable sim state notification */ - g_at_chat_send(data->chat, "AT#QSS=1", none_prefix, NULL, NULL, NULL); - /* Follow sim state */ g_at_chat_register(data->chat, "#QSS:", telit_qss_notify, FALSE, modem, NULL); - /* Query current sim state */ - g_at_chat_send(data->chat, "AT#QSS?", qss_prefix, - telit_qss_cb, modem, NULL); + /* Enable sim state notification */ + g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL); } static int telit_enable(struct ofono_modem *modem) @@ -359,6 +332,12 @@ static int telit_enable(struct ofono_modem *modem) g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix, NULL, NULL, NULL); + /* + * Disable sim state notification so that we sure get a notification + * when we enable it again later and don't have to query it. + */ + g_at_chat_send(data->chat, "AT#QSS=0", none_prefix, NULL, NULL, NULL); + /* Set phone functionality */ g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix, cfun_enable_cb, modem, NULL); @@ -418,9 +397,6 @@ static void cfun_disable_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_unref(data->chat); data->chat = NULL; - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - if (ok) ofono_modem_set_powered(modem, FALSE); @@ -583,8 +559,6 @@ static void telit_post_sim(struct ofono_modem *modem) DBG("%p", modem); - ofono_sms_create(modem, 0, "atmodem", data->chat); - gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem", data->chat); gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem); @@ -608,7 +582,7 @@ static void telit_set_online(struct ofono_modem *modem, ofono_bool_t online, { struct telit_data *data = ofono_modem_get_data(modem); struct cb_data *cbd = cb_data_new(cb, user_data); - char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4"; + char const *command = online ? "AT+CFUN=1,0" : "AT+CFUN=4,0"; DBG("modem %p %s", modem, online ? "online" : "offline"); @@ -675,9 +649,6 @@ static void telit_remove(struct ofono_modem *modem) ofono_modem_set_data(modem, NULL); - if (data->sim_inserted_source > 0) - g_source_remove(data->sim_inserted_source); - /* Cleanup after hot-unplug */ g_at_chat_unref(data->chat); g_at_chat_unref(data->modem); -- 1.7.7.6 -- Scanned by MailScanner. ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] telit: enable extended sim status notification 2012-08-29 15:01 ` [PATCH] telit: enable extended sim status notification Christopher Vogl @ 2012-08-30 14:46 ` Denis Kenzior 0 siblings, 0 replies; 17+ messages in thread From: Denis Kenzior @ 2012-08-30 14:46 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1548 bytes --] Hi Christopher, On 08/29/2012 10:01 AM, Christopher Vogl wrote: > Use AT#QSS=2 instead of AT#QSS=1 to get an URC when the SIM is not only > inserted but also when PIN is unlocked and when SMS + phonebook are > ready to be used. > > Disable sim state notification in telit_enable() so that we sure get a > notification when we enable it later again. This way we don't have to > query the state the first time. Without this the Telit modem does not > always send an URC when AT#QSS=2 is sent. > > Remove sim_inserted_source and sim_inserted_timeout_cb which are not > needed anymore as a consequence. > By the way the 1 second timeout was an ugly hack. > > Don't query current SIM status in cfun_enable_cb() as the SIM is > disabled due to prior AT+CFUN=4. > > Register '#QSS:' before enabling sim state notifications. > > Remove telit_qss_cb() which was used as a callback for querying the > current SIM status. > > Move sms atom creation into switch_sim_state_status() and add creation > of phonebook atom. These are created when QSS: 3 is received. > > Avoid a reset when switching between online and offline (airplane) > mode in telit_set_online(). +CFUN accepts a second parameter (0), which > disables a reset: AT+CFUN=x,0. > --- > plugins/telit.c | 99 +++++++++++++++++++----------------------------------- > 1 files changed, 35 insertions(+), 64 deletions(-) > Patch has been applied, however I broke it up into two. One for the extra CFUN parameter changes and the rest. Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] sim: return from CPIN when SIM unlocked for telit 2012-08-22 14:24 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Christopher Vogl 2012-08-22 14:24 ` [PATCH] telit: sim status notification without polling Christopher Vogl @ 2012-08-22 23:44 ` Denis Kenzior 1 sibling, 0 replies; 17+ messages in thread From: Denis Kenzior @ 2012-08-22 23:44 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 339 bytes --] Hi Christopher, On 08/22/2012 09:24 AM, Christopher Vogl wrote: > Only return from CPIN when the modem informs that the SIM is unlocked. > --- > drivers/atmodem/sim.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-) > Patch has been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-08-30 14:46 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-13 13:16 [PATCH 1/8] telit: notify sim inserted when sim ready Christopher Vogl 2012-08-13 13:23 ` Denis Kenzior 2012-08-20 14:34 ` Christopher Vogl 2012-08-20 14:50 ` Denis Kenzior 2012-08-20 15:20 ` Christopher Vogl 2012-08-20 15:42 ` Denis Kenzior 2012-08-22 14:24 ` [PATCH] sim: return from CPIN when SIM unlocked for telit Christopher Vogl 2012-08-22 14:24 ` [PATCH] telit: sim status notification without polling Christopher Vogl 2012-08-23 14:21 ` Denis Kenzior 2012-08-23 16:00 ` Christopher Vogl 2012-08-23 17:37 ` Denis Kenzior 2012-08-24 10:26 ` Christopher Vogl 2012-08-28 15:19 ` Christopher Vogl 2012-08-28 14:53 ` Denis Kenzior 2012-08-29 15:01 ` [PATCH] telit: enable extended sim status notification Christopher Vogl 2012-08-30 14:46 ` Denis Kenzior 2012-08-22 23:44 ` [PATCH] sim: return from CPIN when SIM unlocked for telit 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.