~ubuntu-branches/ubuntu/utopic/ofono/utopic-proposed

« back to all changes in this revision

Viewing changes to plugins/ril.c

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Jussi Kangas, Tony Espy, Ubuntu daily release
  • Date: 2014-09-04 22:31:59 UTC
  • mfrom: (1.3.25)
  • Revision ID: package-import@ubuntu.com-20140904223159-o4zgzipoyz0ejmlt
Tags: 1.12.bzr6876+14.10.20140904-0ubuntu1
[ Jussi Kangas ]
* src/gprs.c: Fix to allow MMS properties to be set (LP: #1362068)

[ Tony Espy ]
* rilmodem/sim.c: Fix EnterPIN logic (LP: #1363413)

[ Ubuntu daily release ]
* New rebuild forced

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
 
67
67
#define MAX_SIM_STATUS_RETRIES 15
68
68
 
 
69
/* this gives 30s for rild to initialize */
 
70
#define RILD_MAX_CONNECT_RETRIES 5
 
71
#define RILD_CONNECT_RETRY_TIME_S 5
 
72
 
69
73
#define RILD_CMD_SOCKET "/dev/socket/rild"
70
74
 
71
75
struct ril_data {
73
77
        enum ofono_ril_vendor vendor;
74
78
        int sim_status_retries;
75
79
        ofono_bool_t connected;
76
 
        ofono_bool_t have_sim;
77
80
        ofono_bool_t ofono_online;
78
81
        int radio_state;
79
82
        struct ofono_sim *sim;
80
83
        struct ofono_voicecall *voice;
 
84
        int rild_connect_retries;
81
85
};
82
86
 
83
87
static void send_get_sim_status(struct ofono_modem *modem);
180
184
                                DBG("Card PRESENT; num_apps: %d",
181
185
                                        status->num_apps);
182
186
 
183
 
                                if (!ril->have_sim) {
184
 
                                        DBG("notify SIM inserted");
185
 
                                        ril->have_sim = TRUE;
186
 
 
187
 
                                        ofono_sim_inserted_notify(ril->sim, TRUE);
188
 
                                }
 
187
                                ofono_sim_inserted_notify(ril->sim, TRUE);
189
188
 
190
189
                        } else {
191
190
                                ofono_warn("Card NOT_PRESENT.");
192
191
 
193
 
                                if (ril->have_sim) {
194
 
                                        DBG("notify SIM removed");
195
 
                                        ril->have_sim = FALSE;
196
 
 
197
 
                                        ofono_sim_inserted_notify(ril->sim, FALSE);
198
 
                                }
 
192
                                ofono_sim_inserted_notify(ril->sim, FALSE);
199
193
                        }
200
194
                        g_ril_reply_free_sim_status(status);
201
195
                }
223
217
        DBG("");
224
218
 
225
219
        ril->vendor = vendor;
226
 
        ril->have_sim = FALSE;
227
220
        ril->ofono_online = FALSE;
228
221
        ril->radio_state = RADIO_STATE_OFF;
229
222
 
412
405
         */
413
406
 
414
407
        if (ril->modem == NULL) {
415
 
                DBG("g_ril_new() failed to create modem!");
 
408
                ofono_error("g_ril_new() failed to create modem!");
416
409
                return -EIO;
417
410
        }
418
411
 
431
424
        return 0;
432
425
}
433
426
 
 
427
static gboolean connect_rild(gpointer user_data)
 
428
{
 
429
        struct ofono_modem *modem = (struct ofono_modem *) user_data;
 
430
        struct ril_data *ril = ofono_modem_get_data(modem);
 
431
 
 
432
        ofono_info("Trying to reconnect to rild...");
 
433
 
 
434
        if (ril->rild_connect_retries++ < RILD_MAX_CONNECT_RETRIES) {
 
435
                if (create_gril(modem) < 0)
 
436
                        return TRUE;
 
437
        } else {
 
438
                ofono_error("Exiting, can't connect to rild.");
 
439
                exit(0);
 
440
        }
 
441
 
 
442
        return FALSE;
 
443
}
 
444
 
434
445
int ril_enable(struct ofono_modem *modem)
435
446
{
436
447
        int ret;
439
450
 
440
451
        ret = create_gril(modem);
441
452
        if (ret < 0)
442
 
                return ret;
 
453
                g_timeout_add_seconds(RILD_CONNECT_RETRY_TIME_S,
 
454
                                        connect_rild, modem);
443
455
 
444
456
        return -EINPROGRESS;
445
457
}