Merge lp:~phablet-team/ofono/rilmodem-power-ussd into lp:~phablet-team/ofono/ubuntu

Proposed by Tony Espy
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 6850
Merged at revision: 6850
Proposed branch: lp:~phablet-team/ofono/rilmodem-power-ussd
Merge into: lp:~phablet-team/ofono/ubuntu
Diff against target: 3717 lines (+1816/-630)
36 files modified
Makefile.am (+10/-2)
debian/changelog (+20/-0)
drivers/rilmodem/call-settings.c (+286/-0)
drivers/rilmodem/call-volume.c (+5/-16)
drivers/rilmodem/devinfo.c (+11/-20)
drivers/rilmodem/gprs-context.c (+7/-22)
drivers/rilmodem/gprs.c (+2/-8)
drivers/rilmodem/network-registration.c (+20/-62)
drivers/rilmodem/rilmodem.c (+4/-1)
drivers/rilmodem/rilmodem.h (+6/-0)
drivers/rilmodem/rilutil.c (+0/-69)
drivers/rilmodem/rilutil.h (+0/-5)
drivers/rilmodem/sim.c (+29/-98)
drivers/rilmodem/sms.c (+9/-42)
drivers/rilmodem/ussd.c (+227/-0)
drivers/rilmodem/voicecall.c (+115/-136)
gril/gril.c (+41/-22)
gril/gril.h (+3/-3)
gril/grilreply.c (+100/-0)
gril/grilreply.h (+16/-0)
gril/grilrequest.c (+63/-0)
gril/grilrequest.h (+16/-0)
gril/grilresponse.h (+0/-46)
gril/grilunsol.c (+133/-0)
gril/grilunsol.h (+15/-0)
gril/grilutil.c (+14/-0)
gril/grilutil.h (+1/-0)
gril/parcel.c (+27/-10)
gril/parcel.h (+1/-0)
gril/ril_constants.h (+5/-0)
plugins/ril.c (+133/-66)
src/sim-mnclength.c (+3/-2)
unit/test-grilreply.c (+101/-0)
unit/test-grilrequest.c (+137/-0)
unit/test-grilunsol.c (+90/-0)
unit/test-mnclength.c (+166/-0)
To merge this branch: bzr merge lp:~phablet-team/ofono/rilmodem-power-ussd
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+200909@code.launchpad.net

Commit message

