Merge lp:~phablet-team/ofono/ofono-bug-updates into lp:~phablet-team/ofono/ubuntu
- ofono-bug-updates
- Merge into ubuntu
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Alfonso Sanchez-Beato | ||||||||
Approved revision: | 6873 | ||||||||
Merged at revision: | 6872 | ||||||||
Proposed branch: | lp:~phablet-team/ofono/ofono-bug-updates | ||||||||
Merge into: | lp:~phablet-team/ofono/ubuntu | ||||||||
Diff against target: |
1983 lines (+915/-168) 31 files modified
Makefile.am (+3/-0) debian/changelog (+21/-0) doc/networktime-api.txt (+47/-0) doc/radio-settings-api.txt (+14/-0) drivers/mtkmodem/gprs.c (+32/-4) drivers/mtkmodem/mtk_constants.h (+50/-11) drivers/mtkmodem/mtkreply.c (+68/-0) drivers/mtkmodem/mtkreply.h (+40/-0) drivers/mtkmodem/mtkutil.c (+92/-22) drivers/mtkmodem/mtkutil.h (+13/-0) drivers/mtkmodem/radio-settings.c (+53/-2) drivers/mtkmodem/voicecall.c (+3/-3) drivers/rilmodem/gprs-context.c (+13/-4) drivers/rilmodem/gprs.h (+1/-0) drivers/rilmodem/radio-settings.c (+30/-1) drivers/rilmodem/rilutil.h (+6/-0) gril/gril.c (+36/-2) gril/gril.h (+20/-11) gril/grilreply.c (+2/-2) gril/grilrequest.c (+22/-10) gril/grilrequest.h (+1/-0) gril/ril_constants.h (+2/-0) include/radio-settings.h (+11/-0) plugins/mtk.c (+122/-26) plugins/nettime.c (+88/-55) plugins/ril.c (+14/-9) plugins/ubuntu-apndb.c (+4/-2) src/radio-settings.c (+60/-1) test/list-modems (+2/-1) unit/test-mtkreply.c (+43/-0) unit/test-mtkunsol.c (+2/-2) |
||||||||
To merge this branch: | bzr merge lp:~phablet-team/ofono/ofono-bug-updates | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alfonso Sanchez-Beato | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email:
|
Commit message
* build, doc, gril, mtkmodem, rilmodem, plugins/
RadioSettings 'ModemTechnologies' property. This property can be
used by clients to determine the supported raido technologies supported
by a specific modem instance (LP: #1346790).
* gril/gril.c, mtkmodem, plugins/mtk.c, unit: add support for SIM hot insertion/
removal support. Hot-swap is disabled by default. It can be enabled
by defining OFONO_RIL_
* gril, rilmodem, plugins/
MMS contexts, the cid and a special MMS-specific data profile need
to included in the SETUP_DATA_CALL request.
* plugins/
Description of the change
This merge proposal includes the following changes:
1. Radio technologies ( eg. "umts", "lte", ... ) supported by the modem are now exported in a new RadioSettings "ModemTechnologies" property (LP: #1346790).
2. MTK modems now respond to hot SIM removal
3. Minor fix to priovisioning MVNO/IMSI logic (LP: #1347733)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Martti Piirainen (piiramar) wrote : | # |
Sanity checked in mako on top of image 157: All four changes are included, basic voice and messaging functionality is unaffected.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:6873
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Martti Piirainen (piiramar) wrote : | # |
For reference, all six changes have previously been reviewed and approved in GitHub:
* multi-modem support for nettime plugin: https:/
* expose RadioSettings 'ModemTechnologies' property: https:/
* add support for SIM hot insertion/removal support: https:/
* MTK MMS fix: https:/
* Fix MTK data attachment: https:/
* fix IMSI provisioning: https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Martti Piirainen (piiramar) wrote : | # |
Some test results on top image 165 with an MTK-based device.
* multi-modem support for nettime plugin: As expected, using test scripts:
root@ubuntu-
{ MobileNetworkCode = 91, DST = 1, UTC = 1406870506, Timezone = 10800, MobileCountryCode = 244, Received = 24 }
root@ubuntu-
{ Received = 38, UTC = 1406870521, DST = 1, Timezone = 10800, MobileNetworkCode = 05, MobileCountryCode = 244 }
* expose RadioSettings 'ModemTechnologies' property: As expected, using test scripts:
root@ubuntu-
[ /ril_1 ]
[ org.ofono.
[ /ril_0 ]
[ org.ofono.
* add support for SIM hot insertion/removal support: As expected, using the 'monitor-ofono' test script. When the SIM is removed, the org.ofono.
* MTK MMS fix: Successfully received MMS via modem /ril_0.
* Fix MTK data attachment: Successfully tested according to the steps from https:/
* fix IMSI provisioning: Verified that the code changes are in place (already tested on 2014-07-30).
* Also tested basic voice and messaging functionality, no regression seen.
Looking good.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
Approved
Preview Diff
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2014-07-16 22:55:36 +0000 |
3 | +++ Makefile.am 2014-07-31 23:42:19 +0000 |
4 | @@ -142,6 +142,8 @@ |
5 | drivers/mtkmodem/mtkrequest.c \ |
6 | drivers/mtkmodem/mtkunsol.h \ |
7 | drivers/mtkmodem/mtkunsol.c \ |
8 | + drivers/mtkmodem/mtkreply.h \ |
9 | + drivers/mtkmodem/mtkreply.c \ |
10 | drivers/mtkmodem/voicecall.c \ |
11 | drivers/mtkmodem/gprs.c \ |
12 | drivers/mtkmodem/radio-settings.c |
13 | @@ -820,6 +822,7 @@ |
14 | unit_objects += $(unit_test_mtkrequest_OBJECTS) |
15 | |
16 | unit_test_mtkreply_SOURCES = unit/test-mtkreply.c $(gril_sources) \ |
17 | + drivers/mtkmodem/mtkreply.c \ |
18 | src/log.c src/util.c src/simutil.c \ |
19 | src/common.c gatchat/ringbuffer.c |
20 | unit_test_mtkreply_LDADD = @GLIB_LIBS@ -ldl |
21 | |
22 | === modified file 'debian/changelog' |
23 | --- debian/changelog 2014-07-21 18:59:17 +0000 |
24 | +++ debian/changelog 2014-07-31 23:42:19 +0000 |
25 | @@ -1,3 +1,24 @@ |
26 | +ofono (1.12.bzr6872+14.10.20140729-0ubuntu1) UNRELEASED; urgency=medium |
27 | + |
28 | + [ Alfonso Sanchez-Beato ] |
29 | + * doc, plugins/nettime.c: multi-modem support for nettime plugin |
30 | + * build, doc, gril, mtkmodem, rilmodem, plugins/ril.c,mtk.c: expose |
31 | + RadioSettings 'ModemTechnologies' property. This property can be |
32 | + used by clients to determine the supported raido technologies supported |
33 | + by a specific modem instance (LP: #1346790). |
34 | + * gril/gril.c, mtkmodem, plugins/mtk.c, unit: add support for SIM hot insertion/ |
35 | + removal support. Hot-swap is disabled by default. It can be enabled |
36 | + by defining OFONO_RIL_HOT_SIM_SWAP env var. |
37 | + * gril, rilmodem, plugins/mtk.c,ril.c: MTK MMS fix. For standalone |
38 | + MMS contexts, the cid and a special MMS-specific data profile need |
39 | + to included in the SETUP_DATA_CALL request. |
40 | + * gril, mtk, ril, mtkmodem, rilmodem: Fix MTK data attachment (LP: #1349911) |
41 | + |
42 | + [ Martti Piirainen ] |
43 | + * plugins/ubuntu-apndb.c: fix IMSI provisioning (LP: #1347733) |
44 | + |
45 | + -- Tony Espy <espy@canonical.com> Tue, 29 Jul 2014 16:46:39 -0400 |
46 | + |
47 | ofono (1.12.bzr6870+14.10.20140721-0ubuntu1) utopic; urgency=medium |
48 | |
49 | [ Martti Piirainen ] |
50 | |
51 | === added file 'doc/networktime-api.txt' |
52 | --- doc/networktime-api.txt 1970-01-01 00:00:00 +0000 |
53 | +++ doc/networktime-api.txt 2014-07-31 23:42:19 +0000 |
54 | @@ -0,0 +1,47 @@ |
55 | +Network time hierarchy |
56 | +====================== |
57 | + |
58 | +Service org.ofono |
59 | +Interface org.ofono.NetworkTime |
60 | +Object path [variable prefix]/{modem0,modem1,...} |
61 | + |
62 | +Methods dict GetNetworkTime() |
63 | + |
64 | + Returns the current time and date as notified |
65 | + by the cellular network. The dictionary |
66 | + contains the following possible keys: |
67 | + |
68 | + int64 UTC [optional] |
69 | + Network time in seconds from epoch. |
70 | + Receiving entity obtains current real |
71 | + time by adding the value from monotonic |
72 | + clock e.g. |
73 | + clock_gettime(CLOCK_MONOTONIC,...) and |
74 | + substracting "Received" key value. |
75 | + |
76 | + int32 Timezone [optional] |
77 | + Current timezone offset in seconds from |
78 | + UTC. |
79 | + |
80 | + uint32 DST [optional] |
81 | + Current daylight saving setting in |
82 | + hours. |
83 | + |
84 | + int64 Received [optional] |
85 | + Monotonic time as returned by |
86 | + clock_gettime(CLOCK_MONOTONIC,...) when |
87 | + the network time is received. |
88 | + |
89 | + string MobileCountryCode |
90 | + The Mobile country code of the |
91 | + current network operator. |
92 | + |
93 | + string MobileNetworkCode |
94 | + The Mobile network code of the |
95 | + current network operator. |
96 | + |
97 | +Signals NetworkTimeChanged(dict) |
98 | + |
99 | + Returns a dictionary with the same keys as |
100 | + GetNetworkTime() when a NITZ event is received. |
101 | + |
102 | |
103 | === modified file 'doc/radio-settings-api.txt' |
104 | --- doc/radio-settings-api.txt 2011-03-08 19:28:35 +0000 |
105 | +++ doc/radio-settings-api.txt 2014-07-31 23:42:19 +0000 |
106 | @@ -45,6 +45,20 @@ |
107 | "umts" Only UMTS used for radio access. |
108 | "lte" Only LTE used for radio access. |
109 | |
110 | + NOTE: In Ubuntu for Phones branch the description above |
111 | + is no longer valid. Usage of "any" is deprecated and, |
112 | + after setting the property, RAT selection will be done |
113 | + automatically based on reception and availability among |
114 | + the selected technology *and* less advanced |
115 | + technologies. For instance, if preference is "umts", |
116 | + at a given moment we could be registered in a gsm or |
117 | + umts network, but never in an lte one. |
118 | + |
119 | + array{string} ModemTechnologies [readonly, optional] |
120 | + |
121 | + List of values for TechnologyPreference property |
122 | + supported by the modem. |
123 | + |
124 | string GsmBand [readwrite, optional] |
125 | |
126 | Frequency band in which the modem is allowed to |
127 | |
128 | === modified file 'drivers/mtkmodem/gprs.c' |
129 | --- drivers/mtkmodem/gprs.c 2014-03-20 07:46:16 +0000 |
130 | +++ drivers/mtkmodem/gprs.c 2014-07-31 23:42:19 +0000 |
131 | @@ -41,6 +41,7 @@ |
132 | |
133 | #include "common.h" |
134 | |
135 | +#include "mtkutil.h" |
136 | #include "mtkmodem.h" |
137 | #include "mtk_constants.h" |
138 | #include "mtkrequest.h" |
139 | @@ -79,6 +80,7 @@ |
140 | g_ril_print_response_no_args(gd->ril, message); |
141 | |
142 | gd->ofono_attached = attach_data->set_attached; |
143 | + mtk_set_attach_state(gd->modem, gd->ofono_attached); |
144 | |
145 | CALLBACK_WITH_SUCCESS(cb, cbd->data); |
146 | } else { |
147 | @@ -115,7 +117,7 @@ |
148 | |
149 | g_mtk_request_set_gprs_connect_type(gd->ril, attached, &rilp); |
150 | |
151 | - if (g_ril_send(gd->ril, RIL_REQUEST_SET_GPRS_CONNECT_TYPE, &rilp, |
152 | + if (g_ril_send(gd->ril, MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE, &rilp, |
153 | mtk_gprs_set_connect_type_cb, cbd, g_free) == 0) { |
154 | ofono_error("%s: send failed", __func__); |
155 | g_free(cbd); |
156 | @@ -123,10 +125,21 @@ |
157 | } |
158 | } |
159 | |
160 | +static void detach_event(struct ril_msg *message, gpointer user_data) |
161 | +{ |
162 | + struct ofono_gprs *gprs = user_data; |
163 | + struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); |
164 | + |
165 | + g_ril_print_unsol_no_args(gd->ril, message); |
166 | + |
167 | + mtk_detach_received(gd->modem); |
168 | +} |
169 | + |
170 | static int mtk_gprs_probe(struct ofono_gprs *gprs, |
171 | unsigned int vendor, void *data) |
172 | { |
173 | - GRil *ril = data; |
174 | + struct mtk_gprs_data *gprs_data = data; |
175 | + GRil *ril = gprs_data->gril; |
176 | struct ril_gprs_data *gd; |
177 | |
178 | gd = g_try_new0(struct ril_gprs_data, 1); |
179 | @@ -135,19 +148,34 @@ |
180 | |
181 | ril_gprs_start(ril, gprs, gd); |
182 | |
183 | + gd->modem = gprs_data->modem; |
184 | + |
185 | /* |
186 | * In MTK the event emitted when the gprs state changes is different |
187 | * from the one in AOSP ril. Overwrite the one set in parent. |
188 | */ |
189 | - gd->state_changed_unsol = RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED; |
190 | + gd->state_changed_unsol = |
191 | + MTK_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED; |
192 | + |
193 | + g_ril_register(gd->ril, MTK_RIL_UNSOL_GPRS_DETACH, detach_event, gprs); |
194 | |
195 | return 0; |
196 | } |
197 | |
198 | +static void mtk_gprs_remove(struct ofono_gprs *gprs) |
199 | +{ |
200 | + struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); |
201 | + |
202 | + gd->ofono_attached = FALSE; |
203 | + mtk_set_attach_state(gd->modem, gd->ofono_attached); |
204 | + |
205 | + ril_gprs_remove(gprs); |
206 | +} |
207 | + |
208 | static struct ofono_gprs_driver driver = { |
209 | .name = MTKMODEM, |
210 | .probe = mtk_gprs_probe, |
211 | - .remove = ril_gprs_remove, |
212 | + .remove = mtk_gprs_remove, |
213 | .set_attached = mtk_gprs_set_attached, |
214 | .attached_status = ril_gprs_registration_status, |
215 | }; |
216 | |
217 | === modified file 'drivers/mtkmodem/mtk_constants.h' |
218 | --- drivers/mtkmodem/mtk_constants.h 2014-06-12 10:51:14 +0000 |
219 | +++ drivers/mtkmodem/mtk_constants.h 2014-07-31 23:42:19 +0000 |
220 | @@ -23,18 +23,57 @@ |
221 | #define MTK_CONSTANTS_H |
222 | |
223 | /* RIL Request Messages */ |
224 | -#define RIL_REQUEST_RADIO_POWEROFF 2011 |
225 | -#define RIL_REQUEST_DUAL_SIM_MODE_SWITCH 2012 |
226 | -#define RIL_REQUEST_SET_GPRS_CONNECT_TYPE 2016 |
227 | -#define RIL_REQUEST_SET_GPRS_TRANSFER_TYPE 2017 |
228 | -#define RIL_REQUEST_RADIO_POWERON 2033 |
229 | -#define RIL_REQUEST_SET_CALL_INDICATION 2036 |
230 | -#define RIL_REQUEST_SET_FD_MODE 2073 |
231 | +#define MTK_RIL_REQUEST_RADIO_POWEROFF 2011 |
232 | +#define MTK_RIL_REQUEST_DUAL_SIM_MODE_SWITCH 2012 |
233 | +#define MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE 2016 |
234 | +#define MTK_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE 2017 |
235 | +#define MTK_RIL_REQUEST_RADIO_POWERON 2033 |
236 | +#define MTK_RIL_REQUEST_SET_CALL_INDICATION 2036 |
237 | +#define MTK_RIL_REQUEST_GET_3G_CAPABILITY 2038 |
238 | +#define MTK_RIL_REQUEST_SET_FD_MODE 2073 |
239 | |
240 | /* RIL Unsolicited Messages */ |
241 | -#define RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE 3008 |
242 | -#define RIL_UNSOL_CALL_PROGRESS_INFO 3004 |
243 | -#define RIL_UNSOL_INCOMING_CALL_INDICATION 3014 |
244 | -#define RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED 3022 |
245 | +#define MTK_RIL_UNSOL_MTK_BASE 3000 |
246 | + |
247 | +#define MTK_RIL_UNSOL_NEIGHBORING_CELL_INFO (MTK_RIL_UNSOL_MTK_BASE + 0) |
248 | +#define MTK_RIL_UNSOL_NETWORK_INFO (MTK_RIL_UNSOL_MTK_BASE + 1) |
249 | +#define MTK_RIL_UNSOL_CALL_FORWARDING (MTK_RIL_UNSOL_MTK_BASE + 2) |
250 | +#define MTK_RIL_UNSOL_CRSS_NOTIFICATION (MTK_RIL_UNSOL_MTK_BASE + 3) |
251 | +#define MTK_RIL_UNSOL_CALL_PROGRESS_INFO (MTK_RIL_UNSOL_MTK_BASE + 4) |
252 | +#define MTK_RIL_UNSOL_PHB_READY_NOTIFICATION (MTK_RIL_UNSOL_MTK_BASE + 5) |
253 | +#define MTK_RIL_UNSOL_SPEECH_INFO (MTK_RIL_UNSOL_MTK_BASE + 6) |
254 | +#define MTK_RIL_UNSOL_SIM_INSERTED_STATUS (MTK_RIL_UNSOL_MTK_BASE + 7) |
255 | +#define MTK_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE (MTK_RIL_UNSOL_MTK_BASE + 8) |
256 | +#define MTK_RIL_UNSOL_ME_SMS_STORAGE_FULL (MTK_RIL_UNSOL_MTK_BASE + 9) |
257 | +#define MTK_RIL_UNSOL_SMS_READY_NOTIFICATION (MTK_RIL_UNSOL_MTK_BASE + 10) |
258 | +#define MTK_RIL_UNSOL_SCRI_RESULT (MTK_RIL_UNSOL_MTK_BASE + 11) |
259 | +#define MTK_RIL_UNSOL_VT_STATUS_INFO (MTK_RIL_UNSOL_MTK_BASE + 12) |
260 | +#define MTK_RIL_UNSOL_VT_RING_INFO (MTK_RIL_UNSOL_MTK_BASE + 13) |
261 | +#define MTK_RIL_UNSOL_INCOMING_CALL_INDICATION (MTK_RIL_UNSOL_MTK_BASE + 14) |
262 | +#define MTK_RIL_UNSOL_SIM_MISSING (MTK_RIL_UNSOL_MTK_BASE + 15) |
263 | +#define MTK_RIL_UNSOL_GPRS_DETACH (MTK_RIL_UNSOL_MTK_BASE + 16) |
264 | +#define MTK_RIL_UNSOL_ATCI_RESPONSE (MTK_RIL_UNSOL_MTK_BASE + 17) |
265 | +#define MTK_RIL_UNSOL_SIM_RECOVERY (MTK_RIL_UNSOL_MTK_BASE + 18) |
266 | +#define MTK_RIL_UNSOL_VIRTUAL_SIM_ON (MTK_RIL_UNSOL_MTK_BASE + 19) |
267 | +#define MTK_RIL_UNSOL_VIRTUAL_SIM_OFF (MTK_RIL_UNSOL_MTK_BASE + 20) |
268 | +#define MTK_RIL_UNSOL_INVALID_SIM (MTK_RIL_UNSOL_MTK_BASE + 21) |
269 | +#define MTK_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED \ |
270 | + (MTK_RIL_UNSOL_MTK_BASE + 22) |
271 | +#define MTK_RIL_UNSOL_RESPONSE_ACMT (MTK_RIL_UNSOL_MTK_BASE + 23) |
272 | +#define MTK_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT (MTK_RIL_UNSOL_MTK_BASE + 24) |
273 | +#define MTK_RIL_UNSOL_IMEI_LOCK (MTK_RIL_UNSOL_MTK_BASE + 25) |
274 | +#define MTK_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED (MTK_RIL_UNSOL_MTK_BASE + 26) |
275 | +#define MTK_RIL_UNSOL_SIM_PLUG_OUT (MTK_RIL_UNSOL_MTK_BASE + 27) |
276 | +#define MTK_RIL_UNSOL_SIM_PLUG_IN (MTK_RIL_UNSOL_MTK_BASE + 28) |
277 | +#define MTK_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION (MTK_RIL_UNSOL_MTK_BASE + 29) |
278 | +#define MTK_RIL_UNSOL_RESPONSE_PLMN_CHANGED (MTK_RIL_UNSOL_MTK_BASE + 30) |
279 | +#define MTK_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED \ |
280 | + (MTK_RIL_UNSOL_MTK_BASE + 31) |
281 | +#define MTK_RIL_UNSOL_STK_EVDL_CALL (MTK_RIL_UNSOL_MTK_BASE + 32) |
282 | +#define MTK_RIL_UNSOL_DATA_PACKETS_FLUSH (MTK_RIL_UNSOL_MTK_BASE + 33) |
283 | +#define MTK_RIL_UNSOL_CIPHER_INDICATION (MTK_RIL_UNSOL_MTK_BASE + 34) |
284 | +#define MTK_RIL_UNSOL_FEMTOCELL_INFO (MTK_RIL_UNSOL_MTK_BASE + 35) |
285 | +#define MTK_RIL_UNSOL_CNAP (MTK_RIL_UNSOL_MTK_BASE + 36) |
286 | +#define MTK_RIL_UNSOL_RAC_UPDATE (MTK_RIL_UNSOL_MTK_BASE + 37) |
287 | |
288 | #endif /* MTK_CONSTANTS_H */ |
289 | |
290 | === added file 'drivers/mtkmodem/mtkreply.c' |
291 | --- drivers/mtkmodem/mtkreply.c 1970-01-01 00:00:00 +0000 |
292 | +++ drivers/mtkmodem/mtkreply.c 2014-07-31 23:42:19 +0000 |
293 | @@ -0,0 +1,68 @@ |
294 | +/* |
295 | + * |
296 | + * MTK driver for ofono/rilmodem |
297 | + * |
298 | + * Copyright (C) 2014 Canonical Ltd. |
299 | + * |
300 | + * This program is free software; you can redistribute it and/or modify |
301 | + * it under the terms of the GNU General Public License version 2 as |
302 | + * published by the Free Software Foundation. |
303 | + * |
304 | + * This program is distributed in the hope that it will be useful, |
305 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
306 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
307 | + * GNU General Public License for more details. |
308 | + * |
309 | + * You should have received a copy of the GNU General Public License |
310 | + * along with this program; if not, write to the Free Software |
311 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
312 | + * |
313 | + */ |
314 | + |
315 | +#ifdef HAVE_CONFIG_H |
316 | +#include <config.h> |
317 | +#endif |
318 | + |
319 | +#include <stdio.h> |
320 | + |
321 | +#include <glib.h> |
322 | + |
323 | +#include <ofono/log.h> |
324 | + |
325 | +#include "mtkreply.h" |
326 | + |
327 | +int g_mtk_reply_parse_get_3g_capability(GRil *gril, |
328 | + const struct ril_msg *message) |
329 | +{ |
330 | + struct parcel rilp; |
331 | + int sim_3g, numint, slot; |
332 | + |
333 | + g_ril_init_parcel(message, &rilp); |
334 | + |
335 | + numint = parcel_r_int32(&rilp); |
336 | + if (numint < 1) { |
337 | + ofono_error("%s: wrong format", __func__); |
338 | + goto error; |
339 | + } |
340 | + |
341 | + /* |
342 | + * Bitmap with 3g capability per slot. Reply is the same regardless of |
343 | + * the socket used to sent the request. |
344 | + */ |
345 | + sim_3g = parcel_r_int32(&rilp); |
346 | + |
347 | + if (rilp.malformed) { |
348 | + ofono_error("%s: malformed parcel", __func__); |
349 | + goto error; |
350 | + } |
351 | + |
352 | + g_ril_append_print_buf(gril, "{%d}", sim_3g); |
353 | + g_ril_print_response(gril, message); |
354 | + |
355 | + slot = g_ril_get_slot(gril); |
356 | + |
357 | + return (sim_3g >> slot) & 0x01; |
358 | + |
359 | +error: |
360 | + return -1; |
361 | +} |
362 | |
363 | === added file 'drivers/mtkmodem/mtkreply.h' |
364 | --- drivers/mtkmodem/mtkreply.h 1970-01-01 00:00:00 +0000 |
365 | +++ drivers/mtkmodem/mtkreply.h 2014-07-31 23:42:19 +0000 |
366 | @@ -0,0 +1,40 @@ |
367 | +/* |
368 | + * |
369 | + * MTK driver for ofono/rilmodem |
370 | + * |
371 | + * Copyright (C) 2014 Canonical Ltd. |
372 | + * |
373 | + * This program is free software; you can redistribute it and/or modify |
374 | + * it under the terms of the GNU General Public License version 2 as |
375 | + * published by the Free Software Foundation. |
376 | + * |
377 | + * This program is distributed in the hope that it will be useful, |
378 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
379 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
380 | + * GNU General Public License for more details. |
381 | + * |
382 | + * You should have received a copy of the GNU General Public License |
383 | + * along with this program; if not, write to the Free Software |
384 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
385 | + * |
386 | + */ |
387 | + |
388 | +#ifndef MTKREPLY_H |
389 | +#define MTKREPLY_H |
390 | + |
391 | +#include <ofono/types.h> |
392 | + |
393 | +#include "gril.h" |
394 | + |
395 | +#ifdef __cplusplus |
396 | +extern "C" { |
397 | +#endif |
398 | + |
399 | +int g_mtk_reply_parse_get_3g_capability(GRil *gril, |
400 | + const struct ril_msg *message); |
401 | + |
402 | +#ifdef __cplusplus |
403 | +} |
404 | +#endif |
405 | + |
406 | +#endif /* MTKREPLY_H */ |
407 | |
408 | === modified file 'drivers/mtkmodem/mtkutil.c' |
409 | --- drivers/mtkmodem/mtkutil.c 2014-06-12 10:51:14 +0000 |
410 | +++ drivers/mtkmodem/mtkutil.c 2014-07-31 23:42:19 +0000 |
411 | @@ -27,20 +27,22 @@ |
412 | const char *mtk_request_id_to_string(int req) |
413 | { |
414 | switch (req) { |
415 | - case RIL_REQUEST_RADIO_POWEROFF: |
416 | - return "RIL_REQUEST_RADIO_POWEROFF"; |
417 | - case RIL_REQUEST_DUAL_SIM_MODE_SWITCH: |
418 | - return "RIL_REQUEST_DUAL_SIM_MODE_SWITCH"; |
419 | - case RIL_REQUEST_SET_GPRS_CONNECT_TYPE: |
420 | - return "RIL_REQUEST_SET_GPRS_CONNECT_TYPE"; |
421 | - case RIL_REQUEST_SET_GPRS_TRANSFER_TYPE: |
422 | - return "RIL_REQUEST_SET_GPRS_TRANSFER_TYPE"; |
423 | - case RIL_REQUEST_RADIO_POWERON: |
424 | - return "RIL_REQUEST_RADIO_POWERON"; |
425 | - case RIL_REQUEST_SET_CALL_INDICATION: |
426 | - return "RIL_REQUEST_SET_CALL_INDICATION"; |
427 | - case RIL_REQUEST_SET_FD_MODE: |
428 | - return "RIL_REQUEST_SET_FD_MODE"; |
429 | + case MTK_RIL_REQUEST_RADIO_POWEROFF: |
430 | + return "MTK_RIL_REQUEST_RADIO_POWEROFF"; |
431 | + case MTK_RIL_REQUEST_DUAL_SIM_MODE_SWITCH: |
432 | + return "MTK_RIL_REQUEST_DUAL_SIM_MODE_SWITCH"; |
433 | + case MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE: |
434 | + return "MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE"; |
435 | + case MTK_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE: |
436 | + return "MTK_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE"; |
437 | + case MTK_RIL_REQUEST_RADIO_POWERON: |
438 | + return "MTK_RIL_REQUEST_RADIO_POWERON"; |
439 | + case MTK_RIL_REQUEST_SET_CALL_INDICATION: |
440 | + return "MTK_RIL_REQUEST_SET_CALL_INDICATION"; |
441 | + case MTK_RIL_REQUEST_GET_3G_CAPABILITY: |
442 | + return "MTK_RIL_REQUEST_GET_3G_CAPABILITY"; |
443 | + case MTK_RIL_REQUEST_SET_FD_MODE: |
444 | + return "MTK_RIL_REQUEST_SET_FD_MODE"; |
445 | default: |
446 | return NULL; |
447 | } |
448 | @@ -49,14 +51,82 @@ |
449 | const char *mtk_unsol_request_to_string(int req) |
450 | { |
451 | switch (req) { |
452 | - case RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE: |
453 | - return "RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE"; |
454 | - case RIL_UNSOL_CALL_PROGRESS_INFO: |
455 | - return "RIL_UNSOL_CALL_PROGRESS_INFO"; |
456 | - case RIL_UNSOL_INCOMING_CALL_INDICATION: |
457 | - return "RIL_UNSOL_INCOMING_CALL_INDICATION"; |
458 | - case RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED: |
459 | - return "RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED"; |
460 | + case MTK_RIL_UNSOL_NEIGHBORING_CELL_INFO: |
461 | + return "MTK_RIL_UNSOL_NEIGHBORING_CELL_INFO"; |
462 | + case MTK_RIL_UNSOL_NETWORK_INFO: |
463 | + return "MTK_RIL_UNSOL_NETWORK_INFO"; |
464 | + case MTK_RIL_UNSOL_CALL_FORWARDING: |
465 | + return "MTK_RIL_UNSOL_CALL_FORWARDING"; |
466 | + case MTK_RIL_UNSOL_CRSS_NOTIFICATION: |
467 | + return "MTK_RIL_UNSOL_CRSS_NOTIFICATION"; |
468 | + case MTK_RIL_UNSOL_CALL_PROGRESS_INFO: |
469 | + return "MTK_RIL_UNSOL_CALL_PROGRESS_INFO"; |
470 | + case MTK_RIL_UNSOL_PHB_READY_NOTIFICATION: |
471 | + return "MTK_RIL_UNSOL_PHB_READY_NOTIFICATION"; |
472 | + case MTK_RIL_UNSOL_SPEECH_INFO: |
473 | + return "MTK_RIL_UNSOL_SPEECH_INFO"; |
474 | + case MTK_RIL_UNSOL_SIM_INSERTED_STATUS: |
475 | + return "MTK_RIL_UNSOL_SIM_INSERTED_STATUS"; |
476 | + case MTK_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE: |
477 | + return "MTK_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE"; |
478 | + case MTK_RIL_UNSOL_ME_SMS_STORAGE_FULL: |
479 | + return "MTK_RIL_UNSOL_ME_SMS_STORAGE_FULL"; |
480 | + case MTK_RIL_UNSOL_SMS_READY_NOTIFICATION: |
481 | + return "MTK_RIL_UNSOL_SMS_READY_NOTIFICATION"; |
482 | + case MTK_RIL_UNSOL_SCRI_RESULT: |
483 | + return "MTK_RIL_UNSOL_SCRI_RESULT"; |
484 | + case MTK_RIL_UNSOL_VT_STATUS_INFO: |
485 | + return "MTK_RIL_UNSOL_VT_STATUS_INFO"; |
486 | + case MTK_RIL_UNSOL_VT_RING_INFO: |
487 | + return "MTK_RIL_UNSOL_VT_RING_INFO"; |
488 | + case MTK_RIL_UNSOL_INCOMING_CALL_INDICATION: |
489 | + return "MTK_RIL_UNSOL_INCOMING_CALL_INDICATION"; |
490 | + case MTK_RIL_UNSOL_SIM_MISSING: |
491 | + return "MTK_RIL_UNSOL_SIM_MISSING"; |
492 | + case MTK_RIL_UNSOL_GPRS_DETACH: |
493 | + return "MTK_RIL_UNSOL_GPRS_DETACH"; |
494 | + case MTK_RIL_UNSOL_ATCI_RESPONSE: |
495 | + return "MTK_RIL_UNSOL_ATCI_RESPONSE"; |
496 | + case MTK_RIL_UNSOL_SIM_RECOVERY: |
497 | + return "MTK_RIL_UNSOL_SIM_RECOVERY"; |
498 | + case MTK_RIL_UNSOL_VIRTUAL_SIM_ON: |
499 | + return "MTK_RIL_UNSOL_VIRTUAL_SIM_ON"; |
500 | + case MTK_RIL_UNSOL_VIRTUAL_SIM_OFF: |
501 | + return "MTK_RIL_UNSOL_VIRTUAL_SIM_OFF"; |
502 | + case MTK_RIL_UNSOL_INVALID_SIM: |
503 | + return "MTK_RIL_UNSOL_INVALID_SIM"; |
504 | + case MTK_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED: |
505 | + return "MTK_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED"; |
506 | + case MTK_RIL_UNSOL_RESPONSE_ACMT: |
507 | + return "MTK_RIL_UNSOL_RESPONSE_ACMT"; |
508 | + case MTK_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT: |
509 | + return "MTK_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT"; |
510 | + case MTK_RIL_UNSOL_IMEI_LOCK: |
511 | + return "MTK_RIL_UNSOL_IMEI_LOCK"; |
512 | + case MTK_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED: |
513 | + return "MTK_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED"; |
514 | + case MTK_RIL_UNSOL_SIM_PLUG_OUT: |
515 | + return "MTK_RIL_UNSOL_SIM_PLUG_OUT"; |
516 | + case MTK_RIL_UNSOL_SIM_PLUG_IN: |
517 | + return "MTK_RIL_UNSOL_SIM_PLUG_IN"; |
518 | + case MTK_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION: |
519 | + return "MTK_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION"; |
520 | + case MTK_RIL_UNSOL_RESPONSE_PLMN_CHANGED: |
521 | + return "MTK_RIL_UNSOL_RESPONSE_PLMN_CHANGED"; |
522 | + case MTK_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED: |
523 | + return "MTK_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED"; |
524 | + case MTK_RIL_UNSOL_STK_EVDL_CALL: |
525 | + return "MTK_RIL_UNSOL_STK_EVDL_CALL"; |
526 | + case MTK_RIL_UNSOL_DATA_PACKETS_FLUSH: |
527 | + return "MTK_RIL_UNSOL_DATA_PACKETS_FLUSH"; |
528 | + case MTK_RIL_UNSOL_CIPHER_INDICATION: |
529 | + return "MTK_RIL_UNSOL_CIPHER_INDICATION"; |
530 | + case MTK_RIL_UNSOL_FEMTOCELL_INFO: |
531 | + return "MTK_RIL_UNSOL_FEMTOCELL_INFO"; |
532 | + case MTK_RIL_UNSOL_CNAP: |
533 | + return "MTK_RIL_UNSOL_CNAP"; |
534 | + case MTK_RIL_UNSOL_RAC_UPDATE: |
535 | + return "MTK_RIL_UNSOL_RAC_UPDATE"; |
536 | default: |
537 | return NULL; |
538 | } |
539 | |
540 | === modified file 'drivers/mtkmodem/mtkutil.h' |
541 | --- drivers/mtkmodem/mtkutil.h 2014-03-20 07:46:16 +0000 |
542 | +++ drivers/mtkmodem/mtkutil.h 2014-07-31 23:42:19 +0000 |
543 | @@ -22,10 +22,23 @@ |
544 | #ifndef MTKUTIL_H |
545 | #define MTKUTIL_H |
546 | |
547 | +#include <ofono/types.h> |
548 | +#include <gril.h> |
549 | + |
550 | #ifdef __cplusplus |
551 | extern "C" { |
552 | #endif |
553 | |
554 | +struct ofono_modem; |
555 | + |
556 | +void mtk_set_attach_state(struct ofono_modem *modem, ofono_bool_t attached); |
557 | +void mtk_detach_received(struct ofono_modem *modem); |
558 | + |
559 | +struct mtk_gprs_data { |
560 | + GRil *gril; |
561 | + struct ofono_modem *modem; |
562 | +}; |
563 | + |
564 | const char *mtk_request_id_to_string(int req); |
565 | const char *mtk_unsol_request_to_string(int req); |
566 | |
567 | |
568 | === modified file 'drivers/mtkmodem/radio-settings.c' |
569 | --- drivers/mtkmodem/radio-settings.c 2014-06-12 10:51:14 +0000 |
570 | +++ drivers/mtkmodem/radio-settings.c 2014-07-31 23:42:19 +0000 |
571 | @@ -36,6 +36,7 @@ |
572 | |
573 | #include "mtk_constants.h" |
574 | #include "mtkunsol.h" |
575 | +#include "mtkreply.h" |
576 | #include "mtkrequest.h" |
577 | |
578 | #include "common.h" |
579 | @@ -90,7 +91,7 @@ |
580 | g_mtk_request_set_fd_mode(rsd->ril, MTK_FD_MODE_SCREEN_STATUS, |
581 | enable ? FALSE : TRUE, 0, &rilp); |
582 | |
583 | - if (g_ril_send(rsd->ril, RIL_REQUEST_SET_FD_MODE, &rilp, |
584 | + if (g_ril_send(rsd->ril, MTK_RIL_REQUEST_SET_FD_MODE, &rilp, |
585 | mtk_set_fd_mode_cb, cbd, g_free) <= 0) { |
586 | g_free(cbd); |
587 | g_free(user); |
588 | @@ -118,6 +119,55 @@ |
589 | return 0; |
590 | } |
591 | |
592 | +static void mtk_query_modem_rats_cb(struct ril_msg *message, gpointer user_data) |
593 | +{ |
594 | + struct cb_data *cbd = user_data; |
595 | + struct ofono_radio_settings *rs = cbd->user; |
596 | + struct radio_data *rd = ofono_radio_settings_get_data(rs); |
597 | + ofono_radio_settings_modem_rats_query_cb_t cb = cbd->cb; |
598 | + ofono_bool_t modem_rats[OFONO_RADIO_ACCESS_MODE_LAST] = { FALSE }; |
599 | + int is_3g; |
600 | + |
601 | + if (message->error != RIL_E_SUCCESS) { |
602 | + ofono_error("%s: error %s", __func__, |
603 | + ril_error_to_string(message->error)); |
604 | + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); |
605 | + return; |
606 | + } |
607 | + |
608 | + is_3g = g_mtk_reply_parse_get_3g_capability(rd->ril, message); |
609 | + if (is_3g < 0) { |
610 | + ofono_error("%s: parse error", __func__); |
611 | + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); |
612 | + return; |
613 | + } |
614 | + |
615 | + modem_rats[OFONO_RADIO_ACCESS_MODE_GSM] = TRUE; |
616 | + |
617 | + if (is_3g) { |
618 | + modem_rats[OFONO_RADIO_ACCESS_MODE_UMTS] = TRUE; |
619 | + |
620 | + if (getenv("OFONO_RIL_RAT_LTE")) |
621 | + modem_rats[OFONO_RADIO_ACCESS_MODE_LTE] = TRUE; |
622 | + } |
623 | + |
624 | + CALLBACK_WITH_SUCCESS(cb, modem_rats, cbd->data); |
625 | +} |
626 | + |
627 | +static void mtk_query_modem_rats(struct ofono_radio_settings *rs, |
628 | + ofono_radio_settings_modem_rats_query_cb_t cb, |
629 | + void *data) |
630 | +{ |
631 | + struct radio_data *rd = ofono_radio_settings_get_data(rs); |
632 | + struct cb_data *cbd = cb_data_new(cb, data, rs); |
633 | + |
634 | + if (g_ril_send(rd->ril, MTK_RIL_REQUEST_GET_3G_CAPABILITY, NULL, |
635 | + mtk_query_modem_rats_cb, cbd, g_free) <= 0) { |
636 | + g_free(cbd); |
637 | + CALLBACK_WITH_FAILURE(cb, NULL, data); |
638 | + } |
639 | +} |
640 | + |
641 | static struct ofono_radio_settings_driver driver = { |
642 | .name = MTKMODEM, |
643 | .probe = mtk_radio_settings_probe, |
644 | @@ -125,7 +175,8 @@ |
645 | .query_rat_mode = ril_query_rat_mode, |
646 | .set_rat_mode = ril_set_rat_mode, |
647 | .query_fast_dormancy = ril_query_fast_dormancy, |
648 | - .set_fast_dormancy = mtk_set_fast_dormancy |
649 | + .set_fast_dormancy = mtk_set_fast_dormancy, |
650 | + .query_modem_rats = mtk_query_modem_rats |
651 | }; |
652 | |
653 | void mtk_radio_settings_init(void) |
654 | |
655 | === modified file 'drivers/mtkmodem/voicecall.c' |
656 | --- drivers/mtkmodem/voicecall.c 2014-05-07 14:20:19 +0000 |
657 | +++ drivers/mtkmodem/voicecall.c 2014-07-31 23:42:19 +0000 |
658 | @@ -84,7 +84,7 @@ |
659 | call_ind->call_id, |
660 | call_ind->seq_number, &rilp); |
661 | |
662 | - if (g_ril_send(vd->ril, RIL_REQUEST_SET_CALL_INDICATION, |
663 | + if (g_ril_send(vd->ril, MTK_RIL_REQUEST_SET_CALL_INDICATION, |
664 | &rilp, mtk_set_indication_cb, vc, NULL) == 0) |
665 | ofono_error("%s: cannot send indication", __func__); |
666 | |
667 | @@ -97,11 +97,11 @@ |
668 | struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc); |
669 | |
670 | /* MTK generates this event instead of CALL_STATE_CHANGED */ |
671 | - g_ril_register(vd->ril, RIL_UNSOL_CALL_PROGRESS_INFO, |
672 | + g_ril_register(vd->ril, MTK_RIL_UNSOL_CALL_PROGRESS_INFO, |
673 | ril_call_state_notify, vc); |
674 | |
675 | /* Indicates incoming call, before telling the network our state */ |
676 | - g_ril_register(vd->ril, RIL_UNSOL_INCOMING_CALL_INDICATION, |
677 | + g_ril_register(vd->ril, MTK_RIL_UNSOL_INCOMING_CALL_INDICATION, |
678 | mtk_incoming_notify, vc); |
679 | |
680 | /* This makes the timeout a single-shot */ |
681 | |
682 | === modified file 'drivers/rilmodem/gprs-context.c' |
683 | --- drivers/rilmodem/gprs-context.c 2014-04-29 15:50:23 +0000 |
684 | +++ drivers/rilmodem/gprs-context.c 2014-07-31 23:42:19 +0000 |
685 | @@ -61,6 +61,7 @@ |
686 | enum state state; |
687 | guint call_list_id; |
688 | char *apn; |
689 | + enum ofono_gprs_context_type type; |
690 | }; |
691 | |
692 | static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc, |
693 | @@ -247,10 +248,16 @@ |
694 | request.tech = gd->tech + 2; |
695 | } |
696 | |
697 | - /* TODO: add comments about tethering, other non-public |
698 | + /* |
699 | + * TODO: add comments about tethering, other non-public |
700 | * profiles... |
701 | */ |
702 | - request.data_profile = RIL_DATA_PROFILE_DEFAULT; |
703 | + if (g_ril_vendor(gcd->ril) == OFONO_RIL_VENDOR_MTK && |
704 | + gcd->type == OFONO_GPRS_CONTEXT_TYPE_MMS) |
705 | + request.data_profile = RIL_DATA_PROFILE_MTK_MMS; |
706 | + else |
707 | + request.data_profile = RIL_DATA_PROFILE_DEFAULT; |
708 | + |
709 | request.apn = g_strdup(ctx->apn); |
710 | request.username = g_strdup(ctx->username); |
711 | request.password = g_strdup(ctx->password); |
712 | @@ -261,6 +268,7 @@ |
713 | request.auth_type = RIL_AUTH_BOTH; |
714 | |
715 | request.protocol = ctx->proto; |
716 | + request.req_cid = ctx->cid; |
717 | |
718 | if (g_ril_request_setup_data_call(gcd->ril, |
719 | &request, |
720 | @@ -405,7 +413,7 @@ |
721 | static int ril_gprs_context_probe(struct ofono_gprs_context *gc, |
722 | unsigned int vendor, void *data) |
723 | { |
724 | - GRil *ril = data; |
725 | + struct ril_gprs_context_data *ril_data = data; |
726 | struct gprs_context_data *gcd; |
727 | |
728 | DBG("*gc: %p", gc); |
729 | @@ -414,9 +422,10 @@ |
730 | if (gcd == NULL) |
731 | return -ENOMEM; |
732 | |
733 | - gcd->ril = g_ril_clone(ril); |
734 | + gcd->ril = g_ril_clone(ril_data->gril); |
735 | set_context_disconnected(gcd); |
736 | gcd->call_list_id = -1; |
737 | + gcd->type = ril_data->type; |
738 | |
739 | ofono_gprs_context_set_data(gc, gcd); |
740 | |
741 | |
742 | === modified file 'drivers/rilmodem/gprs.h' |
743 | --- drivers/rilmodem/gprs.h 2014-04-21 09:02:55 +0000 |
744 | +++ drivers/rilmodem/gprs.h 2014-07-31 23:42:19 +0000 |
745 | @@ -21,6 +21,7 @@ |
746 | |
747 | struct ril_gprs_data { |
748 | GRil *ril; |
749 | + struct ofono_modem *modem; |
750 | gboolean ofono_attached; |
751 | unsigned int max_cids; |
752 | int rild_status; |
753 | |
754 | === modified file 'drivers/rilmodem/radio-settings.c' |
755 | --- drivers/rilmodem/radio-settings.c 2014-06-12 10:47:10 +0000 |
756 | +++ drivers/rilmodem/radio-settings.c 2014-07-31 23:42:19 +0000 |
757 | @@ -200,6 +200,34 @@ |
758 | } |
759 | } |
760 | |
761 | +static ofono_bool_t query_modem_rats_cb(gpointer user_data) |
762 | +{ |
763 | + ofono_bool_t modem_rats[OFONO_RADIO_ACCESS_MODE_LAST] = { FALSE }; |
764 | + struct cb_data *cbd = user_data; |
765 | + ofono_radio_settings_modem_rats_query_cb_t cb = cbd->cb; |
766 | + |
767 | + modem_rats[OFONO_RADIO_ACCESS_MODE_GSM] = TRUE; |
768 | + modem_rats[OFONO_RADIO_ACCESS_MODE_UMTS] = TRUE; |
769 | + |
770 | + if (getenv("OFONO_RIL_RAT_LTE")) |
771 | + modem_rats[OFONO_RADIO_ACCESS_MODE_LTE] = TRUE; |
772 | + |
773 | + CALLBACK_WITH_SUCCESS(cb, modem_rats, cbd->data); |
774 | + |
775 | + g_free(cbd); |
776 | + |
777 | + return FALSE; |
778 | +} |
779 | + |
780 | +static void ril_query_modem_rats(struct ofono_radio_settings *rs, |
781 | + ofono_radio_settings_modem_rats_query_cb_t cb, |
782 | + void *data) |
783 | +{ |
784 | + struct cb_data *cbd = cb_data_new(cb, data, rs); |
785 | + |
786 | + g_idle_add(query_modem_rats_cb, cbd); |
787 | +} |
788 | + |
789 | void ril_delayed_register(const struct ofono_error *error, void *user_data) |
790 | { |
791 | struct ofono_radio_settings *rs = user_data; |
792 | @@ -246,7 +274,8 @@ |
793 | .query_rat_mode = ril_query_rat_mode, |
794 | .set_rat_mode = ril_set_rat_mode, |
795 | .query_fast_dormancy = ril_query_fast_dormancy, |
796 | - .set_fast_dormancy = ril_set_fast_dormancy |
797 | + .set_fast_dormancy = ril_set_fast_dormancy, |
798 | + .query_modem_rats = ril_query_modem_rats |
799 | }; |
800 | |
801 | void ril_radio_settings_init(void) |
802 | |
803 | === modified file 'drivers/rilmodem/rilutil.h' |
804 | --- drivers/rilmodem/rilutil.h 2014-03-20 07:46:16 +0000 |
805 | +++ drivers/rilmodem/rilutil.h 2014-07-31 23:42:19 +0000 |
806 | @@ -25,6 +25,7 @@ |
807 | #include <stdio.h> |
808 | #include <modem.h> |
809 | #include <sim.h> |
810 | +#include <gprs-context.h> |
811 | |
812 | /* TODO: create a table lookup*/ |
813 | #define PREFIX_30_NETMASK "255.255.255.252" |
814 | @@ -93,6 +94,11 @@ |
815 | ofono_sim_state_event_cb_t ril_state_watch; |
816 | }; |
817 | |
818 | +struct ril_gprs_context_data { |
819 | + GRil *gril; |
820 | + enum ofono_gprs_context_type type; |
821 | +}; |
822 | + |
823 | typedef void (*ril_util_sim_inserted_cb_t)(gboolean present, void *userdata); |
824 | |
825 | void decode_ril_error(struct ofono_error *error, const char *final); |
826 | |
827 | === modified file 'gril/gril.c' |
828 | --- gril/gril.c 2014-04-25 08:48:44 +0000 |
829 | +++ gril/gril.c 2014-07-31 23:42:19 +0000 |
830 | @@ -104,6 +104,7 @@ |
831 | gboolean in_read_handler; /* Re-entrancy guard */ |
832 | gboolean in_notify; |
833 | enum ofono_ril_vendor vendor; |
834 | + int slot; |
835 | GRilMsgIdToStrFunc req_to_string; |
836 | GRilMsgIdToStrFunc unsol_to_string; |
837 | }; |
838 | @@ -377,8 +378,8 @@ |
839 | message->req = req->req; |
840 | |
841 | if (message->error != RIL_E_SUCCESS) |
842 | - RIL_TRACE(p, "[%04d]< %s failed %s", |
843 | - message->serial_no, |
844 | + RIL_TRACE(p, "[%d,%04d]< %s failed %s", |
845 | + p->slot, message->serial_no, |
846 | request_id_to_string(p, message->req), |
847 | ril_error_to_string(message->error)); |
848 | |
849 | @@ -413,6 +414,17 @@ |
850 | |
851 | } |
852 | |
853 | +static gboolean node_check_destroyed(struct ril_notify_node *node, |
854 | + gpointer userdata) |
855 | +{ |
856 | + gboolean val = GPOINTER_TO_UINT(userdata); |
857 | + |
858 | + if (node->destroyed == val) |
859 | + return TRUE; |
860 | + |
861 | + return FALSE; |
862 | +} |
863 | + |
864 | static void handle_unsol_req(struct ril_s *p, struct ril_msg *message) |
865 | { |
866 | GHashTableIter iter; |
867 | @@ -454,6 +466,11 @@ |
868 | unsol_request_to_string(p, message->req)); |
869 | |
870 | p->in_notify = FALSE; |
871 | + |
872 | + /* Now destroy nodes possibly removed by callbacks */ |
873 | + if (found) |
874 | + ril_unregister_all(p, FALSE, node_check_destroyed, |
875 | + GUINT_TO_POINTER(TRUE)); |
876 | } |
877 | |
878 | static void dispatch(struct ril_s *p, struct ril_msg *message) |
879 | @@ -1192,6 +1209,23 @@ |
880 | return ril->parent->trace = trace; |
881 | } |
882 | |
883 | +gboolean g_ril_set_slot(GRil *ril, int slot) |
884 | +{ |
885 | + if (ril == NULL || ril->parent == NULL) |
886 | + return FALSE; |
887 | + |
888 | + ril->parent->slot = slot; |
889 | + return TRUE; |
890 | +} |
891 | + |
892 | +int g_ril_get_slot(GRil *ril) |
893 | +{ |
894 | + if (ril == NULL) |
895 | + return 0; |
896 | + |
897 | + return ril->parent->slot; |
898 | +} |
899 | + |
900 | gboolean g_ril_set_debugf(GRil *ril, |
901 | GRilDebugFunc func, gpointer user_data) |
902 | { |
903 | |
904 | === modified file 'gril/gril.h' |
905 | --- gril/gril.h 2014-03-18 10:06:57 +0000 |
906 | +++ gril/gril.h 2014-07-31 23:42:19 +0000 |
907 | @@ -69,37 +69,43 @@ |
908 | */ |
909 | #define G_RIL_TRACE(gril, fmt, arg...) do { \ |
910 | if (gril && g_ril_get_trace(gril)) \ |
911 | - ofono_debug(fmt, ## arg); \ |
912 | + ofono_debug(fmt, ## arg); \ |
913 | } while (0) |
914 | |
915 | extern char print_buf[]; |
916 | |
917 | #define g_ril_print_request(gril, token, req) \ |
918 | - G_RIL_TRACE(gril, "[%04d]> %s %s", token, \ |
919 | + G_RIL_TRACE(gril, "[%d,%04d]> %s %s", \ |
920 | + g_ril_get_slot(gril), token, \ |
921 | g_ril_request_id_to_string(gril, req), print_buf) |
922 | #define g_ril_print_request_no_args(gril, token, req) \ |
923 | - G_RIL_TRACE(gril, "[%04d]> %s", token, \ |
924 | + G_RIL_TRACE(gril, "[%d,%04d]> %s", \ |
925 | + g_ril_get_slot(gril), token, \ |
926 | g_ril_request_id_to_string(gril, req)) |
927 | -#define g_ril_print_response(gril, message) \ |
928 | - G_RIL_TRACE(gril, "[%04d]< %s %s", message->serial_no, \ |
929 | +#define g_ril_print_response(gril, message) \ |
930 | + G_RIL_TRACE(gril, "[%d,%04d]< %s %s", \ |
931 | + g_ril_get_slot(gril), \ |
932 | + message->serial_no, \ |
933 | g_ril_request_id_to_string(gril, message->req), \ |
934 | print_buf) |
935 | #define g_ril_print_response_no_args(gril, message) \ |
936 | - G_RIL_TRACE(gril, "[%04d]< %s", message->serial_no, \ |
937 | + G_RIL_TRACE(gril, "[%d,%04d]< %s", \ |
938 | + g_ril_get_slot(gril), message->serial_no, \ |
939 | g_ril_request_id_to_string(gril, message->req)) |
940 | |
941 | -#define g_ril_append_print_buf(gril, x...) do { \ |
942 | - if (gril && g_ril_get_trace(gril)) \ |
943 | - sprintf(print_buf, x); \ |
944 | +#define g_ril_append_print_buf(gril, x...) do { \ |
945 | + if (gril && g_ril_get_trace(gril)) \ |
946 | + sprintf(print_buf, x); \ |
947 | } while (0) |
948 | |
949 | #define g_ril_print_unsol(gril, message) \ |
950 | - G_RIL_TRACE(gril, "[UNSOL]< %s %s", \ |
951 | + G_RIL_TRACE(gril, "[%d,UNSOL]< %s %s", \ |
952 | + g_ril_get_slot(gril), \ |
953 | g_ril_unsol_request_to_string(gril, \ |
954 | message->req), \ |
955 | print_buf) |
956 | #define g_ril_print_unsol_no_args(gril, message) \ |
957 | - G_RIL_TRACE(gril, "[UNSOL]< %s", \ |
958 | + G_RIL_TRACE(gril, "[%d,UNSOL]< %s", g_ril_get_slot(gril), \ |
959 | g_ril_unsol_request_to_string(gril, message->req)) |
960 | |
961 | void g_ril_init_parcel(const struct ril_msg *message, struct parcel *rilp); |
962 | @@ -120,6 +126,9 @@ |
963 | gboolean g_ril_get_trace(GRil *ril); |
964 | gboolean g_ril_set_trace(GRil *ril, gboolean trace); |
965 | |
966 | +int g_ril_get_slot(GRil *ril); |
967 | +gboolean g_ril_set_slot(GRil *ril, int slot); |
968 | + |
969 | /*! |
970 | * If the function is not NULL, then on every read/write from the GIOChannel |
971 | * provided to GRil the logging function will be called with the |
972 | |
973 | === modified file 'gril/grilreply.c' |
974 | --- gril/grilreply.c 2014-07-16 22:55:36 +0000 |
975 | +++ gril/grilreply.c 2014-07-31 23:42:19 +0000 |
976 | @@ -515,8 +515,8 @@ |
977 | unsigned int i; |
978 | struct reply_sim_status *status; |
979 | |
980 | - g_ril_append_print_buf(gril, "[%04d]< %s", |
981 | - message->serial_no, |
982 | + g_ril_append_print_buf(gril, "[%d,%04d]< %s", |
983 | + g_ril_get_slot(gril), message->serial_no, |
984 | ril_request_id_to_string(message->req)); |
985 | |
986 | g_ril_init_parcel(message, &rilp); |
987 | |
988 | === modified file 'gril/grilrequest.c' |
989 | --- gril/grilrequest.c 2014-07-14 12:47:48 +0000 |
990 | +++ gril/grilrequest.c 2014-07-31 23:42:19 +0000 |
991 | @@ -54,6 +54,7 @@ |
992 | #define DATA_PROFILE_FOTA_STR "3" |
993 | #define DATA_PROFILE_CBS_STR "4" |
994 | #define DATA_PROFILE_OEM_BASE_STR "1000" |
995 | +#define DATA_PROFILE_MTK_MMS_STR "1001" |
996 | |
997 | /* SETUP_DATA_CALL_PARAMS reply parameters */ |
998 | #define MIN_DATA_CALL_REPLY_SIZE 36 |
999 | @@ -83,6 +84,9 @@ |
1000 | #define RIL_FACILITY_UNLOCK "0" |
1001 | #define RIL_FACILITY_LOCK "1" |
1002 | |
1003 | +/* Call ID should not really be a big number */ |
1004 | +#define MAX_CID_DIGITS 3 |
1005 | + |
1006 | /* |
1007 | * TODO: |
1008 | * |
1009 | @@ -238,7 +242,6 @@ |
1010 | gchar *profile_str; |
1011 | size_t apn_len; |
1012 | int num_param = SETUP_DATA_CALL_PARAMS; |
1013 | - const char *request_cid_pr = ""; |
1014 | |
1015 | DBG(""); |
1016 | |
1017 | @@ -277,6 +280,11 @@ |
1018 | case RIL_DATA_PROFILE_CBS: |
1019 | profile_str = DATA_PROFILE_CBS_STR; |
1020 | break; |
1021 | + case RIL_DATA_PROFILE_MTK_MMS: |
1022 | + if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { |
1023 | + profile_str = DATA_PROFILE_MTK_MMS_STR; |
1024 | + break; |
1025 | + } |
1026 | default: |
1027 | ofono_error("%s, invalid data_profile value: %d", |
1028 | __func__, |
1029 | @@ -325,22 +333,26 @@ |
1030 | parcel_w_string(rilp, auth_str); |
1031 | parcel_w_string(rilp, protocol_str); |
1032 | |
1033 | - if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { |
1034 | - /* MTK request_cid parameter */ |
1035 | - parcel_w_string(rilp, "1"); |
1036 | - request_cid_pr = ",1"; |
1037 | - } |
1038 | - |
1039 | g_ril_append_print_buf(gril, |
1040 | - "(%s,%s,%s,%s,%s,%s,%s%s)", |
1041 | + "(%s,%s,%s,%s,%s,%s,%s", |
1042 | tech_str, |
1043 | profile_str, |
1044 | req->apn, |
1045 | req->username, |
1046 | req->password, |
1047 | auth_str, |
1048 | - protocol_str, |
1049 | - request_cid_pr); |
1050 | + protocol_str); |
1051 | + |
1052 | + if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { |
1053 | + /* MTK request_cid parameter */ |
1054 | + char cid_str[MAX_CID_DIGITS + 1]; |
1055 | + |
1056 | + snprintf(cid_str, sizeof(cid_str), "%u", req->req_cid); |
1057 | + parcel_w_string(rilp, cid_str); |
1058 | + g_ril_append_print_buf(gril, "%s,%s", print_buf, cid_str); |
1059 | + } |
1060 | + |
1061 | + g_ril_append_print_buf(gril, "%s)", print_buf); |
1062 | |
1063 | g_free(tech_str); |
1064 | g_free(auth_str); |
1065 | |
1066 | === modified file 'gril/grilrequest.h' |
1067 | --- gril/grilrequest.h 2014-07-14 12:47:48 +0000 |
1068 | +++ gril/grilrequest.h 2014-07-31 23:42:19 +0000 |
1069 | @@ -54,6 +54,7 @@ |
1070 | gchar *password; |
1071 | guint auth_type; |
1072 | guint protocol; |
1073 | + unsigned req_cid; |
1074 | }; |
1075 | |
1076 | struct req_sim_read_info { |
1077 | |
1078 | === modified file 'gril/ril_constants.h' |
1079 | --- gril/ril_constants.h 2014-04-29 15:50:22 +0000 |
1080 | +++ gril/ril_constants.h 2014-07-31 23:42:19 +0000 |
1081 | @@ -169,6 +169,8 @@ |
1082 | #define RIL_DATA_PROFILE_FOTA 3 /* FOTA = Firmware Over the Air */ |
1083 | #define RIL_DATA_PROFILE_CBS 4 |
1084 | #define RIL_DATA_PROFILE_OEM_BASE 1000 /* Start of OEM-specific profiles */ |
1085 | +/* MTK specific profile for MMS */ |
1086 | +#define RIL_DATA_PROFILE_MTK_MMS (RIL_DATA_PROFILE_OEM_BASE + 1) |
1087 | |
1088 | #define RIL_AUTH_NONE 0 |
1089 | #define RIL_AUTH_PAP 1 |
1090 | |
1091 | === modified file 'include/radio-settings.h' |
1092 | --- include/radio-settings.h 2012-06-16 14:50:05 +0000 |
1093 | +++ include/radio-settings.h 2014-07-31 23:42:19 +0000 |
1094 | @@ -35,6 +35,9 @@ |
1095 | OFONO_RADIO_ACCESS_MODE_LTE = 3, |
1096 | }; |
1097 | |
1098 | +/* Set this to latest in ofono_radio_access_mode + 1 */ |
1099 | +#define OFONO_RADIO_ACCESS_MODE_LAST (OFONO_RADIO_ACCESS_MODE_LTE + 1) |
1100 | + |
1101 | enum ofono_radio_band_gsm { |
1102 | OFONO_RADIO_BAND_GSM_ANY, |
1103 | OFONO_RADIO_BAND_GSM_850, |
1104 | @@ -80,6 +83,11 @@ |
1105 | ofono_bool_t enable, |
1106 | void *data); |
1107 | |
1108 | +typedef void (*ofono_radio_settings_modem_rats_query_cb_t)( |
1109 | + const struct ofono_error *error, |
1110 | + const ofono_bool_t rats[], |
1111 | + void *data); |
1112 | + |
1113 | struct ofono_radio_settings_driver { |
1114 | const char *name; |
1115 | int (*probe)(struct ofono_radio_settings *rs, unsigned int vendor, |
1116 | @@ -107,6 +115,9 @@ |
1117 | ofono_bool_t enable, |
1118 | ofono_radio_settings_fast_dormancy_set_cb_t, |
1119 | void *data); |
1120 | + void (*query_modem_rats)(struct ofono_radio_settings *rs, |
1121 | + ofono_radio_settings_modem_rats_query_cb_t cb, |
1122 | + void *data); |
1123 | }; |
1124 | |
1125 | int ofono_radio_settings_driver_register( |
1126 | |
1127 | === modified file 'plugins/mtk.c' |
1128 | --- plugins/mtk.c 2014-07-09 07:47:20 +0000 |
1129 | +++ plugins/mtk.c 2014-07-31 23:42:19 +0000 |
1130 | @@ -81,7 +81,6 @@ |
1131 | struct mtk_data { |
1132 | GRil *modem; |
1133 | int sim_status_retries; |
1134 | - ofono_bool_t connected; |
1135 | ofono_bool_t have_sim; |
1136 | ofono_bool_t ofono_online; |
1137 | int radio_state; |
1138 | @@ -94,6 +93,7 @@ |
1139 | struct ofono_devinfo *devinfo; |
1140 | struct cb_data *pending_online_cbd; |
1141 | ofono_bool_t pending_online; |
1142 | + ofono_bool_t gprs_attach; |
1143 | }; |
1144 | |
1145 | /* |
1146 | @@ -118,6 +118,65 @@ |
1147 | ofono_info("%s%s", prefix, str); |
1148 | } |
1149 | |
1150 | +static struct mtk_data *ril_complement(struct mtk_data *ril) |
1151 | +{ |
1152 | + if (ril->slot == MULTISIM_SLOT_0) |
1153 | + return mtk_1; |
1154 | + else |
1155 | + return mtk_0; |
1156 | +} |
1157 | + |
1158 | +/* |
1159 | + * mtk_set_attach_state and mtk_detach_received are called by mtkmodem's gprs |
1160 | + * driver. They are needed to solve an issue with data attachment: in case |
1161 | + * org.ofono.ConnectionManager Powered property is set for, say, slot 1 while |
1162 | + * slot 0 has that property also set, slot 1 will not change the data |
1163 | + * registration state even after slot 0 data connection is finally dropped. To |
1164 | + * force slot 1 to try to attach we need to send an additional |
1165 | + * MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE. The way to know when to do this is to |
1166 | + * detect when slot 0 has finally detached. This is done listening for |
1167 | + * MTK_RIL_UNSOL_GPRS_DETACH events, but unfortunately these events are received |
1168 | + * in the modem that does not need to know about them, so we have to pass them |
1169 | + * to the mtk plugin (which has knowledge of both modems) that will take proper |
1170 | + * action in the other modem. |
1171 | + */ |
1172 | + |
1173 | +void mtk_set_attach_state(struct ofono_modem *modem, ofono_bool_t attached) |
1174 | +{ |
1175 | + struct mtk_data *ril = ofono_modem_get_data(modem); |
1176 | + |
1177 | + ril->gprs_attach = attached; |
1178 | +} |
1179 | + |
1180 | +static void detach_received_cb(struct ril_msg *message, gpointer user_data) |
1181 | +{ |
1182 | + struct mtk_data *ril = user_data; |
1183 | + |
1184 | + if (message->error == RIL_E_SUCCESS) |
1185 | + g_ril_print_response_no_args(ril->modem, message); |
1186 | + else |
1187 | + ofono_error("%s: RIL error %s", __func__, |
1188 | + ril_error_to_string(message->error)); |
1189 | +} |
1190 | + |
1191 | +void mtk_detach_received(struct ofono_modem *modem) |
1192 | +{ |
1193 | + struct mtk_data *ril = ofono_modem_get_data(modem); |
1194 | + struct mtk_data *ril_c = ril_complement(ril); |
1195 | + |
1196 | + if (ril_c != NULL && ril_c->gprs_attach) { |
1197 | + struct parcel rilp; |
1198 | + |
1199 | + g_mtk_request_set_gprs_connect_type(ril_c->modem, |
1200 | + ril_c->gprs_attach, &rilp); |
1201 | + |
1202 | + if (g_ril_send(ril_c->modem, |
1203 | + MTK_RIL_REQUEST_SET_GPRS_CONNECT_TYPE, |
1204 | + &rilp, detach_received_cb, ril_c, NULL) == 0) |
1205 | + ofono_error("%s: send failed", __func__); |
1206 | + } |
1207 | +} |
1208 | + |
1209 | static gboolean sim_status_retry(gpointer user_data) |
1210 | { |
1211 | struct ofono_modem *modem = user_data; |
1212 | @@ -168,6 +227,34 @@ |
1213 | } |
1214 | } |
1215 | |
1216 | +static void sim_removed(struct ril_msg *message, gpointer user_data) |
1217 | +{ |
1218 | + struct ofono_modem *modem = (struct ofono_modem *) user_data; |
1219 | + struct mtk_data *ril = ofono_modem_get_data(modem); |
1220 | + |
1221 | + DBG(""); |
1222 | + |
1223 | + g_ril_print_unsol_no_args(ril->modem, message); |
1224 | + |
1225 | + ofono_modem_set_powered(modem, FALSE); |
1226 | + g_idle_add(mtk_connected, modem); |
1227 | +} |
1228 | + |
1229 | +static void sim_inserted(struct ril_msg *message, gpointer user_data) |
1230 | +{ |
1231 | + struct ofono_modem *modem = (struct ofono_modem *) user_data; |
1232 | + struct mtk_data *ril = ofono_modem_get_data(modem); |
1233 | + |
1234 | + DBG(""); |
1235 | + |
1236 | + g_ril_print_unsol_no_args(ril->modem, message); |
1237 | + |
1238 | + if (getenv("OFONO_RIL_HOT_SIM_SWAP")) { |
1239 | + ofono_modem_set_powered(modem, FALSE); |
1240 | + g_idle_add(mtk_connected, modem); |
1241 | + } |
1242 | +} |
1243 | + |
1244 | static void sim_status_cb(struct ril_msg *message, gpointer user_data) |
1245 | { |
1246 | struct ofono_modem *modem = user_data; |
1247 | @@ -191,6 +278,12 @@ |
1248 | " exceeded!", ril->slot); |
1249 | } else { |
1250 | |
1251 | + /* Register for changes in SIM insertion */ |
1252 | + g_ril_register(ril->modem, MTK_RIL_UNSOL_SIM_PLUG_OUT, |
1253 | + sim_removed, modem); |
1254 | + g_ril_register(ril->modem, MTK_RIL_UNSOL_SIM_PLUG_IN, |
1255 | + sim_inserted, modem); |
1256 | + |
1257 | if ((status = g_ril_reply_parse_sim_status(ril->modem, message)) |
1258 | != NULL) { |
1259 | |
1260 | @@ -202,7 +295,8 @@ |
1261 | DBG("notify SIM inserted"); |
1262 | ril->have_sim = TRUE; |
1263 | |
1264 | - ofono_sim_inserted_notify(ril->sim, TRUE); |
1265 | + ofono_sim_inserted_notify(ril->sim, |
1266 | + TRUE); |
1267 | } |
1268 | |
1269 | } else { |
1270 | @@ -213,7 +307,8 @@ |
1271 | DBG("notify SIM removed"); |
1272 | ril->have_sim = FALSE; |
1273 | |
1274 | - ofono_sim_inserted_notify(ril->sim, FALSE); |
1275 | + ofono_sim_inserted_notify(ril->sim, |
1276 | + FALSE); |
1277 | } |
1278 | } |
1279 | g_ril_reply_free_sim_status(status); |
1280 | @@ -300,6 +395,11 @@ |
1281 | struct ofono_gprs *gprs; |
1282 | struct ofono_gprs_context *gc; |
1283 | struct ofono_message_waiting *mw; |
1284 | + struct mtk_gprs_data gprs_data = { ril->modem, modem }; |
1285 | + struct ril_gprs_context_data inet_ctx = |
1286 | + { ril->modem, OFONO_GPRS_CONTEXT_TYPE_INTERNET }; |
1287 | + struct ril_gprs_context_data mms_ctx = |
1288 | + { ril->modem, OFONO_GPRS_CONTEXT_TYPE_MMS }; |
1289 | |
1290 | DBG("SIM ready, creating more atoms"); |
1291 | |
1292 | @@ -321,16 +421,14 @@ |
1293 | RILMODEM, ril->modem); |
1294 | ofono_call_forwarding_create(modem, OFONO_RIL_VENDOR_MTK, |
1295 | RILMODEM, ril->modem); |
1296 | - ofono_radio_settings_create(modem, OFONO_RIL_VENDOR_MTK, |
1297 | - MTKMODEM, ril->modem); |
1298 | ofono_call_barring_create(modem, OFONO_RIL_VENDOR_MTK, |
1299 | RILMODEM, ril->modem); |
1300 | |
1301 | gprs = ofono_gprs_create(modem, OFONO_RIL_VENDOR_MTK, |
1302 | - MTKMODEM, ril->modem); |
1303 | + MTKMODEM, &gprs_data); |
1304 | |
1305 | gc = ofono_gprs_context_create(modem, OFONO_RIL_VENDOR_MTK, |
1306 | - RILMODEM, ril->modem); |
1307 | + RILMODEM, &inet_ctx); |
1308 | if (gc) { |
1309 | ofono_gprs_context_set_type(gc, |
1310 | OFONO_GPRS_CONTEXT_TYPE_INTERNET); |
1311 | @@ -338,7 +436,7 @@ |
1312 | } |
1313 | |
1314 | gc = ofono_gprs_context_create(modem, OFONO_RIL_VENDOR_MTK, |
1315 | - RILMODEM, ril->modem); |
1316 | + RILMODEM, &mms_ctx); |
1317 | if (gc) { |
1318 | ofono_gprs_context_set_type(gc, |
1319 | OFONO_GPRS_CONTEXT_TYPE_MMS); |
1320 | @@ -371,19 +469,15 @@ |
1321 | ofono_call_volume_create(modem, OFONO_RIL_VENDOR_MTK, |
1322 | RILMODEM, ril->modem); |
1323 | |
1324 | + /* Radio settings does not depend on the SIM */ |
1325 | + ofono_radio_settings_create(modem, OFONO_RIL_VENDOR_MTK, |
1326 | + MTKMODEM, ril->modem); |
1327 | + |
1328 | /* Ask sim status */ |
1329 | ril->sim_status_retries = 0; |
1330 | send_get_sim_status(modem); |
1331 | } |
1332 | |
1333 | -static struct mtk_data *ril_complement(struct mtk_data *ril) |
1334 | -{ |
1335 | - if (ril->slot == MULTISIM_SLOT_0) |
1336 | - return mtk_1; |
1337 | - else |
1338 | - return mtk_0; |
1339 | -} |
1340 | - |
1341 | static void mtk_sim_mode_cb(struct ril_msg *message, gpointer user_data) |
1342 | { |
1343 | struct cb_data *cbd = user_data; |
1344 | @@ -450,7 +544,7 @@ |
1345 | g_mtk_request_dual_sim_mode_switch(mtk_0->modem, sim_mode, &rilp); |
1346 | |
1347 | /* This request is always sent through the main socket */ |
1348 | - if (g_ril_send(mtk_0->modem, RIL_REQUEST_DUAL_SIM_MODE_SWITCH, |
1349 | + if (g_ril_send(mtk_0->modem, MTK_RIL_REQUEST_DUAL_SIM_MODE_SWITCH, |
1350 | &rilp, func, cbd, notify) == 0 && cbd != NULL) { |
1351 | ofono_error("%s: failure sending request", __func__); |
1352 | CALLBACK_WITH_FAILURE(cb, cbd->data); |
1353 | @@ -555,8 +649,8 @@ |
1354 | |
1355 | if (current_state == NO_SIM_ACTIVE) { |
1356 | /* Old state was off, need to power on the modem */ |
1357 | - if (g_ril_send(mtk_0->modem, RIL_REQUEST_RADIO_POWERON, NULL, |
1358 | - poweron_cb, cbd, NULL) == 0) { |
1359 | + if (g_ril_send(mtk_0->modem, MTK_RIL_REQUEST_RADIO_POWERON, |
1360 | + NULL, poweron_cb, cbd, NULL) == 0) { |
1361 | CALLBACK_WITH_FAILURE(cb, cbd->data); |
1362 | g_free(cbd); |
1363 | } else { |
1364 | @@ -565,8 +659,8 @@ |
1365 | mtk_0->pending_cbd = cbd; |
1366 | } |
1367 | } else if (next_state == NO_SIM_ACTIVE) { |
1368 | - if (g_ril_send(mtk_0->modem, RIL_REQUEST_RADIO_POWEROFF, NULL, |
1369 | - online_off_cb, cbd, g_free) == 0) { |
1370 | + if (g_ril_send(mtk_0->modem, MTK_RIL_REQUEST_RADIO_POWEROFF, |
1371 | + NULL, online_off_cb, cbd, g_free) == 0) { |
1372 | ofono_error("%s: failure sending request", __func__); |
1373 | CALLBACK_WITH_FAILURE(cb, cbd->data); |
1374 | g_free(cbd); |
1375 | @@ -581,10 +675,7 @@ |
1376 | struct ofono_modem *modem = (struct ofono_modem *) user_data; |
1377 | struct mtk_data *ril = ofono_modem_get_data(modem); |
1378 | |
1379 | - ofono_info("[slot %d] CONNECTED", ril->slot); |
1380 | - |
1381 | - /* TODO: need a disconnect function to restart things! */ |
1382 | - ril->connected = TRUE; |
1383 | + ofono_info("[slot %d] CONNECTED", ril->slot); |
1384 | |
1385 | DBG("calling set_powered(TRUE)"); |
1386 | |
1387 | @@ -602,7 +693,7 @@ |
1388 | struct ofono_modem *modem = (struct ofono_modem *) user_data; |
1389 | struct mtk_data *ril = ofono_modem_get_data(modem); |
1390 | |
1391 | - ofono_info("[slot %d] trying to reconnect", ril->slot); |
1392 | + ofono_info("[slot %d] trying to reconnect", ril->slot); |
1393 | |
1394 | if (create_gril(modem) < 0) |
1395 | return TRUE; |
1396 | @@ -649,6 +740,9 @@ |
1397 | |
1398 | DBG("slot %d", ril->slot); |
1399 | |
1400 | + if (ril->modem != NULL) |
1401 | + return 0; |
1402 | + |
1403 | if (ril->slot == MULTISIM_SLOT_0) { |
1404 | sock_path = sock_slot_0; |
1405 | hex_prefix = hex_slot_0; |
1406 | @@ -674,6 +768,8 @@ |
1407 | return -EIO; |
1408 | } |
1409 | |
1410 | + g_ril_set_slot(ril->modem, ril->slot); |
1411 | + |
1412 | g_ril_set_vendor_print_msg_id_funcs(ril->modem, |
1413 | mtk_request_id_to_string, |
1414 | mtk_unsol_request_to_string); |
1415 | |
1416 | === modified file 'plugins/nettime.c' |
1417 | --- plugins/nettime.c 2014-06-17 00:17:49 +0000 |
1418 | +++ plugins/nettime.c 2014-07-31 23:42:19 +0000 |
1419 | @@ -3,6 +3,7 @@ |
1420 | * oFono - Open Source Telephony |
1421 | * |
1422 | * Copyright (C) 2012-2013 Jolla Ltd. |
1423 | + * Copyright (C) 2014 Canonical Ltd. |
1424 | * |
1425 | * This program is free software; you can redistribute it and/or modify |
1426 | * it under the terms of the GNU General Public License version 2 as |
1427 | @@ -48,26 +49,25 @@ |
1428 | int dst; |
1429 | int time_zone; |
1430 | |
1431 | - const char *mcc; |
1432 | - const char *mnc; |
1433 | + char mcc[OFONO_MAX_MCC_LENGTH + 1]; |
1434 | + char mnc[OFONO_MAX_MNC_LENGTH + 1]; |
1435 | const char *path; |
1436 | }; |
1437 | |
1438 | -static struct nt_data *ntd = NULL; |
1439 | - |
1440 | - |
1441 | -static void init_time(void) |
1442 | +static void init_time(struct ofono_nettime_context *context) |
1443 | { |
1444 | - ntd = g_new0(struct nt_data, 1); |
1445 | - |
1446 | - ntd->time_available = FALSE; |
1447 | - ntd->time_pending = FALSE; |
1448 | - ntd->dst = 0; |
1449 | - ntd->time_zone = 0; |
1450 | + struct nt_data *nt_data = g_new0(struct nt_data, 1); |
1451 | + |
1452 | + nt_data->time_available = FALSE; |
1453 | + nt_data->time_pending = FALSE; |
1454 | + nt_data->dst = 0; |
1455 | + nt_data->time_zone = 0; |
1456 | + |
1457 | + context->data = nt_data; |
1458 | } |
1459 | |
1460 | static gboolean encode_time_format(const struct ofono_network_time *time, |
1461 | - struct tm *tm) |
1462 | + struct tm *tm) |
1463 | { |
1464 | if (time->year < 0) |
1465 | return FALSE; |
1466 | @@ -92,8 +92,7 @@ |
1467 | return ts.tv_sec; |
1468 | } |
1469 | |
1470 | -static int fill_time_notification(DBusMessage *msg, |
1471 | - struct nt_data *ntd) |
1472 | +static int fill_time_notification(DBusMessage *msg, struct nt_data *ntd) |
1473 | { |
1474 | DBusMessageIter iter, iter_array; |
1475 | dbus_int64_t utc_long, received; |
1476 | @@ -102,6 +101,7 @@ |
1477 | dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, |
1478 | "{sv}", |
1479 | &iter_array); |
1480 | + |
1481 | if (ntd->time_pending) { |
1482 | if (ntd->time_available) { |
1483 | utc_long = (dbus_int64_t) ntd->nw_time_utc; |
1484 | @@ -114,6 +114,11 @@ |
1485 | "DST", |
1486 | DBUS_TYPE_UINT32, |
1487 | &dst); |
1488 | + timezone = (dbus_int32_t) ntd->time_zone; |
1489 | + ofono_dbus_dict_append(&iter_array, |
1490 | + "Timezone", |
1491 | + DBUS_TYPE_INT32, |
1492 | + &timezone); |
1493 | received = (dbus_int64_t) ntd->received; |
1494 | ofono_dbus_dict_append(&iter_array, |
1495 | "Received", |
1496 | @@ -121,21 +126,21 @@ |
1497 | &received); |
1498 | } |
1499 | |
1500 | - timezone = (dbus_int32_t) ntd->time_zone; |
1501 | - ofono_dbus_dict_append(&iter_array, |
1502 | - "Timezone", |
1503 | - DBUS_TYPE_INT32, |
1504 | - &timezone); |
1505 | - |
1506 | - ofono_dbus_dict_append(&iter_array, |
1507 | - "MobileCountryCode", |
1508 | - DBUS_TYPE_STRING, |
1509 | - &ntd->mcc); |
1510 | - |
1511 | - ofono_dbus_dict_append(&iter_array, |
1512 | - "MobileNetworkCode", |
1513 | - DBUS_TYPE_STRING, |
1514 | - &ntd->mnc); |
1515 | + if (ntd->mcc[0] != '\0') { |
1516 | + char *mcc = ntd->mcc; |
1517 | + ofono_dbus_dict_append(&iter_array, |
1518 | + "MobileCountryCode", |
1519 | + DBUS_TYPE_STRING, |
1520 | + &mcc); |
1521 | + } |
1522 | + |
1523 | + if (ntd->mnc[0] != '\0') { |
1524 | + char *mnc = ntd->mnc; |
1525 | + ofono_dbus_dict_append(&iter_array, |
1526 | + "MobileNetworkCode", |
1527 | + DBUS_TYPE_STRING, |
1528 | + &mnc); |
1529 | + } |
1530 | } else { |
1531 | DBG("fill_time_notification: time not available"); |
1532 | } |
1533 | @@ -145,14 +150,17 @@ |
1534 | } |
1535 | |
1536 | static DBusMessage *get_network_time(DBusConnection *conn, |
1537 | - DBusMessage *msg, void *data) |
1538 | + DBusMessage *msg, void *data) |
1539 | { |
1540 | DBusMessage *reply; |
1541 | + struct ofono_nettime_context *context = data; |
1542 | + struct nt_data *nt_data = context->data; |
1543 | |
1544 | reply = dbus_message_new_method_return(msg); |
1545 | if (reply == NULL) |
1546 | return NULL; |
1547 | - fill_time_notification(reply, ntd); |
1548 | + |
1549 | + fill_time_notification(reply, nt_data); |
1550 | return reply; |
1551 | } |
1552 | |
1553 | @@ -173,17 +181,20 @@ |
1554 | { |
1555 | DBusConnection *conn = ofono_dbus_get_connection(); |
1556 | const char *path = ofono_modem_get_path(context->modem); |
1557 | + |
1558 | DBG("Network time probe for modem: %p (%s)", context->modem, path); |
1559 | - init_time(); |
1560 | + |
1561 | + init_time(context); |
1562 | + |
1563 | if (!g_dbus_register_interface(conn, path, |
1564 | - OFONO_NETWORK_TIME_INTERFACE, // name |
1565 | - nettime_methods, // methods |
1566 | - nettime_signals, // signals |
1567 | - NULL, // GDBusPropertyTable *properties |
1568 | - NULL, // user data |
1569 | - NULL)) { // GDBusDestroyFunction destroy |
1570 | - ofono_error("Networkt time: Could not register interface %s, path %s", |
1571 | - OFONO_NETWORK_TIME_INTERFACE, path); |
1572 | + OFONO_NETWORK_TIME_INTERFACE, |
1573 | + nettime_methods, |
1574 | + nettime_signals, |
1575 | + NULL, /* properties */ |
1576 | + context, /* user data */ |
1577 | + NULL)) { |
1578 | + ofono_error("Network time: Could not register interface %s, " |
1579 | + "path %s", OFONO_NETWORK_TIME_INTERFACE, path); |
1580 | return 1; |
1581 | } else { |
1582 | ofono_info("Network time: Registered inteface %s, path %s", |
1583 | @@ -191,6 +202,7 @@ |
1584 | } |
1585 | |
1586 | ofono_modem_add_interface(context->modem, OFONO_NETWORK_TIME_INTERFACE); |
1587 | + |
1588 | return 0; |
1589 | } |
1590 | |
1591 | @@ -198,22 +210,26 @@ |
1592 | { |
1593 | DBusConnection *conn = ofono_dbus_get_connection(); |
1594 | const char *path = ofono_modem_get_path(context->modem); |
1595 | + |
1596 | DBG("Network time remove for modem: %p (%s)", context->modem, path); |
1597 | - if (!g_dbus_unregister_interface(conn, path, OFONO_NETWORK_TIME_INTERFACE)) { |
1598 | - ofono_error("Network time: could not unregister interface %s, path %s", |
1599 | - OFONO_NETWORK_TIME_INTERFACE, path); |
1600 | - } |
1601 | - |
1602 | - ofono_modem_remove_interface(context->modem, OFONO_NETWORK_TIME_INTERFACE); |
1603 | - g_free(ntd); |
1604 | + |
1605 | + if (!g_dbus_unregister_interface(conn, path, |
1606 | + OFONO_NETWORK_TIME_INTERFACE)) |
1607 | + ofono_error("Network time: could not unregister interface %s, " |
1608 | + "path %s", OFONO_NETWORK_TIME_INTERFACE, path); |
1609 | + |
1610 | + ofono_modem_remove_interface(context->modem, |
1611 | + OFONO_NETWORK_TIME_INTERFACE); |
1612 | + g_free(context->data); |
1613 | } |
1614 | |
1615 | static void send_signal(struct nt_data *ntd) |
1616 | { |
1617 | DBusConnection *conn = ofono_dbus_get_connection(); |
1618 | - DBusMessage *signal = dbus_message_new_signal(ntd->path, |
1619 | - OFONO_NETWORK_TIME_INTERFACE, |
1620 | - "NetworkTimeChanged"); |
1621 | + DBusMessage *signal = |
1622 | + dbus_message_new_signal(ntd->path, OFONO_NETWORK_TIME_INTERFACE, |
1623 | + "NetworkTimeChanged"); |
1624 | + |
1625 | fill_time_notification(signal, ntd); |
1626 | g_dbus_send_message(conn, signal); |
1627 | } |
1628 | @@ -223,15 +239,30 @@ |
1629 | { |
1630 | struct ofono_netreg *netreg; |
1631 | struct tm t; |
1632 | + struct nt_data *ntd = context->data; |
1633 | + const char *mcc; |
1634 | + const char *mnc; |
1635 | |
1636 | if (info == NULL) |
1637 | return; |
1638 | |
1639 | netreg = __ofono_atom_get_data(__ofono_modem_find_atom( |
1640 | - context->modem, OFONO_ATOM_TYPE_NETREG)); |
1641 | + context->modem, OFONO_ATOM_TYPE_NETREG)); |
1642 | + |
1643 | ntd->path = ofono_modem_get_path(context->modem); |
1644 | - ntd->mcc = ofono_netreg_get_mcc(netreg); |
1645 | - ntd->mnc = ofono_netreg_get_mnc(netreg); |
1646 | + mcc = ofono_netreg_get_mcc(netreg); |
1647 | + mnc = ofono_netreg_get_mnc(netreg); |
1648 | + |
1649 | + if (mcc == NULL) |
1650 | + ntd->mcc[0] = '\0'; |
1651 | + else |
1652 | + strcpy(ntd->mcc, mcc); |
1653 | + |
1654 | + if (mnc == NULL) |
1655 | + ntd->mnc[0] = '\0'; |
1656 | + else |
1657 | + strcpy(ntd->mnc, mnc); |
1658 | + |
1659 | ntd->received = get_monotonic_time(); |
1660 | ntd->time_pending = TRUE; |
1661 | ntd->dst = info->dst; |
1662 | @@ -242,7 +273,9 @@ |
1663 | ntd->nw_time_utc = timegm(&t); |
1664 | |
1665 | send_signal(ntd); |
1666 | - DBG("modem: %p (%s)", context->modem, ofono_modem_get_path(context->modem)); |
1667 | + |
1668 | + DBG("modem: %p (%s)", |
1669 | + context->modem, ofono_modem_get_path(context->modem)); |
1670 | DBG("time: %04d-%02d-%02d %02d:%02d:%02d%c%02d:%02d (DST=%d)", |
1671 | info->year, info->mon, info->mday, info->hour, |
1672 | info->min, info->sec, info->utcoff > 0 ? '+' : '-', |
1673 | |
1674 | === modified file 'plugins/ril.c' |
1675 | --- plugins/ril.c 2014-07-16 22:55:36 +0000 |
1676 | +++ plugins/ril.c 2014-07-31 23:42:19 +0000 |
1677 | @@ -117,12 +117,17 @@ |
1678 | switch (radio_state) { |
1679 | case RADIO_STATE_ON: |
1680 | |
1681 | - if (ril->voice == NULL) |
1682 | + if (ril->voice == NULL) { |
1683 | ril->voice = |
1684 | ofono_voicecall_create(modem, |
1685 | ril->vendor, |
1686 | RILMODEM, |
1687 | ril->modem); |
1688 | + ofono_call_volume_create(modem, ril->vendor, |
1689 | + RILMODEM, ril->modem); |
1690 | + ofono_radio_settings_create(modem, ril->vendor, |
1691 | + RILMODEM, ril->modem); |
1692 | + } |
1693 | |
1694 | send_get_sim_status(modem); |
1695 | break; |
1696 | @@ -274,6 +279,10 @@ |
1697 | struct ofono_gprs *gprs; |
1698 | struct ofono_gprs_context *gc; |
1699 | struct ofono_message_waiting *mw; |
1700 | + struct ril_gprs_context_data inet_ctx = |
1701 | + { ril->modem, OFONO_GPRS_CONTEXT_TYPE_INTERNET }; |
1702 | + struct ril_gprs_context_data mms_ctx = |
1703 | + { ril->modem, OFONO_GPRS_CONTEXT_TYPE_MMS }; |
1704 | |
1705 | /* TODO: this function should setup: |
1706 | * - phonebook |
1707 | @@ -283,8 +292,7 @@ |
1708 | ofono_sms_create(modem, ril->vendor, RILMODEM, ril->modem); |
1709 | |
1710 | gprs = ofono_gprs_create(modem, ril->vendor, RILMODEM, ril->modem); |
1711 | - gc = ofono_gprs_context_create(modem, ril->vendor, |
1712 | - RILMODEM, ril->modem); |
1713 | + gc = ofono_gprs_context_create(modem, ril->vendor, RILMODEM, &inet_ctx); |
1714 | |
1715 | if (gc) { |
1716 | ofono_gprs_context_set_type(gc, |
1717 | @@ -292,8 +300,7 @@ |
1718 | ofono_gprs_add_context(gprs, gc); |
1719 | } |
1720 | |
1721 | - gc = ofono_gprs_context_create(modem, ril->vendor, |
1722 | - RILMODEM, ril->modem); |
1723 | + gc = ofono_gprs_context_create(modem, ril->vendor, RILMODEM, &mms_ctx); |
1724 | |
1725 | if (gc) { |
1726 | ofono_gprs_context_set_type(gc, |
1727 | @@ -312,11 +319,9 @@ |
1728 | { |
1729 | struct ril_data *ril = ofono_modem_get_data(modem); |
1730 | |
1731 | - ofono_call_volume_create(modem, ril->vendor, RILMODEM, ril->modem); |
1732 | ofono_netreg_create(modem, ril->vendor, RILMODEM, ril->modem); |
1733 | ofono_ussd_create(modem, ril->vendor, RILMODEM, ril->modem); |
1734 | ofono_call_settings_create(modem, ril->vendor, RILMODEM, ril->modem); |
1735 | - ofono_radio_settings_create(modem, ril->vendor, RILMODEM, ril->modem); |
1736 | ofono_call_barring_create(modem, ril->vendor, RILMODEM, ril->modem); |
1737 | } |
1738 | |
1739 | @@ -381,8 +386,8 @@ |
1740 | struct ofono_modem *modem = (struct ofono_modem *) user_data; |
1741 | struct ril_data *ril = ofono_modem_get_data(modem); |
1742 | |
1743 | - ofono_info("[UNSOL]< %s", g_ril_unsol_request_to_string(ril->modem, |
1744 | - message->req)); |
1745 | + ofono_info("[%d,UNSOL]< %s", g_ril_get_slot(ril->modem), |
1746 | + g_ril_unsol_request_to_string(ril->modem, message->req)); |
1747 | |
1748 | /* TODO: need a disconnect function to restart things! */ |
1749 | ril->connected = TRUE; |
1750 | |
1751 | === modified file 'plugins/ubuntu-apndb.c' |
1752 | --- plugins/ubuntu-apndb.c 2014-07-16 15:15:04 +0000 |
1753 | +++ plugins/ubuntu-apndb.c 2014-07-31 23:42:19 +0000 |
1754 | @@ -82,14 +82,16 @@ |
1755 | |
1756 | DBG("imsi %s match %s", imsi, match); |
1757 | |
1758 | - if (imsi_len != match_len) |
1759 | + if (match_len == 0 || imsi_len < match_len) |
1760 | goto done; |
1761 | |
1762 | - for (i = 0; i < imsi_len; i++) { |
1763 | + for (i = 0; i < match_len; i++) { |
1764 | if (*(imsi + i) == *(match + i)) |
1765 | continue; |
1766 | else if (*(match + i) == 'x') |
1767 | continue; |
1768 | + else if (*(match + i) == 'X') |
1769 | + continue; |
1770 | else |
1771 | goto done; |
1772 | } |
1773 | |
1774 | === modified file 'src/radio-settings.c' |
1775 | --- src/radio-settings.c 2012-05-20 09:47:57 +0000 |
1776 | +++ src/radio-settings.c 2014-07-31 23:42:19 +0000 |
1777 | @@ -48,6 +48,8 @@ |
1778 | enum ofono_radio_band_gsm pending_band_gsm; |
1779 | enum ofono_radio_band_umts pending_band_umts; |
1780 | ofono_bool_t fast_dormancy_pending; |
1781 | + ofono_bool_t modem_rats[OFONO_RADIO_ACCESS_MODE_LAST]; |
1782 | + ofono_bool_t modem_rats_filled; |
1783 | const struct ofono_radio_settings_driver *driver; |
1784 | void *driver_data; |
1785 | struct ofono_atom *atom; |
1786 | @@ -222,6 +224,21 @@ |
1787 | DBUS_TYPE_BOOLEAN, &value); |
1788 | } |
1789 | |
1790 | + if (rs->driver->query_modem_rats) { |
1791 | + const char *rats_strs[OFONO_RADIO_ACCESS_MODE_LAST + 1]; |
1792 | + const char *(*strs)[] = &rats_strs; |
1793 | + int i, str_i; |
1794 | + |
1795 | + for (i = 0, str_i = 0; i < OFONO_RADIO_ACCESS_MODE_LAST; ++i) |
1796 | + if (rs->modem_rats[i]) |
1797 | + rats_strs[str_i++] = |
1798 | + radio_access_mode_to_string(i); |
1799 | + rats_strs[str_i] = NULL; |
1800 | + |
1801 | + ofono_dbus_dict_append_array(&dict, "ModemTechnologies", |
1802 | + DBUS_TYPE_STRING, &strs); |
1803 | + } |
1804 | + |
1805 | dbus_message_iter_close_container(&iter, &dict); |
1806 | |
1807 | return reply; |
1808 | @@ -374,6 +391,43 @@ |
1809 | __ofono_dbus_pending_reply(&rs->pending, reply); |
1810 | } |
1811 | |
1812 | +static void radio_set_modem_rats(struct ofono_radio_settings *rs, |
1813 | + const ofono_bool_t rats[]) |
1814 | +{ |
1815 | + memcpy(rs->modem_rats, rats, sizeof(rs->modem_rats)); |
1816 | + rs->modem_rats_filled = TRUE; |
1817 | +} |
1818 | + |
1819 | +static void radio_modem_rats_query_callback(const struct ofono_error *error, |
1820 | + const ofono_bool_t rats[], |
1821 | + void *data) |
1822 | +{ |
1823 | + struct ofono_radio_settings *rs = data; |
1824 | + DBusMessage *reply; |
1825 | + |
1826 | + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { |
1827 | + DBG("Error during modem rats query"); |
1828 | + |
1829 | + reply = __ofono_error_failed(rs->pending); |
1830 | + __ofono_dbus_pending_reply(&rs->pending, reply); |
1831 | + |
1832 | + return; |
1833 | + } |
1834 | + |
1835 | + radio_set_modem_rats(rs, rats); |
1836 | + radio_send_properties_reply(rs); |
1837 | +} |
1838 | + |
1839 | +static void radio_query_modem_rats(struct ofono_radio_settings *rs) |
1840 | +{ |
1841 | + if (rs->driver->query_modem_rats == NULL) { |
1842 | + radio_send_properties_reply(rs); |
1843 | + return; |
1844 | + } |
1845 | + |
1846 | + rs->driver->query_modem_rats(rs, radio_modem_rats_query_callback, rs); |
1847 | +} |
1848 | + |
1849 | static void radio_fast_dormancy_query_callback(const struct ofono_error *error, |
1850 | ofono_bool_t enable, void *data) |
1851 | { |
1852 | @@ -390,7 +444,12 @@ |
1853 | } |
1854 | |
1855 | radio_set_fast_dormancy(rs, enable); |
1856 | - radio_send_properties_reply(rs); |
1857 | + |
1858 | + /* Modem technology is not supposed to change, so one query is enough */ |
1859 | + if (rs->modem_rats_filled) |
1860 | + radio_send_properties_reply(rs); |
1861 | + else |
1862 | + radio_query_modem_rats(rs); |
1863 | } |
1864 | |
1865 | static void radio_query_fast_dormancy(struct ofono_radio_settings *rs) |
1866 | |
1867 | === modified file 'test/list-modems' |
1868 | --- test/list-modems 2014-04-02 20:11:54 +0000 |
1869 | +++ test/list-modems 2014-07-31 23:42:19 +0000 |
1870 | @@ -44,7 +44,8 @@ |
1871 | "PreferredLanguages", |
1872 | "PrimaryContexts", |
1873 | "LockedPins", |
1874 | - "Features"]: |
1875 | + "Features", |
1876 | + "ModemTechnologies"]: |
1877 | val = "" |
1878 | for i in properties[key]: |
1879 | val += i + " " |
1880 | |
1881 | === modified file 'unit/test-mtkreply.c' |
1882 | --- unit/test-mtkreply.c 2014-04-29 09:01:49 +0000 |
1883 | +++ unit/test-mtkreply.c 2014-07-31 23:42:19 +0000 |
1884 | @@ -35,6 +35,8 @@ |
1885 | |
1886 | #include "common.h" |
1887 | #include "grilreply.h" |
1888 | +#include "drivers/mtkmodem/mtk_constants.h" |
1889 | +#include "drivers/mtkmodem/mtkreply.h" |
1890 | |
1891 | /* |
1892 | * As all our architectures are little-endian except for |
1893 | @@ -50,6 +52,11 @@ |
1894 | const struct ril_msg msg; |
1895 | }; |
1896 | |
1897 | +struct rep_3g_capability_test { |
1898 | + int is_3g; |
1899 | + const struct ril_msg msg; |
1900 | +}; |
1901 | + |
1902 | /* |
1903 | * The following hexadecimal data contains the event data of a valid |
1904 | * MTK-specific RIL_REQUEST_AVAILABLE_NETWORKS with the following parameters: |
1905 | @@ -97,6 +104,26 @@ |
1906 | } |
1907 | }; |
1908 | |
1909 | +/* |
1910 | + * The following hexadecimal data contains the reply to a |
1911 | + * MTK_RIL_REQUEST_GET_3G_CAPABILITY request with parameter {1} |
1912 | + */ |
1913 | +static const guchar mtk_reply_3g_capability_valid_parcel1[] = { |
1914 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
1915 | +}; |
1916 | + |
1917 | +static const struct rep_3g_capability_test mtk_reply_3g_capability_valid_1 = { |
1918 | + .is_3g = 1, |
1919 | + .msg = { |
1920 | + .buf = (char *) &mtk_reply_3g_capability_valid_parcel1, |
1921 | + .buf_len = sizeof(mtk_reply_3g_capability_valid_parcel1), |
1922 | + .unsolicited = FALSE, |
1923 | + .req = MTK_RIL_REQUEST_GET_3G_CAPABILITY, |
1924 | + .serial_no = 0, |
1925 | + .error = 0, |
1926 | + } |
1927 | +}; |
1928 | + |
1929 | static void test_mtk_reply_avail_ops_valid(gconstpointer data) |
1930 | { |
1931 | struct reply_avail_ops *reply; |
1932 | @@ -122,6 +149,17 @@ |
1933 | g_ril_unref(gril); |
1934 | } |
1935 | |
1936 | +static void test_mtk_reply_3g_capability_valid(gconstpointer data) |
1937 | +{ |
1938 | + GRil *gril = g_ril_new(NULL, OFONO_RIL_VENDOR_MTK); |
1939 | + const struct rep_3g_capability_test *test = data; |
1940 | + int is_3g = g_mtk_reply_parse_get_3g_capability(gril, &test->msg); |
1941 | + |
1942 | + g_assert(is_3g == test->is_3g); |
1943 | + |
1944 | + g_ril_unref(gril); |
1945 | +} |
1946 | + |
1947 | #endif /* LITTLE_ENDIAN */ |
1948 | |
1949 | int main(int argc, char **argv) |
1950 | @@ -146,6 +184,11 @@ |
1951 | &mtk_reply_enter_sim_pin_valid_1, |
1952 | test_mtk_reply_enter_sim_pin_valid); |
1953 | |
1954 | + g_test_add_data_func("/testmtkreply/radio-settings: " |
1955 | + "valid GET_3G_CAPABILITY Test 1", |
1956 | + &mtk_reply_3g_capability_valid_1, |
1957 | + test_mtk_reply_3g_capability_valid); |
1958 | + |
1959 | #endif /* LITTLE_ENDIAN */ |
1960 | |
1961 | return g_test_run(); |
1962 | |
1963 | === modified file 'unit/test-mtkunsol.c' |
1964 | --- unit/test-mtkunsol.c 2014-04-21 10:27:24 +0000 |
1965 | +++ unit/test-mtkunsol.c 2014-07-31 23:42:19 +0000 |
1966 | @@ -49,7 +49,7 @@ |
1967 | |
1968 | /* |
1969 | * The following hexadecimal data represents a serialized Binder parcel instance |
1970 | - * containing a valid RIL_UNSOL_INCOMING_CALL_INDICATION message with the |
1971 | + * containing a valid MTK_RIL_UNSOL_INCOMING_CALL_INDICATION message with the |
1972 | * following parameters: |
1973 | * |
1974 | * {1,677777777,161,0,1} |
1975 | @@ -67,7 +67,7 @@ |
1976 | .buf = (gchar *) &unsol_incoming_call_indication_parcel1, |
1977 | .buf_len = sizeof(unsol_incoming_call_indication_parcel1), |
1978 | .unsolicited = TRUE, |
1979 | - .req = RIL_UNSOL_INCOMING_CALL_INDICATION, |
1980 | + .req = MTK_RIL_UNSOL_INCOMING_CALL_INDICATION, |
1981 | .serial_no = 0, |
1982 | .error = 0, |
1983 | }; |
PASSED: Continuous integration, rev:6872 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- ci/56/ jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- utopic- amd64-ci/ 13 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- utopic- armhf-ci/ 10 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- utopic- armhf-ci/ 10/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- utopic- i386-ci/ 10
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/phablet- team-ofono- ubuntu- ci/56/rebuild
http://