Enable phone functionality only once the SIM card is ready
This commit is contained in:
parent
f57a3d7846
commit
8e47df04cc
12
src/gsm.c
12
src/gsm.c
@ -410,6 +410,13 @@ void gsm_set_callback(GSM * gsm, GSMCallback callback, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* gsm_set_functional */
|
||||||
|
int gsm_set_functional(GSM * gsm, int functional)
|
||||||
|
{
|
||||||
|
return _gsm_modem_set_functional(gsm, (functional != 0) ? TRUE : FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* gsm_set_operator_format */
|
/* gsm_set_operator_format */
|
||||||
int gsm_set_operator_format(GSM * gsm, GSMOperatorFormat format)
|
int gsm_set_operator_format(GSM * gsm, GSMOperatorFormat format)
|
||||||
{
|
{
|
||||||
@ -1368,7 +1375,6 @@ static int _parse_do(GSM * gsm)
|
|||||||
_gsm_modem_set_echo(gsm, FALSE);
|
_gsm_modem_set_echo(gsm, FALSE);
|
||||||
_gsm_modem_set_verbose(gsm, TRUE);
|
_gsm_modem_set_verbose(gsm, TRUE);
|
||||||
_gsm_modem_set_extended_ring(gsm, TRUE);
|
_gsm_modem_set_extended_ring(gsm, TRUE);
|
||||||
_gsm_modem_set_functional(gsm, TRUE);
|
|
||||||
_gsm_modem_get_model(gsm);
|
_gsm_modem_get_model(gsm);
|
||||||
_gsm_event_set_status(gsm, GSM_STATUS_INITIALIZED);
|
_gsm_event_set_status(gsm, GSM_STATUS_INITIALIZED);
|
||||||
_gsm_queue_push(gsm);
|
_gsm_queue_push(gsm);
|
||||||
@ -1937,7 +1943,9 @@ static int _reset_do(int fd, unsigned int baudrate, unsigned int hwflow)
|
|||||||
term.c_oflag = 0;
|
term.c_oflag = 0;
|
||||||
term.c_cc[VMIN] = 1;
|
term.c_cc[VMIN] = 1;
|
||||||
term.c_cc[VTIME] = 0;
|
term.c_cc[VTIME] = 0;
|
||||||
cfsetospeed(&term, baudrate); /* ignore errors */
|
if(cfsetospeed(&term, baudrate) != 0)
|
||||||
|
/* otherwise ignore error */
|
||||||
|
phone_error(NULL, "/dev/modem", 0);
|
||||||
if(tcsetattr(fd, TCSAFLUSH, &term) != 0)
|
if(tcsetattr(fd, TCSAFLUSH, &term) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -211,11 +211,12 @@ void gsm_delete(GSM * gsm);
|
|||||||
void gsm_set_callback(GSM * gsm, GSMCallback callback, gpointer data);
|
void gsm_set_callback(GSM * gsm, GSMCallback callback, gpointer data);
|
||||||
|
|
||||||
unsigned int gsm_get_retry(GSM * gsm);
|
unsigned int gsm_get_retry(GSM * gsm);
|
||||||
|
int gsm_set_functional(GSM * gsm, int functional);
|
||||||
int gsm_set_operator_format(GSM * gsm, GSMOperatorFormat format);
|
int gsm_set_operator_format(GSM * gsm, GSMOperatorFormat format);
|
||||||
int gsm_set_operator_mode(GSM * gsm, GSMOperatorMode mode);
|
int gsm_set_operator_mode(GSM * gsm, GSMOperatorMode mode);
|
||||||
int gsm_set_registration_report(GSM * gsm, GSMRegistrationReport report);
|
int gsm_set_registration_report(GSM * gsm, GSMRegistrationReport report);
|
||||||
int gsm_set_retry(GSM * gsm, unsigned int retry);
|
int gsm_set_retry(GSM * gsm, unsigned int retry);
|
||||||
int gsm_set_extended_ring(GSM * gsm, gboolean extended);
|
int gsm_set_extended_ring(GSM * gsm, int extended);
|
||||||
|
|
||||||
/* useful */
|
/* useful */
|
||||||
int gsm_answer(GSM * gsm);
|
int gsm_answer(GSM * gsm);
|
||||||
|
@ -1031,6 +1031,7 @@ static void _phone_set_status(Phone * phone, GSMStatus status)
|
|||||||
operator = _("SIM ready...");
|
operator = _("SIM ready...");
|
||||||
_phone_track(phone, PHONE_TRACK_CONTACT_LIST, TRUE);
|
_phone_track(phone, PHONE_TRACK_CONTACT_LIST, TRUE);
|
||||||
_phone_track(phone, PHONE_TRACK_MESSAGE_LIST, TRUE);
|
_phone_track(phone, PHONE_TRACK_MESSAGE_LIST, TRUE);
|
||||||
|
gsm_set_functional(phone->gsm, TRUE);
|
||||||
gsm_set_operator_mode(phone->gsm,
|
gsm_set_operator_mode(phone->gsm,
|
||||||
GSM_OPERATOR_MODE_AUTOMATIC);
|
GSM_OPERATOR_MODE_AUTOMATIC);
|
||||||
gsm_set_registration_report(phone->gsm, report);
|
gsm_set_registration_report(phone->gsm, report);
|
||||||
|
Loading…
Reference in New Issue
Block a user