* gril, unit, rilmodem/call-settings: Add Call-settings suport
    - merge applicable nemomobile code
    - re-factor parcel code
    - add call-volume parcel unit tests
  * gril, unit, rilmodem/ussd: Add USSD support (LP: #1195398)
    - merge applicable nemomobile code
    - re-factor parcel code
    - add call-volume parcel unit tests
  * gril: fix cancel_group/offline crash (LP: #1262340)
  * rilmodem/voicecall: fix conference calls for maguro (LP: #1257206)
  * gril, plugins/ril: Re-worked RIL power code to prepare for flight-
    mode implementation (LP: #1245860), (LP: #1208657).

Description of the change

This merge proposal includes the following changes pulled from rilmodem trunk:

1. Call-settings support added
2. USSD support added (LP: #1195398)
3. Modem Offline crash fixed (LP: #1262340)
4. Maguro Conference call fix (LP: #1257206)
5. RIL plugin power re-factor (LP: ##1245860), (LP: #1208657)

All of this code was subject to github pull request reviews.

Items 1-4 have been tested on image r62 using both mako, and maguro. For details on how to test call-settings, and USSD, please refer to the 14.04 Telephony Test plan.

The RIL power fix is a re-working of the power on sequence implemented in the ril plugin. Prior to this change, we actually didn't have the ability to detect that actual power state of the radio. As we've added support for the unsolicited radio_state_changed event, we now are able to recognize actual power on/off state transitions. As such, we've re-worked the plugin logic so that we don't send an initial get_sim_status command till we're sure the radio is on. This is due to the fact that not all RIL implementations ( eg. maguro ) respond to sim_status or SIM IO commands unless the radio is on. This code has been tested on maguro, mako and the touch emulator. To test, on/off-lining the modem, you need to first stop NetworkManager and telepathy-ofono ( which can be challenging ). Again, see the test plan for more details.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good, tested with mako and maguro using image 138, no regression (call, sms, gprs, sim, all working).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2013-12-04 20:19:31 +0000
3+++ Makefile.am 2014-01-08 20:51:43 +0000
4@@ -133,7 +133,9 @@
5 drivers/rilmodem/sim.c \
6 drivers/rilmodem/sms.c \
7 drivers/rilmodem/rilutil.c \
8- drivers/rilmodem/rilutil.h
9+ drivers/rilmodem/rilutil.h \
10+ drivers/rilmodem/ussd.c \
11+ drivers/rilmodem/call-settings.c
12
13 endif
14
15@@ -699,7 +701,8 @@
16 unit/test-sms unit/test-cdmasms \
17 unit/test-grilrequest \
18 unit/test-grilreply \
19- unit/test-grilunsol
20+ unit/test-grilunsol \
21+ unit/test-mnclength
22
23 noinst_PROGRAMS = $(unit_tests) \
24 unit/test-sms-root unit/test-mux unit/test-caif
25@@ -769,6 +772,11 @@
26 unit_test_grilunsol_LDADD = @GLIB_LIBS@ -ldl
27 unit_objects += $(unit_test_grilunsol_OBJECTS)
28
29+unit_test_mnclength_SOURCES = unit/test-mnclength.c plugins/mnclength.c \
30+ src/log.c src/sim-mnclength.c
31+unit_test_mnclength_LDADD = @GLIB_LIBS@ -ldl
32+unit_objects += $(unit_test_mnclength_OBJECTS)
33+
34 TESTS = $(unit_tests)
35
36 if TOOLS
37
38=== modified file 'debian/changelog'
39--- debian/changelog 2013-12-23 18:38:54 +0000
40+++ debian/changelog 2014-01-08 20:51:43 +0000
41@@ -9,6 +9,26 @@
42 a print_backtrace() function declaration
43 with __attribute__ ((unused))
44
45+ [ Alfonso Sanchez-Beato ]
46+ * gril, unit, rilmodem/call-settings: Add Call-settings suport
47+ - merge applicable nemomobile code
48+ - re-factor parcel code
49+ - add call-volume parcel unit tests
50+ * gril, unit, rilmodem/ussd: Add USSD support (LP: #1195398)
51+ - merge applicable nemomobile code
52+ - re-factor parcel code
53+ - add call-volume parcel unit tests
54+
55+ [ Tony Espy ]
56+ * gril: fix cancel_group/offline crash (LP: #1262340)
57+
58+ [ Alfonso Sanchez-Beato ]
59+ * rilmodem/voicecall: fix conference calls for maguro (LP: #1257206)
60+
61+ [ Tony Espy ]
62+ * gril, plugins/ril: Re-worked RIL power code to prepare for flight-
63+ mode implementation (LP: #1245860), (LP: #1208657).
64+
65 -- Tony Espy <espy@canonical.com> Mon, 23 Dec 2013 13:33:47 -0500
66
67 ofono (1.12+bzr6848-0ubuntu1) trusty; urgency=low
68
69=== added file 'drivers/rilmodem/call-settings.c'
70--- drivers/rilmodem/call-settings.c 1970-01-01 00:00:00 +0000
71+++ drivers/rilmodem/call-settings.c 2014-01-08 20:51:43 +0000
72@@ -0,0 +1,286 @@
73+/*
74+ *
75+ * oFono - Open Source Telephony
76+ *
77+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
78+ * Copyright (C) 2013 Jolla Ltd
79+ * Copyright (C) 2013 Canonical Ltd
80+ * Contact: Jussi Kangas <jussi.kangas@tieto.com>
81+ *
82+ * This program is free software; you can redistribute it and/or modify
83+ * it under the terms of the GNU General Public License version 2 as
84+ * published by the Free Software Foundation.
85+ *
86+ * This program is distributed in the hope that it will be useful,
87+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
88+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89+ * GNU General Public License for more details.
90+ *
91+ * You should have received a copy of the GNU General Public License
92+ * along with this program; if not, write to the Free Software
93+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
94+ *
95+ */
96+
97+#ifdef HAVE_CONFIG_H
98+#include <config.h>
99+#endif
100+
101+#define _GNU_SOURCE
102+#include <stdio.h>
103+#include <stdlib.h>
104+#include <string.h>
105+#include <errno.h>
106+
107+#include <glib.h>
108+
109+#include <ofono/log.h>
110+#include <ofono/modem.h>
111+#include <ofono/call-settings.h>
112+
113+#include "gril.h"
114+#include "grilutil.h"
115+#include "grilrequest.h"
116+#include "grilreply.h"
117+
118+#include "rilmodem.h"
119+#include "ril_constants.h"
120+#include "common.h"
121+
122+struct settings_data {
123+ GRil *ril;
124+};
125+
126+static void ril_set_cb(struct ril_msg *message, gpointer user_data)
127+{
128+ struct cb_data *cbd = user_data;
129+ struct ofono_call_settings *cs = cbd->user;
130+ struct settings_data *sd = ofono_call_settings_get_data(cs);
131+ ofono_call_settings_set_cb_t cb = cbd->cb;
132+
133+ if (message->error == RIL_E_SUCCESS) {
134+ g_ril_print_response_no_args(sd->ril, message);
135+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
136+ } else {
137+ CALLBACK_WITH_FAILURE(cb, cbd->data);
138+ }
139+}
140+
141+static void ril_cw_set(struct ofono_call_settings *cs, int mode, int cls,
142+ ofono_call_settings_set_cb_t cb, void *data)
143+{
144+ struct settings_data *sd = ofono_call_settings_get_data(cs);
145+ struct cb_data *cbd = cb_data_new(cb, data, cs);
146+ int ret;
147+ struct parcel rilp;
148+
149+ g_ril_request_set_call_waiting(sd->ril, mode, cls, &rilp);
150+
151+ ret = g_ril_send(sd->ril, RIL_REQUEST_SET_CALL_WAITING, &rilp,
152+ ril_set_cb, cbd, g_free);
153+
154+ /* In case of error free cbd and return the cb with failure */
155+ if (ret <= 0) {
156+ g_free(cbd);
157+ CALLBACK_WITH_FAILURE(cb, data);
158+ }
159+}
160+
161+static void ril_cw_query_cb(struct ril_msg *message, gpointer user_data)
162+{
163+ struct cb_data *cbd = user_data;
164+ struct ofono_call_settings *cs = cbd->user;
165+ struct settings_data *sd = ofono_call_settings_get_data(cs);
166+ ofono_call_settings_status_cb_t cb = cbd->cb;
167+
168+ if (message->error == RIL_E_SUCCESS) {
169+ int res;
170+
171+ res = g_ril_reply_parse_query_call_waiting(sd->ril, message);
172+
173+ CALLBACK_WITH_SUCCESS(cb, res, cbd->data);
174+ } else {
175+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
176+ }
177+}
178+
179+static void ril_cw_query(struct ofono_call_settings *cs, int cls,
180+ ofono_call_settings_status_cb_t cb, void *data)
181+{
182+ struct settings_data *sd = ofono_call_settings_get_data(cs);
183+ struct cb_data *cbd = cb_data_new(cb, data, cs);
184+ int ret;
185+ struct parcel rilp;
186+
187+ g_ril_request_query_call_waiting(sd->ril, cls, &rilp);
188+
189+ ret = g_ril_send(sd->ril, RIL_REQUEST_QUERY_CALL_WAITING, &rilp,
190+ ril_cw_query_cb, cbd, g_free);
191+
192+ /* In case of error free cbd and return the cb with failure */
193+ if (ret <= 0) {
194+ g_free(cbd);
195+ CALLBACK_WITH_FAILURE(cb, -1, data);
196+ }
197+}
198+
199+static void ril_clip_query_cb(struct ril_msg *message, gpointer user_data)
200+{
201+ struct cb_data *cbd = user_data;
202+ struct ofono_call_settings *cs = cbd->user;
203+ struct settings_data *sd = ofono_call_settings_get_data(cs);
204+ ofono_call_settings_status_cb_t cb = cbd->cb;
205+
206+ if (message->error == RIL_E_SUCCESS) {
207+ int res;
208+
209+ res = g_ril_reply_parse_query_clip(sd->ril, message);
210+
211+ CALLBACK_WITH_SUCCESS(cb, res, cbd->data);
212+ } else {
213+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
214+ }
215+}
216+
217+static void ril_clip_query(struct ofono_call_settings *cs,
218+ ofono_call_settings_status_cb_t cb, void *data)
219+{
220+ struct settings_data *sd = ofono_call_settings_get_data(cs);
221+ struct cb_data *cbd = cb_data_new(cb, data, cs);
222+ int ret;
223+
224+ ret = g_ril_send(sd->ril, RIL_REQUEST_QUERY_CLIP, NULL,
225+ ril_clip_query_cb, cbd, g_free);
226+
227+ /* In case of error free cbd and return the cb with failure */
228+ if (ret <= 0) {
229+ g_free(cbd);
230+ CALLBACK_WITH_FAILURE(cb, -1, data);
231+ }
232+}
233+
234+static void ril_clir_query_cb(struct ril_msg *message, gpointer user_data)
235+{
236+ struct cb_data *cbd = user_data;
237+ struct ofono_call_settings *cs = cbd->user;
238+ struct settings_data *sd = ofono_call_settings_get_data(cs);
239+ ofono_call_settings_clir_cb_t cb = cbd->cb;
240+ struct reply_clir *rclir;
241+
242+ if (message->error != RIL_E_SUCCESS) {
243+ ofono_error("%s: Reply failure: %s", __func__,
244+ ril_error_to_string(message->error));
245+ goto error;
246+ }
247+
248+ rclir = g_ril_reply_parse_get_clir(sd->ril, message);
249+ if (rclir == NULL) {
250+ ofono_error("%s: parse error", __func__);
251+ goto error;
252+ }
253+
254+ CALLBACK_WITH_SUCCESS(cb, rclir->status, rclir->provisioned, cbd->data);
255+
256+ g_ril_reply_free_get_clir(rclir);
257+
258+ return;
259+
260+error:
261+ CALLBACK_WITH_FAILURE(cb, -1, -1, cbd->data);
262+}
263+
264+static void ril_clir_query(struct ofono_call_settings *cs,
265+ ofono_call_settings_clir_cb_t cb, void *data)
266+{
267+ struct settings_data *sd = ofono_call_settings_get_data(cs);
268+ struct cb_data *cbd = cb_data_new(cb, data, cs);
269+ int ret;
270+
271+ ret = g_ril_send(sd->ril, RIL_REQUEST_GET_CLIR, NULL,
272+ ril_clir_query_cb, cbd, g_free);
273+
274+ if (ret <= 0) {
275+ g_free(cbd);
276+ CALLBACK_WITH_FAILURE(cb, -1, -1, data);
277+ }
278+}
279+
280+
281+static void ril_clir_set(struct ofono_call_settings *cs, int mode,
282+ ofono_call_settings_set_cb_t cb, void *data)
283+{
284+ struct settings_data *sd = ofono_call_settings_get_data(cs);
285+ struct cb_data *cbd = cb_data_new(cb, data, cs);
286+ struct parcel rilp;
287+ int ret;
288+
289+ g_ril_request_set_clir(sd->ril, mode, &rilp);
290+
291+ ret = g_ril_send(sd->ril, RIL_REQUEST_SET_CLIR, &rilp,
292+ ril_set_cb, cbd, g_free);
293+
294+ if (ret <= 0) {
295+ g_free(cbd);
296+ CALLBACK_WITH_FAILURE(cb, data);
297+ }
298+}
299+
300+static gboolean ril_delayed_register(gpointer user_data)
301+{
302+ struct ofono_call_settings *cs = user_data;
303+
304+ ofono_call_settings_register(cs);
305+
306+ return FALSE;
307+}
308+
309+static int ril_call_settings_probe(struct ofono_call_settings *cs,
310+ unsigned int vendor, void *user)
311+{
312+ GRil *ril = user;
313+ struct settings_data *sd = g_new0(struct settings_data, 1);
314+
315+ sd->ril = g_ril_clone(ril);
316+
317+ ofono_call_settings_set_data(cs, sd);
318+
319+ g_idle_add(ril_delayed_register, cs);
320+
321+ return 0;
322+}
323+
324+static void ril_call_settings_remove(struct ofono_call_settings *cs)
325+{
326+ struct settings_data *sd = ofono_call_settings_get_data(cs);
327+ ofono_call_settings_set_data(cs, NULL);
328+
329+ g_ril_unref(sd->ril);
330+ g_free(sd);
331+}
332+
333+static struct ofono_call_settings_driver driver = {
334+ .name = RILMODEM,
335+ .probe = ril_call_settings_probe,
336+ .remove = ril_call_settings_remove,
337+ .clip_query = ril_clip_query,
338+ .cw_query = ril_cw_query,
339+ .cw_set = ril_cw_set,
340+ .clir_query = ril_clir_query,
341+ .clir_set = ril_clir_set
342+
343+ /*
344+ * Not supported in RIL API
345+ * .colp_query = ril_colp_query,
346+ * .colr_query = ril_colr_query
347+ */
348+};
349+
350+void ril_call_settings_init(void)
351+{
352+ ofono_call_settings_driver_register(&driver);
353+}
354+
355+void ril_call_settings_exit(void)
356+{
357+ ofono_call_settings_driver_unregister(&driver);
358+}
359
360=== modified file 'drivers/rilmodem/call-volume.c'
361--- drivers/rilmodem/call-volume.c 2013-11-28 13:31:35 +0000
362+++ drivers/rilmodem/call-volume.c 2014-01-08 20:51:43 +0000
363@@ -76,20 +76,13 @@
364 struct cv_data *cvd = ofono_call_volume_get_data(cv);
365 struct cb_data *cbd = cb_data_new(cb, data, cvd);
366 struct parcel rilp;
367- int request = RIL_REQUEST_SET_MUTE;
368- int ret;
369
370 DBG("Initial ril muted state: %d", muted);
371
372 g_ril_request_set_mute(cvd->ril, muted, &rilp);
373
374- ret = g_ril_send(cvd->ril, request, rilp.data, rilp.size,
375- volume_mute_cb, cbd, g_free);
376-
377- g_ril_print_request(cvd->ril, ret, request);
378- parcel_free(&rilp);
379-
380- if (ret <= 0) {
381+ if (g_ril_send(cvd->ril, RIL_REQUEST_SET_MUTE, &rilp,
382+ volume_mute_cb, cbd, g_free) == 0) {
383 ofono_error("Send RIL_REQUEST_SET_MUTE failed.");
384 g_free(cbd);
385 CALLBACK_WITH_FAILURE(cb, data);
386@@ -116,13 +109,9 @@
387 {
388 struct ofono_call_volume *cv = user_data;
389 struct cv_data *cvd = ofono_call_volume_get_data(cv);
390- int request = RIL_REQUEST_GET_MUTE;
391- int ret;
392-
393- ret = g_ril_send(cvd->ril, request, NULL, 0,
394- probe_mute_cb, cv, NULL);
395-
396- g_ril_print_request_no_args(cvd->ril, ret, request);
397+
398+ g_ril_send(cvd->ril, RIL_REQUEST_GET_MUTE, NULL,
399+ probe_mute_cb, cv, NULL);
400 }
401
402 static gboolean ril_delayed_register(gpointer user_data)
403
404=== modified file 'drivers/rilmodem/devinfo.c'
405--- drivers/rilmodem/devinfo.c 2013-12-03 08:22:15 +0000
406+++ drivers/rilmodem/devinfo.c 2014-01-08 20:51:43 +0000
407@@ -106,15 +106,9 @@
408 {
409 GRil *ril = ofono_devinfo_get_data(info);
410 struct cb_data *cbd = cb_data_new(cb, data, ril);
411- int request = RIL_REQUEST_BASEBAND_VERSION;
412- int ret;
413-
414- ret = g_ril_send(ril, request, NULL, 0,
415- query_revision_cb, cbd, g_free);
416-
417- g_ril_print_request_no_args(ril, ret, request);
418-
419- if (ret <= 0) {
420+
421+ if (g_ril_send(ril, RIL_REQUEST_BASEBAND_VERSION, NULL,
422+ query_revision_cb, cbd, g_free) == 0) {
423 g_free(cbd);
424 CALLBACK_WITH_FAILURE(cb, NULL, data);
425 }
426@@ -149,17 +143,14 @@
427 {
428 GRil *ril = ofono_devinfo_get_data(info);
429 struct cb_data *cbd = cb_data_new(cb, data, ril);
430- /* TODO: make it support both RIL_REQUEST_GET_IMEI (deprecated) and
431- * RIL_REQUEST_DEVICE_IDENTITY depending on the rild version used */
432- int request = RIL_REQUEST_GET_IMEI;
433- int ret;
434-
435- ret = g_ril_send(ril, request, NULL, 0,
436- query_serial_cb, cbd, g_free);
437-
438- g_ril_print_request_no_args(ril, ret, request);
439-
440- if (ret <= 0) {
441+
442+ /*
443+ * TODO: make it support both RIL_REQUEST_GET_IMEI (deprecated) and
444+ * RIL_REQUEST_DEVICE_IDENTITY depending on the rild version used
445+ */
446+
447+ if (g_ril_send(ril, RIL_REQUEST_GET_IMEI, NULL,
448+ query_serial_cb, cbd, g_free) == 0) {
449 g_free(cbd);
450 CALLBACK_WITH_FAILURE(cb, NULL, data);
451 }
452
453=== modified file 'drivers/rilmodem/gprs-context.c'
454--- drivers/rilmodem/gprs-context.c 2013-11-06 03:59:35 +0000
455+++ drivers/rilmodem/gprs-context.c 2014-01-08 20:51:43 +0000
456@@ -228,7 +228,6 @@
457 struct req_setup_data_call request;
458 struct parcel rilp;
459 struct ofono_error error;
460- int reqid = RIL_REQUEST_SETUP_DATA_CALL;
461 int ret = 0;
462
463 DBG("Activating contex: %d", ctx->cid);
464@@ -257,17 +256,9 @@
465 gcd->active_ctx_cid = ctx->cid;
466 gcd->state = STATE_ENABLING;
467
468- ret = g_ril_send(gcd->ril,
469- reqid,
470- rilp.data,
471- rilp.size,
472+ ret = g_ril_send(gcd->ril, RIL_REQUEST_SETUP_DATA_CALL, &rilp,
473 ril_setup_data_call_cb, cbd, g_free);
474
475- /* NOTE - we could make the following function part of g_ril_send? */
476- g_ril_print_request(gcd->ril, ret, reqid);
477-
478- parcel_free(&rilp);
479-
480 error:
481 g_free(request.apn);
482 g_free(request.username);
483@@ -329,13 +320,12 @@
484 struct parcel rilp;
485 struct req_deactivate_data_call request;
486 struct ofono_error error;
487- int reqid = RIL_REQUEST_DEACTIVATE_DATA_CALL;
488 int ret = 0;
489
490 DBG("cid: %d active_rild_cid: %d", id, gcd->active_rild_cid);
491
492 if (gcd->state == STATE_IDLE || gcd->state == STATE_DISABLING) {
493- /* nothing to do */
494+ /* nothing to do */
495
496 if (cb) {
497 CALLBACK_WITH_SUCCESS(cb, data);
498@@ -358,20 +348,15 @@
499 goto error;
500 }
501
502- ret = g_ril_send(gcd->ril,
503- reqid,
504- rilp.data,
505- rilp.size,
506+ /* TODO: this should be folded into g_ril_request_deactivate_data_call()!!! */
507+ g_ril_append_print_buf(gcd->ril, "(%d,0)", request.cid);
508+
509+ ret = g_ril_send(gcd->ril, RIL_REQUEST_DEACTIVATE_DATA_CALL, &rilp,
510 ril_deactivate_data_call_cb, cbd, g_free);
511
512- g_ril_append_print_buf(gcd->ril, "(%d,0)", request.cid);
513- g_ril_print_request(gcd->ril, ret, reqid);
514-
515- parcel_free(&rilp);
516-
517 error:
518 if (ret <= 0) {
519- /* TODO: should we force state to disconnected here? */
520+ /* TODO: should we force state to disconnected here? */
521
522 ofono_error("Send RIL_REQUEST_DEACTIVATE_DATA_CALL failed.");
523 g_free(cbd);
524
525=== modified file 'drivers/rilmodem/gprs.c'
526--- drivers/rilmodem/gprs.c 2013-12-04 20:19:31 +0000
527+++ drivers/rilmodem/gprs.c 2014-01-08 20:51:43 +0000
528@@ -262,17 +262,11 @@
529 {
530 struct gprs_data *gd = ofono_gprs_get_data(gprs);
531 struct cb_data *cbd = cb_data_new(cb, data, gprs);
532- int request = RIL_REQUEST_DATA_REGISTRATION_STATE;
533- gint ret;
534
535 DBG("");
536
537- ret = g_ril_send(gd->ril, request,
538- NULL, 0, ril_data_reg_cb, cbd, g_free);
539-
540- g_ril_print_request_no_args(gd->ril, ret, request);
541-
542- if (!ret) {
543+ if (g_ril_send(gd->ril, RIL_REQUEST_DATA_REGISTRATION_STATE, NULL,
544+ ril_data_reg_cb, cbd, g_free) == 0) {
545 ofono_error("%s: send "
546 "RIL_REQUEST_DATA_REGISTRATION_STATE failed",
547 __func__);
548
549=== modified file 'drivers/rilmodem/network-registration.c'
550--- drivers/rilmodem/network-registration.c 2013-11-15 23:18:12 +0000
551+++ drivers/rilmodem/network-registration.c 2014-01-08 20:51:43 +0000
552@@ -137,8 +137,6 @@
553 {
554 struct netreg_data *nd = ofono_netreg_get_data(netreg);
555 struct cb_data *cbd;
556- int request = RIL_REQUEST_VOICE_REGISTRATION_STATE;
557- int ret;
558
559 /*
560 * If no cb specified, setup internal callback to
561@@ -149,12 +147,8 @@
562 else
563 cbd = cb_data_new(cb, data, nd);
564
565- ret = g_ril_send(nd->ril, request, NULL,
566- 0, ril_creg_cb, cbd, g_free);
567-
568- g_ril_print_request_no_args(nd->ril, ret, request);
569-
570- if (!ret) {
571+ if (g_ril_send(nd->ril, RIL_REQUEST_VOICE_REGISTRATION_STATE, NULL,
572+ ril_creg_cb, cbd, g_free) == 0) {
573 g_free(cbd);
574 CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, data);
575 }
576@@ -204,15 +198,9 @@
577 {
578 struct netreg_data *nd = ofono_netreg_get_data(netreg);
579 struct cb_data *cbd = cb_data_new(cb, data, nd);
580- int request = RIL_REQUEST_OPERATOR;
581- int ret;
582-
583- ret = g_ril_send(nd->ril, request, NULL,
584- 0, ril_cops_cb, cbd, g_free);
585-
586- g_ril_print_request_no_args(nd->ril, ret, request);
587-
588- if (!ret) {
589+
590+ if (g_ril_send(nd->ril, RIL_REQUEST_OPERATOR, NULL,
591+ ril_cops_cb, cbd, g_free) == 0) {
592 g_free(cbd);
593 CALLBACK_WITH_FAILURE(cb, NULL, data);
594 }
595@@ -291,15 +279,9 @@
596 {
597 struct netreg_data *nd = ofono_netreg_get_data(netreg);
598 struct cb_data *cbd = cb_data_new(cb, data, nd);
599- int request = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS;
600- int ret;
601-
602- ret = g_ril_send(nd->ril, request, NULL,
603- 0, ril_cops_list_cb, cbd, g_free);
604-
605- g_ril_print_request_no_args(nd->ril, ret, request);
606-
607- if (!ret) {
608+
609+ if (g_ril_send(nd->ril, RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, NULL,
610+ ril_cops_list_cb, cbd, g_free) == 0) {
611 g_free(cbd);
612 CALLBACK_WITH_FAILURE(cb, 0, NULL, data);
613 }
614@@ -329,15 +311,9 @@
615 {
616 struct netreg_data *nd = ofono_netreg_get_data(netreg);
617 struct cb_data *cbd = cb_data_new(cb, data, nd);
618- int request = RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC;
619- int ret;
620-
621- ret = g_ril_send(nd->ril, request,
622- NULL, 0, ril_register_cb, cbd, g_free);
623-
624- g_ril_print_request_no_args(nd->ril, ret, request);
625-
626- if (!ret) {
627+
628+ if (g_ril_send(nd->ril, RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, NULL,
629+ ril_register_cb, cbd, g_free) == 0) {
630 g_free(cbd);
631 CALLBACK_WITH_FAILURE(cb, data);
632 }
633@@ -351,23 +327,15 @@
634 struct cb_data *cbd = cb_data_new(cb, data, nd);
635 char buf[OFONO_MAX_MCC_LENGTH + OFONO_MAX_MNC_LENGTH + 1];
636 struct parcel rilp;
637- int request = RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL;
638- int ret;
639
640 /* RIL expects a char * specifying MCCMNC of network to select */
641 snprintf(buf, sizeof(buf), "%s%s", mcc, mnc);
642
643 g_ril_request_set_net_select_manual(nd->ril, buf, &rilp);
644
645- ret = g_ril_send(nd->ril, request,
646- rilp.data, rilp.size, ril_register_cb,
647- cbd, g_free);
648-
649- g_ril_print_request(nd->ril, ret, request);
650- parcel_free(&rilp);
651-
652 /* In case of error free cbd and return the cb with failure */
653- if (!ret) {
654+ if (g_ril_send(nd->ril, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, &rilp,
655+ ril_register_cb, cbd, g_free) == 0) {
656 g_free(cbd);
657 CALLBACK_WITH_FAILURE(cb, data);
658 }
659@@ -377,14 +345,9 @@
660 {
661 struct ofono_netreg *netreg = user_data;
662 struct netreg_data *nd = ofono_netreg_get_data(netreg);
663- int strength;
664-
665- g_assert(message->req == RIL_UNSOL_SIGNAL_STRENGTH);
666-
667- strength = ril_util_get_signal(nd->ril, message);
668+ int strength = g_ril_unsol_parse_signal_strength(nd->ril, message);
669+
670 ofono_netreg_strength_notify(netreg, strength);
671-
672- return;
673 }
674
675 static void ril_strength_cb(struct ril_msg *message, gpointer user_data)
676@@ -402,7 +365,8 @@
677 goto error;
678 }
679
680- strength = ril_util_get_signal(nd->ril, message);
681+ /* The g_ril_unsol* function handles both reply & unsolicited */
682+ strength = g_ril_unsol_parse_signal_strength(nd->ril, message);
683 cb(&error, strength, cbd->data);
684
685 return;
686@@ -416,15 +380,9 @@
687 {
688 struct netreg_data *nd = ofono_netreg_get_data(netreg);
689 struct cb_data *cbd = cb_data_new(cb, data, nd);
690- int request = RIL_REQUEST_SIGNAL_STRENGTH;
691- int ret;
692-
693- ret = g_ril_send(nd->ril, request,
694- NULL, 0, ril_strength_cb, cbd, g_free);
695-
696- g_ril_print_request_no_args(nd->ril, ret, request);
697-
698- if (!ret) {
699+
700+ if (g_ril_send(nd->ril, RIL_REQUEST_SIGNAL_STRENGTH, NULL,
701+ ril_strength_cb, cbd, g_free) == 0) {
702 ofono_error("Send RIL_REQUEST_SIGNAL_STRENGTH failed.");
703
704 g_free(cbd);
705
706=== modified file 'drivers/rilmodem/rilmodem.c'
707--- drivers/rilmodem/rilmodem.c 2013-09-09 19:21:32 +0000
708+++ drivers/rilmodem/rilmodem.c 2014-01-08 20:51:43 +0000
709@@ -44,9 +44,10 @@
710 ril_sms_init();
711 ril_netreg_init();
712 ril_call_volume_init();
713-
714 ril_gprs_init();
715 ril_gprs_context_init();
716+ ril_ussd_init();
717+ ril_call_settings_init();
718
719 return 0;
720 }
721@@ -63,6 +64,8 @@
722 ril_call_volume_exit();
723 ril_gprs_exit();
724 ril_gprs_context_exit();
725+ ril_ussd_exit();
726+ ril_call_settings_exit();
727 }
728
729 OFONO_PLUGIN_DEFINE(rilmodem, "RIL modem driver", VERSION,
730
731=== modified file 'drivers/rilmodem/rilmodem.h'
732--- drivers/rilmodem/rilmodem.h 2013-09-09 19:21:32 +0000
733+++ drivers/rilmodem/rilmodem.h 2014-01-08 20:51:43 +0000
734@@ -51,3 +51,9 @@
735
736 extern void ril_gprs_context_init(void);
737 extern void ril_gprs_context_exit(void);
738+
739+extern void ril_ussd_init(void);
740+extern void ril_ussd_exit(void);
741+
742+extern void ril_call_settings_init(void);
743+extern void ril_call_settings_exit(void);
744
745=== modified file 'drivers/rilmodem/rilutil.c'
746--- drivers/rilmodem/rilutil.c 2013-11-25 13:54:04 +0000
747+++ drivers/rilmodem/rilutil.c 2014-01-08 20:51:43 +0000
748@@ -157,17 +157,6 @@
749 return result;
750 }
751
752-/* TODO: this function can go away, once all the code has been
753- * re-factored to use grilreply.c */
754-void ril_util_init_parcel(struct ril_msg *message, struct parcel *rilp)
755-{
756- /* Set up Parcel struct for proper parsing */
757- rilp->data = message->buf;
758- rilp->size = message->buf_len;
759- rilp->capacity = message->buf_len;
760- rilp->offset = 0;
761-}
762-
763 struct ril_util_sim_state_query *ril_util_sim_state_query_new(GRil *ril,
764 guint interval, guint num_times,
765 ril_util_sim_inserted_cb_t cb,
766@@ -203,61 +192,3 @@
767
768 g_free(req);
769 }
770-
771-gint ril_util_get_signal(GRil *gril, struct ril_msg *message)
772-{
773- struct parcel rilp;
774- int gw_signal, cdma_dbm, evdo_dbm, lte_signal;
775-
776- /* Set up Parcel struct for proper parsing */
777- ril_util_init_parcel(message, &rilp);
778-
779- /* RIL_SignalStrength_v6 */
780- /* GW_SignalStrength */
781- gw_signal = parcel_r_int32(&rilp);
782- parcel_r_int32(&rilp); /* bitErrorRate */
783-
784- /* CDMA_SignalStrength */
785- cdma_dbm = parcel_r_int32(&rilp);
786- parcel_r_int32(&rilp); /* ecio */
787-
788- /* EVDO_SignalStrength */
789- evdo_dbm = parcel_r_int32(&rilp);
790- parcel_r_int32(&rilp); /* ecio */
791- parcel_r_int32(&rilp); /* signalNoiseRatio */
792-
793- /* LTE_SignalStrength */
794- lte_signal = parcel_r_int32(&rilp);
795- parcel_r_int32(&rilp); /* rsrp */
796- parcel_r_int32(&rilp); /* rsrq */
797- parcel_r_int32(&rilp); /* rssnr */
798- parcel_r_int32(&rilp); /* cqi */
799-
800- g_ril_append_print_buf(gril, "(gw: %d, cdma: %d, evdo: %d, lte: %d)",
801- gw_signal, cdma_dbm, evdo_dbm, lte_signal);
802-
803- if (message->unsolicited)
804- g_ril_print_unsol(gril, message);
805- else
806- g_ril_print_response(gril, message);
807-
808- /* Return the first valid one */
809- if ((gw_signal != 99) && (gw_signal != -1))
810- return (gw_signal * 100) / 31;
811- if ((lte_signal != 99) && (lte_signal != -1))
812- return (lte_signal * 100) / 31;
813-
814- /* In case of dbm, return the value directly */
815- if (cdma_dbm != -1) {
816- if (cdma_dbm > 100)
817- cdma_dbm = 100;
818- return cdma_dbm;
819- }
820- if (evdo_dbm != -1) {
821- if (evdo_dbm > 100)
822- evdo_dbm = 100;
823- return evdo_dbm;
824- }
825-
826- return -1;
827-}
828
829=== modified file 'drivers/rilmodem/rilutil.h'
830--- drivers/rilmodem/rilutil.h 2013-11-25 13:54:04 +0000
831+++ drivers/rilmodem/rilutil.h 2014-01-08 20:51:43 +0000
832@@ -24,8 +24,6 @@
833
834 #include <stdio.h>
835
836-#include "parcel.h"
837-
838 /* TODO: create a table lookup*/
839 #define PREFIX_30_NETMASK "255.255.255.252"
840 #define PREFIX_29_NETMASK "255.255.255.248"
841@@ -95,7 +93,6 @@
842 gint ril_util_call_compare_by_id(gconstpointer a, gconstpointer b);
843 gint ril_util_call_compare(gconstpointer a, gconstpointer b);
844 gchar *ril_util_get_netmask(const char *address);
845-void ril_util_init_parcel(struct ril_msg *message, struct parcel *rilp);
846
847 struct ril_util_sim_state_query *ril_util_sim_state_query_new(GRil *ril,
848 guint interval, guint num_times,
849@@ -104,8 +101,6 @@
850 GDestroyNotify destroy);
851 void ril_util_sim_state_query_free(struct ril_util_sim_state_query *req);
852
853-gint ril_util_get_signal(GRil *gril, struct ril_msg *message);
854-
855 struct cb_data {
856 void *cb;
857 void *data;
858
859=== modified file 'drivers/rilmodem/sim.c'
860--- drivers/rilmodem/sim.c 2013-11-28 10:56:16 +0000
861+++ drivers/rilmodem/sim.c 2014-01-08 20:51:43 +0000
862@@ -193,7 +193,6 @@
863 struct cb_data *cbd = cb_data_new(cb, data, sd);
864 struct parcel rilp;
865 struct req_sim_read_info req;
866- int request = RIL_REQUEST_SIM_IO;
867 guint ret = 0;
868
869 DBG("file %04x", fileid);
870@@ -211,20 +210,14 @@
871 goto error;
872 }
873
874- ret = g_ril_send(sd->ril,
875- request,
876- rilp.data,
877- rilp.size,
878+ g_ril_append_print_buf(sd->ril,
879+ "%s0,0,15,(null),pin2=(null),aid=%s)",
880+ print_buf,
881+ sd->aid_str);
882+
883+ ret = g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
884 ril_file_info_cb, cbd, g_free);
885
886- g_ril_append_print_buf(sd->ril,
887- "%s0,0,15,(null),pin2=(null),aid=%s)",
888- print_buf,
889- sd->aid_str);
890- g_ril_print_request(sd->ril, ret, request);
891-
892- parcel_free(&rilp);
893-
894 error:
895 if (ret == 0) {
896 g_free(cbd);
897@@ -276,8 +269,7 @@
898 struct cb_data *cbd = cb_data_new(cb, data, sd);
899 struct parcel rilp;
900 struct req_sim_read_binary req;
901- int request = RIL_REQUEST_SIM_IO;
902- guint ret = 0;
903+ gint ret = 0;
904
905 DBG("file %04x", fileid);
906
907@@ -296,12 +288,6 @@
908 goto error;
909 }
910
911- ret = g_ril_send(sd->ril,
912- request,
913- rilp.data,
914- rilp.size,
915- ril_file_io_cb, cbd, g_free);
916-
917 g_ril_append_print_buf(sd->ril,
918 "%s%d,%d,%d,(null),pin2=(null),aid=%s)",
919 print_buf,
920@@ -309,10 +295,9 @@
921 (start & 0xff),
922 length,
923 sd->aid_str);
924- g_ril_print_request(sd->ril, ret, request);
925-
926- parcel_free(&rilp);
927-
928+
929+ ret = g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
930+ ril_file_io_cb, cbd, g_free);
931 error:
932 if (ret == 0) {
933 g_free(cbd);
934@@ -329,7 +314,6 @@
935 struct cb_data *cbd = cb_data_new(cb, data, sd);
936 struct parcel rilp;
937 struct req_sim_read_record req;
938- int request = RIL_REQUEST_SIM_IO;
939 guint ret = 0;
940
941 DBG("file %04x", fileid);
942@@ -349,12 +333,6 @@
943 goto error;
944 }
945
946- ret = g_ril_send(sd->ril,
947- request,
948- rilp.data,
949- rilp.size,
950- ril_file_io_cb, cbd, g_free);
951-
952 g_ril_append_print_buf(sd->ril,
953 "%s%d,%d,%d,(null),pin2=(null),aid=%s)",
954 print_buf,
955@@ -362,9 +340,9 @@
956 4,
957 length,
958 sd->aid_str);
959- g_ril_print_request(sd->ril, ret, request);
960
961- parcel_free(&rilp);
962+ ret = g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
963+ ril_file_io_cb, cbd, g_free);
964
965 error:
966 if (ret == 0) {
967@@ -412,21 +390,11 @@
968 struct sim_data *sd = ofono_sim_get_data(sim);
969 struct cb_data *cbd = cb_data_new(cb, data, sd);
970 struct parcel rilp;
971- int request = RIL_REQUEST_GET_IMSI;
972- guint ret;
973-
974- g_ril_request_read_imsi(sd->ril,
975- sd->aid_str,
976- &rilp);
977-
978- ret = g_ril_send(sd->ril, request,
979- rilp.data, rilp.size, ril_imsi_cb, cbd, g_free);
980-
981- g_ril_print_request(sd->ril, ret, request);
982-
983- parcel_free(&rilp);
984-
985- if (ret == 0) {
986+
987+ g_ril_request_read_imsi(sd->ril, sd->aid_str, &rilp);
988+
989+ if (g_ril_send(sd->ril, RIL_REQUEST_GET_IMSI, &rilp,
990+ ril_imsi_cb, cbd, g_free) == 0) {
991 g_free(cbd);
992 CALLBACK_WITH_FAILURE(cb, NULL, data);
993 }
994@@ -554,18 +522,12 @@
995 }
996
997
998-static int send_get_sim_status(struct ofono_sim *sim)
999+static void send_get_sim_status(struct ofono_sim *sim)
1000 {
1001 struct sim_data *sd = ofono_sim_get_data(sim);
1002- int request = RIL_REQUEST_GET_SIM_STATUS;
1003- guint ret;
1004-
1005- ret = g_ril_send(sd->ril, request,
1006- NULL, 0, sim_status_cb, sim, NULL);
1007-
1008- g_ril_print_request_no_args(sd->ril, ret, request);
1009-
1010- return ret;
1011+
1012+ g_ril_send(sd->ril, RIL_REQUEST_GET_SIM_STATUS, NULL,
1013+ sim_status_cb, sim, NULL);
1014 }
1015
1016 static void ril_sim_status_changed(struct ril_msg *message, gpointer user_data)
1017@@ -637,8 +599,6 @@
1018 struct sim_data *sd = ofono_sim_get_data(sim);
1019 struct cb_data *cbd = cb_data_new(cb, data, sd);
1020 struct parcel rilp;
1021- int request = RIL_REQUEST_ENTER_SIM_PIN;
1022- int ret;
1023
1024 sd->passwd_type = OFONO_SIM_PASSWORD_SIM_PIN;
1025
1026@@ -647,15 +607,8 @@
1027 sd->aid_str,
1028 &rilp);
1029
1030- ret = g_ril_send(sd->ril, request,
1031- rilp.data, rilp.size, ril_pin_change_state_cb,
1032- cbd, g_free);
1033-
1034- g_ril_print_request(sd->ril, ret, request);
1035-
1036- parcel_free(&rilp);
1037-
1038- if (ret == 0) {
1039+ if (g_ril_send(sd->ril, RIL_REQUEST_ENTER_SIM_PIN, &rilp,
1040+ ril_pin_change_state_cb, cbd, g_free) == 0) {
1041 g_free(cbd);
1042 CALLBACK_WITH_FAILURE(cb, data);
1043 }
1044@@ -670,7 +623,6 @@
1045 struct cb_data *cbd = cb_data_new(cb, data, sd);
1046 struct parcel rilp;
1047 struct req_pin_change_state req;
1048- int request = RIL_REQUEST_SET_FACILITY_LOCK;
1049 int ret = 0;
1050
1051 sd->passwd_type = passwd_type;
1052@@ -687,13 +639,8 @@
1053 goto error;
1054 }
1055
1056- ret = g_ril_send(sd->ril, request,
1057- rilp.data, rilp.size, ril_pin_change_state_cb,
1058- cbd, g_free);
1059-
1060- g_ril_print_request(sd->ril, ret, request);
1061-
1062- parcel_free(&rilp);
1063+ ret = g_ril_send(sd->ril, RIL_REQUEST_SET_FACILITY_LOCK, &rilp,
1064+ ril_pin_change_state_cb, cbd, g_free);
1065
1066 error:
1067 if (ret == 0) {
1068@@ -709,8 +656,6 @@
1069 struct sim_data *sd = ofono_sim_get_data(sim);
1070 struct cb_data *cbd = cb_data_new(cb, data, sd);
1071 struct parcel rilp;
1072- int request = RIL_REQUEST_ENTER_SIM_PUK;
1073- int ret = 0;
1074
1075 sd->passwd_type = OFONO_SIM_PASSWORD_SIM_PUK;
1076
1077@@ -720,15 +665,8 @@
1078 sd->aid_str,
1079 &rilp);
1080
1081- ret = g_ril_send(sd->ril, request,
1082- rilp.data, rilp.size, ril_pin_change_state_cb,
1083- cbd, g_free);
1084-
1085- g_ril_print_request(sd->ril, ret, request);
1086-
1087- parcel_free(&rilp);
1088-
1089- if (ret == 0) {
1090+ if (g_ril_send(sd->ril, RIL_REQUEST_ENTER_SIM_PUK, &rilp,
1091+ ril_pin_change_state_cb, cbd, g_free) == 0) {
1092 g_free(cbd);
1093 CALLBACK_WITH_FAILURE(cb, data);
1094 }
1095@@ -743,7 +681,6 @@
1096 struct cb_data *cbd = cb_data_new(cb, data, sd);
1097 struct parcel rilp;
1098 int request = RIL_REQUEST_CHANGE_SIM_PIN;
1099- int ret = 0;
1100
1101 sd->passwd_type = passwd_type;
1102
1103@@ -756,14 +693,8 @@
1104 if (passwd_type == OFONO_SIM_PASSWORD_SIM_PIN2)
1105 request = RIL_REQUEST_CHANGE_SIM_PIN2;
1106
1107- ret = g_ril_send(sd->ril, request, rilp.data, rilp.size,
1108- ril_pin_change_state_cb, cbd, g_free);
1109-
1110- g_ril_print_request(sd->ril, ret, request);
1111-
1112- parcel_free(&rilp);
1113-
1114- if (ret == 0) {
1115+ if (g_ril_send(sd->ril, request, &rilp, ril_pin_change_state_cb,
1116+ cbd, g_free) == 0) {
1117 g_free(cbd);
1118 CALLBACK_WITH_FAILURE(cb, data);
1119 }
1120
1121=== modified file 'drivers/rilmodem/sms.c'
1122--- drivers/rilmodem/sms.c 2013-12-12 22:17:51 +0000
1123+++ drivers/rilmodem/sms.c 2014-01-08 20:51:43 +0000
1124@@ -73,21 +73,12 @@
1125 struct sms_data *sd = ofono_sms_get_data(sms);
1126 struct cb_data *cbd = cb_data_new(cb, user_data, sd);
1127 struct parcel rilp;
1128- gint ret;
1129- int request = RIL_REQUEST_SET_SMSC_ADDRESS;
1130
1131 g_ril_request_set_smsc_address(sd->ril, sca, &rilp);
1132
1133 /* Send request to RIL */
1134- ret = g_ril_send(sd->ril, request, rilp.data,
1135- rilp.size, ril_csca_set_cb, cbd, g_free);
1136-
1137- g_ril_print_request(sd->ril, ret, request);
1138-
1139- parcel_free(&rilp);
1140-
1141- /* In case of error free cbd and return the cb with failure */
1142- if (ret == 0) {
1143+ if (g_ril_send(sd->ril, RIL_REQUEST_SET_SMSC_ADDRESS, &rilp,
1144+ ril_csca_set_cb, cbd, g_free) == 0) {
1145 g_free(cbd);
1146 CALLBACK_WITH_FAILURE(cb, user_data);
1147 }
1148@@ -122,17 +113,11 @@
1149 {
1150 struct sms_data *sd = ofono_sms_get_data(sms);
1151 struct cb_data *cbd = cb_data_new(cb, user_data, sd);
1152- int request = RIL_REQUEST_GET_SMSC_ADDRESS;
1153- int ret;
1154
1155 DBG("Sending csca_query");
1156
1157- ret = g_ril_send(sd->ril, request, NULL, 0,
1158- ril_csca_query_cb, cbd, g_free);
1159-
1160- g_ril_print_request(sd->ril, ret, request);
1161-
1162- if (ret == 0) {
1163+ if (g_ril_send(sd->ril, RIL_REQUEST_GET_SMSC_ADDRESS, NULL,
1164+ ril_csca_query_cb, cbd, g_free) == 0) {
1165 g_free(cbd);
1166 CALLBACK_WITH_FAILURE(cb, NULL, user_data);
1167 }
1168@@ -163,8 +148,6 @@
1169 struct sms_data *sd = ofono_sms_get_data(sms);
1170 struct cb_data *cbd = cb_data_new(cb, user_data, sd);
1171 struct parcel rilp;
1172- int request = RIL_REQUEST_SEND_SMS;
1173- int ret;
1174 struct req_sms_cmgs req;
1175
1176 DBG("pdu_len: %d, tpdu_len: %d mms: %d", pdu_len, tpdu_len, mms);
1177@@ -177,17 +160,8 @@
1178
1179 g_ril_request_sms_cmgs(sd->ril, &req, &rilp);
1180
1181- ret = g_ril_send(sd->ril,
1182- request,
1183- rilp.data,
1184- rilp.size,
1185- ril_submit_sms_cb, cbd, g_free);
1186-
1187- g_ril_print_request(sd->ril, ret, request);
1188-
1189- parcel_free(&rilp);
1190-
1191- if (ret == 0) {
1192+ if (g_ril_send(sd->ril, RIL_REQUEST_SEND_SMS, &rilp,
1193+ ril_submit_sms_cb, cbd, g_free) == 0) {
1194 g_free(cbd);
1195 CALLBACK_WITH_FAILURE(cb, -1, user_data);
1196 }
1197@@ -204,22 +178,15 @@
1198 {
1199 struct sms_data *sd = ofono_sms_get_data(sms);
1200 struct parcel rilp;
1201- int ret;
1202- int request = RIL_REQUEST_SMS_ACKNOWLEDGE;
1203
1204 g_ril_request_sms_acknowledge(sd->ril, &rilp);
1205
1206 /* TODO: should ACK be sent for either of the error cases? */
1207
1208 /* ACK the incoming NEW_SMS */
1209- ret = g_ril_send(sd->ril, request,
1210- rilp.data,
1211- rilp.size,
1212- ril_ack_delivery_cb, NULL, NULL);
1213-
1214- g_ril_print_request(sd->ril, ret, request);
1215-
1216- parcel_free(&rilp);
1217+ g_ril_send(sd->ril, RIL_REQUEST_SMS_ACKNOWLEDGE, &rilp,
1218+ ril_ack_delivery_cb, NULL, NULL);
1219+
1220 }
1221
1222 static void ril_sms_notify(struct ril_msg *message, gpointer user_data)
1223
1224=== added file 'drivers/rilmodem/ussd.c'
1225--- drivers/rilmodem/ussd.c 1970-01-01 00:00:00 +0000
1226+++ drivers/rilmodem/ussd.c 2014-01-08 20:51:43 +0000
1227@@ -0,0 +1,227 @@
1228+/*
1229+ *
1230+ * oFono - Open Source Telephony
1231+ *
1232+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
1233+ * Copyright (C) 2013 Jolla Ltd
1234+ * Copyright (C) 2013 Canonical Ltd
1235+ *
1236+ * This program is free software; you can redistribute it and/or modify
1237+ * it under the terms of the GNU General Public License version 2 as
1238+ * published by the Free Software Foundation.
1239+ *
1240+ * This program is distributed in the hope that it will be useful,
1241+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1242+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1243+ * GNU General Public License for more details.
1244+ *
1245+ * You should have received a copy of the GNU General Public License
1246+ * along with this program; if not, write to the Free Software
1247+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1248+ *
1249+ */
1250+#ifdef HAVE_CONFIG_H
1251+#include <config.h>
1252+#endif
1253+
1254+#define _GNU_SOURCE
1255+#include <stdio.h>
1256+#include <stdlib.h>
1257+#include <string.h>
1258+#include <errno.h>
1259+
1260+#include <glib.h>
1261+
1262+#include <ofono/log.h>
1263+#include <ofono/modem.h>
1264+#include <ofono/ussd.h>
1265+#include <smsutil.h>
1266+#include <util.h>
1267+
1268+#include "gril.h"
1269+#include "grilutil.h"
1270+#include "grilrequest.h"
1271+#include "grilunsol.h"
1272+
1273+#include "rilmodem.h"
1274+
1275+#include "ril_constants.h"
1276+
1277+struct ussd_data {
1278+ GRil *ril;
1279+};
1280+
1281+static void ril_ussd_cb(struct ril_msg *message, gpointer user_data)
1282+{
1283+ struct cb_data *cbd = user_data;
1284+ struct ofono_ussd *ussd = cbd->user;
1285+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1286+ ofono_ussd_cb_t cb = cbd->cb;
1287+
1288+ if (message->error == RIL_E_SUCCESS) {
1289+ g_ril_print_response_no_args(ud->ril, message);
1290+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
1291+ } else {
1292+ CALLBACK_WITH_FAILURE(cb, cbd->data);
1293+ }
1294+}
1295+
1296+static void ril_ussd_request(struct ofono_ussd *ussd, int dcs,
1297+ const unsigned char *pdu, int len,
1298+ ofono_ussd_cb_t cb, void *data)
1299+{
1300+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1301+ struct cb_data *cbd = cb_data_new(cb, data, ussd);
1302+ enum sms_charset charset;
1303+ int ret = 0;
1304+
1305+ if (cbs_dcs_decode(dcs, NULL, NULL, &charset, NULL, NULL, NULL)) {
1306+ /* TODO: send other alphabets (maybe needed by STK) */
1307+ if (charset == SMS_CHARSET_7BIT) {
1308+ unsigned char *unpacked_buf;
1309+ long written;
1310+
1311+ unpacked_buf = unpack_7bit(pdu, len, 0, TRUE, 0,
1312+ &written, 1);
1313+
1314+ if (written >= 1) {
1315+ struct parcel rilp;
1316+
1317+ *(unpacked_buf + written) = '\0';
1318+ g_ril_request_send_ussd(ud->ril,
1319+ (char *) unpacked_buf,
1320+ &rilp);
1321+
1322+ ret = g_ril_send(ud->ril, RIL_REQUEST_SEND_USSD,
1323+ &rilp, ril_ussd_cb, cbd,
1324+ g_free);
1325+ }
1326+
1327+ g_free(unpacked_buf);
1328+ } else {
1329+ ofono_error("%s: No support for charset %d",
1330+ __func__, charset);
1331+ }
1332+ }
1333+
1334+ if (ret <= 0) {
1335+ g_free(cbd);
1336+ CALLBACK_WITH_FAILURE(cb, data);
1337+ }
1338+}
1339+static void ril_ussd_cancel_cb(struct ril_msg *message, gpointer user_data)
1340+{
1341+ struct cb_data *cbd = user_data;
1342+ struct ofono_ussd *ussd = cbd->user;
1343+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1344+ ofono_ussd_cb_t cb = cbd->cb;
1345+
1346+ if (message->error == RIL_E_SUCCESS) {
1347+ g_ril_print_response_no_args(ud->ril, message);
1348+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
1349+ } else {
1350+ CALLBACK_WITH_FAILURE(cb, cbd->data);
1351+ }
1352+}
1353+
1354+static void ril_ussd_cancel(struct ofono_ussd *ussd,
1355+ ofono_ussd_cb_t cb, void *user_data)
1356+{
1357+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1358+ struct cb_data *cbd = cb_data_new(cb, user_data, ussd);
1359+ int ret;
1360+
1361+ ret = g_ril_send(ud->ril, RIL_REQUEST_CANCEL_USSD, NULL,
1362+ ril_ussd_cancel_cb, cbd, g_free);
1363+
1364+ if (ret <= 0) {
1365+ g_free(cbd);
1366+ CALLBACK_WITH_FAILURE(cb, user_data);
1367+ }
1368+}
1369+
1370+static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
1371+{
1372+ struct ofono_ussd *ussd = user_data;
1373+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1374+ struct unsol_ussd *unsol;
1375+
1376+ unsol = g_ril_unsol_parse_ussd(ud->ril, message);
1377+ if (unsol == NULL) {
1378+ ofono_error("%s: Parsing error", __func__);
1379+ return;
1380+ }
1381+
1382+ /*
1383+ * TODO
1384+ *
1385+ * With data coding scheme 0x44, we are saying that the ussd string is
1386+ * 8-bit data, uncompressed, and with unspecified message class. This
1387+ * must be changed in the future so we get the UTF16 from the RIL parcel
1388+ * and decode it properly. For the DCS coding, see 3gpp 23.038, sect. 5.
1389+ */
1390+ if (unsol->message != NULL)
1391+ ofono_ussd_notify(ussd, unsol->type, 0x44,
1392+ (const unsigned char *) unsol->message,
1393+ strlen(unsol->message));
1394+ else
1395+ ofono_ussd_notify(ussd, unsol->type, 0, NULL, 0);
1396+
1397+ g_ril_unsol_free_ussd(unsol);
1398+}
1399+
1400+static gboolean ril_delayed_register(gpointer user_data)
1401+{
1402+ struct ofono_ussd *ussd = user_data;
1403+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1404+
1405+ DBG("");
1406+
1407+ ofono_ussd_register(ussd);
1408+
1409+ /* Register for USSD responses */
1410+ g_ril_register(ud->ril, RIL_UNSOL_ON_USSD, ril_ussd_notify, ussd);
1411+
1412+ return FALSE;
1413+}
1414+
1415+static int ril_ussd_probe(struct ofono_ussd *ussd,
1416+ unsigned int vendor,
1417+ void *user)
1418+{
1419+ GRil *ril = user;
1420+ struct ussd_data *ud = g_new0(struct ussd_data, 1);
1421+
1422+ ud->ril = g_ril_clone(ril);
1423+ ofono_ussd_set_data(ussd, ud);
1424+ g_idle_add(ril_delayed_register, ussd);
1425+
1426+ return 0;
1427+}
1428+
1429+static void ril_ussd_remove(struct ofono_ussd *ussd)
1430+{
1431+ struct ussd_data *ud = ofono_ussd_get_data(ussd);
1432+ ofono_ussd_set_data(ussd, NULL);
1433+
1434+ g_ril_unref(ud->ril);
1435+ g_free(ud);
1436+}
1437+
1438+static struct ofono_ussd_driver driver = {
1439+ .name = RILMODEM,
1440+ .probe = ril_ussd_probe,
1441+ .remove = ril_ussd_remove,
1442+ .request = ril_ussd_request,
1443+ .cancel = ril_ussd_cancel
1444+};
1445+
1446+void ril_ussd_init(void)
1447+{
1448+ ofono_ussd_driver_register(&driver);
1449+}
1450+
1451+void ril_ussd_exit(void)
1452+{
1453+ ofono_ussd_driver_unregister(&driver);
1454+}
1455
1456=== modified file 'drivers/rilmodem/voicecall.c'
1457--- drivers/rilmodem/voicecall.c 2013-11-25 13:54:04 +0000
1458+++ drivers/rilmodem/voicecall.c 2014-01-08 20:51:43 +0000
1459@@ -90,6 +90,13 @@
1460 int id;
1461 };
1462
1463+/* Data for dial after swap */
1464+struct hold_before_dial_req {
1465+ struct ofono_voicecall *vc;
1466+ struct ofono_phone_number dial_ph;
1467+ enum ofono_clir_option dial_clir;
1468+};
1469+
1470 static void send_one_dtmf(struct voicecall_data *vd);
1471 static void clear_dtmf_queue(struct voicecall_data *vd);
1472
1473@@ -111,6 +118,7 @@
1474 {
1475 struct ofono_voicecall *vc = user_data;
1476 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1477+ int reqid = RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
1478 GSList *calls;
1479 GSList *n, *o;
1480 struct ofono_call *nc, *oc;
1481@@ -140,14 +148,13 @@
1482 /* Get disconnect cause before calling core */
1483 struct lastcause_req *reqdata =
1484 g_try_new0(struct lastcause_req, 1);
1485- if (reqdata) {
1486- int req;
1487- req = RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
1488+ if (reqdata != NULL) {
1489 reqdata->vc = user_data;
1490 reqdata->id = oc->id;
1491- g_ril_send(vd->ril, req,
1492- NULL, 0, lastcause_cb,
1493- reqdata, g_free);
1494+
1495+ g_ril_send(vd->ril, reqid, NULL,
1496+ lastcause_cb, reqdata,
1497+ g_free);
1498 }
1499 }
1500
1501@@ -221,13 +228,9 @@
1502 {
1503 struct ofono_voicecall *vc = user_data;
1504 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1505- int request = RIL_REQUEST_GET_CURRENT_CALLS;
1506- int ret;
1507-
1508- ret = g_ril_send(vd->ril, request, NULL,
1509- 0, clcc_poll_cb, vc, NULL);
1510-
1511- g_ril_print_request_no_args(vd->ril, ret, request);
1512+
1513+ g_ril_send(vd->ril, RIL_REQUEST_GET_CURRENT_CALLS, NULL,
1514+ clcc_poll_cb, vc, NULL);
1515
1516 vd->clcc_source = 0;
1517
1518@@ -239,8 +242,6 @@
1519 struct change_state_req *req = user_data;
1520 struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
1521 struct ofono_error error;
1522- int request = RIL_REQUEST_GET_CURRENT_CALLS;
1523- int ret;
1524
1525 if (message->error == RIL_E_SUCCESS) {
1526 decode_ril_error(&error, "OK");
1527@@ -264,10 +265,8 @@
1528 }
1529
1530 out:
1531- ret = g_ril_send(vd->ril, request, NULL,
1532- 0, clcc_poll_cb, req->vc, NULL);
1533-
1534- g_ril_print_request_no_args(vd->ril, ret, request);
1535+ g_ril_send(vd->ril, RIL_REQUEST_GET_CURRENT_CALLS, NULL,
1536+ clcc_poll_cb, req->vc, NULL);
1537
1538 /* We have to callback after we schedule a poll if required */
1539 if (req->cb)
1540@@ -276,8 +275,7 @@
1541
1542 static int ril_template(const guint rreq, struct ofono_voicecall *vc,
1543 GRilResponseFunc func, unsigned int affected_types,
1544- gpointer pdata, const gsize psize,
1545- ofono_voicecall_cb_t cb, void *data)
1546+ gpointer pdata, ofono_voicecall_cb_t cb, void *data)
1547 {
1548 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1549 struct change_state_req *req = g_try_new0(struct change_state_req, 1);
1550@@ -291,7 +289,7 @@
1551 req->data = data;
1552 req->affected_types = affected_types;
1553
1554- ret = g_ril_send(vd->ril, rreq, pdata, psize, func, req, g_free);
1555+ ret = g_ril_send(vd->ril, rreq, pdata, func, req, g_free);
1556 if (ret > 0)
1557 return ret;
1558 error:
1559@@ -310,8 +308,6 @@
1560 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1561 ofono_voicecall_cb_t cb = cbd->cb;
1562 struct ofono_error error;
1563- struct ofono_call *call;
1564- GSList *l;
1565
1566 if (message->error == RIL_E_SUCCESS) {
1567 decode_ril_error(&error, "OK");
1568@@ -322,17 +318,6 @@
1569
1570 g_ril_print_response_no_args(vd->ril, message);
1571
1572- /* On a success, make sure to put all active calls on hold */
1573- for (l = vd->calls; l; l = l->next) {
1574- call = l->data;
1575-
1576- if (call->status != CALL_STATUS_ACTIVE)
1577- continue;
1578-
1579- call->status = CALL_STATUS_HELD;
1580- ofono_voicecall_notify(vc, call);
1581- }
1582-
1583 /* CLCC will update the oFono call list with proper ids */
1584 if (!vd->clcc_source)
1585 vd->clcc_source = g_timeout_add(POLL_CLCC_INTERVAL,
1586@@ -348,7 +333,7 @@
1587 cb(&error, cbd->data);
1588 }
1589
1590-static void ril_dial(struct ofono_voicecall *vc,
1591+static void dial(struct ofono_voicecall *vc,
1592 const struct ofono_phone_number *ph,
1593 enum ofono_clir_option clir, ofono_voicecall_cb_t cb,
1594 void *data)
1595@@ -356,26 +341,87 @@
1596 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1597 struct cb_data *cbd = cb_data_new(cb, data, vc);
1598 struct parcel rilp;
1599- int request = RIL_REQUEST_DIAL;
1600- int ret;
1601
1602 g_ril_request_dial(vd->ril, ph, clir, &rilp);
1603
1604 /* Send request to RIL */
1605- ret = g_ril_send(vd->ril, request, rilp.data,
1606- rilp.size, rild_cb, cbd, g_free);
1607-
1608- g_ril_print_request(vd->ril, ret, request);
1609-
1610- parcel_free(&rilp);
1611-
1612- /* In case of error free cbd and return the cb with failure */
1613- if (ret <= 0) {
1614+ if (g_ril_send(vd->ril, RIL_REQUEST_DIAL, &rilp,
1615+ rild_cb, cbd, g_free) == 0) {
1616 g_free(cbd);
1617 CALLBACK_WITH_FAILURE(cb, data);
1618 }
1619 }
1620
1621+static void hold_before_dial_cb(struct ril_msg *message, gpointer user_data)
1622+{
1623+ struct cb_data *cbd = user_data;
1624+ struct hold_before_dial_req *req = cbd->user;
1625+ struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
1626+ ofono_voicecall_cb_t cb = cbd->cb;
1627+
1628+ if (message->error != RIL_E_SUCCESS) {
1629+ g_free(req);
1630+ CALLBACK_WITH_FAILURE(cb, cbd->data);
1631+ return;
1632+ }
1633+
1634+ g_ril_print_response_no_args(vd->ril, message);
1635+
1636+ /* Current calls held: we can dial now */
1637+ dial(req->vc, &req->dial_ph, req->dial_clir, cb, cbd->data);
1638+
1639+ g_free(req);
1640+}
1641+
1642+static void ril_dial(struct ofono_voicecall *vc,
1643+ const struct ofono_phone_number *ph,
1644+ enum ofono_clir_option clir, ofono_voicecall_cb_t cb,
1645+ void *data)
1646+{
1647+ struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1648+ int current_active = 0;
1649+ struct ofono_call *call;
1650+ GSList *l;
1651+
1652+ /* Check for current active calls */
1653+ for (l = vd->calls; l; l = l->next) {
1654+ call = l->data;
1655+
1656+ if (call->status == CALL_STATUS_ACTIVE) {
1657+ current_active = 1;
1658+ break;
1659+ }
1660+ }
1661+
1662+ /*
1663+ * The network will put current active calls on hold. In some cases
1664+ * (mako), the modem also updates properly the state. In others
1665+ * (maguro), we need to explicitly set the state to held. In both cases
1666+ * we send a request for holding the active call, as it is not harmful
1667+ * when it is not really needed, and is what Android does.
1668+ */
1669+ if (current_active) {
1670+ struct hold_before_dial_req *req;
1671+ struct cb_data *cbd;
1672+
1673+ req = g_malloc0(sizeof(*req));
1674+ req->vc = vc;
1675+ req->dial_ph = *ph;
1676+ req->dial_clir = clir;
1677+
1678+ cbd = cb_data_new(cb, data, req);
1679+
1680+ if (g_ril_send(vd->ril, RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE,
1681+ NULL, hold_before_dial_cb, cbd, g_free) == 0) {
1682+ g_free(cbd);
1683+ CALLBACK_WITH_FAILURE(cb, data);
1684+ }
1685+
1686+ } else {
1687+ dial(vc, ph, clir, cb, data);
1688+ }
1689+}
1690+
1691 static void ril_hangup_all(struct ofono_voicecall *vc,
1692 ofono_voicecall_cb_t cb, void *data)
1693 {
1694@@ -384,8 +430,6 @@
1695 struct ofono_error error;
1696 struct ofono_call *call;
1697 GSList *l;
1698- int request = RIL_REQUEST_HANGUP;
1699- int ret;
1700
1701 for (l = vd->calls; l; l = l->next) {
1702 call = l->data;
1703@@ -394,12 +438,8 @@
1704 g_ril_request_hangup(vd->ril, call->id, &rilp);
1705
1706 /* Send request to RIL */
1707- ret = ril_template(request, vc, generic_cb, AFFECTED_STATES_ALL,
1708- rilp.data, rilp.size, NULL, NULL);
1709-
1710- g_ril_print_request(vd->ril, ret, request);
1711-
1712- parcel_free(&rilp);
1713+ ril_template(RIL_REQUEST_HANGUP, vc, generic_cb,
1714+ AFFECTED_STATES_ALL, &rilp, NULL, NULL);
1715 }
1716
1717 /* TODO: Deal in case of an error at hungup */
1718@@ -412,20 +452,14 @@
1719 {
1720 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1721 struct parcel rilp;
1722- int request = RIL_REQUEST_HANGUP;
1723- int ret;
1724
1725 DBG("Hanging up call with id %d", id);
1726
1727 g_ril_request_hangup(vd->ril, id, &rilp);
1728
1729 /* Send request to RIL */
1730- ret = ril_template(request, vc, generic_cb, AFFECTED_STATES_ALL,
1731- rilp.data, rilp.size, cb, data);
1732-
1733- g_ril_print_request(vd->ril, ret, request);
1734-
1735- parcel_free(&rilp);
1736+ ril_template(RIL_REQUEST_HANGUP, vc, generic_cb,
1737+ AFFECTED_STATES_ALL, &rilp, cb, data);
1738 }
1739
1740 static void ril_call_state_notify(struct ril_msg *message, gpointer user_data)
1741@@ -473,17 +507,10 @@
1742 static void ril_answer(struct ofono_voicecall *vc,
1743 ofono_voicecall_cb_t cb, void *data)
1744 {
1745- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1746- int request = RIL_REQUEST_ANSWER;
1747- int ret;
1748-
1749 DBG("Answering current call");
1750
1751 /* Send request to RIL */
1752- ret = ril_template(request, vc, generic_cb, 0,
1753- NULL, 0, cb, data);
1754-
1755- g_ril_print_request_no_args(vd->ril, ret, request);
1756+ ril_template(RIL_REQUEST_ANSWER, vc, generic_cb, 0, NULL, cb, data);
1757 }
1758
1759 static void ril_send_dtmf_cb(struct ril_msg *message, gpointer user_data)
1760@@ -512,8 +539,6 @@
1761 static void send_one_dtmf(struct voicecall_data *vd)
1762 {
1763 struct parcel rilp;
1764- int request = RIL_REQUEST_DTMF;
1765- int ret;
1766
1767 if (vd->tone_pending == TRUE)
1768 return; /* RIL request pending */
1769@@ -523,11 +548,8 @@
1770
1771 g_ril_request_dtmf(vd->ril, vd->tone_queue[0], &rilp);
1772
1773- ret = g_ril_send(vd->ril, request, rilp.data,
1774- rilp.size, ril_send_dtmf_cb, vd, NULL);
1775-
1776- g_ril_print_request(vd->ril, ret, request);
1777- parcel_free(&rilp);
1778+ g_ril_send(vd->ril, RIL_REQUEST_DTMF, &rilp,
1779+ ril_send_dtmf_cb, vd, NULL);
1780
1781 vd->tone_pending = TRUE;
1782 }
1783@@ -563,13 +585,7 @@
1784 static void ril_create_multiparty(struct ofono_voicecall *vc,
1785 ofono_voicecall_cb_t cb, void *data)
1786 {
1787- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1788- int request = RIL_REQUEST_CONFERENCE;
1789- int ret;
1790-
1791- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1792-
1793- g_ril_print_request_no_args(vd->ril, ret, request);
1794+ ril_template(RIL_REQUEST_CONFERENCE, vc, generic_cb, 0, NULL, cb, data);
1795 }
1796
1797 static void ril_private_chat(struct ofono_voicecall *vc, int id,
1798@@ -577,96 +593,59 @@
1799 {
1800 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1801 struct parcel rilp;
1802- int request = RIL_REQUEST_SEPARATE_CONNECTION;
1803- int ret;
1804
1805 g_ril_request_separate_conn(vd->ril, id, &rilp);
1806
1807 /* Send request to RIL */
1808- ret = ril_template(request, vc, generic_cb, 0, rilp.data, rilp.size,
1809- cb, data);
1810-
1811- g_ril_print_request(vd->ril, ret, request);
1812-
1813- parcel_free(&rilp);
1814+ ril_template(RIL_REQUEST_SEPARATE_CONNECTION, vc,
1815+ generic_cb, 0, &rilp, cb, data);
1816 }
1817
1818 static void ril_swap_without_accept(struct ofono_voicecall *vc,
1819 ofono_voicecall_cb_t cb, void *data)
1820 {
1821- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1822- int request = RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE;
1823- int ret;
1824-
1825- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1826-
1827- g_ril_print_request_no_args(vd->ril, ret, request);
1828+ ril_template(RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE, vc,
1829+ generic_cb, 0, NULL, cb, data);
1830 }
1831
1832 static void ril_hold_all_active(struct ofono_voicecall *vc,
1833 ofono_voicecall_cb_t cb, void *data)
1834 {
1835- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1836- int request = RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE;
1837- int ret;
1838-
1839- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1840-
1841- g_ril_print_request_no_args(vd->ril, ret, request);
1842+ ril_template(RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE, vc,
1843+ generic_cb, 0, NULL, cb, data);
1844 }
1845
1846 static void ril_release_all_held(struct ofono_voicecall *vc,
1847 ofono_voicecall_cb_t cb, void *data)
1848 {
1849- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1850- int request = RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND;
1851- int ret;
1852-
1853- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1854-
1855- g_ril_print_request_no_args(vd->ril, ret, request);
1856+ ril_template(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, vc,
1857+ generic_cb, 0, NULL, cb, data);
1858 }
1859
1860 static void ril_release_all_active(struct ofono_voicecall *vc,
1861 ofono_voicecall_cb_t cb, void *data)
1862 {
1863- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1864- int request = RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND;
1865- int ret;
1866-
1867- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1868-
1869- g_ril_print_request_no_args(vd->ril, ret, request);
1870+ ril_template(RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, vc,
1871+ generic_cb, 0, NULL, cb, data);
1872 }
1873
1874 static void ril_set_udub(struct ofono_voicecall *vc,
1875 ofono_voicecall_cb_t cb, void *data)
1876 {
1877- struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1878- int request = RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND;
1879- int ret;
1880-
1881- ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data);
1882-
1883- g_ril_print_request_no_args(vd->ril, ret, request);
1884+ ril_template(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, vc,
1885+ generic_cb, 0, NULL, cb, data);
1886 }
1887
1888 static gboolean enable_supp_svc(gpointer user_data)
1889 {
1890 struct ofono_voicecall *vc = user_data;
1891 struct voicecall_data *vd = ofono_voicecall_get_data(vc);
1892- int request = RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION;
1893- int ret;
1894 struct parcel rilp;
1895
1896 g_ril_request_set_supp_svc_notif(vd->ril, &rilp);
1897
1898- ret = g_ril_send(vd->ril, request, rilp.data,
1899- rilp.size, NULL, vc, NULL);
1900-
1901- g_ril_print_request(vd->ril, ret, request);
1902-
1903- parcel_free(&rilp);
1904+ g_ril_send(vd->ril, RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, &rilp,
1905+ NULL, vc, NULL);
1906
1907 /* Makes this a single shot */
1908 return FALSE;
1909
1910=== modified file 'gril/gril.c'
1911--- gril/gril.c 2013-11-28 10:56:16 +0000
1912+++ gril/gril.c 2014-01-08 20:51:43 +0000
1913@@ -211,7 +211,6 @@
1914 return TRUE;
1915 }
1916
1917-
1918 /*
1919 * This function creates a RIL request. For a good reference on
1920 * the layout of RIL requests, responses, and unsolicited requests
1921@@ -224,8 +223,7 @@
1922 guint gid,
1923 const gint req,
1924 const gint id,
1925- const char *data,
1926- const gsize data_len,
1927+ struct parcel *rilp,
1928 GRilResponseFunc func,
1929 gpointer user_data,
1930 GDestroyNotify notify,
1931@@ -233,6 +231,10 @@
1932 {
1933 struct ril_request *r;
1934 struct req_hdr header;
1935+ guint data_len = 0;
1936+
1937+ if (rilp != NULL)
1938+ data_len = rilp->size;
1939
1940 r = g_try_new0(struct ril_request, 1);
1941 if (r == NULL) {
1942@@ -240,7 +242,7 @@
1943 return NULL;
1944 }
1945
1946- DBG("req: %s, id: %d, data_len: %zu",
1947+ DBG("req: %s, id: %d, data_len: %u",
1948 ril_request_id_to_string(req), id, data_len);
1949
1950 /* Full request size: header size plus buffer length */
1951@@ -261,7 +263,8 @@
1952 /* copy header */
1953 memcpy(r->data, &header, sizeof(header));
1954 /* copy request data */
1955- memcpy(r->data + sizeof(header), data, data_len);
1956+ if (data_len)
1957+ memcpy(r->data + sizeof(header), rilp->data, data_len);
1958
1959 r->req = req;
1960 r->gid = gid;
1961@@ -309,6 +312,8 @@
1962 {
1963 struct ril_s *ril = user_data;
1964
1965+ ofono_error("%s: disconnected from rild", __func__);
1966+
1967 ril_cleanup(ril);
1968 g_ril_io_unref(ril->io);
1969 ril->io = NULL;
1970@@ -348,7 +353,7 @@
1971 req->callback(message, req->user_data);
1972
1973 len = g_queue_get_length(p->out_queue);
1974- DBG("requests in sent queue before removing:%d", len);
1975+ DBG("requests in out_queue before removing: %d", len);
1976 for (i = 0; i < len; i++) {
1977 id = GPOINTER_TO_INT(g_queue_peek_nth(
1978 p->out_queue, i));
1979@@ -526,8 +531,11 @@
1980 */
1981
1982 message_len = *len - 4;
1983- if (message_len < plen)
1984+ if (message_len < plen) {
1985+ DBG("Not enough bytes for fixed record; len: %d avail: %d",
1986+ plen, message_len);
1987 return NULL;
1988+ }
1989
1990 /* FIXME: add check for message_len = 0? */
1991
1992@@ -557,8 +565,6 @@
1993
1994 p->in_read_handler = TRUE;
1995
1996- DBG("len: %d, wrap: %d", len, wrap);
1997-
1998 while (p->suspended == FALSE && (p->read_so_far < len)) {
1999 gsize rbytes = MIN(len - p->read_so_far, wrap - p->read_so_far);
2000
2001@@ -576,10 +582,8 @@
2002 message = read_fixed_record(p, buf, &rbytes);
2003
2004 /* wait for the rest of the record... */
2005- if (message == NULL) {
2006- DBG("Not enough bytes for fixed record");
2007+ if (message == NULL)
2008 break;
2009- }
2010
2011 buf += rbytes;
2012 p->read_so_far += rbytes;
2013@@ -870,31 +874,36 @@
2014 int n = 0;
2015 guint len, i;
2016 struct ril_request *req;
2017+ gboolean sent;
2018
2019 if (ril->command_queue == NULL)
2020 return;
2021
2022 while ((req = g_queue_peek_nth(ril->command_queue, n)) != NULL) {
2023- if (req->gid != group) {
2024+ if (req->id == 0 || req->gid != group) {
2025 n += 1;
2026 continue;
2027 }
2028
2029 req->callback = NULL;
2030+ sent = FALSE;
2031
2032 len = g_queue_get_length(ril->out_queue);
2033 for (i = 0; i < len; i++) {
2034 if (GPOINTER_TO_INT(
2035 g_queue_peek_nth(ril->out_queue, i))
2036 == req->id) {
2037- g_queue_pop_nth(ril->out_queue, i);
2038+ n += 1;
2039+ sent = TRUE;
2040 break;
2041 }
2042 }
2043
2044+ if (sent)
2045+ continue;
2046+
2047 g_queue_remove(ril->command_queue, req);
2048 ril_request_destroy(req);
2049- n += 1;
2050 }
2051 }
2052
2053@@ -999,6 +1008,7 @@
2054 rilp->size = message->buf_len;
2055 rilp->capacity = message->buf_len;
2056 rilp->offset = 0;
2057+ rilp->malformed = 0;
2058 }
2059
2060 GRil *g_ril_new()
2061@@ -1067,9 +1077,9 @@
2062 return ril;
2063 }
2064
2065-gint g_ril_send(GRil *ril, const gint reqid, const char *data,
2066- const gsize data_len, GRilResponseFunc func,
2067- gpointer user_data, GDestroyNotify notify)
2068+gint g_ril_send(GRil *ril, const gint reqid, struct parcel *rilp,
2069+ GRilResponseFunc func, gpointer user_data,
2070+ GDestroyNotify notify)
2071 {
2072 struct ril_request *r;
2073 struct ril_s *p;
2074@@ -1081,9 +1091,12 @@
2075
2076 p = ril->parent;
2077
2078- r = ril_request_create(p, ril->group, reqid, p->next_cmd_id,
2079- data, data_len, func,
2080- user_data, notify, FALSE);
2081+ r = ril_request_create(p, ril->group, reqid, p->next_cmd_id, rilp,
2082+ func, user_data, notify, FALSE);
2083+
2084+ if (rilp != NULL)
2085+ parcel_free(rilp);
2086+
2087 if (r == NULL)
2088 return 0;
2089
2090@@ -1091,9 +1104,15 @@
2091
2092 g_queue_push_tail(p->command_queue, r);
2093
2094- DBG("calling wakeup_writer: qlen: %d", g_queue_get_length(p->command_queue));
2095+ DBG("calling wakeup_writer: command_queue len: %d",
2096+ g_queue_get_length(p->command_queue));
2097 ril_wakeup_writer(p);
2098
2099+ if (rilp == NULL)
2100+ g_ril_print_request_no_args(ril, r->id, reqid);
2101+ else
2102+ g_ril_print_request(ril, r->id, reqid);
2103+
2104 return r->id;
2105 }
2106
2107
2108=== modified file 'gril/gril.h'
2109--- gril/gril.h 2013-11-20 02:46:47 +0000
2110+++ gril/gril.h 2014-01-08 20:51:43 +0000
2111@@ -125,9 +125,9 @@
2112 * g_ril_cancel. If an error occurred, an id of 0 is returned.
2113 *
2114 */
2115-gint g_ril_send(GRil *ril, const gint reqid, const char *data,
2116- const gsize data_len, GRilResponseFunc func,
2117- gpointer user_data, GDestroyNotify notify);
2118+gint g_ril_send(GRil *ril, const gint reqid, struct parcel *rilp,
2119+ GRilResponseFunc func, gpointer user_data,
2120+ GDestroyNotify notify);
2121
2122 guint g_ril_register(GRil *ril, const int req,
2123 GRilNotifyFunc func, gpointer user_data);
2124
2125=== modified file 'gril/grilreply.c'
2126--- gril/grilreply.c 2013-12-03 08:21:33 +0000
2127+++ gril/grilreply.c 2014-01-08 20:51:43 +0000
2128@@ -1108,3 +1108,103 @@
2129
2130 return imei;
2131 }
2132+
2133+int g_ril_reply_parse_query_call_waiting(GRil *gril,
2134+ const struct ril_msg *message)
2135+{
2136+ struct parcel rilp;
2137+ int numint, enabled, cls;
2138+
2139+ g_ril_init_parcel(message, &rilp);
2140+
2141+ numint = parcel_r_int32(&rilp);
2142+ if (numint < 1) {
2143+ ofono_error("%s Wrong format", __func__);
2144+ goto error;
2145+ }
2146+
2147+ enabled = parcel_r_int32(&rilp);
2148+
2149+ if (enabled > 0)
2150+ cls = parcel_r_int32(&rilp);
2151+ else
2152+ cls = 0;
2153+
2154+ g_ril_append_print_buf(gril, "{%d,0x%x}", enabled, cls);
2155+ g_ril_print_response(gril, message);
2156+
2157+ return cls;
2158+
2159+error:
2160+ return -1;
2161+}
2162+
2163+int g_ril_reply_parse_query_clip(GRil *gril,
2164+ const struct ril_msg *message)
2165+{
2166+ struct parcel rilp;
2167+ int clip_status, numint;
2168+
2169+ g_ril_init_parcel(message, &rilp);
2170+
2171+ numint = parcel_r_int32(&rilp);
2172+ if (numint != 1) {
2173+ ofono_error("%s Wrong format", __func__);
2174+ goto error;
2175+ }
2176+
2177+ clip_status = parcel_r_int32(&rilp);
2178+
2179+ g_ril_append_print_buf(gril, "{%d}", clip_status);
2180+ g_ril_print_response(gril, message);
2181+
2182+ return clip_status;
2183+
2184+error:
2185+ return -1;
2186+}
2187+
2188+void g_ril_reply_free_get_clir(struct reply_clir *rclir)
2189+{
2190+ g_free(rclir);
2191+}
2192+
2193+struct reply_clir *g_ril_reply_parse_get_clir(GRil *gril,
2194+ const struct ril_msg *message)
2195+{
2196+ struct parcel rilp;
2197+ struct reply_clir *rclir;
2198+ int numint;
2199+
2200+ rclir = g_try_malloc0(sizeof(*rclir));
2201+ if (rclir == NULL) {
2202+ ofono_error("%s Out of memory", __func__);
2203+ goto error;
2204+ }
2205+
2206+ g_ril_init_parcel(message, &rilp);
2207+
2208+ /* Length */
2209+ numint = parcel_r_int32(&rilp);
2210+ if (numint != 2) {
2211+ ofono_error("%s Wrong format", __func__);
2212+ goto error;
2213+ }
2214+
2215+ /* Set HideCallerId property from network */
2216+ rclir->status = parcel_r_int32(&rilp);
2217+
2218+ /* State of the CLIR supplementary service in the network */
2219+ rclir->provisioned = parcel_r_int32(&rilp);
2220+
2221+ g_ril_append_print_buf(gril, "{%d,%d}",
2222+ rclir->status, rclir->provisioned);
2223+ g_ril_print_response(gril, message);
2224+
2225+ return rclir;
2226+
2227+error:
2228+ g_free(rclir);
2229+
2230+ return NULL;
2231+}
2232
2233=== modified file 'gril/grilreply.h'
2234--- gril/grilreply.h 2013-12-03 08:21:33 +0000
2235+++ gril/grilreply.h 2014-01-08 20:51:43 +0000
2236@@ -95,6 +95,11 @@
2237 struct reply_sim_app *apps[MAX_UICC_APPS];
2238 };
2239
2240+struct reply_clir {
2241+ int status;
2242+ int provisioned;
2243+};
2244+
2245 void g_ril_reply_free_avail_ops(struct reply_avail_ops *reply);
2246
2247 struct reply_avail_ops *g_ril_reply_parse_avail_ops(GRil *gril,
2248@@ -144,6 +149,17 @@
2249 char *g_ril_reply_parse_get_imei(GRil *gril,
2250 const struct ril_msg *message);
2251
2252+int g_ril_reply_parse_query_call_waiting(GRil *gril,
2253+ const struct ril_msg *message);
2254+
2255+int g_ril_reply_parse_query_clip(GRil *gril,
2256+ const struct ril_msg *message);
2257+
2258+void g_ril_reply_free_get_clir(struct reply_clir *rclir);
2259+
2260+struct reply_clir *g_ril_reply_parse_get_clir(GRil *gril,
2261+ const struct ril_msg *message);
2262+
2263 #ifdef __cplusplus
2264 }
2265 #endif
2266
2267=== modified file 'gril/grilrequest.c'
2268--- gril/grilrequest.c 2013-11-28 13:31:35 +0000
2269+++ gril/grilrequest.c 2014-01-08 20:51:43 +0000
2270@@ -717,3 +717,66 @@
2271
2272 g_ril_append_print_buf(gril, "(%d)", muted);
2273 }
2274+
2275+void g_ril_request_send_ussd(GRil *gril,
2276+ const char *ussd,
2277+ struct parcel *rilp)
2278+{
2279+ parcel_init(rilp);
2280+ parcel_w_string(rilp, ussd);
2281+
2282+ g_ril_append_print_buf(gril, "(%s)", ussd);
2283+}
2284+
2285+void g_ril_request_set_call_waiting(GRil *gril,
2286+ int enabled, int serviceclass,
2287+ struct parcel *rilp)
2288+{
2289+ parcel_init(rilp);
2290+
2291+ parcel_w_int32(rilp, 2); /* Number of params */
2292+ parcel_w_int32(rilp, enabled); /* on/off */
2293+
2294+ /*
2295+ * Modem seems to respond with error to all queries
2296+ * or settings made with bearer class
2297+ * BEARER_CLASS_DEFAULT. Design decision: If given
2298+ * class is BEARER_CLASS_DEFAULT let's map it to
2299+ * SERVICE_CLASS_VOICE effectively making it the
2300+ * default bearer.
2301+ */
2302+ if (serviceclass == BEARER_CLASS_DEFAULT)
2303+ serviceclass = BEARER_CLASS_VOICE;
2304+
2305+ parcel_w_int32(rilp, serviceclass); /* Service class */
2306+
2307+ g_ril_append_print_buf(gril, "(%d, 0x%x)", enabled, serviceclass);
2308+}
2309+
2310+void g_ril_request_query_call_waiting(GRil *gril,
2311+ int serviceclass,
2312+ struct parcel *rilp)
2313+{
2314+ parcel_init(rilp);
2315+
2316+ parcel_w_int32(rilp, 1); /* Number of params */
2317+ /*
2318+ * RILD expects service class to be 0 as certain carriers can reject the
2319+ * query with specific service class
2320+ */
2321+ parcel_w_int32(rilp, 0);
2322+
2323+ g_ril_append_print_buf(gril, "(0)");
2324+}
2325+
2326+void g_ril_request_set_clir(GRil *gril,
2327+ int mode,
2328+ struct parcel *rilp)
2329+{
2330+ parcel_init(rilp);
2331+
2332+ parcel_w_int32(rilp, 1); /* Number of params */
2333+ parcel_w_int32(rilp, mode);
2334+
2335+ g_ril_append_print_buf(gril, "(%d)", mode);
2336+}
2337
2338=== modified file 'gril/grilrequest.h'
2339--- gril/grilrequest.h 2013-11-28 13:31:35 +0000
2340+++ gril/grilrequest.h 2014-01-08 20:51:43 +0000
2341@@ -181,6 +181,22 @@
2342 int muted,
2343 struct parcel *rilp);
2344
2345+void g_ril_request_send_ussd(GRil *gril,
2346+ const char *ussd,
2347+ struct parcel *rilp);
2348+
2349+void g_ril_request_set_call_waiting(GRil *gril,
2350+ int enabled, int serviceclass,
2351+ struct parcel *rilp);
2352+
2353+void g_ril_request_query_call_waiting(GRil *gril,
2354+ int serviceclass,
2355+ struct parcel *rilp);
2356+
2357+void g_ril_request_set_clir(GRil *gril,
2358+ int mode,
2359+ struct parcel *rilp);
2360+
2361 #ifdef __cplusplus
2362 }
2363 #endif
2364
2365=== removed file 'gril/grilresponse.h'
2366--- gril/grilresponse.h 2013-09-09 19:21:32 +0000
2367+++ gril/grilresponse.h 1970-01-01 00:00:00 +0000
2368@@ -1,46 +0,0 @@
2369-/*
2370- *
2371- * RIL chat library with GLib integration
2372- *
2373- * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
2374- * Copyright (C) 2012 Canonical Ltd.
2375- *
2376- * This program is free software; you can redistribute it and/or modify
2377- * it under the terms of the GNU General Public License version 2 as
2378- * published by the Free Software Foundation.
2379- *
2380- * This program is distributed in the hope that it will be useful,
2381- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2382- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2383- * GNU General Public License for more details.
2384- *
2385- * You should have received a copy of the GNU General Public License
2386- * along with this program; if not, write to the Free Software
2387- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2388- *
2389- */
2390-
2391-#ifndef __GRIL_RESPONSE_H
2392-#define __GRIL_RESPONSE_H
2393-
2394-#ifdef __cplusplus
2395-extern "C" {
2396-#endif
2397-
2398-struct _GRilResponse {
2399- GSList *lines;
2400- char *final_or_pdu;
2401-};
2402-
2403-typedef struct _GRilResponse GRilResponse;
2404-
2405-#define G_RIL_RESPONSE_LINE_LENGTH_MAX 2048
2406-
2407-const char *g_ril_final_response(GRilResponse *response);
2408-const char *g_ril_response_pdu(GRilResponse *response);
2409-
2410-#ifdef __cplusplus
2411-}
2412-#endif
2413-
2414-#endif /* __GRIL_RESPONSE_H */
2415
2416=== modified file 'gril/grilunsol.c'
2417--- gril/grilunsol.c 2013-11-25 12:17:06 +0000
2418+++ gril/grilunsol.c 2014-01-08 20:51:43 +0000
2419@@ -243,6 +243,84 @@
2420 return NULL;
2421 }
2422
2423+int g_ril_unsol_parse_radio_state_changed(GRil *gril, const struct ril_msg *message)
2424+{
2425+ struct parcel rilp;
2426+ int radio_state;
2427+
2428+ g_ril_init_parcel(message, &rilp);
2429+
2430+ radio_state = parcel_r_int32(&rilp);
2431+
2432+ if (rilp.malformed) {
2433+ ofono_error("%s: malformed parcel received", __func__);
2434+ radio_state = -1;
2435+ }
2436+
2437+ g_ril_append_print_buf(gril, "(state: %s)",
2438+ ril_radio_state_to_string(radio_state));
2439+
2440+ g_ril_print_unsol(gril, message);
2441+
2442+ return radio_state;
2443+}
2444+int g_ril_unsol_parse_signal_strength(GRil *gril, const struct ril_msg *message)
2445+{
2446+ struct parcel rilp;
2447+ int gw_signal, cdma_dbm, evdo_dbm, lte_signal;
2448+
2449+ g_ril_init_parcel(message, &rilp);
2450+
2451+ /* RIL_SignalStrength_v6 */
2452+ /* GW_SignalStrength */
2453+ gw_signal = parcel_r_int32(&rilp);
2454+ parcel_r_int32(&rilp); /* bitErrorRate */
2455+
2456+ /* CDMA_SignalStrength */
2457+ cdma_dbm = parcel_r_int32(&rilp);
2458+ parcel_r_int32(&rilp); /* ecio */
2459+
2460+ /* EVDO_SignalStrength */
2461+ evdo_dbm = parcel_r_int32(&rilp);
2462+ parcel_r_int32(&rilp); /* ecio */
2463+ parcel_r_int32(&rilp); /* signalNoiseRatio */
2464+
2465+ /* LTE_SignalStrength */
2466+ lte_signal = parcel_r_int32(&rilp);
2467+ parcel_r_int32(&rilp); /* rsrp */
2468+ parcel_r_int32(&rilp); /* rsrq */
2469+ parcel_r_int32(&rilp); /* rssnr */
2470+ parcel_r_int32(&rilp); /* cqi */
2471+
2472+ g_ril_append_print_buf(gril, "(gw: %d, cdma: %d, evdo: %d, lte: %d)",
2473+ gw_signal, cdma_dbm, evdo_dbm, lte_signal);
2474+
2475+ if (message->unsolicited)
2476+ g_ril_print_unsol(gril, message);
2477+ else
2478+ g_ril_print_response(gril, message);
2479+
2480+ /* Return the first valid one */
2481+ if ((gw_signal != 99) && (gw_signal != -1))
2482+ return (gw_signal * 100) / 31;
2483+ if ((lte_signal != 99) && (lte_signal != -1))
2484+ return (lte_signal * 100) / 31;
2485+
2486+ /* In case of dbm, return the value directly */
2487+ if (cdma_dbm != -1) {
2488+ if (cdma_dbm > 100)
2489+ cdma_dbm = 100;
2490+ return cdma_dbm;
2491+ }
2492+ if (evdo_dbm != -1) {
2493+ if (evdo_dbm > 100)
2494+ evdo_dbm = 100;
2495+ return evdo_dbm;
2496+ }
2497+
2498+ return -1;
2499+}
2500+
2501 void g_ril_unsol_free_supp_svc_notif(struct unsol_supp_svc_notif *unsol)
2502 {
2503 g_free(unsol);
2504@@ -279,3 +357,58 @@
2505
2506 return unsol;
2507 }
2508+
2509+void g_ril_unsol_free_ussd(struct unsol_ussd *unsol)
2510+{
2511+ if (unsol != NULL) {
2512+ g_free(unsol->message);
2513+ g_free(unsol);
2514+ }
2515+}
2516+
2517+struct unsol_ussd *g_ril_unsol_parse_ussd(GRil *gril, struct ril_msg *message)
2518+{
2519+ struct parcel rilp;
2520+ struct unsol_ussd *ussd;
2521+ char *typestr = NULL;
2522+ int numstr;
2523+
2524+ ussd = g_try_malloc0(sizeof(*ussd));
2525+ if (ussd == NULL) {
2526+ ofono_error("%s out of memory", __func__);
2527+ goto error;
2528+ }
2529+
2530+ g_ril_init_parcel(message, &rilp);
2531+
2532+ numstr = parcel_r_int32(&rilp);
2533+ if (numstr < 1) {
2534+ ofono_error("%s malformed parcel", __func__);
2535+ goto error;
2536+ }
2537+
2538+ typestr = parcel_r_string(&rilp);
2539+ if (typestr == NULL || *typestr == '\0') {
2540+ ofono_error("%s wrong type", __func__);
2541+ goto error;
2542+ }
2543+
2544+ ussd->type = *typestr - '0';
2545+
2546+ g_free(typestr);
2547+
2548+ if (numstr > 1)
2549+ ussd->message = parcel_r_string(&rilp);
2550+
2551+ g_ril_append_print_buf(gril, "{%d,%s}", ussd->type, ussd->message);
2552+
2553+ g_ril_print_unsol(gril, message);
2554+
2555+ return ussd;
2556+
2557+error:
2558+ g_free(typestr);
2559+ g_free(ussd);
2560+
2561+ return NULL;
2562+}
2563
2564=== modified file 'gril/grilunsol.h'
2565--- gril/grilunsol.h 2013-11-25 12:17:06 +0000
2566+++ gril/grilunsol.h 2014-01-08 20:51:43 +0000
2567@@ -61,6 +61,11 @@
2568 struct ofono_phone_number number;
2569 };
2570
2571+struct unsol_ussd {
2572+ int type;
2573+ char *message;
2574+};
2575+
2576 void g_ril_unsol_free_data_call_list(struct unsol_data_call_list *unsol);
2577
2578 struct unsol_data_call_list *g_ril_unsol_parse_data_call_list(GRil *gril,
2579@@ -74,11 +79,21 @@
2580 struct unsol_sms_data *g_ril_unsol_parse_new_sms(GRil *gril,
2581 const struct ril_msg *message);
2582
2583+int g_ril_unsol_parse_radio_state_changed(GRil *gril,
2584+ const struct ril_msg *message);
2585+
2586+int g_ril_unsol_parse_signal_strength(GRil *gril,
2587+ const struct ril_msg *message);
2588+
2589 void g_ril_unsol_free_supp_svc_notif(struct unsol_supp_svc_notif *unsol);
2590
2591 struct unsol_supp_svc_notif *g_ril_unsol_parse_supp_svc_notif(GRil *gril,
2592 struct ril_msg *message);
2593
2594+void g_ril_unsol_free_ussd(struct unsol_ussd *unsol);
2595+
2596+struct unsol_ussd *g_ril_unsol_parse_ussd(GRil *gril, struct ril_msg *message);
2597+
2598 #ifdef __cplusplus
2599 }
2600 #endif
2601
2602=== modified file 'gril/grilutil.c'
2603--- gril/grilutil.c 2013-11-25 12:17:06 +0000
2604+++ gril/grilutil.c 2014-01-08 20:51:43 +0000
2605@@ -178,6 +178,20 @@
2606 }
2607 }
2608
2609+const char *ril_radio_state_to_string(int radio_state)
2610+{
2611+ switch (radio_state) {
2612+ case RADIO_STATE_OFF:
2613+ return "OFF";
2614+ case RADIO_STATE_UNAVAILABLE:
2615+ return "UNAVAILABLE";
2616+ case RADIO_STATE_ON:
2617+ return "ON";
2618+ default:
2619+ return "<INVALID>";
2620+ }
2621+}
2622+
2623 const char *ril_request_id_to_string(int req)
2624 {
2625 switch (req) {
2626
2627=== modified file 'gril/grilutil.h'
2628--- gril/grilutil.h 2013-09-09 19:21:32 +0000
2629+++ gril/grilutil.h 2014-01-08 20:51:43 +0000
2630@@ -38,6 +38,7 @@
2631 const char *ril_cardstate_to_string(int card_state);
2632 const char *ril_error_to_string(int error);
2633 const char *ril_pinstate_to_string(int pin_state);
2634+const char *ril_radio_state_to_string(int radio_state);
2635 const char *ril_request_id_to_string(int req);
2636 const char *ril_unsol_request_to_string(int request);
2637
2638
2639=== modified file 'gril/parcel.c'
2640--- gril/parcel.c 2013-11-22 08:12:06 +0000
2641+++ gril/parcel.c 2014-01-08 20:51:43 +0000
2642@@ -53,6 +53,7 @@
2643 p->size = 0;
2644 p->capacity = sizeof(int32_t);
2645 p->offset = 0;
2646+ p->malformed = 0;
2647 }
2648
2649 void parcel_grow(struct parcel *p, size_t size)
2650@@ -73,6 +74,16 @@
2651 int32_t parcel_r_int32(struct parcel *p)
2652 {
2653 int32_t ret;
2654+
2655+ if (p->malformed)
2656+ return 0;
2657+
2658+ if (p->offset + sizeof(int32_t) > p->size) {
2659+ ofono_error("%s: parcel is too small", __func__);
2660+ p->malformed = 1;
2661+ return 0;
2662+ }
2663+
2664 ret = *((int32_t *) (void *) (p->data + p->offset));
2665 p->offset += sizeof(int32_t);
2666 return ret;
2667@@ -82,9 +93,6 @@
2668 {
2669 for (;;) {
2670
2671- DBG("parcel_w_int32(%d): offset = %d, cap = %d, size = %d\n",
2672- val, (int) p->offset, (int) p->capacity, (int) p->size);
2673-
2674 if (p->offset + sizeof(int32_t) < p->capacity) {
2675 /* There's enough space */
2676 *((int32_t *) (void *) (p->data + p->offset)) = val;
2677@@ -122,8 +130,6 @@
2678 for (;;) {
2679 size_t padded = PAD_SIZE(len);
2680
2681- DBG("parcel_w_string(\"%s\"): len %d offset %d, cap %d, size %d",
2682- str, (int) len, (int) p->offset, (int) p->capacity, (int) p->size);
2683 if (p->offset + len < p->capacity) {
2684 /* There's enough space */
2685 memcpy(p->data + p->offset, gs16, gs16_size);
2686@@ -146,9 +152,6 @@
2687 };
2688 #endif
2689
2690- DBG("Writing %d bytes, padded to %d\n",
2691- (int) len, (int) padded);
2692-
2693 *((uint32_t*) (void *)
2694 (p->data + p->offset - 4)) &=
2695 mask[padded - len];
2696@@ -169,17 +172,31 @@
2697 {
2698 char *ret;
2699 int len16 = parcel_r_int32(p);
2700+ int strbytes;
2701+
2702+ if (p->malformed)
2703+ return NULL;
2704
2705 /* This is how a null string is sent */
2706 if (len16 < 0)
2707 return NULL;
2708
2709+ strbytes = PAD_SIZE((len16 + 1) * sizeof(char16_t));
2710+ if (p->offset + strbytes > p->size) {
2711+ ofono_error("%s: parcel is too small", __func__);
2712+ p->malformed = 1;
2713+ return NULL;
2714+ }
2715+
2716 ret = g_utf16_to_utf8((gunichar2 *) (void *) (p->data + p->offset),
2717 len16, NULL, NULL, NULL);
2718- if (ret == NULL)
2719+ if (ret == NULL) {
2720+ ofono_error("%s: wrong UTF16 coding", __func__);
2721+ p->malformed = 1;
2722 return NULL;
2723+ }
2724
2725- p->offset += PAD_SIZE((len16 + 1) * sizeof(char16_t));
2726+ p->offset += strbytes;
2727
2728 return ret;
2729 }
2730
2731=== modified file 'gril/parcel.h'
2732--- gril/parcel.h 2013-11-05 16:26:21 +0000
2733+++ gril/parcel.h 2014-01-08 20:51:43 +0000
2734@@ -29,6 +29,7 @@
2735 size_t offset;
2736 size_t capacity;
2737 size_t size;
2738+ int malformed;
2739 };
2740
2741 void parcel_init(struct parcel *p);
2742
2743=== modified file 'gril/ril_constants.h'
2744--- gril/ril_constants.h 2013-11-25 12:17:06 +0000
2745+++ gril/ril_constants.h 2014-01-08 20:51:43 +0000
2746@@ -57,6 +57,11 @@
2747 #define PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA 10
2748 #define PREF_NET_TYPE_LTE_ONLY 11
2749
2750+/* Radio States */
2751+#define RADIO_STATE_OFF 0
2752+#define RADIO_STATE_UNAVAILABLE 1
2753+#define RADIO_STATE_ON 10
2754+
2755 /* Radio technologies */
2756 #define RADIO_TECH_UNKNOWN 0
2757 #define RADIO_TECH_GPRS 1
2758
2759=== modified file 'plugins/ril.c'
2760--- plugins/ril.c 2013-11-06 04:08:00 +0000
2761+++ plugins/ril.c 2014-01-08 20:51:43 +0000
2762@@ -30,10 +30,6 @@
2763 #include <stdlib.h>
2764 #include <string.h>
2765 #include <glib.h>
2766-#include <gril.h>
2767-#include <grilreply.h>
2768-#include <parcel.h>
2769-#include <grilrequest.h>
2770
2771 #define OFONO_API_SUBJECT_TO_CHANGE
2772 #include <ofono/plugin.h>
2773@@ -58,6 +54,13 @@
2774 #include <ofono/audio-settings.h>
2775 #include <ofono/types.h>
2776
2777+#include "ofono.h"
2778+
2779+#include <gril.h>
2780+#include <grilreply.h>
2781+#include <grilrequest.h>
2782+#include <grilunsol.h>
2783+
2784 #include "drivers/rilmodem/rilmodem.h"
2785
2786 #define MAX_SIM_STATUS_RETRIES 15
2787@@ -67,6 +70,10 @@
2788 int sim_status_retries;
2789 ofono_bool_t connected;
2790 ofono_bool_t have_sim;
2791+ ofono_bool_t ofono_online;
2792+ int radio_state;
2793+ struct ofono_sim *sim;
2794+ struct ofono_voicecall *voice;
2795 };
2796
2797 static void send_get_sim_status(struct ofono_modem *modem);
2798@@ -87,6 +94,55 @@
2799 return FALSE;
2800 }
2801
2802+static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data)
2803+{
2804+ struct ofono_modem *modem = user_data;
2805+ struct ril_data *ril = ofono_modem_get_data(modem);
2806+ int radio_state = g_ril_unsol_parse_radio_state_changed(ril->modem,
2807+ message);
2808+
2809+ if (radio_state != ril->radio_state) {
2810+
2811+ ofono_info("%s: state: %s ril->ofono_online: %d",
2812+ __func__,
2813+ ril_radio_state_to_string(radio_state),
2814+ ril->ofono_online);
2815+
2816+ ril->radio_state = radio_state;
2817+
2818+ switch (radio_state) {
2819+ case RADIO_STATE_ON:
2820+
2821+ if (ril->voice == NULL)
2822+ ril->voice =
2823+ ofono_voicecall_create(modem,
2824+ 0,
2825+ RILMODEM,
2826+ ril->modem);
2827+
2828+ send_get_sim_status(modem);
2829+ break;
2830+
2831+ case RADIO_STATE_UNAVAILABLE:
2832+ case RADIO_STATE_OFF:
2833+
2834+ /*
2835+ * If radio powers off asychronously, then
2836+ * assert, and let upstart re-start the stack.
2837+ */
2838+ if (ril->ofono_online) {
2839+ ofono_error("%s: radio self-powered off!",
2840+ __func__);
2841+ g_assert(FALSE);
2842+ }
2843+ break;
2844+ default:
2845+ /* Malformed parcel; no radio state == broken rild */
2846+ g_assert(FALSE);
2847+ }
2848+ }
2849+}
2850+
2851 static void sim_status_cb(struct ril_msg *message, gpointer user_data)
2852 {
2853 struct ofono_modem *modem = user_data;
2854@@ -95,66 +151,71 @@
2855
2856 DBG("");
2857
2858- /*
2859- * ril.h claims this should NEVER fail!
2860- * However this isn't quite true. So,
2861- * on anything other than SUCCESS, we
2862- * log an error, and schedule another
2863- * GET_SIM_STATUS request.
2864- */
2865-
2866 if (message->error != RIL_E_SUCCESS) {
2867 ril->sim_status_retries++;
2868
2869- ofono_error("GET_SIM_STATUS reques failed: %d; retries: %d",
2870- message->error, ril->sim_status_retries);
2871+ ofono_error("GET_SIM_STATUS request failed: %s; retries: %d",
2872+ ril_error_to_string(message->error),
2873+ ril->sim_status_retries);
2874
2875 if (ril->sim_status_retries < MAX_SIM_STATUS_RETRIES)
2876 g_timeout_add_seconds(2, sim_status_retry, modem);
2877 else
2878 ofono_error("Max retries for GET_SIM_STATUS exceeded!");
2879 } else {
2880+
2881 if ((status = g_ril_reply_parse_sim_status(ril->modem, message))
2882 != NULL) {
2883+
2884 if (status->card_state == RIL_CARDSTATE_PRESENT) {
2885- DBG("have_sim = TRUE; powering on modem; num_apps: %d",
2886+ DBG("Card PRESENT; num_apps: %d",
2887 status->num_apps);
2888- ril->have_sim = TRUE;
2889+
2890+ if (!ril->have_sim) {
2891+ DBG("notify SIM inserted");
2892+ ril->have_sim = TRUE;
2893+
2894+ ofono_sim_inserted_notify(ril->sim, TRUE);
2895+ }
2896+
2897 } else {
2898- ofono_warn("No SIM card present.");
2899+ ofono_warn("Card NOT_PRESENT.");
2900+
2901+ if (ril->have_sim) {
2902+ DBG("notify SIM removed");
2903+ ril->have_sim = FALSE;
2904+
2905+ ofono_sim_inserted_notify(ril->sim, FALSE);
2906+ }
2907 }
2908 g_ril_reply_free_sim_status(status);
2909 }
2910- DBG("calling set_powered(TRUE)");
2911- ofono_modem_set_powered(modem, TRUE);
2912 }
2913- /* TODO: handle emergency calls if SIM !present or locked */
2914 }
2915
2916 static void send_get_sim_status(struct ofono_modem *modem)
2917 {
2918 struct ril_data *ril = ofono_modem_get_data(modem);
2919- int request = RIL_REQUEST_GET_SIM_STATUS;
2920- gint ret;
2921-
2922- ret = g_ril_send(ril->modem, request,
2923- NULL, 0, sim_status_cb, modem, NULL);
2924-
2925- if (ret > 0)
2926- g_ril_print_request_no_args(ril->modem, ret, request);
2927+
2928+ DBG("");
2929+
2930+ g_ril_send(ril->modem, RIL_REQUEST_GET_SIM_STATUS, NULL,
2931+ sim_status_cb, modem, NULL);
2932 }
2933
2934 static int ril_probe(struct ofono_modem *modem)
2935 {
2936- struct ril_data *ril = NULL;
2937-
2938- ril = g_try_new0(struct ril_data, 1);
2939+ struct ril_data *ril = g_try_new0(struct ril_data, 1);
2940 if (ril == NULL) {
2941 errno = ENOMEM;
2942 goto error;
2943 }
2944
2945- ril->modem = NULL;
2946+ DBG("");
2947+
2948+ ril->have_sim = FALSE;
2949+ ril->ofono_online = FALSE;
2950+ ril->radio_state = RADIO_STATE_OFF;
2951
2952 ofono_modem_set_data(modem, ril);
2953
2954@@ -184,13 +245,11 @@
2955 static void ril_pre_sim(struct ofono_modem *modem)
2956 {
2957 struct ril_data *ril = ofono_modem_get_data(modem);
2958- struct ofono_sim *sim;
2959-
2960- sim = ofono_sim_create(modem, 0, RILMODEM, ril->modem);
2961- ofono_voicecall_create(modem, 0, RILMODEM, ril->modem);
2962-
2963- if (sim && ril->have_sim)
2964- ofono_sim_inserted_notify(sim, TRUE);
2965+
2966+ DBG("");
2967+
2968+ ril->sim = ofono_sim_create(modem, 0, RILMODEM, ril->modem);
2969+ g_assert(ril->sim != NULL);
2970 }
2971
2972 static void ril_post_sim(struct ofono_modem *modem)
2973@@ -221,53 +280,50 @@
2974
2975 ofono_call_volume_create(modem, 0, RILMODEM, ril->modem);
2976 ofono_netreg_create(modem, 0, RILMODEM, ril->modem);
2977+ ofono_ussd_create(modem, 0, RILMODEM, ril->modem);
2978+ ofono_call_settings_create(modem, 0, RILMODEM, ril->modem);
2979 }
2980
2981 static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
2982 {
2983 struct cb_data *cbd = user_data;
2984+ struct ril_data *ril = cbd->user;
2985 ofono_modem_online_cb_t cb = cbd->cb;
2986
2987- if (message->error == RIL_E_SUCCESS)
2988+ if (message->error == RIL_E_SUCCESS) {
2989+ DBG("%s: set_online OK: ril->ofono_online: %d", __func__,
2990+ ril->ofono_online);
2991 CALLBACK_WITH_SUCCESS(cb, cbd->data);
2992- else
2993+ } else {
2994+ ofono_error("%s: set_online: %d failed", __func__,
2995+ ril->ofono_online);
2996 CALLBACK_WITH_FAILURE(cb, cbd->data);
2997+ }
2998 }
2999
3000 static void ril_send_power(struct ril_data *ril, ofono_bool_t online,
3001 GRilResponseFunc func,
3002- ofono_modem_online_cb_t callback,
3003- void *data)
3004+ gpointer user_data)
3005 {
3006- struct cb_data *cbd;
3007- GDestroyNotify notify;
3008- int request = RIL_REQUEST_RADIO_POWER;
3009+ struct cb_data *cbd = user_data;
3010+ ofono_modem_online_cb_t cb;
3011+ GDestroyNotify notify = NULL;
3012 struct parcel rilp;
3013- int ret;
3014
3015- if (callback) {
3016- cbd = cb_data_new(callback, data, NULL);
3017+ if (cbd != NULL) {
3018 notify = g_free;
3019- g_assert(func);
3020- } else {
3021- cbd = NULL;
3022- notify = NULL;
3023+ cb = cbd->cb;
3024 }
3025
3026 DBG("(online = 1, offline = 0)): %i", online);
3027
3028 g_ril_request_power(ril->modem, (const gboolean) online, &rilp);
3029
3030- ret = g_ril_send(ril->modem, request, rilp.data,
3031- rilp.size, func, cbd, notify);
3032-
3033- parcel_free(&rilp);
3034-
3035- if (ret <= 0) {
3036+ if (g_ril_send(ril->modem, RIL_REQUEST_RADIO_POWER, &rilp,
3037+ func, cbd, notify) == 0 && cbd != NULL) {
3038+
3039+ CALLBACK_WITH_FAILURE(cb, cbd->data);
3040 g_free(cbd);
3041- CALLBACK_WITH_FAILURE(callback, data);
3042- } else {
3043- g_ril_print_request(ril->modem, ret, request);
3044 }
3045 }
3046
3047@@ -275,7 +331,13 @@
3048 ofono_modem_online_cb_t callback, void *data)
3049 {
3050 struct ril_data *ril = ofono_modem_get_data(modem);
3051- ril_send_power(ril, online, ril_set_online_cb, callback, data);
3052+ struct cb_data *cbd = cb_data_new(callback, data, ril);
3053+
3054+ ril->ofono_online = online;
3055+
3056+ DBG("setting ril->ofono_online to: %d", online);
3057+
3058+ ril_send_power(ril, online, ril_set_online_cb, cbd);
3059 }
3060
3061 static void ril_connected(struct ril_msg *message, gpointer user_data)
3062@@ -288,14 +350,16 @@
3063 /* TODO: need a disconnect function to restart things! */
3064 ril->connected = TRUE;
3065
3066- send_get_sim_status(modem);
3067+ DBG("calling set_powered(TRUE)");
3068+
3069+ ofono_modem_set_powered(modem, TRUE);
3070 }
3071
3072 static int ril_enable(struct ofono_modem *modem)
3073 {
3074 struct ril_data *ril = ofono_modem_get_data(modem);
3075
3076- ril->have_sim = FALSE;
3077+ DBG("");
3078
3079 ril->modem = g_ril_new();
3080
3081@@ -321,6 +385,9 @@
3082 g_ril_register(ril->modem, RIL_UNSOL_RIL_CONNECTED,
3083 ril_connected, modem);
3084
3085+ g_ril_register(ril->modem, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
3086+ ril_radio_state_changed, modem);
3087+
3088 ofono_devinfo_create(modem, 0, RILMODEM, ril->modem);
3089
3090 return -EINPROGRESS;
3091@@ -332,7 +399,7 @@
3092
3093 DBG("%p", modem);
3094
3095- ril_send_power(ril, FALSE, NULL, NULL, NULL);
3096+ ril_send_power(ril, FALSE, NULL, NULL);
3097
3098 return 0;
3099 }
3100
3101=== modified file 'src/sim-mnclength.c'
3102--- src/sim-mnclength.c 2013-11-11 10:37:01 +0000
3103+++ src/sim-mnclength.c 2014-01-08 20:51:43 +0000
3104@@ -24,6 +24,7 @@
3105 #include <config.h>
3106 #endif
3107
3108+#include <errno.h>
3109 #include <string.h>
3110 #include <glib.h>
3111 #include "ofono.h"
3112@@ -34,7 +35,7 @@
3113 int __ofono_sim_mnclength_get_mnclength(const char *imsi)
3114 {
3115 GSList *d;
3116- int mnclen;
3117+ int mnclen = -ENOTSUP;
3118
3119 for (d = g_drivers; d != NULL; d = d->next) {
3120 const struct ofono_sim_mnclength_driver *driver = d->data;
3121@@ -50,7 +51,7 @@
3122 return mnclen;
3123 }
3124
3125- return 0;
3126+ return mnclen;
3127 }
3128
3129 int ofono_sim_mnclength_driver_register(
3130
3131=== modified file 'unit/test-grilreply.c'
3132--- unit/test-grilreply.c 2013-12-03 23:56:44 +0000
3133+++ unit/test-grilreply.c 2014-01-08 20:51:43 +0000
3134@@ -1344,6 +1344,63 @@
3135 .error = 0,
3136 };
3137
3138+/*
3139+ * The following hexadecimal data contains the event data of a valid
3140+ * RIL_REQUEST_QUERY_CALL_WAITING reply with the following parameters:
3141+ *
3142+ * {1,0x30}
3143+ */
3144+static const guchar reply_query_call_waiting_valid_parcel1[] = {
3145+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00
3146+};
3147+
3148+static const struct ril_msg reply_query_call_waiting_valid_1 = {
3149+ .buf = (gchar *) reply_query_call_waiting_valid_parcel1,
3150+ .buf_len = sizeof(reply_query_call_waiting_valid_parcel1),
3151+ .unsolicited = FALSE,
3152+ .req = RIL_REQUEST_QUERY_CALL_WAITING,
3153+ .serial_no = 0,
3154+ .error = 0,
3155+};
3156+
3157+/*
3158+ * The following hexadecimal data contains the event data of a valid
3159+ * RIL_REQUEST_QUERY_CLIP reply with the following parameters:
3160+ *
3161+ * {1}
3162+ */
3163+static const guchar reply_query_clip_valid_parcel1[] = {
3164+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
3165+};
3166+
3167+static const struct ril_msg reply_query_clip_valid_1 = {
3168+ .buf = (gchar *) reply_query_clip_valid_parcel1,
3169+ .buf_len = sizeof(reply_query_clip_valid_parcel1),
3170+ .unsolicited = FALSE,
3171+ .req = RIL_REQUEST_QUERY_CLIP,
3172+ .serial_no = 0,
3173+ .error = 0,
3174+};
3175+
3176+/*
3177+ * The following hexadecimal data contains the event data of a valid
3178+ * RIL_REQUEST_GET_CLIR reply with the following parameters:
3179+ *
3180+ * {2,4}
3181+ */
3182+static const guchar reply_get_clir_valid_parcel1[] = {
3183+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
3184+};
3185+
3186+static const struct ril_msg reply_get_clir_valid_1 = {
3187+ .buf = (gchar *) reply_get_clir_valid_parcel1,
3188+ .buf_len = sizeof(reply_get_clir_valid_parcel1),
3189+ .unsolicited = FALSE,
3190+ .req = RIL_REQUEST_GET_CLIR,
3191+ .serial_no = 0,
3192+ .error = 0,
3193+};
3194+
3195 static void test_reply_data_call_invalid(gconstpointer data)
3196 {
3197 struct ofono_error error;
3198@@ -1516,6 +1573,35 @@
3199 g_free(imei);
3200 }
3201
3202+static void test_reply_query_call_waiting_valid(gconstpointer data)
3203+{
3204+ int cls;
3205+
3206+ cls = g_ril_reply_parse_query_call_waiting(NULL, data);
3207+
3208+ g_assert(cls != -1);
3209+}
3210+
3211+static void test_reply_query_clip_valid(gconstpointer data)
3212+{
3213+ int clip_status;
3214+
3215+ clip_status = g_ril_reply_parse_query_clip(NULL, data);
3216+
3217+ g_assert(clip_status != -1);
3218+}
3219+
3220+static void test_reply_get_clir_valid(gconstpointer data)
3221+{
3222+ struct reply_clir *reply;
3223+
3224+ reply = g_ril_reply_parse_get_clir(NULL, data);
3225+
3226+ g_assert(reply != NULL);
3227+
3228+ g_ril_reply_free_get_clir(reply);
3229+}
3230+
3231 int main(int argc, char **argv)
3232 {
3233 g_test_init(&argc, &argv, NULL);
3234@@ -1748,6 +1834,21 @@
3235 &reply_get_imei_valid_1,
3236 test_reply_get_imei_valid);
3237
3238+ g_test_add_data_func("/testgrilreply/call-settings: "
3239+ "valid QUERY_CALL_WAITING Test 1",
3240+ &reply_query_call_waiting_valid_1,
3241+ test_reply_query_call_waiting_valid);
3242+
3243+ g_test_add_data_func("/testgrilreply/call-settings: "
3244+ "valid QUERY_CLIP Test 1",
3245+ &reply_query_clip_valid_1,
3246+ test_reply_query_clip_valid);
3247+
3248+ g_test_add_data_func("/testgrilreply/call-settings: "
3249+ "valid GET_CLIR Test 1",
3250+ &reply_get_clir_valid_1,
3251+ test_reply_get_clir_valid);
3252+
3253 #endif
3254
3255 return g_test_run();
3256
3257=== modified file 'unit/test-grilrequest.c'
3258--- unit/test-grilrequest.c 2013-11-28 13:40:27 +0000
3259+++ unit/test-grilrequest.c 2014-01-08 20:51:43 +0000
3260@@ -515,6 +515,68 @@
3261 .parcel_size = sizeof(req_set_mute_valid_parcel2),
3262 };
3263
3264+/* send_ussd tests */
3265+
3266+static const guchar req_send_ussd_parcel_valid_1[] = {
3267+ 0x05, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x31, 0x00, 0x31, 0x00, 0x38, 0x00,
3268+ 0x23, 0x00, 0x00, 0x00
3269+};
3270+
3271+static const struct request_test_data send_ussd_valid_test_1 = {
3272+ .request = "*118#",
3273+ .parcel_data = req_send_ussd_parcel_valid_1,
3274+ .parcel_size = sizeof(req_send_ussd_parcel_valid_1),
3275+};
3276+
3277+/* set_call_waiting tests */
3278+
3279+struct request_test_set_call_waiting {
3280+ int enabled;
3281+ int serviceclass;
3282+ const char *parcel_data;
3283+ size_t parcel_size;
3284+};
3285+
3286+static const char req_set_call_waiting_parcel_valid_1[] = {
3287+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
3288+};
3289+
3290+static const struct request_test_set_call_waiting
3291+ set_call_waiting_valid_test_1 = {
3292+ .enabled = 0,
3293+ .serviceclass = 0x01,
3294+ .parcel_data = req_set_call_waiting_parcel_valid_1,
3295+ .parcel_size = sizeof(req_set_call_waiting_parcel_valid_1),
3296+};
3297+
3298+/* query_call_waiting tests */
3299+
3300+const int query_call_waiting_mode_0 = 0;
3301+
3302+static const guchar req_query_call_waiting_parcel_valid_1[] = {
3303+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3304+};
3305+
3306+static const struct request_test_data query_call_waiting_valid_test_1 = {
3307+ .request = &query_call_waiting_mode_0,
3308+ .parcel_data = req_query_call_waiting_parcel_valid_1,
3309+ .parcel_size = sizeof(req_query_call_waiting_parcel_valid_1),
3310+};
3311+
3312+/* set_clir tests */
3313+
3314+const int set_clir_mode_0 = 0;
3315+
3316+static const guchar req_set_clir_parcel_valid_1[] = {
3317+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3318+};
3319+
3320+static const struct request_test_data set_clir_valid_test_1 = {
3321+ .request = &set_clir_mode_0,
3322+ .parcel_data = req_set_clir_parcel_valid_1,
3323+ .parcel_size = sizeof(req_set_clir_parcel_valid_1),
3324+};
3325+
3326 /*
3327 * The following hexadecimal data represents a serialized Binder parcel
3328 * instance containing a valid RIL_REQUEST_RADIO_POWER 'OFF' message.
3329@@ -887,6 +949,61 @@
3330 parcel_free(&rilp);
3331 }
3332
3333+static void test_request_send_ussd(gconstpointer data)
3334+{
3335+ const struct request_test_data *test_data = data;
3336+ struct parcel rilp;
3337+
3338+ g_ril_request_send_ussd(NULL, test_data->request, &rilp);
3339+
3340+ g_assert(!memcmp(rilp.data, test_data->parcel_data,
3341+ test_data->parcel_size));
3342+
3343+ parcel_free(&rilp);
3344+}
3345+
3346+static void test_request_set_call_waiting(gconstpointer data)
3347+{
3348+ const struct request_test_set_call_waiting *test_data = data;
3349+ struct parcel rilp;
3350+
3351+ g_ril_request_set_call_waiting(NULL, test_data->enabled,
3352+ test_data->serviceclass, &rilp);
3353+
3354+ g_assert(!memcmp(rilp.data, test_data->parcel_data,
3355+ test_data->parcel_size));
3356+
3357+ parcel_free(&rilp);
3358+}
3359+
3360+static void test_request_query_call_waiting(gconstpointer data)
3361+{
3362+ const struct request_test_data *test_data = data;
3363+ int mode = *(int *) test_data->request;
3364+ struct parcel rilp;
3365+
3366+ g_ril_request_query_call_waiting(NULL, mode, &rilp);
3367+
3368+ g_assert(!memcmp(rilp.data, test_data->parcel_data,
3369+ test_data->parcel_size));
3370+
3371+ parcel_free(&rilp);
3372+}
3373+
3374+static void test_request_set_clir(gconstpointer data)
3375+{
3376+ const struct request_test_data *test_data = data;
3377+ int mode = *(int *) test_data->request;
3378+ struct parcel rilp;
3379+
3380+ g_ril_request_set_clir(NULL, mode, &rilp);
3381+
3382+ g_assert(!memcmp(rilp.data, test_data->parcel_data,
3383+ test_data->parcel_size));
3384+
3385+ parcel_free(&rilp);
3386+}
3387+
3388 int main(int argc, char **argv)
3389 {
3390 g_test_init(&argc, &argv, NULL);
3391@@ -1074,6 +1191,26 @@
3392 &set_mute_valid_test_2,
3393 test_request_set_mute_valid);
3394
3395+ g_test_add_data_func("/testgrilrequest/ussd: "
3396+ "valid SEND_USSD Test 1",
3397+ &send_ussd_valid_test_1,
3398+ test_request_send_ussd);
3399+
3400+ g_test_add_data_func("/testgrilrequest/call-settings: "
3401+ "valid SET_CALL_WAITING Test 1",
3402+ &set_call_waiting_valid_test_1,
3403+ test_request_set_call_waiting);
3404+
3405+ g_test_add_data_func("/testgrilrequest/call-settings: "
3406+ "valid QUERY_CALL_WAITING Test 1",
3407+ &query_call_waiting_valid_test_1,
3408+ test_request_query_call_waiting);
3409+
3410+ g_test_add_data_func("/testgrilrequest/call-settings: "
3411+ "valid SET_CLIR Test 1",
3412+ &set_clir_valid_test_1,
3413+ test_request_set_clir);
3414+
3415 #endif
3416 return g_test_run();
3417 }
3418
3419=== modified file 'unit/test-grilunsol.c'
3420--- unit/test-grilunsol.c 2013-11-25 13:54:04 +0000
3421+++ unit/test-grilunsol.c 2014-01-08 20:51:43 +0000
3422@@ -42,6 +42,12 @@
3423 * once more tests are added.
3424 */
3425
3426+typedef struct signal_strength_test signal_strength_test;
3427+struct signal_strength_test {
3428+ int strength;
3429+ const struct ril_msg msg;
3430+};
3431+
3432 static const struct ril_msg unsol_data_call_list_changed_invalid_1 = {
3433 .buf = "",
3434 .buf_len = 0,
3435@@ -175,6 +181,63 @@
3436 .error = 0,
3437 };
3438
3439+/*
3440+ * The following hexadecimal data represents a serialized Binder parcel
3441+ * instance containing a valid RIL_UNSOL_SIGNAL_STRENGTH message
3442+ * with the following parameters:
3443+ *
3444+ * (gw: 14, cdma: -1, evdo: -1, lte: 99)
3445+ *
3446+ * Note, the return value for gw sigmal is: (gw * 100) / 31, which
3447+ * in this case equals 45.
3448+ */
3449+static const guchar unsol_signal_strength_parcel1[] = {
3450+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
3451+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
3452+ 0xff, 0xff, 0xff, 0xff, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f,
3453+ 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f
3454+};
3455+
3456+static const signal_strength_test unsol_signal_strength_valid_1 = {
3457+ .strength = 45,
3458+ .msg = {
3459+ .buf = (gchar *) &unsol_signal_strength_parcel1,
3460+ .buf_len = sizeof(unsol_signal_strength_parcel1),
3461+ .unsolicited = TRUE,
3462+ .req = RIL_UNSOL_SIGNAL_STRENGTH,
3463+ .serial_no = 0,
3464+ .error = 0,
3465+ }
3466+};
3467+
3468+/*
3469+ * The following hexadecimal data represents a serialized Binder parcel
3470+ * instance containing a valid RIL_UNSOL_ON_USSD message with the following
3471+ * parameters:
3472+ *
3473+ * {0,Spain 12:56 09/12/13 Canary 11:56 09/12/13 }
3474+ */
3475+static const guchar unsol_on_ussd_parcel1[] = {
3476+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
3477+ 0x2d, 0x00, 0x00, 0x00, 0x53, 0x00, 0x70, 0x00, 0x61, 0x00, 0x69, 0x00,
3478+ 0x6e, 0x00, 0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x3a, 0x00, 0x35, 0x00,
3479+ 0x36, 0x00, 0x20, 0x00, 0x30, 0x00, 0x39, 0x00, 0x2f, 0x00, 0x31, 0x00,
3480+ 0x32, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x33, 0x00, 0x20, 0x00, 0x20, 0x00,
3481+ 0x43, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79, 0x00,
3482+ 0x20, 0x00, 0x31, 0x00, 0x31, 0x00, 0x3a, 0x00, 0x35, 0x00, 0x36, 0x00,
3483+ 0x20, 0x00, 0x30, 0x00, 0x39, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x32, 0x00,
3484+ 0x2f, 0x00, 0x31, 0x00, 0x33, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00
3485+};
3486+
3487+static const struct ril_msg unsol_on_ussd_valid_1 = {
3488+ .buf = (gchar *) &unsol_on_ussd_parcel1,
3489+ .buf_len = sizeof(unsol_on_ussd_parcel1),
3490+ .unsolicited = TRUE,
3491+ .req = RIL_UNSOL_ON_USSD,
3492+ .serial_no = 0,
3493+ .error = 0,
3494+};
3495+
3496 static void test_unsol_data_call_list_changed_invalid(gconstpointer data)
3497 {
3498 struct ofono_error error;
3499@@ -201,6 +264,13 @@
3500 error.error == 0);
3501 }
3502
3503+static void test_signal_strength_valid(gconstpointer data)
3504+{
3505+ const signal_strength_test *test = data;
3506+ int strength = g_ril_unsol_parse_signal_strength(NULL, &test->msg);
3507+ g_assert(strength == test->strength);
3508+}
3509+
3510 static void test_unsol_response_new_sms_valid(gconstpointer data)
3511 {
3512 struct unsol_sms_data *sms_data;
3513@@ -224,6 +294,16 @@
3514 g_ril_unsol_free_supp_svc_notif(unsol);
3515 }
3516
3517+static void test_unsol_on_ussd_valid(gconstpointer data)
3518+{
3519+ struct unsol_ussd *unsol;
3520+
3521+ unsol = g_ril_unsol_parse_ussd(NULL, (struct ril_msg *) data);
3522+
3523+ g_assert(unsol != NULL);
3524+ g_ril_unsol_free_ussd(unsol);
3525+}
3526+
3527 int main(int argc, char **argv)
3528 {
3529 g_test_init(&argc, &argv, NULL);
3530@@ -260,6 +340,16 @@
3531 &unsol_supp_svc_notif_valid_1,
3532 test_unsol_supp_svc_notif_valid);
3533
3534+ g_test_add_data_func("/testgrilunsol/voicecall: "
3535+ "valid SIGNAL_STRENGTH Test 1",
3536+ &unsol_signal_strength_valid_1,
3537+ test_signal_strength_valid);
3538+
3539+ g_test_add_data_func("/testgrilunsol/ussd: "
3540+ "valid ON_USSD Test 1",
3541+ &unsol_on_ussd_valid_1,
3542+ test_unsol_on_ussd_valid);
3543+
3544 #endif
3545 return g_test_run();
3546 }
3547
3548=== added file 'unit/test-mnclength.c'
3549--- unit/test-mnclength.c 1970-01-01 00:00:00 +0000
3550+++ unit/test-mnclength.c 2014-01-08 20:51:43 +0000
3551@@ -0,0 +1,166 @@
3552+/*
3553+ *
3554+ * oFono - Open Source Telephony
3555+ *
3556+ * Copyright (C) 2013 Canonical Ltd.
3557+ *
3558+ * This program is free software; you can redistribute it and/or modify
3559+ * it under the terms of the GNU General Public License version 2 as
3560+ * published by the Free Software Foundation.
3561+ *
3562+ * This program is distributed in the hope that it will be useful,
3563+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3564+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3565+ * GNU General Public License for more details.
3566+ *
3567+ * You should have received a copy of the GNU General Public License
3568+ * along with this program; if not, write to the Free Software
3569+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3570+ *
3571+ */
3572+
3573+#ifdef HAVE_CONFIG_H
3574+#include <config.h>
3575+#endif
3576+
3577+#include <errno.h>
3578+#include <fcntl.h>
3579+#include <unistd.h>
3580+#include <stdlib.h>
3581+#include <string.h>
3582+
3583+#include <glib.h>
3584+#include <glib/gprintf.h>
3585+
3586+#include <ofono.h>
3587+#include <plugin.h>
3588+#include <sim-mnclength.h>
3589+
3590+extern struct ofono_plugin_desc __ofono_builtin_mnclength;
3591+
3592+struct get_mnclength_test_data {
3593+ const char *imsi;
3594+ int mnc_length; /* Expected length */
3595+};
3596+
3597+/* test data */
3598+
3599+static const struct get_mnclength_test_data get_mnclength_0 = {
3600+ .imsi = "214060240111837",
3601+ .mnc_length = -ENOTSUP
3602+};
3603+
3604+static const struct get_mnclength_test_data get_mnclength_1 = {
3605+ .imsi = "214060240111837",
3606+ .mnc_length = 2
3607+};
3608+
3609+static const struct get_mnclength_test_data get_mnclength_2 = {
3610+ .imsi = "313001740111837",
3611+ .mnc_length = 3
3612+};
3613+
3614+static const struct get_mnclength_test_data get_mnclength_3 = {
3615+ .imsi = "352060240111837",
3616+ .mnc_length = 3
3617+};
3618+
3619+static const struct get_mnclength_test_data get_mnclength_4 = {
3620+ .imsi = "602060240111837",
3621+ .mnc_length = 2
3622+};
3623+
3624+static const struct get_mnclength_test_data get_mnclength_5 = {
3625+ .imsi = "4051000240111837",
3626+ .mnc_length = 2
3627+};
3628+
3629+static const struct get_mnclength_test_data get_mnclength_6 = {
3630+ .imsi = "405801240111837",
3631+ .mnc_length = 3
3632+};
3633+
3634+static const struct get_mnclength_test_data get_mnclength_7 = {
3635+ .imsi = "714020240111837",
3636+ .mnc_length = 3
3637+};
3638+
3639+static const struct get_mnclength_test_data get_mnclength_8 = {
3640+ .imsi = "000000000000000",
3641+ .mnc_length = -ENOENT
3642+};
3643+
3644+static const struct get_mnclength_test_data get_mnclength_9 = {
3645+ .imsi = "0xx000000000000",
3646+ .mnc_length = -EINVAL
3647+};
3648+
3649+static const struct get_mnclength_test_data get_mnclength_10 = {
3650+ .imsi = "111111000000000",
3651+ .mnc_length = -ENOENT
3652+};
3653+
3654+static void test_get_mnclength(gconstpointer data)
3655+{
3656+ int mnc_length;
3657+ const struct get_mnclength_test_data *testdata = data;
3658+
3659+ mnc_length = __ofono_sim_mnclength_get_mnclength(testdata->imsi);
3660+ g_assert(mnc_length == testdata->mnc_length);
3661+}
3662+
3663+static void test_mnclength_register(void)
3664+{
3665+ g_assert(__ofono_builtin_mnclength.init() == 0);
3666+}
3667+
3668+int main(int argc, char **argv)
3669+{
3670+ int res;
3671+
3672+ g_test_init(&argc, &argv, NULL);
3673+
3674+ g_test_add_data_func("/testmnclength: Test 0",
3675+ &get_mnclength_0,
3676+ test_get_mnclength);
3677+
3678+ g_test_add_func("/testmnclength: Test register",
3679+ test_mnclength_register);
3680+
3681+ g_test_add_data_func("/testmnclength: Test 1",
3682+ &get_mnclength_1,
3683+ test_get_mnclength);
3684+ g_test_add_data_func("/testmnclength: Test 2",
3685+ &get_mnclength_2,
3686+ test_get_mnclength);
3687+ g_test_add_data_func("/testmnclength: Test 3",
3688+ &get_mnclength_3,
3689+ test_get_mnclength);
3690+ g_test_add_data_func("/testmnclength: Test 4",
3691+ &get_mnclength_4,
3692+ test_get_mnclength);
3693+ g_test_add_data_func("/testmnclength: Test 5",
3694+ &get_mnclength_5,
3695+ test_get_mnclength);
3696+ g_test_add_data_func("/testmnclength: Test 6",
3697+ &get_mnclength_6,
3698+ test_get_mnclength);
3699+ g_test_add_data_func("/testmnclength: Test 7",
3700+ &get_mnclength_7,
3701+ test_get_mnclength);
3702+ g_test_add_data_func("/testmnclength: Test 8",
3703+ &get_mnclength_8,
3704+ test_get_mnclength);
3705+ g_test_add_data_func("/testmnclength: Test 9",
3706+ &get_mnclength_9,
3707+ test_get_mnclength);
3708+ g_test_add_data_func("/testmnclength: Test 10",
3709+ &get_mnclength_10,
3710+ test_get_mnclength);
3711+
3712+ res = g_test_run();
3713+
3714+ __ofono_builtin_mnclength.exit();
3715+
3716+ return res;
3717+}

Subscribers

People subscribed via source and target branches

to all changes: