mirror of
https://github.com/sailfishos/ofono
synced 2025-12-02 23:51:10 +08:00
Compare commits
23 Commits
mer/1.16+g
...
mer/1.16+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
297bdaba0f | ||
|
|
f14db3b2a6 | ||
|
|
4a0182616d | ||
|
|
bbdfc8f46d | ||
|
|
fbd59a8dc9 | ||
|
|
7eb6d5559a | ||
|
|
9a47510eb5 | ||
|
|
8fc7ae836f | ||
|
|
8c0f4f27eb | ||
|
|
b932bed519 | ||
|
|
db83ac369b | ||
|
|
e26df8a645 | ||
|
|
5144f3fa14 | ||
|
|
0d6459b9b0 | ||
|
|
10328e626d | ||
|
|
5b407d654a | ||
|
|
d88af05dc3 | ||
|
|
99cae6876f | ||
|
|
89e6593f9c | ||
|
|
8e9085f5ab | ||
|
|
c33a48ea0c | ||
|
|
3860230644 | ||
|
|
063234a433 |
@@ -292,22 +292,19 @@ void handle_sne(size_t len, const unsigned char *msg, char *sne)
|
|||||||
list_entry->data;
|
list_entry->data;
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
/* If one already exists,
|
|
||||||
delete it */
|
|
||||||
if (entry->sne)
|
|
||||||
g_free(entry->sne);
|
|
||||||
|
|
||||||
DBG("Adding SNE to entry %d",
|
DBG("Adding SNE to entry %d",
|
||||||
phonebook_entry_nbr);
|
phonebook_entry_nbr);
|
||||||
DBG("name %s", entry->name);
|
DBG("name %s", entry->name);
|
||||||
|
|
||||||
|
g_free(entry->sne);
|
||||||
entry->sne = sne;
|
entry->sne = sne;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_free(sne);
|
g_free(sne);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_anr(size_t len,const unsigned char *msg,char *anr,
|
void handle_anr(size_t len,const unsigned char *msg,char *anr,
|
||||||
struct pb_file_info *next_file, struct pb_data *pbd)
|
struct pb_file_info *next_file, struct pb_data *pbd)
|
||||||
|
|||||||
@@ -401,7 +401,6 @@ gboolean ril_util_parse_sim_status(GRil *gril,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < status->num_apps; i++) {
|
for (i = 0; i < status->num_apps; i++) {
|
||||||
DBG("processing app[%d]", i);
|
|
||||||
apps[i] = g_try_new0(struct sim_app, 1);
|
apps[i] = g_try_new0(struct sim_app, 1);
|
||||||
if (apps[i] == NULL) {
|
if (apps[i] == NULL) {
|
||||||
ofono_error("Can't allocate app_data");
|
ofono_error("Can't allocate app_data");
|
||||||
@@ -411,8 +410,6 @@ gboolean ril_util_parse_sim_status(GRil *gril,
|
|||||||
apps[i]->app_type = parcel_r_int32(&rilp);
|
apps[i]->app_type = parcel_r_int32(&rilp);
|
||||||
apps[i]->app_state = parcel_r_int32(&rilp);
|
apps[i]->app_state = parcel_r_int32(&rilp);
|
||||||
|
|
||||||
DBG("app[%d]: app_type: %d, app_state: %d", i,
|
|
||||||
apps[i]->app_type, apps[i]->app_state);
|
|
||||||
/*
|
/*
|
||||||
* Consider RIL_APPSTATE_ILLEGAL also READY. Even if app state
|
* Consider RIL_APPSTATE_ILLEGAL also READY. Even if app state
|
||||||
* is RIL_APPSTATE_ILLEGAL (-1), ICC operations must be
|
* is RIL_APPSTATE_ILLEGAL (-1), ICC operations must be
|
||||||
|
|||||||
@@ -519,44 +519,6 @@ static void ril_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_pin_lock_state(struct ofono_sim *sim, struct sim_app *app)
|
|
||||||
{
|
|
||||||
DBG("pin1:%u,pin2:%u", app->pin1_state, app->pin2_state);
|
|
||||||
/*
|
|
||||||
* Updates only pin and pin2 state. Other locks are not dealt here. For
|
|
||||||
* that a RIL_REQUEST_QUERY_FACILITY_LOCK request should be used.
|
|
||||||
*/
|
|
||||||
switch (app->pin1_state) {
|
|
||||||
case RIL_PINSTATE_ENABLED_NOT_VERIFIED:
|
|
||||||
case RIL_PINSTATE_ENABLED_VERIFIED:
|
|
||||||
case RIL_PINSTATE_ENABLED_BLOCKED:
|
|
||||||
case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
|
|
||||||
ofono_set_pin_lock_state(sim, OFONO_SIM_PASSWORD_SIM_PIN, TRUE);
|
|
||||||
break;
|
|
||||||
case RIL_PINSTATE_DISABLED:
|
|
||||||
ofono_set_pin_lock_state(
|
|
||||||
sim, OFONO_SIM_PASSWORD_SIM_PIN, FALSE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (app->pin2_state) {
|
|
||||||
case RIL_PINSTATE_ENABLED_NOT_VERIFIED:
|
|
||||||
case RIL_PINSTATE_ENABLED_VERIFIED:
|
|
||||||
case RIL_PINSTATE_ENABLED_BLOCKED:
|
|
||||||
case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
|
|
||||||
ofono_set_pin_lock_state(
|
|
||||||
sim, OFONO_SIM_PASSWORD_SIM_PIN2, TRUE);
|
|
||||||
break;
|
|
||||||
case RIL_PINSTATE_DISABLED:
|
|
||||||
ofono_set_pin_lock_state(
|
|
||||||
sim, OFONO_SIM_PASSWORD_SIM_PIN2, FALSE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void configure_active_app(struct sim_data *sd,
|
static void configure_active_app(struct sim_data *sd,
|
||||||
struct sim_app *app,
|
struct sim_app *app,
|
||||||
guint index)
|
guint index)
|
||||||
@@ -627,6 +589,19 @@ static void configure_active_app(struct sim_data *sd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_sim_state(struct sim_data *sd)
|
||||||
|
{
|
||||||
|
guint i = 0;
|
||||||
|
|
||||||
|
sd->passwd_state = OFONO_SIM_PASSWORD_INVALID;
|
||||||
|
|
||||||
|
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
|
||||||
|
sd->retries[i] = -1;
|
||||||
|
|
||||||
|
sd->removed = TRUE;
|
||||||
|
sd->initialized = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_sim *sim = user_data;
|
struct ofono_sim *sim = user_data;
|
||||||
@@ -637,7 +612,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
guint search_index = -1;
|
guint search_index = -1;
|
||||||
struct parcel rilp;
|
struct parcel rilp;
|
||||||
|
|
||||||
DBG("%p", message);
|
DBG("");
|
||||||
|
|
||||||
if (ril_util_parse_sim_status(sd->ril, message, &status, apps) &&
|
if (ril_util_parse_sim_status(sd->ril, message, &status, apps) &&
|
||||||
status.num_apps) {
|
status.num_apps) {
|
||||||
@@ -652,22 +627,21 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
apps[i]->app_type != RIL_APPTYPE_UNKNOWN) {
|
apps[i]->app_type != RIL_APPTYPE_UNKNOWN) {
|
||||||
current_active_app = apps[i]->app_type;
|
current_active_app = apps[i]->app_type;
|
||||||
configure_active_app(sd, apps[i], i);
|
configure_active_app(sd, apps[i], i);
|
||||||
set_pin_lock_state(sim, apps[i]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sd->removed = FALSE;
|
||||||
|
|
||||||
|
if (sd->passwd_state != OFONO_SIM_PASSWORD_INVALID) {
|
||||||
/*
|
/*
|
||||||
* ril_util_parse_sim_status returns true only when
|
* ril_util_parse_sim_status returns true only when
|
||||||
* card status is RIL_CARDSTATE_PRESENT so notify TRUE always.
|
* card status is RIL_CARDSTATE_PRESENT,
|
||||||
*
|
* ofono_sim_inserted_notify returns if status doesn't
|
||||||
* ofono_sim_inserted_notify skips and returns if
|
* change. So can notify core always in this branch.
|
||||||
* present/not_present status doesn't change from previous.
|
|
||||||
*/
|
*/
|
||||||
ofono_sim_inserted_notify(sim, TRUE);
|
ofono_sim_inserted_notify(sim, TRUE);
|
||||||
|
|
||||||
sd->removed = FALSE;
|
|
||||||
|
|
||||||
/* TODO: There doesn't seem to be any other
|
/* TODO: There doesn't seem to be any other
|
||||||
* way to force the core SIM code to
|
* way to force the core SIM code to
|
||||||
* recheck the PIN.
|
* recheck the PIN.
|
||||||
@@ -676,6 +650,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
* __ofono_sim_refresh(sim, NULL, TRUE, TRUE);
|
* __ofono_sim_refresh(sim, NULL, TRUE, TRUE);
|
||||||
*/
|
*/
|
||||||
__ofono_sim_recheck_pin(sim);
|
__ofono_sim_recheck_pin(sim);
|
||||||
|
}
|
||||||
|
|
||||||
if (current_online_state == RIL_ONLINE_PREF) {
|
if (current_online_state == RIL_ONLINE_PREF) {
|
||||||
|
|
||||||
@@ -703,10 +678,9 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
if (status.card_state == RIL_CARDSTATE_ABSENT) {
|
if (status.card_state == RIL_CARDSTATE_ABSENT) {
|
||||||
ofono_info("%s: RIL_CARDSTATE_ABSENT", __func__);
|
ofono_info("%s: RIL_CARDSTATE_ABSENT", __func__);
|
||||||
|
|
||||||
ofono_sim_inserted_notify(sim, FALSE);
|
free_sim_state(sd);
|
||||||
|
|
||||||
sd->removed = TRUE;
|
ofono_sim_inserted_notify(sim, FALSE);
|
||||||
sd->initialized = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -771,7 +745,6 @@ static void ril_query_passwd_state_cb(struct ril_msg *message, gpointer user_dat
|
|||||||
apps[i]->app_type != RIL_APPTYPE_UNKNOWN) {
|
apps[i]->app_type != RIL_APPTYPE_UNKNOWN) {
|
||||||
current_active_app = apps[i]->app_type;
|
current_active_app = apps[i]->app_type;
|
||||||
configure_active_app(sd, apps[i], i);
|
configure_active_app(sd, apps[i], i);
|
||||||
set_pin_lock_state(sim, apps[i]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -826,8 +799,9 @@ static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
struct sim_data *sd = cbd->user;
|
struct sim_data *sd = cbd->user;
|
||||||
struct parcel rilp;
|
struct parcel rilp;
|
||||||
int retry_count;
|
int retry_count;
|
||||||
int retries[OFONO_SIM_PASSWORD_INVALID];
|
|
||||||
int passwd_type;
|
int passwd_type;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* There is no reason to ask SIM status until
|
/* There is no reason to ask SIM status until
|
||||||
* unsolicited sim status change indication
|
* unsolicited sim status change indication
|
||||||
* Looks like state does not change before that.
|
* Looks like state does not change before that.
|
||||||
@@ -837,8 +811,11 @@ static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
ril_util_init_parcel(message, &rilp);
|
ril_util_init_parcel(message, &rilp);
|
||||||
parcel_r_int32(&rilp);
|
parcel_r_int32(&rilp);
|
||||||
retry_count = parcel_r_int32(&rilp);
|
retry_count = parcel_r_int32(&rilp);
|
||||||
retries[passwd_type] = retry_count;
|
|
||||||
sd->retries[passwd_type] = retries[passwd_type];
|
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
|
||||||
|
sd->retries[i] = -1;
|
||||||
|
|
||||||
|
sd->retries[passwd_type] = retry_count;
|
||||||
|
|
||||||
DBG("result=%d passwd_type=%d retry_count=%d",
|
DBG("result=%d passwd_type=%d retry_count=%d",
|
||||||
message->error, passwd_type, retry_count);
|
message->error, passwd_type, retry_count);
|
||||||
@@ -1110,7 +1087,7 @@ static gboolean ril_sim_register(gpointer user)
|
|||||||
send_get_sim_status(sim);
|
send_get_sim_status(sim);
|
||||||
|
|
||||||
sd->idle_id = 0;
|
sd->idle_id = 0;
|
||||||
sd->idle_id = g_ril_register(sd->ril,
|
g_ril_register(sd->ril,
|
||||||
RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED,
|
RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED,
|
||||||
(GRilNotifyFunc) ril_sim_status_changed, sim);
|
(GRilNotifyFunc) ril_sim_status_changed, sim);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1153,12 +1130,15 @@ static int ril_sim_probe(struct ofono_sim *sim, unsigned int vendor,
|
|||||||
|
|
||||||
static void ril_sim_remove(struct ofono_sim *sim)
|
static void ril_sim_remove(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||||
|
|
||||||
ofono_sim_set_data(sim, NULL);
|
ofono_sim_set_data(sim, NULL);
|
||||||
|
|
||||||
if (sd->idle_id > 0)
|
if (sd->idle_id > 0) {
|
||||||
g_source_remove(sd->idle_id);
|
g_source_remove(sd->idle_id);
|
||||||
|
sd->idle_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
g_free(sd->aid_str);
|
g_free(sd->aid_str);
|
||||||
g_free(sd->app_str);
|
g_free(sd->app_str);
|
||||||
|
|||||||
@@ -51,9 +51,6 @@
|
|||||||
#define COMMAND_FLAG_EXPECT_PDU 0x1
|
#define COMMAND_FLAG_EXPECT_PDU 0x1
|
||||||
#define COMMAND_FLAG_EXPECT_SHORT_PROMPT 0x2
|
#define COMMAND_FLAG_EXPECT_SHORT_PROMPT 0x2
|
||||||
|
|
||||||
#define RILD_CMD_SOCKET "/dev/socket/rild"
|
|
||||||
#define RILD_DBG_SOCKET "/dev/socket/rild-debug"
|
|
||||||
|
|
||||||
struct ril_request {
|
struct ril_request {
|
||||||
gchar *data;
|
gchar *data;
|
||||||
guint data_len;
|
guint data_len;
|
||||||
@@ -807,7 +804,7 @@ static gboolean node_compare_by_group(struct ril_notify_node *node,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ril_s *create_ril()
|
static struct ril_s *create_ril(const char *sockpath)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct ril_s *ril;
|
struct ril_s *ril;
|
||||||
@@ -819,6 +816,10 @@ static struct ril_s *create_ril()
|
|||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
char *path = "/etc/ofono/ril_subscription.conf";
|
char *path = "/etc/ofono/ril_subscription.conf";
|
||||||
|
|
||||||
|
DBG("sockpath: %s", sockpath);
|
||||||
|
if (!sockpath)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ril = g_try_new0(struct ril_s, 1);
|
ril = g_try_new0(struct ril_s, 1);
|
||||||
if (ril == NULL)
|
if (ril == NULL)
|
||||||
return ril;
|
return ril;
|
||||||
@@ -841,7 +842,7 @@ static struct ril_s *create_ril()
|
|||||||
|
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strncpy(addr.sun_path, RILD_CMD_SOCKET, sizeof(addr.sun_path) - 1);
|
strncpy(addr.sun_path, sockpath, sizeof(addr.sun_path) - 1);
|
||||||
|
|
||||||
if (connect(ril->sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
if (connect(ril->sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
||||||
ofono_error("%s: can't connect to RILD: %s (%d)\n",
|
ofono_error("%s: can't connect to RILD: %s (%d)\n",
|
||||||
@@ -1074,15 +1075,16 @@ void g_ril_init_parcel(struct ril_msg *message, struct parcel *rilp)
|
|||||||
rilp->offset = 0;
|
rilp->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRil *g_ril_new()
|
GRil *g_ril_new(const char *sockpath)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
GRil *ril;
|
GRil *ril;
|
||||||
|
|
||||||
ril = g_try_new0(GRil, 1);
|
ril = g_try_new0(GRil, 1);
|
||||||
if (ril == NULL)
|
if (ril == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ril->parent = create_ril();
|
ril->parent = create_ril(sockpath);
|
||||||
if (ril->parent == NULL) {
|
if (ril->parent == NULL) {
|
||||||
g_free(ril);
|
g_free(ril);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ extern char print_buf[];
|
|||||||
|
|
||||||
void g_ril_init_parcel(struct ril_msg *message, struct parcel *rilp);
|
void g_ril_init_parcel(struct ril_msg *message, struct parcel *rilp);
|
||||||
|
|
||||||
GRil *g_ril_new();
|
GRil *g_ril_new(const char *sockpath);
|
||||||
|
|
||||||
GIOChannel *g_ril_get_channel(GRil *ril);
|
GIOChannel *g_ril_get_channel(GRil *ril);
|
||||||
GRilIO *g_ril_get_io(GRil *ril);
|
GRilIO *g_ril_get_io(GRil *ril);
|
||||||
|
|||||||
@@ -199,10 +199,6 @@ const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim);
|
|||||||
|
|
||||||
enum ofono_sim_password_type ofono_sim_get_password_type(struct ofono_sim *sim);
|
enum ofono_sim_password_type ofono_sim_get_password_type(struct ofono_sim *sim);
|
||||||
|
|
||||||
void ofono_set_pin_lock_state(struct ofono_sim *sim,
|
|
||||||
enum ofono_sim_password_type type,
|
|
||||||
ofono_bool_t state);
|
|
||||||
|
|
||||||
unsigned int ofono_sim_add_state_watch(struct ofono_sim *sim,
|
unsigned int ofono_sim_add_state_watch(struct ofono_sim *sim,
|
||||||
ofono_sim_state_event_cb_t cb,
|
ofono_sim_state_event_cb_t cb,
|
||||||
void *data, ofono_destroy_func destroy);
|
void *data, ofono_destroy_func destroy);
|
||||||
|
|||||||
@@ -86,6 +86,11 @@
|
|||||||
#define MCE_DISPLAY_DIM_STRING "dimmed"
|
#define MCE_DISPLAY_DIM_STRING "dimmed"
|
||||||
#define MCE_DISPLAY_OFF_STRING "off"
|
#define MCE_DISPLAY_OFF_STRING "off"
|
||||||
|
|
||||||
|
#define RILMODEM_CONF_FILE "/etc/ofono/ril_subscription.conf"
|
||||||
|
#define RILSOCK_CONF_GROUP "cmdsocket"
|
||||||
|
#define RILSOCK_CONF_PATH "path"
|
||||||
|
#define DEFAULT_CMD_SOCK "/dev/socket/rild"
|
||||||
|
|
||||||
struct ril_data {
|
struct ril_data {
|
||||||
GRil *modem;
|
GRil *modem;
|
||||||
int power_on_retries;
|
int power_on_retries;
|
||||||
@@ -475,6 +480,45 @@ void ril_switchUser()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Reading RILD socket path by for now from rilmodem .conf file,
|
||||||
|
* but change this later to StateFs when plans are more concrete.
|
||||||
|
* return: Null-terminated path string. Ownership transferred.
|
||||||
|
* */
|
||||||
|
static char *ril_socket_path()
|
||||||
|
{
|
||||||
|
GError *err = NULL;
|
||||||
|
GKeyFile *keyfile = NULL;
|
||||||
|
char *res = NULL;
|
||||||
|
|
||||||
|
keyfile = g_key_file_new();
|
||||||
|
g_key_file_set_list_separator(keyfile, ',');
|
||||||
|
|
||||||
|
if (!g_key_file_load_from_file(keyfile, RILMODEM_CONF_FILE, 0, &err)) {
|
||||||
|
if (err) {
|
||||||
|
DBG("conf load result: %s", err->message);
|
||||||
|
g_error_free(err);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (g_key_file_has_group(keyfile, RILSOCK_CONF_GROUP)) {
|
||||||
|
res = g_key_file_get_string(
|
||||||
|
keyfile, RILSOCK_CONF_GROUP, RILSOCK_CONF_PATH, &err);
|
||||||
|
if (err) {
|
||||||
|
DBG("conf get result: %s", err->message);
|
||||||
|
g_error_free(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_key_file_free(keyfile);
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
DBG("Falling back to default cmd sock path");
|
||||||
|
res = g_strdup(DEFAULT_CMD_SOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int create_gril(struct ofono_modem *modem)
|
static int create_gril(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
DBG(" modem: %p", modem);
|
DBG(" modem: %p", modem);
|
||||||
@@ -483,7 +527,10 @@ static int create_gril(struct ofono_modem *modem)
|
|||||||
/* RIL expects user radio */
|
/* RIL expects user radio */
|
||||||
ril_switchUser();
|
ril_switchUser();
|
||||||
|
|
||||||
ril->modem = g_ril_new();
|
char *path = ril_socket_path();
|
||||||
|
ril->modem = g_ril_new(path);
|
||||||
|
g_free(path);
|
||||||
|
path = NULL;
|
||||||
|
|
||||||
g_ril_set_disconnect_function(ril->modem, gril_disconnected, modem);
|
g_ril_set_disconnect_function(ril->modem, gril_disconnected, modem);
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct ofono_modem {
|
|||||||
unsigned int call_ids;
|
unsigned int call_ids;
|
||||||
DBusMessage *pending;
|
DBusMessage *pending;
|
||||||
guint interface_update;
|
guint interface_update;
|
||||||
|
ofono_bool_t features_update;
|
||||||
ofono_bool_t powered;
|
ofono_bool_t powered;
|
||||||
ofono_bool_t powered_pending;
|
ofono_bool_t powered_pending;
|
||||||
ofono_bool_t get_online;
|
ofono_bool_t get_online;
|
||||||
@@ -1247,6 +1248,9 @@ static gboolean trigger_interface_update(void *data)
|
|||||||
&interfaces);
|
&interfaces);
|
||||||
g_free(interfaces);
|
g_free(interfaces);
|
||||||
|
|
||||||
|
if (!modem->features_update)
|
||||||
|
goto out;
|
||||||
|
|
||||||
features = g_new0(char *, g_slist_length(modem->feature_list) + 1);
|
features = g_new0(char *, g_slist_length(modem->feature_list) + 1);
|
||||||
for (i = 0, l = modem->feature_list; l; l = l->next, i++)
|
for (i = 0, l = modem->feature_list; l; l = l->next, i++)
|
||||||
features[i] = l->data;
|
features[i] = l->data;
|
||||||
@@ -1255,7 +1259,9 @@ static gboolean trigger_interface_update(void *data)
|
|||||||
"Features", DBUS_TYPE_STRING,
|
"Features", DBUS_TYPE_STRING,
|
||||||
&features);
|
&features);
|
||||||
g_free(features);
|
g_free(features);
|
||||||
|
modem->features_update = FALSE;
|
||||||
|
|
||||||
|
out:
|
||||||
modem->interface_update = 0;
|
modem->interface_update = 0;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1299,9 +1305,11 @@ void ofono_modem_add_interface(struct ofono_modem *modem,
|
|||||||
g_strdup(interface));
|
g_strdup(interface));
|
||||||
|
|
||||||
feature = get_feature(interface);
|
feature = get_feature(interface);
|
||||||
if (feature)
|
if (feature) {
|
||||||
|
modem->features_update = TRUE;
|
||||||
modem->feature_list = g_slist_prepend(modem->feature_list,
|
modem->feature_list = g_slist_prepend(modem->feature_list,
|
||||||
g_strdup(feature));
|
g_strdup(feature));
|
||||||
|
}
|
||||||
|
|
||||||
if (modem->interface_update != 0)
|
if (modem->interface_update != 0)
|
||||||
return;
|
return;
|
||||||
@@ -1333,6 +1341,7 @@ void ofono_modem_remove_interface(struct ofono_modem *modem,
|
|||||||
(GCompareFunc) strcmp);
|
(GCompareFunc) strcmp);
|
||||||
if (found) {
|
if (found) {
|
||||||
g_free(found->data);
|
g_free(found->data);
|
||||||
|
modem->features_update = TRUE;
|
||||||
modem->feature_list =
|
modem->feature_list =
|
||||||
g_slist_remove(modem->feature_list,
|
g_slist_remove(modem->feature_list,
|
||||||
found->data);
|
found->data);
|
||||||
@@ -2071,6 +2080,7 @@ static void modem_unregister(struct ofono_modem *modem)
|
|||||||
if (modem->interface_update) {
|
if (modem->interface_update) {
|
||||||
g_source_remove(modem->interface_update);
|
g_source_remove(modem->interface_update);
|
||||||
modem->interface_update = 0;
|
modem->interface_update = 0;
|
||||||
|
modem->features_update = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modem->lock_watch) {
|
if (modem->lock_watch) {
|
||||||
|
|||||||
@@ -2296,13 +2296,6 @@ enum ofono_sim_password_type ofono_sim_get_password_type(struct ofono_sim *sim)
|
|||||||
return sim->pin_type;
|
return sim->pin_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofono_set_pin_lock_state(struct ofono_sim *sim,
|
|
||||||
enum ofono_sim_password_type type,
|
|
||||||
ofono_bool_t state)
|
|
||||||
{
|
|
||||||
sim->locked_pins[type] = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim)
|
const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
if (sim == NULL)
|
if (sim == NULL)
|
||||||
@@ -2513,9 +2506,19 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
|
|||||||
|
|
||||||
if (inserted)
|
if (inserted)
|
||||||
sim_initialize(sim);
|
sim_initialize(sim);
|
||||||
else
|
else {
|
||||||
|
/*
|
||||||
|
* Reset type to trigger property change signal after sim is
|
||||||
|
* removed and inserted.
|
||||||
|
* Can't reset in sim_free_main_state because it's called also
|
||||||
|
* when sim state changes to OFONO_SIM_STATE_LOCKED_OUT
|
||||||
|
* (PUK lock) if user fails to change PIN.
|
||||||
|
*/
|
||||||
|
sim->pin_type = OFONO_SIM_PASSWORD_NONE;
|
||||||
|
|
||||||
sim_free_state(sim);
|
sim_free_state(sim);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int ofono_sim_add_state_watch(struct ofono_sim *sim,
|
unsigned int ofono_sim_add_state_watch(struct ofono_sim *sim,
|
||||||
ofono_sim_state_event_cb_t notify,
|
ofono_sim_state_event_cb_t notify,
|
||||||
@@ -2763,6 +2766,10 @@ static void sim_pin_query_cb(const struct ofono_error *error,
|
|||||||
DBusConnection *conn = ofono_dbus_get_connection();
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
const char *path = __ofono_atom_get_path(sim->atom);
|
const char *path = __ofono_atom_get_path(sim->atom);
|
||||||
const char *pin_name;
|
const char *pin_name;
|
||||||
|
char **locked_pins;
|
||||||
|
gboolean lock_changed;
|
||||||
|
|
||||||
|
DBG("sim->pin_type: %d, pin_type: %d", sim->pin_type, pin_type);
|
||||||
|
|
||||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
|
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
|
||||||
ofono_error("Querying PIN authentication state failed");
|
ofono_error("Querying PIN authentication state failed");
|
||||||
@@ -2777,9 +2784,24 @@ static void sim_pin_query_cb(const struct ofono_error *error,
|
|||||||
password_is_pin(pin_type) == FALSE)
|
password_is_pin(pin_type) == FALSE)
|
||||||
pin_type = puk2pin(pin_type);
|
pin_type = puk2pin(pin_type);
|
||||||
|
|
||||||
if (pin_type != OFONO_SIM_PASSWORD_INVALID)
|
if (pin_type != OFONO_SIM_PASSWORD_INVALID
|
||||||
|
&& pin_type != OFONO_SIM_PASSWORD_NONE) {
|
||||||
|
lock_changed = !sim->locked_pins[pin_type];
|
||||||
|
|
||||||
sim->locked_pins[pin_type] = TRUE;
|
sim->locked_pins[pin_type] = TRUE;
|
||||||
|
|
||||||
|
if (lock_changed) {
|
||||||
|
locked_pins = get_locked_pins(sim);
|
||||||
|
|
||||||
|
ofono_dbus_signal_array_property_changed(conn,
|
||||||
|
path,
|
||||||
|
OFONO_SIM_MANAGER_INTERFACE,
|
||||||
|
"LockedPins", DBUS_TYPE_STRING,
|
||||||
|
&locked_pins);
|
||||||
|
|
||||||
|
g_strfreev(locked_pins);
|
||||||
|
}
|
||||||
|
}
|
||||||
ofono_dbus_signal_property_changed(conn, path,
|
ofono_dbus_signal_property_changed(conn, path,
|
||||||
OFONO_SIM_MANAGER_INTERFACE,
|
OFONO_SIM_MANAGER_INTERFACE,
|
||||||
"PinRequired", DBUS_TYPE_STRING,
|
"PinRequired", DBUS_TYPE_STRING,
|
||||||
|
|||||||
Reference in New Issue
Block a user