~phablet-team/ofono/midori-support

« back to all changes in this revision

Viewing changes to plugins/sierra.c

  • Committer: Alfonso Sanchez-Beato
  • Date: 2015-09-28 08:10:59 UTC
  • mfrom: (6830.1.168)
  • mto: This revision was merged to the branch mainline in revision 6904.
  • Revision ID: alfonso.sanchez-beato@canonical.com-20150928081059-1o08e2a9pkit6ar6
* Update to upstream release 1.17
* Do not assert when the radio is unavailable (LP: #1490991)
* Fix crash when importing phonebook (LP: #1486004)
* Check only destination port when receiving push (LP: #1490673)
* Fix crash when retrying to close context (LP: #1492483)

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
struct sierra_data {
50
50
        GAtChat *modem;
 
51
        gboolean have_sim;
 
52
        struct at_util_sim_state_query *sim_state_query;
51
53
};
52
54
 
53
55
static void sierra_debug(const char *str, void *user_data)
80
82
 
81
83
        ofono_modem_set_data(modem, NULL);
82
84
 
 
85
        /* Cleanup potential SIM state polling */
 
86
        at_util_sim_state_query_free(data->sim_state_query);
 
87
 
83
88
        /* Cleanup after hot-unplug */
84
89
        g_at_chat_unref(data->modem);
85
90
 
119
124
        return chat;
120
125
}
121
126
 
 
127
static void sim_state_cb(gboolean present, gpointer user_data)
 
128
{
 
129
        struct ofono_modem *modem = user_data;
 
130
        struct sierra_data *data = ofono_modem_get_data(modem);
 
131
 
 
132
        DBG("%p", modem);
 
133
 
 
134
        at_util_sim_state_query_free(data->sim_state_query);
 
135
        data->sim_state_query = NULL;
 
136
 
 
137
        data->have_sim = present;
 
138
        ofono_modem_set_powered(modem, TRUE);
 
139
 
 
140
}
 
141
 
122
142
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
123
143
{
124
144
        struct ofono_modem *modem = user_data;
131
151
                data->modem = NULL;
132
152
        }
133
153
 
134
 
        ofono_modem_set_powered(modem, ok);
 
154
        data->sim_state_query = at_util_sim_state_query_new(data->modem,
 
155
                                                2, 20, sim_state_cb, modem,
 
156
                                                NULL);
135
157
}
136
158
 
137
159
static int sierra_enable(struct ofono_modem *modem)
222
244
        sim = ofono_sim_create(modem, OFONO_VENDOR_SIERRA,
223
245
                                        "atmodem", data->modem);
224
246
 
225
 
        if (sim)
 
247
        if (sim && data->have_sim == TRUE)
226
248
                ofono_sim_inserted_notify(sim, TRUE);
227
249
}
228
250