Merge lp:~phablet-team/ofono/midori-support into lp:~phablet-team/ofono/ubuntu
- midori-support
- Merge into ubuntu
Status: | Merged |
---|---|
Approved by: | Jim Hodapp |
Approved revision: | 6919 |
Merged at revision: | 6916 |
Proposed branch: | lp:~phablet-team/ofono/midori-support |
Merge into: | lp:~phablet-team/ofono/ubuntu |
Diff against target: |
3276 lines (+1954/-264) 48 files modified
Makefile.am (+14/-1) debian/changelog (+17/-0) drivers/mtk2modem/gprs.c (+88/-0) drivers/mtk2modem/mtk2_constants.h (+148/-0) drivers/mtk2modem/mtk2modem.c (+55/-0) drivers/mtk2modem/mtk2modem.h (+28/-0) drivers/mtk2modem/mtk2util.c (+275/-0) drivers/mtk2modem/mtk2util.h (+39/-0) drivers/mtk2modem/voicecall.c (+149/-0) drivers/mtkmodem/mtkunsol.c (+17/-7) drivers/qcommsimmodem/gprs.c (+118/-0) drivers/qcommsimmodem/qcom_msim_constants.h (+2/-1) drivers/qcommsimmodem/qcom_msim_modem.c (+2/-0) drivers/qcommsimmodem/qcom_msim_modem.h (+3/-0) drivers/rilmodem/call-barring.c (+1/-0) drivers/rilmodem/call-forwarding.c (+1/-0) drivers/rilmodem/call-settings.c (+1/-0) drivers/rilmodem/call-volume.c (+1/-0) drivers/rilmodem/devinfo.c (+1/-0) drivers/rilmodem/gprs.c (+139/-53) drivers/rilmodem/gprs.h (+2/-0) drivers/rilmodem/network-registration.c (+2/-0) drivers/rilmodem/phonebook.c (+1/-0) drivers/rilmodem/radio-settings.c (+56/-4) drivers/rilmodem/rilmodem.h (+0/-2) drivers/rilmodem/sim.c (+3/-1) drivers/rilmodem/sms.c (+1/-0) drivers/rilmodem/ussd.c (+6/-2) drivers/rilmodem/vendor.h (+2/-1) drivers/rilmodem/voicecall.c (+1/-0) gril/grilreply.c (+106/-5) gril/grilreply.h (+12/-0) gril/grilrequest.c (+34/-13) gril/grilunsol.c (+11/-1) gril/grilutil.c (+107/-1) gril/grilutil.h (+2/-0) gril/ril_constants.h (+70/-0) include/modem.h (+0/-5) plugins/infineon.c (+2/-1) plugins/mtk.c (+1/-6) plugins/mtk2.c (+93/-0) plugins/qcom-msim.c (+16/-1) plugins/ril.c (+291/-139) plugins/ril.h (+8/-1) plugins/rildev.c (+9/-2) src/gprs.c (+10/-3) src/modem.c (+0/-8) src/voicecall.c (+9/-6) |
To merge this branch: | bzr merge lp:~phablet-team/ofono/midori-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jim Hodapp (community) | Approve | ||
Konrad Zapałowicz (community) | code | Needs Information | |
Review via email: mp+298542@code.launchpad.net |
Commit message
Description of the change
[ Ratchanan Srirattanamet ]
* qcommsimmodem: fix slot selection for cellular data
[ Alfonso Sanchez-Beato ]
* gril: update requests to M
* ril: refactor management of radio power states
* mtk2: new driver to support midori
* Fix cellular data switch in turbo (LP: #1592258)
* Fix ofono re-starts on boot in turbo (LP: #1580908)
[ Rex Tsai ]
voicecall: add emergency numbers required for China Market
Konrad Zapałowicz (kzapalowicz) wrote : | # |
- 6917. By Alfonso Sanchez-Beato
-
Create radio settings atom in pre-sim state so we can set FastDormancy and
enter low power state even when there is no SIM.
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
@Konrad, thanks for the comments, I have answered them below. Note however that for historical reasons in ofono we do usually the reviews in our github repo, and import the code to bzr when merged there. For this branch, we had PR https:/
- 6918. By Alfonso Sanchez-Beato
-
Fix turbo regressions
- 6919. By Alfonso Sanchez-Beato
-
[ Rex Tsai ]
voicecall: add emergency numbers required for China Market
Preview Diff
1 | === modified file 'Makefile.am' | |||
2 | --- Makefile.am 2016-03-14 08:16:40 +0000 | |||
3 | +++ Makefile.am 2016-07-01 17:24:58 +0000 | |||
4 | @@ -135,6 +135,9 @@ | |||
5 | 135 | builtin_modules += mtk | 135 | builtin_modules += mtk |
6 | 136 | builtin_sources += plugins/mtk.c | 136 | builtin_sources += plugins/mtk.c |
7 | 137 | 137 | ||
8 | 138 | builtin_modules += mtk2 | ||
9 | 139 | builtin_sources += plugins/mtk2.c | ||
10 | 140 | |||
11 | 138 | builtin_modules += infineon | 141 | builtin_modules += infineon |
12 | 139 | builtin_sources += plugins/infineon.c | 142 | builtin_sources += plugins/infineon.c |
13 | 140 | 143 | ||
14 | @@ -160,6 +163,15 @@ | |||
15 | 160 | drivers/mtkmodem/radio-settings.c \ | 163 | drivers/mtkmodem/radio-settings.c \ |
16 | 161 | drivers/mtkmodem/mtksettings.c | 164 | drivers/mtkmodem/mtksettings.c |
17 | 162 | 165 | ||
18 | 166 | builtin_modules += mtk2modem | ||
19 | 167 | builtin_sources += drivers/mtk2modem/mtk2modem.h \ | ||
20 | 168 | drivers/mtk2modem/mtk2modem.c \ | ||
21 | 169 | drivers/mtk2modem/mtk2_constants.h \ | ||
22 | 170 | drivers/mtk2modem/mtk2util.h \ | ||
23 | 171 | drivers/mtk2modem/mtk2util.c \ | ||
24 | 172 | drivers/mtk2modem/voicecall.c \ | ||
25 | 173 | drivers/mtk2modem/gprs.c | ||
26 | 174 | |||
27 | 163 | builtin_modules += rilmodem | 175 | builtin_modules += rilmodem |
28 | 164 | builtin_sources += drivers/rilmodem/rilmodem.h \ | 176 | builtin_sources += drivers/rilmodem/rilmodem.h \ |
29 | 165 | drivers/rilmodem/vendor.h \ | 177 | drivers/rilmodem/vendor.h \ |
30 | @@ -183,7 +195,8 @@ | |||
31 | 183 | 195 | ||
32 | 184 | builtin_modules += qcommsimmodem | 196 | builtin_modules += qcommsimmodem |
33 | 185 | builtin_sources += drivers/qcommsimmodem/qcom_msim_modem.c \ | 197 | builtin_sources += drivers/qcommsimmodem/qcom_msim_modem.c \ |
35 | 186 | drivers/qcommsimmodem/radio-settings.c | 198 | drivers/qcommsimmodem/radio-settings.c \ |
36 | 199 | drivers/qcommsimmodem/gprs.c | ||
37 | 187 | endif | 200 | endif |
38 | 188 | 201 | ||
39 | 189 | if ISIMODEM | 202 | if ISIMODEM |
40 | 190 | 203 | ||
41 | === modified file 'debian/changelog' | |||
42 | --- debian/changelog 2016-04-13 14:43:54 +0000 | |||
43 | +++ debian/changelog 2016-07-01 17:24:58 +0000 | |||
44 | @@ -1,3 +1,20 @@ | |||
45 | 1 | ofono (1.17.bzr6919+16.10.20160701.1-0ubuntu1) UNRELEASED; urgency=medium | ||
46 | 2 | |||
47 | 3 | [ Ratchanan Srirattanamet ] | ||
48 | 4 | * qcommsimmodem: fix slot selection for cellular data | ||
49 | 5 | |||
50 | 6 | [ Alfonso Sanchez-Beato ] | ||
51 | 7 | * gril: update requests to M | ||
52 | 8 | * ril: refactor management of radio power states | ||
53 | 9 | * mtk2: new driver to support midori | ||
54 | 10 | * Fix cellular data switch in turbo (LP: #1592258) | ||
55 | 11 | * Fix ofono re-starts on boot in turbo (LP: #1580908) | ||
56 | 12 | |||
57 | 13 | [ Rex Tsai ] | ||
58 | 14 | * voicecall: add emergency numbers required for China Market | ||
59 | 15 | |||
60 | 16 | -- Alfonso Sanchez-Beato (email Canonical) <alfonso.sanchez-beato@canonical.com> Fri, 01 Jul 2016 17:17:05 +0200 | ||
61 | 17 | |||
62 | 1 | ofono (1.17.bzr6914+16.04.20160413.1-0ubuntu1) xenial; urgency=medium | 18 | ofono (1.17.bzr6914+16.04.20160413.1-0ubuntu1) xenial; urgency=medium |
63 | 2 | 19 | ||
64 | 3 | [ Alfonso Sanchez-Beato (email Canonical) ] | 20 | [ Alfonso Sanchez-Beato (email Canonical) ] |
65 | 4 | 21 | ||
66 | === added directory 'drivers/mtk2modem' | |||
67 | === added file 'drivers/mtk2modem/gprs.c' | |||
68 | --- drivers/mtk2modem/gprs.c 1970-01-01 00:00:00 +0000 | |||
69 | +++ drivers/mtk2modem/gprs.c 2016-07-01 17:24:58 +0000 | |||
70 | @@ -0,0 +1,88 @@ | |||
71 | 1 | /* | ||
72 | 2 | * | ||
73 | 3 | * oFono - Open Source Telephony | ||
74 | 4 | * | ||
75 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
76 | 6 | * | ||
77 | 7 | * This program is free software; you can redistribute it and/or modify | ||
78 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
79 | 9 | * published by the Free Software Foundation. | ||
80 | 10 | * | ||
81 | 11 | * This program is distributed in the hope that it will be useful, | ||
82 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
83 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
84 | 14 | * GNU General Public License for more details. | ||
85 | 15 | * | ||
86 | 16 | * You should have received a copy of the GNU General Public License | ||
87 | 17 | * along with this program; if not, write to the Free Software | ||
88 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
89 | 19 | * | ||
90 | 20 | */ | ||
91 | 21 | |||
92 | 22 | #ifdef HAVE_CONFIG_H | ||
93 | 23 | #include <config.h> | ||
94 | 24 | #endif | ||
95 | 25 | |||
96 | 26 | #define _GNU_SOURCE | ||
97 | 27 | #include <errno.h> | ||
98 | 28 | |||
99 | 29 | #include <glib.h> | ||
100 | 30 | |||
101 | 31 | #include <ofono/modem.h> | ||
102 | 32 | #include <ofono/gprs.h> | ||
103 | 33 | |||
104 | 34 | #include "common.h" | ||
105 | 35 | |||
106 | 36 | #include "mtk2util.h" | ||
107 | 37 | #include "mtk2modem.h" | ||
108 | 38 | #include "mtk2_constants.h" | ||
109 | 39 | #include "drivers/mtkmodem/mtkunsol.h" | ||
110 | 40 | #include "drivers/rilmodem/rilutil.h" | ||
111 | 41 | #include "drivers/rilmodem/gprs.h" | ||
112 | 42 | |||
113 | 43 | /* | ||
114 | 44 | * This module is the ofono_gprs_driver implementation for mtk2modem. Most of | ||
115 | 45 | * the implementation can be found in the rilmodem gprs atom. The main reason | ||
116 | 46 | * for creating a new atom is the need to handle specific MTK requests. | ||
117 | 47 | */ | ||
118 | 48 | |||
119 | 49 | static int mtk2_gprs_probe(struct ofono_gprs *gprs, | ||
120 | 50 | unsigned int vendor, void *data) | ||
121 | 51 | { | ||
122 | 52 | struct ril_gprs_driver_data *driver_data = data; | ||
123 | 53 | struct ril_gprs_data *gd; | ||
124 | 54 | |||
125 | 55 | gd = g_try_new0(struct ril_gprs_data, 1); | ||
126 | 56 | if (gd == NULL) | ||
127 | 57 | return -ENOMEM; | ||
128 | 58 | |||
129 | 59 | ril_gprs_start(driver_data, gprs, gd); | ||
130 | 60 | |||
131 | 61 | /* | ||
132 | 62 | * In MTK the event emitted when the gprs state changes is different | ||
133 | 63 | * from the one in AOSP ril. Overwrite the one set in parent. | ||
134 | 64 | */ | ||
135 | 65 | gd->state_changed_unsol = | ||
136 | 66 | MTK2_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED; | ||
137 | 67 | |||
138 | 68 | return 0; | ||
139 | 69 | } | ||
140 | 70 | |||
141 | 71 | static struct ofono_gprs_driver driver = { | ||
142 | 72 | .name = MTK2MODEM, | ||
143 | 73 | .probe = mtk2_gprs_probe, | ||
144 | 74 | .remove = ril_gprs_remove, | ||
145 | 75 | .set_attached = ril_gprs_set_attached, | ||
146 | 76 | .attached_status = ril_gprs_registration_status, | ||
147 | 77 | .set_ia_apn = ril_gprs_set_ia_apn, | ||
148 | 78 | }; | ||
149 | 79 | |||
150 | 80 | void mtk2_gprs_init(void) | ||
151 | 81 | { | ||
152 | 82 | ofono_gprs_driver_register(&driver); | ||
153 | 83 | } | ||
154 | 84 | |||
155 | 85 | void mtk2_gprs_exit(void) | ||
156 | 86 | { | ||
157 | 87 | ofono_gprs_driver_unregister(&driver); | ||
158 | 88 | } | ||
159 | 0 | 89 | ||
160 | === added file 'drivers/mtk2modem/mtk2_constants.h' | |||
161 | --- drivers/mtk2modem/mtk2_constants.h 1970-01-01 00:00:00 +0000 | |||
162 | +++ drivers/mtk2modem/mtk2_constants.h 2016-07-01 17:24:58 +0000 | |||
163 | @@ -0,0 +1,148 @@ | |||
164 | 1 | /* | ||
165 | 2 | * | ||
166 | 3 | * RIL constants for MTK modem | ||
167 | 4 | * | ||
168 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
169 | 6 | * | ||
170 | 7 | * This program is free software; you can redistribute it and/or modify | ||
171 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
172 | 9 | * published by the Free Software Foundation. | ||
173 | 10 | * | ||
174 | 11 | * This program is distributed in the hope that it will be useful, | ||
175 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
176 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
177 | 14 | * GNU General Public License for more details. | ||
178 | 15 | * | ||
179 | 16 | * You should have received a copy of the GNU General Public License | ||
180 | 17 | * along with this program; if not, write to the Free Software | ||
181 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
182 | 19 | * | ||
183 | 20 | */ | ||
184 | 21 | |||
185 | 22 | #ifndef MTK2_CONSTANTS_H | ||
186 | 23 | #define MTK2_CONSTANTS_H | ||
187 | 24 | |||
188 | 25 | /* RIL Request Messages */ | ||
189 | 26 | #define MTK2_RIL_REQUEST_MODEM_POWEROFF 2010 | ||
190 | 27 | #define MTK2_RIL_REQUEST_DUAL_SIM_MODE_SWITCH 2011 | ||
191 | 28 | #define MTK2_RIL_REQUEST_SET_GPRS_CONNECT_TYPE 2015 | ||
192 | 29 | #define MTK2_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE 2016 | ||
193 | 30 | #define MTK2_RIL_REQUEST_MODEM_POWERON 2028 | ||
194 | 31 | #define MTK2_RIL_REQUEST_SET_CALL_INDICATION 2086 | ||
195 | 32 | #define MTK2_RIL_REQUEST_GET_PHONE_CAPABILITY 2030 | ||
196 | 33 | #define MTK2_RIL_REQUEST_SET_PHONE_CAPABILITY 2031 | ||
197 | 34 | #define MTK2_RIL_REQUEST_SET_TRM 2043 | ||
198 | 35 | #define MTK2_RIL_REQUEST_SET_FD_MODE 2061 | ||
199 | 36 | #define MTK2_RIL_REQUEST_RESUME_REGISTRATION 2065 | ||
200 | 37 | #define MTK2_RIL_REQUEST_STORE_MODEM_TYPE 2066 | ||
201 | 38 | #define MTK2_RIL_REQUEST_QUERY_MODEM_TYPE 2067 | ||
202 | 39 | #define MTK2_RIL_REQUEST_SET_DATA_ON_TO_MD 2111 | ||
203 | 40 | |||
204 | 41 | /* RIL Unsolicited Messages */ | ||
205 | 42 | #define MTK2_RIL_UNSOL_MTK_BASE 3000 | ||
206 | 43 | |||
207 | 44 | #define MTK2_RIL_UNSOL_NEIGHBORING_CELL_INFO (MTK2_RIL_UNSOL_MTK_BASE + 0) | ||
208 | 45 | #define MTK2_RIL_UNSOL_NETWORK_INFO (MTK2_RIL_UNSOL_MTK_BASE + 1) | ||
209 | 46 | #define MTK2_RIL_UNSOL_PHB_READY_NOTIFICATION (MTK2_RIL_UNSOL_MTK_BASE + 2) | ||
210 | 47 | #define MTK2_RIL_UNSOL_SIM_INSERTED_STATUS (MTK2_RIL_UNSOL_MTK_BASE + 3) | ||
211 | 48 | #define MTK2_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE (MTK2_RIL_UNSOL_MTK_BASE + 4) | ||
212 | 49 | #define MTK2_RIL_UNSOL_ME_SMS_STORAGE_FULL (MTK2_RIL_UNSOL_MTK_BASE + 5) | ||
213 | 50 | #define MTK2_RIL_UNSOL_SMS_READY_NOTIFICATION (MTK2_RIL_UNSOL_MTK_BASE + 6) | ||
214 | 51 | #define MTK2_RIL_UNSOL_SCRI_RESULT (MTK2_RIL_UNSOL_MTK_BASE + 7) | ||
215 | 52 | #define MTK2_RIL_UNSOL_SIM_MISSING (MTK2_RIL_UNSOL_MTK_BASE + 8) | ||
216 | 53 | #define MTK2_RIL_UNSOL_GPRS_DETACH (MTK2_RIL_UNSOL_MTK_BASE + 9) | ||
217 | 54 | #define MTK2_RIL_UNSOL_ATCI_RESPONSE (MTK2_RIL_UNSOL_MTK_BASE + 10) | ||
218 | 55 | #define MTK2_RIL_UNSOL_SIM_RECOVERY (MTK2_RIL_UNSOL_MTK_BASE + 11) | ||
219 | 56 | #define MTK2_RIL_UNSOL_VIRTUAL_SIM_ON (MTK2_RIL_UNSOL_MTK_BASE + 12) | ||
220 | 57 | #define MTK2_RIL_UNSOL_VIRTUAL_SIM_OFF (MTK2_RIL_UNSOL_MTK_BASE + 13) | ||
221 | 58 | #define MTK2_RIL_UNSOL_INVALID_SIM (MTK2_RIL_UNSOL_MTK_BASE + 14) | ||
222 | 59 | #define MTK2_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 15) | ||
223 | 60 | #define MTK2_RIL_UNSOL_RESPONSE_ACMT (MTK2_RIL_UNSOL_MTK_BASE + 16) | ||
224 | 61 | #define MTK2_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT (MTK2_RIL_UNSOL_MTK_BASE + 17) | ||
225 | 62 | #define MTK2_RIL_UNSOL_IMEI_LOCK (MTK2_RIL_UNSOL_MTK_BASE + 18) | ||
226 | 63 | #define MTK2_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 19) | ||
227 | 64 | #define MTK2_RIL_UNSOL_SIM_PLUG_OUT (MTK2_RIL_UNSOL_MTK_BASE + 20) | ||
228 | 65 | #define MTK2_RIL_UNSOL_SIM_PLUG_IN (MTK2_RIL_UNSOL_MTK_BASE + 21) | ||
229 | 66 | #define MTK2_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION (MTK2_RIL_UNSOL_MTK_BASE + 22) | ||
230 | 67 | #define MTK2_RIL_UNSOL_RESPONSE_PLMN_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 23) | ||
231 | 68 | #define MTK2_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED (MTK2_RIL_UNSOL_MTK_BASE + 24) | ||
232 | 69 | #define MTK2_RIL_UNSOL_STK_EVDL_CALL (MTK2_RIL_UNSOL_MTK_BASE + 25) | ||
233 | 70 | #define MTK2_RIL_UNSOL_DATA_PACKETS_FLUSH (MTK2_RIL_UNSOL_MTK_BASE + 26) | ||
234 | 71 | #define MTK2_RIL_UNSOL_FEMTOCELL_INFO (MTK2_RIL_UNSOL_MTK_BASE + 27) | ||
235 | 72 | #define MTK2_RIL_UNSOL_STK_SETUP_MENU_RESET (MTK2_RIL_UNSOL_MTK_BASE + 28) | ||
236 | 73 | #define MTK2_RIL_UNSOL_APPLICATION_SESSION_ID_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 29) | ||
237 | 74 | #define MTK2_RIL_UNSOL_ECONF_SRVCC_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 30) | ||
238 | 75 | #define MTK2_RIL_UNSOL_IMS_ENABLE_DONE (MTK2_RIL_UNSOL_MTK_BASE + 31) | ||
239 | 76 | #define MTK2_RIL_UNSOL_IMS_DISABLE_DONE (MTK2_RIL_UNSOL_MTK_BASE + 32) | ||
240 | 77 | #define MTK2_RIL_UNSOL_IMS_REGISTRATION_INFO (MTK2_RIL_UNSOL_MTK_BASE + 33) | ||
241 | 78 | #define MTK2_RIL_UNSOL_DEDICATE_BEARER_ACTIVATED (MTK2_RIL_UNSOL_MTK_BASE + 34) | ||
242 | 79 | #define MTK2_RIL_UNSOL_DEDICATE_BEARER_MODIFIED (MTK2_RIL_UNSOL_MTK_BASE + 35) | ||
243 | 80 | #define MTK2_RIL_UNSOL_DEDICATE_BEARER_DEACTIVATED (MTK2_RIL_UNSOL_MTK_BASE + 36) | ||
244 | 81 | #define MTK2_RIL_UNSOL_RAC_UPDATE (MTK2_RIL_UNSOL_MTK_BASE + 37) | ||
245 | 82 | #define MTK2_RIL_UNSOL_ECONF_RESULT_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 38) | ||
246 | 83 | #define MTK2_RIL_UNSOL_MELOCK_NOTIFICATION (MTK2_RIL_UNSOL_MTK_BASE + 39) | ||
247 | 84 | #define MTK2_RIL_UNSOL_CALL_FORWARDING (MTK2_RIL_UNSOL_MTK_BASE + 40) | ||
248 | 85 | #define MTK2_RIL_UNSOL_CRSS_NOTIFICATION (MTK2_RIL_UNSOL_MTK_BASE + 41) | ||
249 | 86 | #define MTK2_RIL_UNSOL_INCOMING_CALL_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 42) | ||
250 | 87 | #define MTK2_RIL_UNSOL_CIPHER_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 43) | ||
251 | 88 | #define MTK2_RIL_UNSOL_CNAP (MTK2_RIL_UNSOL_MTK_BASE + 44) | ||
252 | 89 | #define MTK2_RIL_UNSOL_SIM_COMMON_SLOT_NO_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 45) | ||
253 | 90 | #define MTK2_RIL_UNSOL_DATA_ALLOWED (MTK2_RIL_UNSOL_MTK_BASE + 46) | ||
254 | 91 | #define MTK2_RIL_UNSOL_STK_CALL_CTRL (MTK2_RIL_UNSOL_MTK_BASE + 47) | ||
255 | 92 | #define MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_SUPPORT (MTK2_RIL_UNSOL_MTK_BASE + 48) | ||
256 | 93 | #define MTK2_RIL_UNSOL_CALL_INFO_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 49) | ||
257 | 94 | #define MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_INFO (MTK2_RIL_UNSOL_MTK_BASE + 50) | ||
258 | 95 | #define MTK2_RIL_UNSOL_SRVCC_HANDOVER_INFO_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 51) | ||
259 | 96 | #define MTK2_RIL_UNSOL_SPEECH_CODEC_INFO (MTK2_RIL_UNSOL_MTK_BASE + 52) | ||
260 | 97 | #define MTK2_RIL_UNSOL_MD_STATE_CHANGE (MTK2_RIL_UNSOL_MTK_BASE + 53) | ||
261 | 98 | #define MTK2_RIL_UNSOL_REMOVE_RESTRICT_EUTRAN (MTK2_RIL_UNSOL_MTK_BASE + 54) | ||
262 | 99 | #define MTK2_RIL_UNSOL_MO_DATA_BARRING_INFO (MTK2_RIL_UNSOL_MTK_BASE + 55) | ||
263 | 100 | #define MTK2_RIL_UNSOL_SSAC_BARRING_INFO (MTK2_RIL_UNSOL_MTK_BASE + 56) | ||
264 | 101 | #define MTK2_RIL_UNSOL_SIP_CALL_PROGRESS_INDICATOR (MTK2_RIL_UNSOL_MTK_BASE + 57) | ||
265 | 102 | #define MTK2_RIL_UNSOL_ABNORMAL_EVENT (MTK2_RIL_UNSOL_MTK_BASE + 58) | ||
266 | 103 | #define MTK2_RIL_UNSOL_EMERGENCY_BEARER_SUPPORT_NOTIFY (MTK2_RIL_UNSOL_MTK_BASE + 59) | ||
267 | 104 | #define MTK2_RIL_UNSOL_INTER_3GPP_IRAT_STATE_CHANGE (MTK2_RIL_UNSOL_MTK_BASE + 60) | ||
268 | 105 | #define MTK2_RIL_UNSOL_LTE_BG_SEARCH_STATUS (MTK2_RIL_UNSOL_MTK_BASE + 61) | ||
269 | 106 | #define MTK2_RIL_UNSOL_GMSS_RAT_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 62) | ||
270 | 107 | #define MTK2_RIL_UNSOL_CDMA_CARD_TYPE (MTK2_RIL_UNSOL_MTK_BASE + 63) | ||
271 | 108 | #define MTK2_RIL_UNSOL_IMS_ENABLE_START (MTK2_RIL_UNSOL_MTK_BASE + 64) | ||
272 | 109 | #define MTK2_RIL_UNSOL_IMS_DISABLE_START (MTK2_RIL_UNSOL_MTK_BASE + 65) | ||
273 | 110 | #define MTK2_RIL_UNSOL_IMSI_REFRESH_DONE (MTK2_RIL_UNSOL_MTK_BASE + 66) | ||
274 | 111 | #define MTK2_RIL_UNSOL_EUSIM_READY (MTK2_RIL_UNSOL_MTK_BASE + 67) | ||
275 | 112 | #define MTK2_RIL_UNSOL_STK_BIP_PROACTIVE_COMMAND (MTK2_RIL_UNSOL_MTK_BASE + 68) | ||
276 | 113 | #define MTK2_RIL_UNSOL_WORLD_MODE_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 69) | ||
277 | 114 | #define MTK2_RIL_UNSOL_VT_STATUS_INFO (MTK2_RIL_UNSOL_MTK_BASE + 70) | ||
278 | 115 | #define MTK2_RIL_UNSOL_VT_RING_INFO (MTK2_RIL_UNSOL_MTK_BASE + 71) | ||
279 | 116 | #define MTK2_RIL_UNSOL_VSIM_OPERATION_INDICATION (MTK2_RIL_UNSOL_MTK_BASE + 72) | ||
280 | 117 | #define MTK2_RIL_UNSOL_SET_ATTACH_APN (MTK2_RIL_UNSOL_MTK_BASE + 73) | ||
281 | 118 | #define MTK2_RIL_UNSOL_MAL_AT_INFO (MTK2_RIL_UNSOL_MTK_BASE + 74) | ||
282 | 119 | #define MTK2_RIL_UNSOL_MAIN_SIM_INFO (MTK2_RIL_UNSOL_MTK_BASE + 75) | ||
283 | 120 | #define MTK2_RIL_UNSOL_TRAY_PLUG_IN (MTK2_RIL_UNSOL_MTK_BASE + 76) | ||
284 | 121 | #define MTK2_RIL_UNSOL_CALLMOD_CHANGE_INDICATOR (MTK2_RIL_UNSOL_MTK_BASE + 77) | ||
285 | 122 | #define MTK2_RIL_UNSOL_VIDEO_CAPABILITY_INDICATOR (MTK2_RIL_UNSOL_MTK_BASE + 78) | ||
286 | 123 | #define MTK2_RIL_UNSOL_LTE_ACCESS_STRATUM_STATE_CHANGE (MTK2_RIL_UNSOL_MTK_BASE + 79) | ||
287 | 124 | #define MTK2_RIL_UNSOL_SETUP_DATA_CALL_RESPONSE (MTK2_RIL_UNSOL_MTK_BASE + 80) | ||
288 | 125 | #define MTK2_RIL_UNSOL_ON_USSI (MTK2_RIL_UNSOL_MTK_BASE + 81) | ||
289 | 126 | #define MTK2_RIL_UNSOL_CDMA_CALL_ACCEPTED (MTK2_RIL_UNSOL_MTK_BASE + 82) | ||
290 | 127 | #define MTK2_RIL_UNSOL_UTK_SESSION_END (MTK2_RIL_UNSOL_MTK_BASE + 83) | ||
291 | 128 | #define MTK2_RIL_UNSOL_UTK_PROACTIVE_COMMAND (MTK2_RIL_UNSOL_MTK_BASE + 84) | ||
292 | 129 | #define MTK2_RIL_UNSOL_UTK_EVENT_NOTIFY (MTK2_RIL_UNSOL_MTK_BASE + 85) | ||
293 | 130 | #define MTK2_RIL_UNSOL_VIA_GPS_EVENT (MTK2_RIL_UNSOL_MTK_BASE + 86) | ||
294 | 131 | #define MTK2_RIL_UNSOL_VIA_NETWORK_TYPE_CHANGE (MTK2_RIL_UNSOL_MTK_BASE + 87) | ||
295 | 132 | #define MTK2_RIL_UNSOL_CDMA_PLMN_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 88) | ||
296 | 133 | #define MTK2_RIL_UNSOL_VIA_INVALID_SIM_DETECTED (MTK2_RIL_UNSOL_MTK_BASE + 89) | ||
297 | 134 | #define MTK2_RIL_UNSOL_ENG_MODE_NETWORK_INFO (MTK2_RIL_UNSOL_MTK_BASE + 90) | ||
298 | 135 | #define MTK2_RIL_UNSOL_RESPONSE_DATA_NETWORK_TYPE_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 91) | ||
299 | 136 | #define MTK2_RIL_UNSOL_LTE_EARFCN_INFO (MTK2_RIL_UNSOL_MTK_BASE + 92) | ||
300 | 137 | #define MTK2_RIL_UNSOL_CDMA_IMSI_READY (MTK2_RIL_UNSOL_MTK_BASE + 93) | ||
301 | 138 | #define MTK2_RIL_UNSOL_CDMA_SIGNAL_FADE (MTK2_RIL_UNSOL_MTK_BASE + 94) | ||
302 | 139 | #define MTK2_RIL_UNSOL_CDMA_TONE_SIGNALS (MTK2_RIL_UNSOL_MTK_BASE + 95) | ||
303 | 140 | #define MTK2_RIL_UNSOL_NETWORK_EXIST (MTK2_RIL_UNSOL_MTK_BASE + 96) | ||
304 | 141 | #define MTK2_RIL_UNSOL_MODULATION_INFO (MTK2_RIL_UNSOL_MTK_BASE + 97) | ||
305 | 142 | #define MTK2_RIL_UNSOL_NETWORK_EVENT (MTK2_RIL_UNSOL_MTK_BASE + 98) | ||
306 | 143 | #define MTK2_RIL_UNSOL_MBIM_RESPONSE (MTK2_RIL_UNSOL_MTK_BASE + 99) | ||
307 | 144 | #define MTK2_RIL_UNSOL_MAL_DATA_CALL_LIST_CHANGED (MTK2_RIL_UNSOL_MTK_BASE + 100) | ||
308 | 145 | #define MTK2_RIL_UNSOL_EMBMS_AT_INFO (MTK2_RIL_UNSOL_MTK_BASE + 101) | ||
309 | 146 | #define MTK2_RIL_UNSOL_RADIO_CAPABILITY_SWITCH_START (MTK2_RIL_UNSOL_MTK_BASE + 102) | ||
310 | 147 | |||
311 | 148 | #endif /* MTK2_CONSTANTS_H */ | ||
312 | 0 | 149 | ||
313 | === added file 'drivers/mtk2modem/mtk2modem.c' | |||
314 | --- drivers/mtk2modem/mtk2modem.c 1970-01-01 00:00:00 +0000 | |||
315 | +++ drivers/mtk2modem/mtk2modem.c 2016-07-01 17:24:58 +0000 | |||
316 | @@ -0,0 +1,55 @@ | |||
317 | 1 | /* | ||
318 | 2 | * | ||
319 | 3 | * oFono - Open Source Telephony - RIL Modem Support | ||
320 | 4 | * | ||
321 | 5 | * Copyright (C) 2016 Canonical, Ltd. All rights reserved. | ||
322 | 6 | * | ||
323 | 7 | * This program is free software; you can redistribute it and/or modify | ||
324 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
325 | 9 | * published by the Free Software Foundation. | ||
326 | 10 | * | ||
327 | 11 | * This program is distributed in the hope that it will be useful, | ||
328 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
329 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
330 | 14 | * GNU General Public License for more details. | ||
331 | 15 | * | ||
332 | 16 | * You should have received a copy of the GNU General Public License | ||
333 | 17 | * along with this program; if not, write to the Free Software | ||
334 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
335 | 19 | * | ||
336 | 20 | */ | ||
337 | 21 | |||
338 | 22 | #ifdef HAVE_CONFIG_H | ||
339 | 23 | #include <config.h> | ||
340 | 24 | #endif | ||
341 | 25 | |||
342 | 26 | #include <glib.h> | ||
343 | 27 | #include <gril.h> | ||
344 | 28 | |||
345 | 29 | #define OFONO_API_SUBJECT_TO_CHANGE | ||
346 | 30 | #include <ofono/plugin.h> | ||
347 | 31 | #include <ofono/log.h> | ||
348 | 32 | #include <ofono/types.h> | ||
349 | 33 | |||
350 | 34 | #include "mtk2modem.h" | ||
351 | 35 | |||
352 | 36 | static int mtk2modem_init(void) | ||
353 | 37 | { | ||
354 | 38 | DBG(""); | ||
355 | 39 | |||
356 | 40 | mtk2_voicecall_init(); | ||
357 | 41 | mtk2_gprs_init(); | ||
358 | 42 | |||
359 | 43 | return 0; | ||
360 | 44 | } | ||
361 | 45 | |||
362 | 46 | static void mtk2modem_exit(void) | ||
363 | 47 | { | ||
364 | 48 | DBG(""); | ||
365 | 49 | |||
366 | 50 | mtk2_voicecall_exit(); | ||
367 | 51 | mtk2_gprs_exit(); | ||
368 | 52 | } | ||
369 | 53 | |||
370 | 54 | OFONO_PLUGIN_DEFINE(mtk2modem, "MTK2 modem driver", VERSION, | ||
371 | 55 | OFONO_PLUGIN_PRIORITY_DEFAULT, mtk2modem_init, mtk2modem_exit) | ||
372 | 0 | 56 | ||
373 | === added file 'drivers/mtk2modem/mtk2modem.h' | |||
374 | --- drivers/mtk2modem/mtk2modem.h 1970-01-01 00:00:00 +0000 | |||
375 | +++ drivers/mtk2modem/mtk2modem.h 2016-07-01 17:24:58 +0000 | |||
376 | @@ -0,0 +1,28 @@ | |||
377 | 1 | /* | ||
378 | 2 | * | ||
379 | 3 | * oFono - Open Source Telephony - RIL Modem Support | ||
380 | 4 | * | ||
381 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
382 | 6 | * | ||
383 | 7 | * This program is free software; you can redistribute it and/or modify | ||
384 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
385 | 9 | * published by the Free Software Foundation. | ||
386 | 10 | * | ||
387 | 11 | * This program is distributed in the hope that it will be useful, | ||
388 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
389 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
390 | 14 | * GNU General Public License for more details. | ||
391 | 15 | * | ||
392 | 16 | * You should have received a copy of the GNU General Public License | ||
393 | 17 | * along with this program; if not, write to the Free Software | ||
394 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
395 | 19 | * | ||
396 | 20 | */ | ||
397 | 21 | |||
398 | 22 | #define MTK2MODEM "mtk2modem" | ||
399 | 23 | |||
400 | 24 | extern void mtk2_voicecall_init(void); | ||
401 | 25 | extern void mtk2_voicecall_exit(void); | ||
402 | 26 | |||
403 | 27 | extern void mtk2_gprs_init(void); | ||
404 | 28 | extern void mtk2_gprs_exit(void); | ||
405 | 0 | 29 | ||
406 | === added file 'drivers/mtk2modem/mtk2util.c' | |||
407 | --- drivers/mtk2modem/mtk2util.c 1970-01-01 00:00:00 +0000 | |||
408 | +++ drivers/mtk2modem/mtk2util.c 2016-07-01 17:24:58 +0000 | |||
409 | @@ -0,0 +1,275 @@ | |||
410 | 1 | /* | ||
411 | 2 | * | ||
412 | 3 | * MTK2 driver for ofono/rilmodem | ||
413 | 4 | * | ||
414 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
415 | 6 | * | ||
416 | 7 | * This program is free software; you can redistribute it and/or modify | ||
417 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
418 | 9 | * published by the Free Software Foundation. | ||
419 | 10 | * | ||
420 | 11 | * This program is distributed in the hope that it will be useful, | ||
421 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
422 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
423 | 14 | * GNU General Public License for more details. | ||
424 | 15 | * | ||
425 | 16 | * You should have received a copy of the GNU General Public License | ||
426 | 17 | * along with this program; if not, write to the Free Software | ||
427 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
428 | 19 | * | ||
429 | 20 | */ | ||
430 | 21 | |||
431 | 22 | #include <stddef.h> | ||
432 | 23 | |||
433 | 24 | #include "mtk2util.h" | ||
434 | 25 | #include "mtk2_constants.h" | ||
435 | 26 | |||
436 | 27 | const char *mtk2_request_id_to_string(int req) | ||
437 | 28 | { | ||
438 | 29 | switch (req) { | ||
439 | 30 | case MTK2_RIL_REQUEST_MODEM_POWEROFF: | ||
440 | 31 | return "MTK2_RIL_REQUEST_MODEM_POWEROFF"; | ||
441 | 32 | case MTK2_RIL_REQUEST_DUAL_SIM_MODE_SWITCH: | ||
442 | 33 | return "MTK2_RIL_REQUEST_DUAL_SIM_MODE_SWITCH"; | ||
443 | 34 | case MTK2_RIL_REQUEST_SET_GPRS_CONNECT_TYPE: | ||
444 | 35 | return "MTK2_RIL_REQUEST_SET_GPRS_CONNECT_TYPE"; | ||
445 | 36 | case MTK2_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE: | ||
446 | 37 | return "MTK2_RIL_REQUEST_SET_GPRS_TRANSFER_TYPE"; | ||
447 | 38 | case MTK2_RIL_REQUEST_MODEM_POWERON: | ||
448 | 39 | return "MTK2_RIL_REQUEST_MODEM_POWERON"; | ||
449 | 40 | case MTK2_RIL_REQUEST_SET_CALL_INDICATION: | ||
450 | 41 | return "MTK2_RIL_REQUEST_SET_CALL_INDICATION"; | ||
451 | 42 | case MTK2_RIL_REQUEST_GET_PHONE_CAPABILITY: | ||
452 | 43 | return "MTK2_RIL_REQUEST_GET_PHONE_CAPABILITY"; | ||
453 | 44 | case MTK2_RIL_REQUEST_SET_PHONE_CAPABILITY: | ||
454 | 45 | return "MTK2_RIL_REQUEST_SET_PHONE_CAPABILITY"; | ||
455 | 46 | case MTK2_RIL_REQUEST_SET_TRM: | ||
456 | 47 | return "MTK2_RIL_REQUEST_SET_TRM"; | ||
457 | 48 | case MTK2_RIL_REQUEST_SET_FD_MODE: | ||
458 | 49 | return "MTK2_RIL_REQUEST_SET_FD_MODE"; | ||
459 | 50 | case MTK2_RIL_REQUEST_STORE_MODEM_TYPE: | ||
460 | 51 | return "MTK2_RIL_REQUEST_STORE_MODEM_TYPE"; | ||
461 | 52 | case MTK2_RIL_REQUEST_RESUME_REGISTRATION: | ||
462 | 53 | return "MTK2_RIL_REQUEST_RESUME_REGISTRATION"; | ||
463 | 54 | case MTK2_RIL_REQUEST_QUERY_MODEM_TYPE: | ||
464 | 55 | return "MTK2_RIL_REQUEST_QUERY_MODEM_TYPE"; | ||
465 | 56 | case MTK2_RIL_REQUEST_SET_DATA_ON_TO_MD: | ||
466 | 57 | return "MTK2_RIL_REQUEST_SET_DATA_ON_TO_MD"; | ||
467 | 58 | default: | ||
468 | 59 | return NULL; | ||
469 | 60 | } | ||
470 | 61 | } | ||
471 | 62 | |||
472 | 63 | const char *mtk2_unsol_request_to_string(int req) | ||
473 | 64 | { | ||
474 | 65 | switch (req) { | ||
475 | 66 | case MTK2_RIL_UNSOL_NEIGHBORING_CELL_INFO: | ||
476 | 67 | return "MTK2_RIL_UNSOL_NEIGHBORING_CELL_INFO"; | ||
477 | 68 | case MTK2_RIL_UNSOL_NETWORK_INFO: | ||
478 | 69 | return "MTK2_RIL_UNSOL_NETWORK_INFO"; | ||
479 | 70 | case MTK2_RIL_UNSOL_PHB_READY_NOTIFICATION: | ||
480 | 71 | return "MTK2_RIL_UNSOL_PHB_READY_NOTIFICATION"; | ||
481 | 72 | case MTK2_RIL_UNSOL_SIM_INSERTED_STATUS: | ||
482 | 73 | return "MTK2_RIL_UNSOL_SIM_INSERTED_STATUS"; | ||
483 | 74 | case MTK2_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE: | ||
484 | 75 | return "MTK2_RIL_UNSOL_RADIO_TEMPORARILY_UNAVAILABLE"; | ||
485 | 76 | case MTK2_RIL_UNSOL_ME_SMS_STORAGE_FULL: | ||
486 | 77 | return "MTK2_RIL_UNSOL_ME_SMS_STORAGE_FULL"; | ||
487 | 78 | case MTK2_RIL_UNSOL_SMS_READY_NOTIFICATION: | ||
488 | 79 | return "MTK2_RIL_UNSOL_SMS_READY_NOTIFICATION"; | ||
489 | 80 | case MTK2_RIL_UNSOL_SCRI_RESULT: | ||
490 | 81 | return "MTK2_RIL_UNSOL_SCRI_RESULT"; | ||
491 | 82 | case MTK2_RIL_UNSOL_SIM_MISSING: | ||
492 | 83 | return "MTK2_RIL_UNSOL_SIM_MISSING"; | ||
493 | 84 | case MTK2_RIL_UNSOL_GPRS_DETACH: | ||
494 | 85 | return "MTK2_RIL_UNSOL_GPRS_DETACH"; | ||
495 | 86 | case MTK2_RIL_UNSOL_ATCI_RESPONSE: | ||
496 | 87 | return "MTK2_RIL_UNSOL_ATCI_RESPONSE"; | ||
497 | 88 | case MTK2_RIL_UNSOL_SIM_RECOVERY: | ||
498 | 89 | return "MTK2_RIL_UNSOL_SIM_RECOVERY"; | ||
499 | 90 | case MTK2_RIL_UNSOL_VIRTUAL_SIM_ON: | ||
500 | 91 | return "MTK2_RIL_UNSOL_VIRTUAL_SIM_ON"; | ||
501 | 92 | case MTK2_RIL_UNSOL_VIRTUAL_SIM_OFF: | ||
502 | 93 | return "MTK2_RIL_UNSOL_VIRTUAL_SIM_OFF"; | ||
503 | 94 | case MTK2_RIL_UNSOL_INVALID_SIM: | ||
504 | 95 | return "MTK2_RIL_UNSOL_INVALID_SIM"; | ||
505 | 96 | case MTK2_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED: | ||
506 | 97 | return "MTK2_RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED"; | ||
507 | 98 | case MTK2_RIL_UNSOL_RESPONSE_ACMT: | ||
508 | 99 | return "MTK2_RIL_UNSOL_RESPONSE_ACMT"; | ||
509 | 100 | case MTK2_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT: | ||
510 | 101 | return "MTK2_RIL_UNSOL_EF_CSP_PLMN_MODE_BIT"; | ||
511 | 102 | case MTK2_RIL_UNSOL_IMEI_LOCK: | ||
512 | 103 | return "MTK2_RIL_UNSOL_IMEI_LOCK"; | ||
513 | 104 | case MTK2_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED: | ||
514 | 105 | return "MTK2_RIL_UNSOL_RESPONSE_MMRR_STATUS_CHANGED"; | ||
515 | 106 | case MTK2_RIL_UNSOL_SIM_PLUG_OUT: | ||
516 | 107 | return "MTK2_RIL_UNSOL_SIM_PLUG_OUT"; | ||
517 | 108 | case MTK2_RIL_UNSOL_SIM_PLUG_IN: | ||
518 | 109 | return "MTK2_RIL_UNSOL_SIM_PLUG_IN"; | ||
519 | 110 | case MTK2_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION: | ||
520 | 111 | return "MTK2_RIL_UNSOL_RESPONSE_ETWS_NOTIFICATION"; | ||
521 | 112 | case MTK2_RIL_UNSOL_RESPONSE_PLMN_CHANGED: | ||
522 | 113 | return "MTK2_RIL_UNSOL_RESPONSE_PLMN_CHANGED"; | ||
523 | 114 | case MTK2_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED: | ||
524 | 115 | return "MTK2_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED"; | ||
525 | 116 | case MTK2_RIL_UNSOL_STK_EVDL_CALL: | ||
526 | 117 | return "MTK2_RIL_UNSOL_STK_EVDL_CALL"; | ||
527 | 118 | case MTK2_RIL_UNSOL_DATA_PACKETS_FLUSH: | ||
528 | 119 | return "MTK2_RIL_UNSOL_DATA_PACKETS_FLUSH"; | ||
529 | 120 | case MTK2_RIL_UNSOL_FEMTOCELL_INFO: | ||
530 | 121 | return "MTK2_RIL_UNSOL_FEMTOCELL_INFO"; | ||
531 | 122 | case MTK2_RIL_UNSOL_STK_SETUP_MENU_RESET: | ||
532 | 123 | return "MTK2_RIL_UNSOL_STK_SETUP_MENU_RESET"; | ||
533 | 124 | case MTK2_RIL_UNSOL_APPLICATION_SESSION_ID_CHANGED: | ||
534 | 125 | return "MTK2_RIL_UNSOL_APPLICATION_SESSION_ID_CHANGED"; | ||
535 | 126 | case MTK2_RIL_UNSOL_ECONF_SRVCC_INDICATION: | ||
536 | 127 | return "MTK2_RIL_UNSOL_ECONF_SRVCC_INDICATION"; | ||
537 | 128 | case MTK2_RIL_UNSOL_IMS_ENABLE_DONE: | ||
538 | 129 | return "MTK2_RIL_UNSOL_IMS_ENABLE_DONE"; | ||
539 | 130 | case MTK2_RIL_UNSOL_IMS_DISABLE_DONE: | ||
540 | 131 | return "MTK2_RIL_UNSOL_IMS_DISABLE_DONE"; | ||
541 | 132 | case MTK2_RIL_UNSOL_IMS_REGISTRATION_INFO: | ||
542 | 133 | return "MTK2_RIL_UNSOL_IMS_REGISTRATION_INFO"; | ||
543 | 134 | case MTK2_RIL_UNSOL_DEDICATE_BEARER_ACTIVATED: | ||
544 | 135 | return "MTK2_RIL_UNSOL_DEDICATE_BEARER_ACTIVATED"; | ||
545 | 136 | case MTK2_RIL_UNSOL_DEDICATE_BEARER_MODIFIED: | ||
546 | 137 | return "MTK2_RIL_UNSOL_DEDICATE_BEARER_MODIFIED"; | ||
547 | 138 | case MTK2_RIL_UNSOL_DEDICATE_BEARER_DEACTIVATED: | ||
548 | 139 | return "MTK2_RIL_UNSOL_DEDICATE_BEARER_DEACTIVATED"; | ||
549 | 140 | case MTK2_RIL_UNSOL_RAC_UPDATE: | ||
550 | 141 | return "MTK2_RIL_UNSOL_RAC_UPDATE"; | ||
551 | 142 | case MTK2_RIL_UNSOL_ECONF_RESULT_INDICATION: | ||
552 | 143 | return "MTK2_RIL_UNSOL_ECONF_RESULT_INDICATION"; | ||
553 | 144 | case MTK2_RIL_UNSOL_MELOCK_NOTIFICATION: | ||
554 | 145 | return "MTK2_RIL_UNSOL_MELOCK_NOTIFICATION"; | ||
555 | 146 | case MTK2_RIL_UNSOL_CALL_FORWARDING: | ||
556 | 147 | return "MTK2_RIL_UNSOL_CALL_FORWARDING"; | ||
557 | 148 | case MTK2_RIL_UNSOL_CRSS_NOTIFICATION: | ||
558 | 149 | return "MTK2_RIL_UNSOL_CRSS_NOTIFICATION"; | ||
559 | 150 | case MTK2_RIL_UNSOL_INCOMING_CALL_INDICATION: | ||
560 | 151 | return "MTK2_RIL_UNSOL_INCOMING_CALL_INDICATION"; | ||
561 | 152 | case MTK2_RIL_UNSOL_CIPHER_INDICATION: | ||
562 | 153 | return "MTK2_RIL_UNSOL_CIPHER_INDICATION"; | ||
563 | 154 | case MTK2_RIL_UNSOL_CNAP: | ||
564 | 155 | return "MTK2_RIL_UNSOL_CNAP"; | ||
565 | 156 | case MTK2_RIL_UNSOL_SIM_COMMON_SLOT_NO_CHANGED: | ||
566 | 157 | return "MTK2_RIL_UNSOL_SIM_COMMON_SLOT_NO_CHANGED"; | ||
567 | 158 | case MTK2_RIL_UNSOL_DATA_ALLOWED: | ||
568 | 159 | return "MTK2_RIL_UNSOL_DATA_ALLOWED"; | ||
569 | 160 | case MTK2_RIL_UNSOL_STK_CALL_CTRL: | ||
570 | 161 | return "MTK2_RIL_UNSOL_STK_CALL_CTRL"; | ||
571 | 162 | case MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_SUPPORT: | ||
572 | 163 | return "MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_SUPPORT"; | ||
573 | 164 | case MTK2_RIL_UNSOL_CALL_INFO_INDICATION: | ||
574 | 165 | return "MTK2_RIL_UNSOL_CALL_INFO_INDICATION"; | ||
575 | 166 | case MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_INFO: | ||
576 | 167 | return "MTK2_RIL_UNSOL_VOLTE_EPS_NETWORK_FEATURE_INFO"; | ||
577 | 168 | case MTK2_RIL_UNSOL_SRVCC_HANDOVER_INFO_INDICATION: | ||
578 | 169 | return "MTK2_RIL_UNSOL_SRVCC_HANDOVER_INFO_INDICATION"; | ||
579 | 170 | case MTK2_RIL_UNSOL_SPEECH_CODEC_INFO: | ||
580 | 171 | return "MTK2_RIL_UNSOL_SPEECH_CODEC_INFO"; | ||
581 | 172 | case MTK2_RIL_UNSOL_MD_STATE_CHANGE: | ||
582 | 173 | return "MTK2_RIL_UNSOL_MD_STATE_CHANGE"; | ||
583 | 174 | case MTK2_RIL_UNSOL_REMOVE_RESTRICT_EUTRAN: | ||
584 | 175 | return "MTK2_RIL_UNSOL_REMOVE_RESTRICT_EUTRAN"; | ||
585 | 176 | case MTK2_RIL_UNSOL_MO_DATA_BARRING_INFO: | ||
586 | 177 | return "MTK2_RIL_UNSOL_MO_DATA_BARRING_INFO"; | ||
587 | 178 | case MTK2_RIL_UNSOL_SSAC_BARRING_INFO: | ||
588 | 179 | return "MTK2_RIL_UNSOL_SSAC_BARRING_INFO"; | ||
589 | 180 | case MTK2_RIL_UNSOL_SIP_CALL_PROGRESS_INDICATOR: | ||
590 | 181 | return "MTK2_RIL_UNSOL_SIP_CALL_PROGRESS_INDICATOR"; | ||
591 | 182 | case MTK2_RIL_UNSOL_ABNORMAL_EVENT: | ||
592 | 183 | return "MTK2_RIL_UNSOL_ABNORMAL_EVENT"; | ||
593 | 184 | case MTK2_RIL_UNSOL_EMERGENCY_BEARER_SUPPORT_NOTIFY: | ||
594 | 185 | return "MTK2_RIL_UNSOL_EMERGENCY_BEARER_SUPPORT_NOTIFY"; | ||
595 | 186 | case MTK2_RIL_UNSOL_INTER_3GPP_IRAT_STATE_CHANGE: | ||
596 | 187 | return "MTK2_RIL_UNSOL_INTER_3GPP_IRAT_STATE_CHANGE"; | ||
597 | 188 | case MTK2_RIL_UNSOL_LTE_BG_SEARCH_STATUS: | ||
598 | 189 | return "MTK2_RIL_UNSOL_LTE_BG_SEARCH_STATUS"; | ||
599 | 190 | case MTK2_RIL_UNSOL_GMSS_RAT_CHANGED: | ||
600 | 191 | return "MTK2_RIL_UNSOL_GMSS_RAT_CHANGED"; | ||
601 | 192 | case MTK2_RIL_UNSOL_CDMA_CARD_TYPE: | ||
602 | 193 | return "MTK2_RIL_UNSOL_CDMA_CARD_TYPE"; | ||
603 | 194 | case MTK2_RIL_UNSOL_IMS_ENABLE_START: | ||
604 | 195 | return "MTK2_RIL_UNSOL_IMS_ENABLE_START"; | ||
605 | 196 | case MTK2_RIL_UNSOL_IMS_DISABLE_START: | ||
606 | 197 | return "MTK2_RIL_UNSOL_IMS_DISABLE_START"; | ||
607 | 198 | case MTK2_RIL_UNSOL_IMSI_REFRESH_DONE: | ||
608 | 199 | return "MTK2_RIL_UNSOL_IMSI_REFRESH_DONE"; | ||
609 | 200 | case MTK2_RIL_UNSOL_EUSIM_READY: | ||
610 | 201 | return "MTK2_RIL_UNSOL_EUSIM_READY"; | ||
611 | 202 | case MTK2_RIL_UNSOL_STK_BIP_PROACTIVE_COMMAND: | ||
612 | 203 | return "MTK2_RIL_UNSOL_STK_BIP_PROACTIVE_COMMAND"; | ||
613 | 204 | case MTK2_RIL_UNSOL_WORLD_MODE_CHANGED: | ||
614 | 205 | return "MTK2_RIL_UNSOL_WORLD_MODE_CHANGED"; | ||
615 | 206 | case MTK2_RIL_UNSOL_VT_STATUS_INFO: | ||
616 | 207 | return "MTK2_RIL_UNSOL_VT_STATUS_INFO"; | ||
617 | 208 | case MTK2_RIL_UNSOL_VT_RING_INFO: | ||
618 | 209 | return "MTK2_RIL_UNSOL_VT_RING_INFO"; | ||
619 | 210 | case MTK2_RIL_UNSOL_VSIM_OPERATION_INDICATION: | ||
620 | 211 | return "MTK2_RIL_UNSOL_VSIM_OPERATION_INDICATION"; | ||
621 | 212 | case MTK2_RIL_UNSOL_SET_ATTACH_APN: | ||
622 | 213 | return "MTK2_RIL_UNSOL_SET_ATTACH_APN"; | ||
623 | 214 | case MTK2_RIL_UNSOL_MAL_AT_INFO: | ||
624 | 215 | return "MTK2_RIL_UNSOL_MAL_AT_INFO"; | ||
625 | 216 | case MTK2_RIL_UNSOL_MAIN_SIM_INFO: | ||
626 | 217 | return "MTK2_RIL_UNSOL_MAIN_SIM_INFO"; | ||
627 | 218 | case MTK2_RIL_UNSOL_TRAY_PLUG_IN: | ||
628 | 219 | return "MTK2_RIL_UNSOL_TRAY_PLUG_IN"; | ||
629 | 220 | case MTK2_RIL_UNSOL_CALLMOD_CHANGE_INDICATOR: | ||
630 | 221 | return "MTK2_RIL_UNSOL_CALLMOD_CHANGE_INDICATOR"; | ||
631 | 222 | case MTK2_RIL_UNSOL_VIDEO_CAPABILITY_INDICATOR: | ||
632 | 223 | return "MTK2_RIL_UNSOL_VIDEO_CAPABILITY_INDICATOR"; | ||
633 | 224 | case MTK2_RIL_UNSOL_LTE_ACCESS_STRATUM_STATE_CHANGE: | ||
634 | 225 | return "MTK2_RIL_UNSOL_LTE_ACCESS_STRATUM_STATE_CHANGE"; | ||
635 | 226 | case MTK2_RIL_UNSOL_SETUP_DATA_CALL_RESPONSE: | ||
636 | 227 | return "MTK2_RIL_UNSOL_SETUP_DATA_CALL_RESPONSE"; | ||
637 | 228 | case MTK2_RIL_UNSOL_ON_USSI: | ||
638 | 229 | return "MTK2_RIL_UNSOL_ON_USSI"; | ||
639 | 230 | case MTK2_RIL_UNSOL_CDMA_CALL_ACCEPTED: | ||
640 | 231 | return "MTK2_RIL_UNSOL_CDMA_CALL_ACCEPTED"; | ||
641 | 232 | case MTK2_RIL_UNSOL_UTK_SESSION_END: | ||
642 | 233 | return "MTK2_RIL_UNSOL_UTK_SESSION_END"; | ||
643 | 234 | case MTK2_RIL_UNSOL_UTK_PROACTIVE_COMMAND: | ||
644 | 235 | return "MTK2_RIL_UNSOL_UTK_PROACTIVE_COMMAND"; | ||
645 | 236 | case MTK2_RIL_UNSOL_UTK_EVENT_NOTIFY: | ||
646 | 237 | return "MTK2_RIL_UNSOL_UTK_EVENT_NOTIFY"; | ||
647 | 238 | case MTK2_RIL_UNSOL_VIA_GPS_EVENT: | ||
648 | 239 | return "MTK2_RIL_UNSOL_VIA_GPS_EVENT"; | ||
649 | 240 | case MTK2_RIL_UNSOL_VIA_NETWORK_TYPE_CHANGE: | ||
650 | 241 | return "MTK2_RIL_UNSOL_VIA_NETWORK_TYPE_CHANGE"; | ||
651 | 242 | case MTK2_RIL_UNSOL_CDMA_PLMN_CHANGED: | ||
652 | 243 | return "MTK2_RIL_UNSOL_CDMA_PLMN_CHANGED"; | ||
653 | 244 | case MTK2_RIL_UNSOL_VIA_INVALID_SIM_DETECTED: | ||
654 | 245 | return "MTK2_RIL_UNSOL_VIA_INVALID_SIM_DETECTED"; | ||
655 | 246 | case MTK2_RIL_UNSOL_ENG_MODE_NETWORK_INFO: | ||
656 | 247 | return "MTK2_RIL_UNSOL_ENG_MODE_NETWORK_INFO"; | ||
657 | 248 | case MTK2_RIL_UNSOL_RESPONSE_DATA_NETWORK_TYPE_CHANGED: | ||
658 | 249 | return "MTK2_RIL_UNSOL_RESPONSE_DATA_NETWORK_TYPE_CHANGED"; | ||
659 | 250 | case MTK2_RIL_UNSOL_LTE_EARFCN_INFO: | ||
660 | 251 | return "MTK2_RIL_UNSOL_LTE_EARFCN_INFO"; | ||
661 | 252 | case MTK2_RIL_UNSOL_CDMA_IMSI_READY: | ||
662 | 253 | return "MTK2_RIL_UNSOL_CDMA_IMSI_READY"; | ||
663 | 254 | case MTK2_RIL_UNSOL_CDMA_SIGNAL_FADE: | ||
664 | 255 | return "MTK2_RIL_UNSOL_CDMA_SIGNAL_FADE"; | ||
665 | 256 | case MTK2_RIL_UNSOL_CDMA_TONE_SIGNALS: | ||
666 | 257 | return "MTK2_RIL_UNSOL_CDMA_TONE_SIGNALS"; | ||
667 | 258 | case MTK2_RIL_UNSOL_NETWORK_EXIST: | ||
668 | 259 | return "MTK2_RIL_UNSOL_NETWORK_EXIST"; | ||
669 | 260 | case MTK2_RIL_UNSOL_MODULATION_INFO: | ||
670 | 261 | return "MTK2_RIL_UNSOL_MODULATION_INFO"; | ||
671 | 262 | case MTK2_RIL_UNSOL_NETWORK_EVENT: | ||
672 | 263 | return "MTK2_RIL_UNSOL_NETWORK_EVENT"; | ||
673 | 264 | case MTK2_RIL_UNSOL_MBIM_RESPONSE: | ||
674 | 265 | return "MTK2_RIL_UNSOL_MBIM_RESPONSE"; | ||
675 | 266 | case MTK2_RIL_UNSOL_MAL_DATA_CALL_LIST_CHANGED: | ||
676 | 267 | return "MTK2_RIL_UNSOL_MAL_DATA_CALL_LIST_CHANGED"; | ||
677 | 268 | case MTK2_RIL_UNSOL_EMBMS_AT_INFO : | ||
678 | 269 | return "MTK2_RIL_UNSOL_EMBMS_AT_INFO "; | ||
679 | 270 | case MTK2_RIL_UNSOL_RADIO_CAPABILITY_SWITCH_START: | ||
680 | 271 | return "MTK2_RIL_UNSOL_RADIO_CAPABILITY_SWITCH_START"; | ||
681 | 272 | default: | ||
682 | 273 | return NULL; | ||
683 | 274 | } | ||
684 | 275 | } | ||
685 | 0 | 276 | ||
686 | === added file 'drivers/mtk2modem/mtk2util.h' | |||
687 | --- drivers/mtk2modem/mtk2util.h 1970-01-01 00:00:00 +0000 | |||
688 | +++ drivers/mtk2modem/mtk2util.h 2016-07-01 17:24:58 +0000 | |||
689 | @@ -0,0 +1,39 @@ | |||
690 | 1 | /* | ||
691 | 2 | * | ||
692 | 3 | * MTK2 driver for ofono/rilmodem | ||
693 | 4 | * | ||
694 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
695 | 6 | * | ||
696 | 7 | * This program is free software; you can redistribute it and/or modify | ||
697 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
698 | 9 | * published by the Free Software Foundation. | ||
699 | 10 | * | ||
700 | 11 | * This program is distributed in the hope that it will be useful, | ||
701 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
702 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
703 | 14 | * GNU General Public License for more details. | ||
704 | 15 | * | ||
705 | 16 | * You should have received a copy of the GNU General Public License | ||
706 | 17 | * along with this program; if not, write to the Free Software | ||
707 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
708 | 19 | * | ||
709 | 20 | */ | ||
710 | 21 | |||
711 | 22 | #ifndef MTK2UTIL_H | ||
712 | 23 | #define MTK2UTIL_H | ||
713 | 24 | |||
714 | 25 | #include <ofono/types.h> | ||
715 | 26 | #include <gril.h> | ||
716 | 27 | |||
717 | 28 | #ifdef __cplusplus | ||
718 | 29 | extern "C" { | ||
719 | 30 | #endif | ||
720 | 31 | |||
721 | 32 | const char *mtk2_request_id_to_string(int req); | ||
722 | 33 | const char *mtk2_unsol_request_to_string(int req); | ||
723 | 34 | |||
724 | 35 | #ifdef __cplusplus | ||
725 | 36 | } | ||
726 | 37 | #endif | ||
727 | 38 | |||
728 | 39 | #endif /* MTK2UTIL_H */ | ||
729 | 0 | 40 | ||
730 | === added file 'drivers/mtk2modem/voicecall.c' | |||
731 | --- drivers/mtk2modem/voicecall.c 1970-01-01 00:00:00 +0000 | |||
732 | +++ drivers/mtk2modem/voicecall.c 2016-07-01 17:24:58 +0000 | |||
733 | @@ -0,0 +1,149 @@ | |||
734 | 1 | /* | ||
735 | 2 | * | ||
736 | 3 | * oFono - Open Source Telephony | ||
737 | 4 | * | ||
738 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
739 | 6 | * | ||
740 | 7 | * This program is free software; you can redistribute it and/or modify | ||
741 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
742 | 9 | * published by the Free Software Foundation. | ||
743 | 10 | * | ||
744 | 11 | * This program is distributed in the hope that it will be useful, | ||
745 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
746 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
747 | 14 | * GNU General Public License for more details. | ||
748 | 15 | * | ||
749 | 16 | * You should have received a copy of the GNU General Public License | ||
750 | 17 | * along with this program; if not, write to the Free Software | ||
751 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
752 | 19 | * | ||
753 | 20 | */ | ||
754 | 21 | #ifdef HAVE_CONFIG_H | ||
755 | 22 | #include <config.h> | ||
756 | 23 | #endif | ||
757 | 24 | |||
758 | 25 | #define _GNU_SOURCE | ||
759 | 26 | #include <string.h> | ||
760 | 27 | #include <stdlib.h> | ||
761 | 28 | #include <stdio.h> | ||
762 | 29 | #include <errno.h> | ||
763 | 30 | |||
764 | 31 | #include <glib.h> | ||
765 | 32 | |||
766 | 33 | #include <ofono/log.h> | ||
767 | 34 | #include <ofono/modem.h> | ||
768 | 35 | #include <ofono/voicecall.h> | ||
769 | 36 | |||
770 | 37 | #include "mtk2_constants.h" | ||
771 | 38 | #include "drivers/mtkmodem/mtkunsol.h" | ||
772 | 39 | #include "drivers/mtkmodem/mtkrequest.h" | ||
773 | 40 | |||
774 | 41 | #include "common.h" | ||
775 | 42 | #include "mtk2modem.h" | ||
776 | 43 | #include "drivers/rilmodem/rilutil.h" | ||
777 | 44 | #include "drivers/rilmodem/voicecall.h" | ||
778 | 45 | |||
779 | 46 | /* | ||
780 | 47 | * This is the voicecall atom implementation for mtk2modem. Most of the | ||
781 | 48 | * implementation can be found in the rilmodem atom. The main reason for | ||
782 | 49 | * creating a new atom is the need to handle specific MTK requests and | ||
783 | 50 | * unsolicited events. | ||
784 | 51 | */ | ||
785 | 52 | |||
786 | 53 | static void mtk2_set_indication_cb(struct ril_msg *message, gpointer user_data) | ||
787 | 54 | { | ||
788 | 55 | struct ofono_voicecall *vc = user_data; | ||
789 | 56 | struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc); | ||
790 | 57 | |||
791 | 58 | if (message->error == RIL_E_SUCCESS) | ||
792 | 59 | g_ril_print_response_no_args(vd->ril, message); | ||
793 | 60 | else | ||
794 | 61 | ofono_error("%s: RIL error %s", __func__, | ||
795 | 62 | ril_error_to_string(message->error)); | ||
796 | 63 | } | ||
797 | 64 | |||
798 | 65 | static void mtk2_incoming_notify(struct ril_msg *message, gpointer user_data) | ||
799 | 66 | { | ||
800 | 67 | struct ofono_voicecall *vc = user_data; | ||
801 | 68 | struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc); | ||
802 | 69 | struct parcel rilp; | ||
803 | 70 | struct unsol_call_indication *call_ind; | ||
804 | 71 | |||
805 | 72 | call_ind = g_mtk_unsol_parse_incoming_call_indication(vd->ril, message); | ||
806 | 73 | if (call_ind == NULL) { | ||
807 | 74 | ofono_error("%s: error parsing event", __func__); | ||
808 | 75 | return; | ||
809 | 76 | } | ||
810 | 77 | |||
811 | 78 | g_mtk_request_set_call_indication(vd->ril, MTK_CALL_INDIC_MODE_AVAIL, | ||
812 | 79 | call_ind->call_id, | ||
813 | 80 | call_ind->seq_number, &rilp); | ||
814 | 81 | |||
815 | 82 | if (g_ril_send(vd->ril, MTK2_RIL_REQUEST_SET_CALL_INDICATION, | ||
816 | 83 | &rilp, mtk2_set_indication_cb, vc, NULL) == 0) | ||
817 | 84 | ofono_error("%s: cannot send indication", __func__); | ||
818 | 85 | |||
819 | 86 | g_mtk_unsol_free_call_indication(call_ind); | ||
820 | 87 | } | ||
821 | 88 | |||
822 | 89 | static gboolean mtk2_delayed_register(gpointer user_data) | ||
823 | 90 | { | ||
824 | 91 | struct ofono_voicecall *vc = user_data; | ||
825 | 92 | struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc); | ||
826 | 93 | |||
827 | 94 | /* Indicates incoming call, before telling the network our state */ | ||
828 | 95 | g_ril_register(vd->ril, MTK2_RIL_UNSOL_INCOMING_CALL_INDICATION, | ||
829 | 96 | mtk2_incoming_notify, vc); | ||
830 | 97 | |||
831 | 98 | /* This makes the timeout a single-shot */ | ||
832 | 99 | return FALSE; | ||
833 | 100 | } | ||
834 | 101 | |||
835 | 102 | static int mtk2_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, | ||
836 | 103 | void *data) | ||
837 | 104 | { | ||
838 | 105 | struct ril_voicecall_driver_data *driver_data = data; | ||
839 | 106 | struct ril_voicecall_data *vd; | ||
840 | 107 | |||
841 | 108 | vd = g_try_new0(struct ril_voicecall_data, 1); | ||
842 | 109 | if (vd == NULL) | ||
843 | 110 | return -ENOMEM; | ||
844 | 111 | |||
845 | 112 | ril_voicecall_start(driver_data, vc, vendor, vd); | ||
846 | 113 | |||
847 | 114 | /* | ||
848 | 115 | * Register events after ofono_voicecall_register() is called from | ||
849 | 116 | * ril_delayed_register(). | ||
850 | 117 | */ | ||
851 | 118 | g_idle_add(mtk2_delayed_register, vc); | ||
852 | 119 | |||
853 | 120 | return 0; | ||
854 | 121 | } | ||
855 | 122 | |||
856 | 123 | static struct ofono_voicecall_driver driver = { | ||
857 | 124 | .name = MTK2MODEM, | ||
858 | 125 | .probe = mtk2_voicecall_probe, | ||
859 | 126 | .remove = ril_voicecall_remove, | ||
860 | 127 | .dial = ril_dial, | ||
861 | 128 | .answer = ril_answer, | ||
862 | 129 | .hangup_all = ril_hangup_all, | ||
863 | 130 | .release_specific = ril_hangup_specific, | ||
864 | 131 | .send_tones = ril_send_dtmf, | ||
865 | 132 | .create_multiparty = ril_create_multiparty, | ||
866 | 133 | .private_chat = ril_private_chat, | ||
867 | 134 | .swap_without_accept = ril_swap_without_accept, | ||
868 | 135 | .hold_all_active = ril_hold_all_active, | ||
869 | 136 | .release_all_held = ril_release_all_held, | ||
870 | 137 | .set_udub = ril_set_udub, | ||
871 | 138 | .release_all_active = ril_release_all_active, | ||
872 | 139 | }; | ||
873 | 140 | |||
874 | 141 | void mtk2_voicecall_init(void) | ||
875 | 142 | { | ||
876 | 143 | ofono_voicecall_driver_register(&driver); | ||
877 | 144 | } | ||
878 | 145 | |||
879 | 146 | void mtk2_voicecall_exit(void) | ||
880 | 147 | { | ||
881 | 148 | ofono_voicecall_driver_unregister(&driver); | ||
882 | 149 | } | ||
883 | 0 | 150 | ||
884 | === modified file 'drivers/mtkmodem/mtkunsol.c' | |||
885 | --- drivers/mtkmodem/mtkunsol.c 2015-03-30 09:50:34 +0000 | |||
886 | +++ drivers/mtkmodem/mtkunsol.c 2016-07-01 17:24:58 +0000 | |||
887 | @@ -45,7 +45,8 @@ | |||
888 | 45 | struct parcel rilp; | 45 | struct parcel rilp; |
889 | 46 | int numstr; | 46 | int numstr; |
890 | 47 | struct unsol_call_indication *unsol; | 47 | struct unsol_call_indication *unsol; |
892 | 48 | char *call_id, *phone, *mystery, *call_mode, *seq_num; | 48 | char *call_id, *phone, *address_type, *call_mode, *seq_num; |
893 | 49 | char *fw_address = NULL; | ||
894 | 49 | char *endp; | 50 | char *endp; |
895 | 50 | 51 | ||
896 | 51 | unsol = g_try_malloc0(sizeof(*unsol)); | 52 | unsol = g_try_malloc0(sizeof(*unsol)); |
897 | @@ -57,19 +58,26 @@ | |||
898 | 57 | g_ril_init_parcel(message, &rilp); | 58 | g_ril_init_parcel(message, &rilp); |
899 | 58 | 59 | ||
900 | 59 | numstr = parcel_r_int32(&rilp); | 60 | numstr = parcel_r_int32(&rilp); |
902 | 60 | if (numstr != 5) { | 61 | if (numstr < 5) { |
903 | 61 | ofono_error("%s: wrong array size (%d)", __func__, numstr); | 62 | ofono_error("%s: wrong array size (%d)", __func__, numstr); |
904 | 62 | goto error; | 63 | goto error; |
905 | 63 | } | 64 | } |
906 | 64 | 65 | ||
907 | 65 | call_id = parcel_r_string(&rilp); | 66 | call_id = parcel_r_string(&rilp); |
908 | 66 | phone = parcel_r_string(&rilp); | 67 | phone = parcel_r_string(&rilp); |
910 | 67 | mystery = parcel_r_string(&rilp); | 68 | address_type = parcel_r_string(&rilp); |
911 | 68 | call_mode = parcel_r_string(&rilp); | 69 | call_mode = parcel_r_string(&rilp); |
912 | 69 | seq_num = parcel_r_string(&rilp); | 70 | seq_num = parcel_r_string(&rilp); |
913 | 71 | if (numstr > 5) | ||
914 | 72 | fw_address = parcel_r_string(&rilp); | ||
915 | 70 | 73 | ||
918 | 71 | g_ril_append_print_buf(gril, "{%s,%s,%s,%s,%s}", call_id, phone, | 74 | g_ril_append_print_buf(gril, "{%s,%s,%s,%s,%s,%s}", |
919 | 72 | mystery, call_mode, seq_num); | 75 | PRINTABLE_STR(call_id), |
920 | 76 | PRINTABLE_STR(phone), | ||
921 | 77 | PRINTABLE_STR(address_type), | ||
922 | 78 | PRINTABLE_STR(call_mode), | ||
923 | 79 | PRINTABLE_STR(seq_num), | ||
924 | 80 | PRINTABLE_STR(fw_address)); | ||
925 | 73 | 81 | ||
926 | 74 | g_ril_print_unsol(gril, message); | 82 | g_ril_print_unsol(gril, message); |
927 | 75 | 83 | ||
928 | @@ -113,18 +121,20 @@ | |||
929 | 113 | 121 | ||
930 | 114 | g_free(call_id); | 122 | g_free(call_id); |
931 | 115 | g_free(phone); | 123 | g_free(phone); |
933 | 116 | g_free(mystery); | 124 | g_free(address_type); |
934 | 117 | g_free(call_mode); | 125 | g_free(call_mode); |
935 | 118 | g_free(seq_num); | 126 | g_free(seq_num); |
936 | 127 | g_free(fw_address); | ||
937 | 119 | 128 | ||
938 | 120 | return unsol; | 129 | return unsol; |
939 | 121 | 130 | ||
940 | 122 | err_conv: | 131 | err_conv: |
941 | 123 | g_free(call_id); | 132 | g_free(call_id); |
942 | 124 | g_free(phone); | 133 | g_free(phone); |
944 | 125 | g_free(mystery); | 134 | g_free(address_type); |
945 | 126 | g_free(call_mode); | 135 | g_free(call_mode); |
946 | 127 | g_free(seq_num); | 136 | g_free(seq_num); |
947 | 137 | g_free(fw_address); | ||
948 | 128 | 138 | ||
949 | 129 | error: | 139 | error: |
950 | 130 | g_free(unsol); | 140 | g_free(unsol); |
951 | 131 | 141 | ||
952 | === added file 'drivers/qcommsimmodem/gprs.c' | |||
953 | --- drivers/qcommsimmodem/gprs.c 1970-01-01 00:00:00 +0000 | |||
954 | +++ drivers/qcommsimmodem/gprs.c 2016-07-01 17:24:58 +0000 | |||
955 | @@ -0,0 +1,118 @@ | |||
956 | 1 | /* | ||
957 | 2 | * | ||
958 | 3 | * oFono - Open Source Telephony | ||
959 | 4 | * | ||
960 | 5 | * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. | ||
961 | 6 | * Copyright (C) 2010 ST-Ericsson AB. | ||
962 | 7 | * Copyright (C) 2013-2014 Canonical Ltd. | ||
963 | 8 | * Copyright (C) 2013 Jolla Ltd. | ||
964 | 9 | * Copyright (C) 2016 Ratchanan Srirattanamet. | ||
965 | 10 | * | ||
966 | 11 | * This program is free software; you can redistribute it and/or modify | ||
967 | 12 | * it under the terms of the GNU General Public License version 2 as | ||
968 | 13 | * published by the Free Software Foundation. | ||
969 | 14 | * | ||
970 | 15 | * This program is distributed in the hope that it will be useful, | ||
971 | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
972 | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
973 | 18 | * GNU General Public License for more details. | ||
974 | 19 | * | ||
975 | 20 | * You should have received a copy of the GNU General Public License | ||
976 | 21 | * along with this program; if not, write to the Free Software | ||
977 | 22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
978 | 23 | * | ||
979 | 24 | */ | ||
980 | 25 | |||
981 | 26 | #include <glib.h> | ||
982 | 27 | |||
983 | 28 | #include <ofono/log.h> | ||
984 | 29 | #include <ofono/modem.h> | ||
985 | 30 | #include <ofono/gprs.h> | ||
986 | 31 | |||
987 | 32 | #include "gril.h" | ||
988 | 33 | |||
989 | 34 | #include "drivers/rilmodem/rilutil.h" | ||
990 | 35 | #include "drivers/rilmodem/gprs.h" | ||
991 | 36 | #include "qcom_msim_modem.h" | ||
992 | 37 | #include "qcom_msim_constants.h" | ||
993 | 38 | |||
994 | 39 | static void set_data_sub_cb(struct ril_msg *message, gpointer user_data) | ||
995 | 40 | { | ||
996 | 41 | struct cb_data *cbd = user_data; | ||
997 | 42 | ofono_gprs_cb_t cb = cbd->cb; | ||
998 | 43 | struct ril_gprs_data *gd = cbd->user; | ||
999 | 44 | |||
1000 | 45 | if (message->error == RIL_E_SUCCESS) { | ||
1001 | 46 | g_ril_print_response_no_args(gd->ril, message); | ||
1002 | 47 | |||
1003 | 48 | gd->ofono_attached = 1; | ||
1004 | 49 | |||
1005 | 50 | CALLBACK_WITH_SUCCESS(cb, cbd->data); | ||
1006 | 51 | } else { | ||
1007 | 52 | ofono_error("%s: RIL error %s", __func__, | ||
1008 | 53 | ril_error_to_string(message->error)); | ||
1009 | 54 | CALLBACK_WITH_FAILURE(cb, cbd->data); | ||
1010 | 55 | } | ||
1011 | 56 | } | ||
1012 | 57 | |||
1013 | 58 | static void qcom_msim_gprs_set_attached(struct ofono_gprs *gprs, int attached, | ||
1014 | 59 | ofono_gprs_cb_t cb, void *data) | ||
1015 | 60 | { | ||
1016 | 61 | struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); | ||
1017 | 62 | struct cb_data *cbd = cb_data_new(cb, data, gd); | ||
1018 | 63 | |||
1019 | 64 | DBG("attached: %d", attached); | ||
1020 | 65 | |||
1021 | 66 | /* | ||
1022 | 67 | * This modem use RIL_REQUEST_SET_DATA_SUBSCRIPTION to select which SIM | ||
1023 | 68 | * is used for data connection. We still doesn't have actual control | ||
1024 | 69 | * over 'attached' state. So, we still use the same trick as rilmodem's | ||
1025 | 70 | * gprs atom (save the desired state, and use it to override the actual | ||
1026 | 71 | * modem's state in the 'attached_status' function). | ||
1027 | 72 | * | ||
1028 | 73 | * The core gprs code calls driver->set_attached() when a netreg | ||
1029 | 74 | * notificaiton is received and any configured roaming conditions | ||
1030 | 75 | * are met. | ||
1031 | 76 | */ | ||
1032 | 77 | |||
1033 | 78 | if (attached) { | ||
1034 | 79 | /* | ||
1035 | 80 | * We don't have a request to see if we're a selected SIM slot. | ||
1036 | 81 | * So, we just send this request. There's no harm sending this | ||
1037 | 82 | * repeatedly anyway. | ||
1038 | 83 | */ | ||
1039 | 84 | g_ril_send(gd->ril, QCOM_MSIM_RIL_REQUEST_SET_DATA_SUBSCRIPTION | ||
1040 | 85 | , NULL, set_data_sub_cb, cbd, NULL); | ||
1041 | 86 | } else { | ||
1042 | 87 | /* | ||
1043 | 88 | * We don't actually have a request to unselect the slot. | ||
1044 | 89 | * So, just do nothing. | ||
1045 | 90 | */ | ||
1046 | 91 | gd->ofono_attached = attached; | ||
1047 | 92 | |||
1048 | 93 | /* | ||
1049 | 94 | * Call from idle loop, so core can set driver_attached before | ||
1050 | 95 | * the callback is invoked. | ||
1051 | 96 | */ | ||
1052 | 97 | g_idle_add(ril_gprs_set_attached_cb, cbd); | ||
1053 | 98 | } | ||
1054 | 99 | } | ||
1055 | 100 | |||
1056 | 101 | static struct ofono_gprs_driver driver = { | ||
1057 | 102 | .name = QCOMMSIMMODEM, | ||
1058 | 103 | .probe = ril_gprs_probe, | ||
1059 | 104 | .remove = ril_gprs_remove, | ||
1060 | 105 | .set_attached = qcom_msim_gprs_set_attached, | ||
1061 | 106 | .attached_status = ril_gprs_registration_status, | ||
1062 | 107 | .set_ia_apn = ril_gprs_set_ia_apn, | ||
1063 | 108 | }; | ||
1064 | 109 | |||
1065 | 110 | void qcom_msim_gprs_init(void) | ||
1066 | 111 | { | ||
1067 | 112 | ofono_gprs_driver_register(&driver); | ||
1068 | 113 | } | ||
1069 | 114 | |||
1070 | 115 | void qcom_msim_gprs_exit(void) | ||
1071 | 116 | { | ||
1072 | 117 | ofono_gprs_driver_unregister(&driver); | ||
1073 | 118 | } | ||
1074 | 0 | 119 | ||
1075 | === modified file 'drivers/qcommsimmodem/qcom_msim_constants.h' | |||
1076 | --- drivers/qcommsimmodem/qcom_msim_constants.h 2015-06-11 16:14:06 +0000 | |||
1077 | +++ drivers/qcommsimmodem/qcom_msim_constants.h 2016-07-01 17:24:58 +0000 | |||
1078 | @@ -24,6 +24,7 @@ | |||
1079 | 24 | 24 | ||
1080 | 25 | #define QCOMMSIM_NUM_SLOTS_MAX 2 | 25 | #define QCOMMSIM_NUM_SLOTS_MAX 2 |
1081 | 26 | 26 | ||
1083 | 27 | #define QCOM_MSIM_RIL_REQUEST_SET_UICC_SUBSCRIPTION 115 | 27 | #define QCOM_MSIM_RIL_REQUEST_SET_UICC_SUBSCRIPTION 115 |
1084 | 28 | #define QCOM_MSIM_RIL_REQUEST_SET_DATA_SUBSCRIPTION 116 | ||
1085 | 28 | 29 | ||
1086 | 29 | #endif /* QCOM_MSIM_CONSTANTS_H */ | 30 | #endif /* QCOM_MSIM_CONSTANTS_H */ |
1087 | 30 | 31 | ||
1088 | === modified file 'drivers/qcommsimmodem/qcom_msim_modem.c' | |||
1089 | --- drivers/qcommsimmodem/qcom_msim_modem.c 2015-06-11 16:14:06 +0000 | |||
1090 | +++ drivers/qcommsimmodem/qcom_msim_modem.c 2016-07-01 17:24:58 +0000 | |||
1091 | @@ -40,6 +40,7 @@ | |||
1092 | 40 | DBG(""); | 40 | DBG(""); |
1093 | 41 | 41 | ||
1094 | 42 | qcom_msim_radio_settings_init(); | 42 | qcom_msim_radio_settings_init(); |
1095 | 43 | qcom_msim_gprs_init(); | ||
1096 | 43 | 44 | ||
1097 | 44 | return 0; | 45 | return 0; |
1098 | 45 | } | 46 | } |
1099 | @@ -49,6 +50,7 @@ | |||
1100 | 49 | DBG(""); | 50 | DBG(""); |
1101 | 50 | 51 | ||
1102 | 51 | qcom_msim_radio_settings_exit(); | 52 | qcom_msim_radio_settings_exit(); |
1103 | 53 | qcom_msim_gprs_exit(); | ||
1104 | 52 | } | 54 | } |
1105 | 53 | 55 | ||
1106 | 54 | OFONO_PLUGIN_DEFINE(qcommsimmodem, "Qualcomm multi-sim modem driver", VERSION, | 56 | OFONO_PLUGIN_DEFINE(qcommsimmodem, "Qualcomm multi-sim modem driver", VERSION, |
1107 | 55 | 57 | ||
1108 | === modified file 'drivers/qcommsimmodem/qcom_msim_modem.h' | |||
1109 | --- drivers/qcommsimmodem/qcom_msim_modem.h 2015-06-11 16:14:06 +0000 | |||
1110 | +++ drivers/qcommsimmodem/qcom_msim_modem.h 2016-07-01 17:24:58 +0000 | |||
1111 | @@ -23,3 +23,6 @@ | |||
1112 | 23 | 23 | ||
1113 | 24 | extern void qcom_msim_radio_settings_init(void); | 24 | extern void qcom_msim_radio_settings_init(void); |
1114 | 25 | extern void qcom_msim_radio_settings_exit(void); | 25 | extern void qcom_msim_radio_settings_exit(void); |
1115 | 26 | |||
1116 | 27 | extern void qcom_msim_gprs_init(void); | ||
1117 | 28 | extern void qcom_msim_gprs_exit(void); | ||
1118 | 26 | 29 | ||
1119 | === modified file 'drivers/rilmodem/call-barring.c' | |||
1120 | --- drivers/rilmodem/call-barring.c 2016-01-05 14:42:38 +0000 | |||
1121 | +++ drivers/rilmodem/call-barring.c 2016-07-01 17:24:58 +0000 | |||
1122 | @@ -33,6 +33,7 @@ | |||
1123 | 33 | #include "call-barring.h" | 33 | #include "call-barring.h" |
1124 | 34 | #include "rilmodem.h" | 34 | #include "rilmodem.h" |
1125 | 35 | #include "ril_constants.h" | 35 | #include "ril_constants.h" |
1126 | 36 | #include "rilutil.h" | ||
1127 | 36 | 37 | ||
1128 | 37 | struct barring_data { | 38 | struct barring_data { |
1129 | 38 | GRil *ril; | 39 | GRil *ril; |
1130 | 39 | 40 | ||
1131 | === modified file 'drivers/rilmodem/call-forwarding.c' | |||
1132 | --- drivers/rilmodem/call-forwarding.c 2015-09-29 08:46:51 +0000 | |||
1133 | +++ drivers/rilmodem/call-forwarding.c 2016-07-01 17:24:58 +0000 | |||
1134 | @@ -42,6 +42,7 @@ | |||
1135 | 42 | #include "grilreply.h" | 42 | #include "grilreply.h" |
1136 | 43 | #include "grilunsol.h" | 43 | #include "grilunsol.h" |
1137 | 44 | 44 | ||
1138 | 45 | #include "rilutil.h" | ||
1139 | 45 | #include "rilmodem.h" | 46 | #include "rilmodem.h" |
1140 | 46 | 47 | ||
1141 | 47 | #include "common.h" | 48 | #include "common.h" |
1142 | 48 | 49 | ||
1143 | === modified file 'drivers/rilmodem/call-settings.c' | |||
1144 | --- drivers/rilmodem/call-settings.c 2013-12-10 09:44:10 +0000 | |||
1145 | +++ drivers/rilmodem/call-settings.c 2016-07-01 17:24:58 +0000 | |||
1146 | @@ -44,6 +44,7 @@ | |||
1147 | 44 | #include "grilreply.h" | 44 | #include "grilreply.h" |
1148 | 45 | 45 | ||
1149 | 46 | #include "rilmodem.h" | 46 | #include "rilmodem.h" |
1150 | 47 | #include "rilutil.h" | ||
1151 | 47 | #include "ril_constants.h" | 48 | #include "ril_constants.h" |
1152 | 48 | #include "common.h" | 49 | #include "common.h" |
1153 | 49 | 50 | ||
1154 | 50 | 51 | ||
1155 | === modified file 'drivers/rilmodem/call-volume.c' | |||
1156 | --- drivers/rilmodem/call-volume.c 2013-12-09 17:09:20 +0000 | |||
1157 | +++ drivers/rilmodem/call-volume.c 2016-07-01 17:24:58 +0000 | |||
1158 | @@ -41,6 +41,7 @@ | |||
1159 | 41 | #include "common.h" | 41 | #include "common.h" |
1160 | 42 | 42 | ||
1161 | 43 | #include "rilmodem.h" | 43 | #include "rilmodem.h" |
1162 | 44 | #include "rilutil.h" | ||
1163 | 44 | #include "parcel.h" | 45 | #include "parcel.h" |
1164 | 45 | #include "grilrequest.h" | 46 | #include "grilrequest.h" |
1165 | 46 | #include "grilreply.h" | 47 | #include "grilreply.h" |
1166 | 47 | 48 | ||
1167 | === modified file 'drivers/rilmodem/devinfo.c' | |||
1168 | --- drivers/rilmodem/devinfo.c 2013-12-09 17:09:20 +0000 | |||
1169 | +++ drivers/rilmodem/devinfo.c 2016-07-01 17:24:58 +0000 | |||
1170 | @@ -39,6 +39,7 @@ | |||
1171 | 39 | #include "gril.h" | 39 | #include "gril.h" |
1172 | 40 | 40 | ||
1173 | 41 | #include "rilmodem.h" | 41 | #include "rilmodem.h" |
1174 | 42 | #include "rilutil.h" | ||
1175 | 42 | #include "grilreply.h" | 43 | #include "grilreply.h" |
1176 | 43 | 44 | ||
1177 | 44 | /* | 45 | /* |
1178 | 45 | 46 | ||
1179 | === modified file 'drivers/rilmodem/gprs.c' | |||
1180 | --- drivers/rilmodem/gprs.c 2016-04-13 14:35:57 +0000 | |||
1181 | +++ drivers/rilmodem/gprs.c 2016-07-01 17:24:58 +0000 | |||
1182 | @@ -38,6 +38,7 @@ | |||
1183 | 38 | #include <ofono/modem.h> | 38 | #include <ofono/modem.h> |
1184 | 39 | #include <ofono/gprs.h> | 39 | #include <ofono/gprs.h> |
1185 | 40 | #include <ofono/types.h> | 40 | #include <ofono/types.h> |
1186 | 41 | #include <ofono.h> | ||
1187 | 41 | 42 | ||
1188 | 42 | #include "gril.h" | 43 | #include "gril.h" |
1189 | 43 | #include "grilutil.h" | 44 | #include "grilutil.h" |
1190 | @@ -49,9 +50,13 @@ | |||
1191 | 49 | #include "grilunsol.h" | 50 | #include "grilunsol.h" |
1192 | 50 | #include "gprs.h" | 51 | #include "gprs.h" |
1193 | 51 | 52 | ||
1194 | 53 | #include "plugins/ril.h" | ||
1195 | 54 | |||
1196 | 52 | /* Time between get data status retries */ | 55 | /* Time between get data status retries */ |
1197 | 53 | #define GET_STATUS_TIMER_MS 5000 | 56 | #define GET_STATUS_TIMER_MS 5000 |
1198 | 54 | 57 | ||
1199 | 58 | static void send_allow_data(struct cb_data *cbd, GRil *ril, int attached); | ||
1200 | 59 | |||
1201 | 55 | /* | 60 | /* |
1202 | 56 | * This module is the ofono_gprs_driver implementation for rilmodem. | 61 | * This module is the ofono_gprs_driver implementation for rilmodem. |
1203 | 57 | * | 62 | * |
1204 | @@ -78,6 +83,7 @@ | |||
1205 | 78 | case RADIO_TECH_EDGE: | 83 | case RADIO_TECH_EDGE: |
1206 | 79 | return PACKET_BEARER_EGPRS; | 84 | return PACKET_BEARER_EGPRS; |
1207 | 80 | case RADIO_TECH_UMTS: | 85 | case RADIO_TECH_UMTS: |
1208 | 86 | case RADIO_TECH_TD_SCDMA: | ||
1209 | 81 | return PACKET_BEARER_UMTS; | 87 | return PACKET_BEARER_UMTS; |
1210 | 82 | case RADIO_TECH_HSDPA: | 88 | case RADIO_TECH_HSDPA: |
1211 | 83 | return PACKET_BEARER_HSDPA; | 89 | return PACKET_BEARER_HSDPA; |
1212 | @@ -162,6 +168,75 @@ | |||
1213 | 162 | ril_gprs_registration_status(gprs, NULL, NULL); | 168 | ril_gprs_registration_status(gprs, NULL, NULL); |
1214 | 163 | } | 169 | } |
1215 | 164 | 170 | ||
1216 | 171 | struct gprs_attach_data { | ||
1217 | 172 | struct ril_gprs_data *gd; | ||
1218 | 173 | GRil *ril; | ||
1219 | 174 | gboolean set_attached; | ||
1220 | 175 | gboolean detaching_other_slot; | ||
1221 | 176 | }; | ||
1222 | 177 | |||
1223 | 178 | static void free_attach_cbd(struct cb_data *cbd) | ||
1224 | 179 | { | ||
1225 | 180 | g_free(cbd->user); | ||
1226 | 181 | g_free(cbd); | ||
1227 | 182 | } | ||
1228 | 183 | |||
1229 | 184 | static void gprs_allow_data_cb(struct ril_msg *message, gpointer user_data) | ||
1230 | 185 | { | ||
1231 | 186 | struct cb_data *cbd = user_data; | ||
1232 | 187 | ofono_gprs_cb_t cb = cbd->cb; | ||
1233 | 188 | struct gprs_attach_data *attach_data = cbd->user; | ||
1234 | 189 | struct ril_gprs_data *gd = attach_data->gd; | ||
1235 | 190 | |||
1236 | 191 | g_ril_print_response_no_args(attach_data->ril, message); | ||
1237 | 192 | |||
1238 | 193 | /* | ||
1239 | 194 | * We do not care if detaching the other slot fails. This happens in | ||
1240 | 195 | * turbo when the other slot is empty, for instance. | ||
1241 | 196 | */ | ||
1242 | 197 | if (attach_data->detaching_other_slot) { | ||
1243 | 198 | attach_data->ril = gd->ril; | ||
1244 | 199 | attach_data->detaching_other_slot = FALSE; | ||
1245 | 200 | |||
1246 | 201 | send_allow_data(cbd, gd->ril, attach_data->set_attached); | ||
1247 | 202 | return; | ||
1248 | 203 | } | ||
1249 | 204 | |||
1250 | 205 | if (message->error != RIL_E_SUCCESS) { | ||
1251 | 206 | ofono_error("%s: RIL error %s", __func__, | ||
1252 | 207 | ril_error_to_string(message->error)); | ||
1253 | 208 | CALLBACK_WITH_FAILURE(cb, cbd->data); | ||
1254 | 209 | free_attach_cbd(cbd); | ||
1255 | 210 | return; | ||
1256 | 211 | } | ||
1257 | 212 | |||
1258 | 213 | gd->ofono_attached = attach_data->set_attached; | ||
1259 | 214 | |||
1260 | 215 | CALLBACK_WITH_SUCCESS(cb, cbd->data); | ||
1261 | 216 | |||
1262 | 217 | free_attach_cbd(cbd); | ||
1263 | 218 | } | ||
1264 | 219 | |||
1265 | 220 | static void send_allow_data(struct cb_data *cbd, GRil *ril, int attached) | ||
1266 | 221 | { | ||
1267 | 222 | ofono_gprs_cb_t cb = cbd->cb; | ||
1268 | 223 | struct parcel rilp; | ||
1269 | 224 | |||
1270 | 225 | /* ALLOW_DATA payload: int[] with attach value */ | ||
1271 | 226 | parcel_init(&rilp); | ||
1272 | 227 | parcel_w_int32(&rilp, 1); | ||
1273 | 228 | parcel_w_int32(&rilp, attached); | ||
1274 | 229 | |||
1275 | 230 | g_ril_append_print_buf(ril, "(%d)", attached); | ||
1276 | 231 | |||
1277 | 232 | if (g_ril_send(ril, RIL_REQUEST_ALLOW_DATA, &rilp, | ||
1278 | 233 | gprs_allow_data_cb, cbd, NULL) == 0) { | ||
1279 | 234 | ofono_error("%s: send failed", __func__); | ||
1280 | 235 | free_attach_cbd(cbd); | ||
1281 | 236 | CALLBACK_WITH_FAILURE(cb, cbd->data); | ||
1282 | 237 | } | ||
1283 | 238 | } | ||
1284 | 239 | |||
1285 | 165 | gboolean ril_gprs_set_attached_cb(gpointer user_data) | 240 | gboolean ril_gprs_set_attached_cb(gpointer user_data) |
1286 | 166 | { | 241 | { |
1287 | 167 | struct cb_data *cbd = user_data; | 242 | struct cb_data *cbd = user_data; |
1288 | @@ -176,44 +251,55 @@ | |||
1289 | 176 | return FALSE; | 251 | return FALSE; |
1290 | 177 | } | 252 | } |
1291 | 178 | 253 | ||
1294 | 179 | static void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached, | 254 | void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached, |
1295 | 180 | ofono_gprs_cb_t cb, void *data) | 255 | ofono_gprs_cb_t cb, void *data) |
1296 | 181 | { | 256 | { |
1297 | 182 | struct cb_data *cbd = cb_data_new(cb, data, NULL); | 257 | struct cb_data *cbd = cb_data_new(cb, data, NULL); |
1298 | 183 | struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); | 258 | struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); |
1299 | 259 | struct gprs_attach_data *attach_data; | ||
1300 | 260 | int attach_aux = attached; | ||
1301 | 184 | 261 | ||
1302 | 185 | DBG("attached: %d", attached); | 262 | DBG("attached: %d", attached); |
1303 | 186 | 263 | ||
1334 | 187 | /* | 264 | if (g_ril_get_version(gd->ril) < 10) { |
1335 | 188 | * As RIL offers no actual control over the GPRS 'attached' | 265 | /* |
1336 | 189 | * state, we save the desired state, and use it to override | 266 | * Older RILs offer no actual control over the GPRS 'attached' |
1337 | 190 | * the actual modem's state in the 'attached_status' function. | 267 | * state, we save the desired state, and use it to override |
1338 | 191 | * This is similar to the way the core ofono gprs code handles | 268 | * the actual modem's state in the 'attached_status' function. |
1339 | 192 | * data roaming ( see src/gprs.c gprs_netreg_update(). | 269 | * This is similar to the way the core ofono gprs code handles |
1340 | 193 | * | 270 | * data roaming ( see src/gprs.c gprs_netreg_update() ). |
1341 | 194 | * The core gprs code calls driver->set_attached() when a netreg | 271 | * |
1342 | 195 | * notificaiton is received and any configured roaming conditions | 272 | * The core gprs code calls driver->set_attached() when a netreg |
1343 | 196 | * are met. | 273 | * notificaiton is received and any configured roaming |
1344 | 197 | */ | 274 | * conditions are met. |
1345 | 198 | gd->ofono_attached = attached; | 275 | */ |
1346 | 199 | 276 | gd->ofono_attached = attached; | |
1347 | 200 | /* | 277 | |
1348 | 201 | * Call from idle loop, so core can set driver_attached before | 278 | /* |
1349 | 202 | * the callback is invoked. | 279 | * Call from idle loop, so core can set driver_attached before |
1350 | 203 | */ | 280 | * the callback is invoked. |
1351 | 204 | g_idle_add(ril_gprs_set_attached_cb, cbd); | 281 | */ |
1352 | 205 | } | 282 | g_idle_add(ril_gprs_set_attached_cb, cbd); |
1353 | 206 | 283 | return; | |
1354 | 207 | static gboolean ril_get_status_retry(gpointer user_data) | 284 | } |
1355 | 208 | { | 285 | |
1356 | 209 | struct ofono_gprs *gprs = user_data; | 286 | attach_data = g_new0(struct gprs_attach_data, 1); |
1357 | 210 | struct ril_gprs_data *gd = ofono_gprs_get_data(gprs); | 287 | attach_data->gd = gd; |
1358 | 211 | 288 | attach_data->ril = gd->ril; | |
1359 | 212 | gd->status_retry_cb_id = 0; | 289 | attach_data->set_attached = attached; |
1360 | 213 | 290 | attach_data->detaching_other_slot = FALSE; | |
1361 | 214 | ril_gprs_registration_status(gprs, NULL, NULL); | 291 | |
1362 | 215 | 292 | /* If we want to attach we have to detach the other slot */ | |
1363 | 216 | return FALSE; | 293 | if (attached && ril_get_gril_complement(gd->modem)) { |
1364 | 294 | attach_data->ril = ril_get_gril_complement(gd->modem); | ||
1365 | 295 | attach_data->detaching_other_slot = TRUE; | ||
1366 | 296 | |||
1367 | 297 | attach_aux = !attached; | ||
1368 | 298 | } | ||
1369 | 299 | |||
1370 | 300 | cbd = cb_data_new(cb, data, attach_data); | ||
1371 | 301 | |||
1372 | 302 | send_allow_data(cbd, attach_data->ril, attach_aux); | ||
1373 | 217 | } | 303 | } |
1374 | 218 | 304 | ||
1375 | 219 | static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data) | 305 | static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data) |
1376 | @@ -229,17 +315,32 @@ | |||
1377 | 229 | 315 | ||
1378 | 230 | old_status = gd->rild_status; | 316 | old_status = gd->rild_status; |
1379 | 231 | 317 | ||
1381 | 232 | if (message->error != RIL_E_SUCCESS) { | 318 | if (message->error == RIL_E_SUCCESS) { |
1382 | 319 | reply = g_ril_reply_parse_data_reg_state(gd->ril, message); | ||
1383 | 320 | if (reply == NULL) { | ||
1384 | 321 | if (cb) | ||
1385 | 322 | CALLBACK_WITH_FAILURE(cb, -1, cbd->data); | ||
1386 | 323 | return; | ||
1387 | 324 | } | ||
1388 | 325 | } else { | ||
1389 | 326 | /* | ||
1390 | 327 | * If we get a RIL error (say, radio not available) it is better | ||
1391 | 328 | * to return unknown values than to call cb with failure status. | ||
1392 | 329 | * If we do the last, ConnectionManager would not be created if | ||
1393 | 330 | * this is the first time we retrieve data status, or we can | ||
1394 | 331 | * even create infinite loops as the status in gprs atom would | ||
1395 | 332 | * not be refreshed. When we finally register we will get events | ||
1396 | 333 | * so we will try to retrieve data state again. | ||
1397 | 334 | */ | ||
1398 | 233 | ofono_error("%s: DATA_REGISTRATION_STATE reply failure: %s", | 335 | ofono_error("%s: DATA_REGISTRATION_STATE reply failure: %s", |
1399 | 234 | __func__, | 336 | __func__, |
1400 | 235 | ril_error_to_string(message->error)); | 337 | ril_error_to_string(message->error)); |
1402 | 236 | goto error; | 338 | |
1403 | 339 | reply = g_malloc0(sizeof(*reply)); | ||
1404 | 340 | reply->reg_state.status = NETWORK_REGISTRATION_STATUS_UNKNOWN; | ||
1405 | 341 | reply->reg_state.tech = RADIO_TECH_UNKNOWN; | ||
1406 | 237 | } | 342 | } |
1407 | 238 | 343 | ||
1408 | 239 | reply = g_ril_reply_parse_data_reg_state(gd->ril, message); | ||
1409 | 240 | if (reply == NULL) | ||
1410 | 241 | goto error; | ||
1411 | 242 | |||
1412 | 243 | /* | 344 | /* |
1413 | 244 | * There are three cases that can result in this callback | 345 | * There are three cases that can result in this callback |
1414 | 245 | * running: | 346 | * running: |
1415 | @@ -344,21 +445,6 @@ | |||
1416 | 344 | CALLBACK_WITH_SUCCESS(cb, reply->reg_state.status, cbd->data); | 445 | CALLBACK_WITH_SUCCESS(cb, reply->reg_state.status, cbd->data); |
1417 | 345 | 446 | ||
1418 | 346 | g_free(reply); | 447 | g_free(reply); |
1419 | 347 | |||
1420 | 348 | return; | ||
1421 | 349 | error: | ||
1422 | 350 | |||
1423 | 351 | /* | ||
1424 | 352 | * For some modems DATA_REGISTRATION_STATE will return an error until we | ||
1425 | 353 | * are registered in the voice network. | ||
1426 | 354 | */ | ||
1427 | 355 | if (old_status == -1 && message->error == RIL_E_GENERIC_FAILURE) | ||
1428 | 356 | gd->status_retry_cb_id = | ||
1429 | 357 | g_timeout_add(GET_STATUS_TIMER_MS, | ||
1430 | 358 | ril_get_status_retry, gprs); | ||
1431 | 359 | |||
1432 | 360 | if (cb) | ||
1433 | 361 | CALLBACK_WITH_FAILURE(cb, -1, cbd->data); | ||
1434 | 362 | } | 448 | } |
1435 | 363 | 449 | ||
1436 | 364 | void ril_gprs_registration_status(struct ofono_gprs *gprs, | 450 | void ril_gprs_registration_status(struct ofono_gprs *gprs, |
1437 | 365 | 451 | ||
1438 | === modified file 'drivers/rilmodem/gprs.h' | |||
1439 | --- drivers/rilmodem/gprs.h 2015-01-29 14:50:30 +0000 | |||
1440 | +++ drivers/rilmodem/gprs.h 2016-07-01 17:24:58 +0000 | |||
1441 | @@ -38,6 +38,8 @@ | |||
1442 | 38 | void ril_gprs_start(struct ril_gprs_driver_data *driver_data, | 38 | void ril_gprs_start(struct ril_gprs_driver_data *driver_data, |
1443 | 39 | struct ofono_gprs *gprs, struct ril_gprs_data *gd); | 39 | struct ofono_gprs *gprs, struct ril_gprs_data *gd); |
1444 | 40 | gboolean ril_gprs_set_attached_cb(gpointer user_data); | 40 | gboolean ril_gprs_set_attached_cb(gpointer user_data); |
1445 | 41 | void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached, | ||
1446 | 42 | ofono_gprs_cb_t cb, void *data); | ||
1447 | 41 | void ril_gprs_registration_status(struct ofono_gprs *gprs, | 43 | void ril_gprs_registration_status(struct ofono_gprs *gprs, |
1448 | 42 | ofono_gprs_status_cb_t cb, void *data); | 44 | ofono_gprs_status_cb_t cb, void *data); |
1449 | 43 | void ril_gprs_set_ia_apn(struct ofono_gprs *gprs, const char *apn, | 45 | void ril_gprs_set_ia_apn(struct ofono_gprs *gprs, const char *apn, |
1450 | 44 | 46 | ||
1451 | === modified file 'drivers/rilmodem/network-registration.c' | |||
1452 | --- drivers/rilmodem/network-registration.c 2015-09-29 08:46:51 +0000 | |||
1453 | +++ drivers/rilmodem/network-registration.c 2016-07-01 17:24:58 +0000 | |||
1454 | @@ -40,6 +40,7 @@ | |||
1455 | 40 | 40 | ||
1456 | 41 | #include "common.h" | 41 | #include "common.h" |
1457 | 42 | #include "gril.h" | 42 | #include "gril.h" |
1458 | 43 | #include "rilutil.h" | ||
1459 | 43 | #include "rilmodem.h" | 44 | #include "rilmodem.h" |
1460 | 44 | 45 | ||
1461 | 45 | #include "grilreply.h" | 46 | #include "grilreply.h" |
1462 | @@ -81,6 +82,7 @@ | |||
1463 | 81 | case RADIO_TECH_EDGE: | 82 | case RADIO_TECH_EDGE: |
1464 | 82 | return ACCESS_TECHNOLOGY_GSM_EGPRS; | 83 | return ACCESS_TECHNOLOGY_GSM_EGPRS; |
1465 | 83 | case RADIO_TECH_UMTS: | 84 | case RADIO_TECH_UMTS: |
1466 | 85 | case RADIO_TECH_TD_SCDMA: | ||
1467 | 84 | return ACCESS_TECHNOLOGY_UTRAN; | 86 | return ACCESS_TECHNOLOGY_UTRAN; |
1468 | 85 | case RADIO_TECH_HSDPA: | 87 | case RADIO_TECH_HSDPA: |
1469 | 86 | return ACCESS_TECHNOLOGY_UTRAN_HSDPA; | 88 | return ACCESS_TECHNOLOGY_UTRAN_HSDPA; |
1470 | 87 | 89 | ||
1471 | === modified file 'drivers/rilmodem/phonebook.c' | |||
1472 | --- drivers/rilmodem/phonebook.c 2015-09-10 07:16:24 +0000 | |||
1473 | +++ drivers/rilmodem/phonebook.c 2016-07-01 17:24:58 +0000 | |||
1474 | @@ -48,6 +48,7 @@ | |||
1475 | 48 | #include "simutil.h" | 48 | #include "simutil.h" |
1476 | 49 | #include "common.h" | 49 | #include "common.h" |
1477 | 50 | 50 | ||
1478 | 51 | #include "rilutil.h" | ||
1479 | 51 | #include "rilmodem.h" | 52 | #include "rilmodem.h" |
1480 | 52 | 53 | ||
1481 | 53 | #define UNUSED 0xFF | 54 | #define UNUSED 0xFF |
1482 | 54 | 55 | ||
1483 | === modified file 'drivers/rilmodem/radio-settings.c' | |||
1484 | --- drivers/rilmodem/radio-settings.c 2015-09-29 08:46:51 +0000 | |||
1485 | +++ drivers/rilmodem/radio-settings.c 2016-07-01 17:24:58 +0000 | |||
1486 | @@ -39,6 +39,7 @@ | |||
1487 | 39 | 39 | ||
1488 | 40 | #include "gril.h" | 40 | #include "gril.h" |
1489 | 41 | 41 | ||
1490 | 42 | #include "rilutil.h" | ||
1491 | 42 | #include "rilmodem.h" | 43 | #include "rilmodem.h" |
1492 | 43 | 44 | ||
1493 | 44 | #include "grilrequest.h" | 45 | #include "grilrequest.h" |
1494 | @@ -229,23 +230,74 @@ | |||
1495 | 229 | return FALSE; | 230 | return FALSE; |
1496 | 230 | } | 231 | } |
1497 | 231 | 232 | ||
1498 | 233 | static void get_radio_caps_cb(struct ril_msg *message, gpointer user_data) | ||
1499 | 234 | { | ||
1500 | 235 | unsigned int available_rats = 0; | ||
1501 | 236 | struct cb_data *cbd = user_data; | ||
1502 | 237 | ofono_radio_settings_available_rats_query_cb_t cb = cbd->cb; | ||
1503 | 238 | struct ofono_radio_settings *rs = cbd->user; | ||
1504 | 239 | struct radio_data *rd = ofono_radio_settings_get_data(rs); | ||
1505 | 240 | struct reply_radio_capability *caps; | ||
1506 | 241 | |||
1507 | 242 | if (message->error != RIL_E_SUCCESS) { | ||
1508 | 243 | ofono_error("%s: error %s", __func__, | ||
1509 | 244 | ril_error_to_string(message->error)); | ||
1510 | 245 | CALLBACK_WITH_FAILURE(cb, 0, cbd->data); | ||
1511 | 246 | return; | ||
1512 | 247 | } | ||
1513 | 248 | |||
1514 | 249 | caps = g_ril_reply_parse_get_radio_capability(rd->ril, message); | ||
1515 | 250 | if (caps == NULL) { | ||
1516 | 251 | ofono_error("%s: parse error", __func__); | ||
1517 | 252 | CALLBACK_WITH_FAILURE(cb, 0, cbd->data); | ||
1518 | 253 | return; | ||
1519 | 254 | } | ||
1520 | 255 | |||
1521 | 256 | if (caps->rat & RIL_RAF_GSM) | ||
1522 | 257 | available_rats |= OFONO_RADIO_ACCESS_MODE_GSM; | ||
1523 | 258 | |||
1524 | 259 | if (caps->rat & (RIL_RAF_UMTS | RIL_RAF_TD_SCDMA)) | ||
1525 | 260 | available_rats |= OFONO_RADIO_ACCESS_MODE_UMTS; | ||
1526 | 261 | |||
1527 | 262 | if (caps->rat & RIL_RAF_LTE) | ||
1528 | 263 | available_rats |= OFONO_RADIO_ACCESS_MODE_LTE; | ||
1529 | 264 | |||
1530 | 265 | g_free(caps); | ||
1531 | 266 | |||
1532 | 267 | CALLBACK_WITH_SUCCESS(cb, available_rats, cbd->data); | ||
1533 | 268 | } | ||
1534 | 269 | |||
1535 | 232 | void ril_query_available_rats(struct ofono_radio_settings *rs, | 270 | void ril_query_available_rats(struct ofono_radio_settings *rs, |
1536 | 233 | ofono_radio_settings_available_rats_query_cb_t cb, | 271 | ofono_radio_settings_available_rats_query_cb_t cb, |
1537 | 234 | void *data) | 272 | void *data) |
1538 | 235 | { | 273 | { |
1539 | 274 | struct radio_data *rd = ofono_radio_settings_get_data(rs); | ||
1540 | 236 | struct cb_data *cbd = cb_data_new(cb, data, rs); | 275 | struct cb_data *cbd = cb_data_new(cb, data, rs); |
1541 | 237 | 276 | ||
1543 | 238 | g_idle_add(query_available_rats_cb, cbd); | 277 | if (g_ril_get_version(rd->ril) < 11) { |
1544 | 278 | g_idle_add(query_available_rats_cb, cbd); | ||
1545 | 279 | return; | ||
1546 | 280 | } | ||
1547 | 281 | |||
1548 | 282 | if (g_ril_send(rd->ril, RIL_REQUEST_GET_RADIO_CAPABILITY, NULL, | ||
1549 | 283 | get_radio_caps_cb, cbd, g_free) <= 0) { | ||
1550 | 284 | g_free(cbd); | ||
1551 | 285 | CALLBACK_WITH_FAILURE(cb, 0, data); | ||
1552 | 286 | } | ||
1553 | 239 | } | 287 | } |
1554 | 240 | 288 | ||
1555 | 241 | void ril_delayed_register(const struct ofono_error *error, void *user_data) | 289 | void ril_delayed_register(const struct ofono_error *error, void *user_data) |
1556 | 242 | { | 290 | { |
1557 | 243 | struct ofono_radio_settings *rs = user_data; | 291 | struct ofono_radio_settings *rs = user_data; |
1558 | 244 | 292 | ||
1562 | 245 | if (error->type == OFONO_ERROR_TYPE_NO_ERROR) | 293 | if (error->type != OFONO_ERROR_TYPE_NO_ERROR) |
1560 | 246 | ofono_radio_settings_register(rs); | ||
1561 | 247 | else | ||
1563 | 248 | ofono_error("%s: cannot set default fast dormancy", __func__); | 294 | ofono_error("%s: cannot set default fast dormancy", __func__); |
1564 | 295 | |||
1565 | 296 | /* | ||
1566 | 297 | * We register in all cases, setting FD some times fails until radio is | ||
1567 | 298 | * available (this happens on turbo and maybe in other devices). | ||
1568 | 299 | */ | ||
1569 | 300 | ofono_radio_settings_register(rs); | ||
1570 | 249 | } | 301 | } |
1571 | 250 | 302 | ||
1572 | 251 | static int ril_radio_settings_probe(struct ofono_radio_settings *rs, | 303 | static int ril_radio_settings_probe(struct ofono_radio_settings *rs, |
1573 | 252 | 304 | ||
1574 | === modified file 'drivers/rilmodem/rilmodem.h' | |||
1575 | --- drivers/rilmodem/rilmodem.h 2014-10-29 15:59:10 +0000 | |||
1576 | +++ drivers/rilmodem/rilmodem.h 2016-07-01 17:24:58 +0000 | |||
1577 | @@ -20,8 +20,6 @@ | |||
1578 | 20 | * | 20 | * |
1579 | 21 | */ | 21 | */ |
1580 | 22 | 22 | ||
1581 | 23 | #include "rilutil.h" | ||
1582 | 24 | |||
1583 | 25 | #define RILMODEM "rilmodem" | 23 | #define RILMODEM "rilmodem" |
1584 | 26 | 24 | ||
1585 | 27 | /* Shared constants */ | 25 | /* Shared constants */ |
1586 | 28 | 26 | ||
1587 | === modified file 'drivers/rilmodem/sim.c' | |||
1588 | --- drivers/rilmodem/sim.c 2016-03-14 08:16:40 +0000 | |||
1589 | +++ drivers/rilmodem/sim.c 2016-07-01 17:24:58 +0000 | |||
1590 | @@ -46,6 +46,7 @@ | |||
1591 | 46 | #include "grilutil.h" | 46 | #include "grilutil.h" |
1592 | 47 | #include "parcel.h" | 47 | #include "parcel.h" |
1593 | 48 | #include "ril_constants.h" | 48 | #include "ril_constants.h" |
1594 | 49 | #include "rilutil.h" | ||
1595 | 49 | #include "rilmodem.h" | 50 | #include "rilmodem.h" |
1596 | 50 | 51 | ||
1597 | 51 | #include "grilreply.h" | 52 | #include "grilreply.h" |
1598 | @@ -943,7 +944,8 @@ | |||
1599 | 943 | g_free(cbd); | 944 | g_free(cbd); |
1600 | 944 | CALLBACK_WITH_FAILURE(cb, NULL, data); | 945 | CALLBACK_WITH_FAILURE(cb, NULL, data); |
1601 | 945 | } | 946 | } |
1603 | 946 | } else if (sd->vendor == OFONO_RIL_VENDOR_MTK) { | 947 | } else if (sd->vendor == OFONO_RIL_VENDOR_MTK || |
1604 | 948 | sd->vendor == OFONO_RIL_VENDOR_MTK2) { | ||
1605 | 947 | struct cb_data *cbd = cb_data_new(cb, data, sd); | 949 | struct cb_data *cbd = cb_data_new(cb, data, sd); |
1606 | 948 | struct parcel rilp; | 950 | struct parcel rilp; |
1607 | 949 | const char *at_epinc[] = { "AT+EPINC", "+EPINC:" }; | 951 | const char *at_epinc[] = { "AT+EPINC", "+EPINC:" }; |
1608 | 950 | 952 | ||
1609 | === modified file 'drivers/rilmodem/sms.c' | |||
1610 | --- drivers/rilmodem/sms.c 2016-03-14 08:16:40 +0000 | |||
1611 | +++ drivers/rilmodem/sms.c 2016-07-01 17:24:58 +0000 | |||
1612 | @@ -42,6 +42,7 @@ | |||
1613 | 42 | #include "util.h" | 42 | #include "util.h" |
1614 | 43 | 43 | ||
1615 | 44 | #include "rilmodem.h" | 44 | #include "rilmodem.h" |
1616 | 45 | #include "rilutil.h" | ||
1617 | 45 | #include "grilrequest.h" | 46 | #include "grilrequest.h" |
1618 | 46 | #include "grilreply.h" | 47 | #include "grilreply.h" |
1619 | 47 | #include "grilunsol.h" | 48 | #include "grilunsol.h" |
1620 | 48 | 49 | ||
1621 | === modified file 'drivers/rilmodem/ussd.c' | |||
1622 | --- drivers/rilmodem/ussd.c 2014-05-12 14:21:13 +0000 | |||
1623 | +++ drivers/rilmodem/ussd.c 2016-07-01 17:24:58 +0000 | |||
1624 | @@ -43,6 +43,7 @@ | |||
1625 | 43 | #include "grilrequest.h" | 43 | #include "grilrequest.h" |
1626 | 44 | #include "grilunsol.h" | 44 | #include "grilunsol.h" |
1627 | 45 | 45 | ||
1628 | 46 | #include "rilutil.h" | ||
1629 | 46 | #include "rilmodem.h" | 47 | #include "rilmodem.h" |
1630 | 47 | 48 | ||
1631 | 48 | #include "ril_constants.h" | 49 | #include "ril_constants.h" |
1632 | @@ -170,6 +171,7 @@ | |||
1633 | 170 | struct ofono_ussd *ussd = user_data; | 171 | struct ofono_ussd *ussd = user_data; |
1634 | 171 | struct ussd_data *ud = ofono_ussd_get_data(ussd); | 172 | struct ussd_data *ud = ofono_ussd_get_data(ussd); |
1635 | 172 | struct unsol_ussd *unsol; | 173 | struct unsol_ussd *unsol; |
1636 | 174 | enum ofono_ril_vendor vendor; | ||
1637 | 173 | 175 | ||
1638 | 174 | unsol = g_ril_unsol_parse_ussd(ud->ril, message); | 176 | unsol = g_ril_unsol_parse_ussd(ud->ril, message); |
1639 | 175 | if (unsol == NULL) { | 177 | if (unsol == NULL) { |
1640 | @@ -178,8 +180,10 @@ | |||
1641 | 178 | } | 180 | } |
1642 | 179 | 181 | ||
1643 | 180 | /* To fix bug in MTK: USSD-Notify arrive with type 2 instead of 0 */ | 182 | /* To fix bug in MTK: USSD-Notify arrive with type 2 instead of 0 */ |
1646 | 181 | if (g_ril_vendor(ud->ril) == OFONO_RIL_VENDOR_MTK && | 183 | vendor = g_ril_vendor(ud->ril); |
1647 | 182 | unsol->message != NULL && unsol->type == 2) | 184 | if ((vendor == OFONO_RIL_VENDOR_MTK || |
1648 | 185 | vendor == OFONO_RIL_VENDOR_MTK2) | ||
1649 | 186 | && unsol->message != NULL && unsol->type == 2) | ||
1650 | 183 | unsol->type = 0; | 187 | unsol->type = 0; |
1651 | 184 | 188 | ||
1652 | 185 | /* | 189 | /* |
1653 | 186 | 190 | ||
1654 | === modified file 'drivers/rilmodem/vendor.h' | |||
1655 | --- drivers/rilmodem/vendor.h 2015-04-23 13:08:30 +0000 | |||
1656 | +++ drivers/rilmodem/vendor.h 2016-07-01 17:24:58 +0000 | |||
1657 | @@ -26,7 +26,8 @@ | |||
1658 | 26 | OFONO_RIL_VENDOR_AOSP = 0, | 26 | OFONO_RIL_VENDOR_AOSP = 0, |
1659 | 27 | OFONO_RIL_VENDOR_MTK, | 27 | OFONO_RIL_VENDOR_MTK, |
1660 | 28 | OFONO_RIL_VENDOR_INFINEON, | 28 | OFONO_RIL_VENDOR_INFINEON, |
1662 | 29 | OFONO_RIL_VENDOR_QCOM_MSIM | 29 | OFONO_RIL_VENDOR_QCOM_MSIM, |
1663 | 30 | OFONO_RIL_VENDOR_MTK2 | ||
1664 | 30 | }; | 31 | }; |
1665 | 31 | 32 | ||
1666 | 32 | #endif /* RILMODEM_VENDOR_H */ | 33 | #endif /* RILMODEM_VENDOR_H */ |
1667 | 33 | 34 | ||
1668 | === modified file 'drivers/rilmodem/voicecall.c' | |||
1669 | --- drivers/rilmodem/voicecall.c 2015-10-07 07:14:11 +0000 | |||
1670 | +++ drivers/rilmodem/voicecall.c 2016-07-01 17:24:58 +0000 | |||
1671 | @@ -45,6 +45,7 @@ | |||
1672 | 45 | #include "grilunsol.h" | 45 | #include "grilunsol.h" |
1673 | 46 | 46 | ||
1674 | 47 | #include "common.h" | 47 | #include "common.h" |
1675 | 48 | #include "rilutil.h" | ||
1676 | 48 | #include "rilmodem.h" | 49 | #include "rilmodem.h" |
1677 | 49 | #include "voicecall.h" | 50 | #include "voicecall.h" |
1678 | 50 | 51 | ||
1679 | 51 | 52 | ||
1680 | === modified file 'gril/grilreply.c' | |||
1681 | --- gril/grilreply.c 2016-03-14 08:16:40 +0000 | |||
1682 | +++ gril/grilreply.c 2016-07-01 17:24:58 +0000 | |||
1683 | @@ -84,8 +84,9 @@ | |||
1684 | 84 | unsigned int num_ops, num_strings; | 84 | unsigned int num_ops, num_strings; |
1685 | 85 | unsigned int i; | 85 | unsigned int i; |
1686 | 86 | int strings_per_opt; | 86 | int strings_per_opt; |
1687 | 87 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1688 | 87 | 88 | ||
1690 | 88 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 89 | if (vendor == OFONO_RIL_VENDOR_MTK) |
1691 | 89 | strings_per_opt = 5; | 90 | strings_per_opt = 5; |
1692 | 90 | else | 91 | else |
1693 | 91 | strings_per_opt = 4; | 92 | strings_per_opt = 4; |
1694 | @@ -142,7 +143,7 @@ | |||
1695 | 142 | * MTK: additional string with technology: 2G/3G are the only | 143 | * MTK: additional string with technology: 2G/3G are the only |
1696 | 143 | * valid values currently. | 144 | * valid values currently. |
1697 | 144 | */ | 145 | */ |
1699 | 145 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 146 | if (vendor == OFONO_RIL_VENDOR_MTK) { |
1700 | 146 | char *tech = parcel_r_string(&rilp); | 147 | char *tech = parcel_r_string(&rilp); |
1701 | 147 | if (strcmp(tech, "3G") == 0) | 148 | if (strcmp(tech, "3G") == 0) |
1702 | 148 | operator->tech = RADIO_TECH_UMTS; | 149 | operator->tech = RADIO_TECH_UMTS; |
1703 | @@ -336,7 +337,8 @@ | |||
1704 | 336 | g_ril_append_print_buf(gril, "%s%s", print_buf, | 337 | g_ril_append_print_buf(gril, "%s%s", print_buf, |
1705 | 337 | ril_radio_tech_to_string(val)); | 338 | ril_radio_tech_to_string(val)); |
1706 | 338 | 339 | ||
1708 | 339 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 340 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK || |
1709 | 341 | g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK2) { | ||
1710 | 340 | switch (val) { | 342 | switch (val) { |
1711 | 341 | case MTK_RADIO_TECH_HSDPAP: | 343 | case MTK_RADIO_TECH_HSDPAP: |
1712 | 342 | case MTK_RADIO_TECH_HSDPAP_UPA: | 344 | case MTK_RADIO_TECH_HSDPAP_UPA: |
1713 | @@ -452,7 +454,8 @@ | |||
1714 | 452 | * MTK modem does not return max_cids, string for this index | 454 | * MTK modem does not return max_cids, string for this index |
1715 | 453 | * actually contains the maximum data bearer capability. | 455 | * actually contains the maximum data bearer capability. |
1716 | 454 | */ | 456 | */ |
1718 | 455 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 457 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK || |
1719 | 458 | g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK2) | ||
1720 | 456 | reply->max_cids = MTK_MODEM_MAX_CIDS; | 459 | reply->max_cids = MTK_MODEM_MAX_CIDS; |
1721 | 457 | else | 460 | else |
1722 | 458 | reply->max_cids = val; | 461 | reply->max_cids = val; |
1723 | @@ -1182,7 +1185,8 @@ | |||
1724 | 1182 | net_type = parcel_net_type; | 1185 | net_type = parcel_net_type; |
1725 | 1183 | 1186 | ||
1726 | 1184 | /* Try to translate special MTK settings */ | 1187 | /* Try to translate special MTK settings */ |
1728 | 1185 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 1188 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK || |
1729 | 1189 | g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK2) { | ||
1730 | 1186 | switch (net_type) { | 1190 | switch (net_type) { |
1731 | 1187 | /* 4G preferred */ | 1191 | /* 4G preferred */ |
1732 | 1188 | case MTK_PREF_NET_TYPE_LTE_GSM_WCDMA: | 1192 | case MTK_PREF_NET_TYPE_LTE_GSM_WCDMA: |
1733 | @@ -1325,6 +1329,7 @@ | |||
1734 | 1325 | g_ril_append_print_buf(gril, "{%d}", retries[passwd_type]); | 1329 | g_ril_append_print_buf(gril, "{%d}", retries[passwd_type]); |
1735 | 1326 | break; | 1330 | break; |
1736 | 1327 | case OFONO_RIL_VENDOR_MTK: | 1331 | case OFONO_RIL_VENDOR_MTK: |
1737 | 1332 | case OFONO_RIL_VENDOR_MTK2: | ||
1738 | 1328 | /* | 1333 | /* |
1739 | 1329 | * Some versions of MTK modem return just the retries for the | 1334 | * Some versions of MTK modem return just the retries for the |
1740 | 1330 | * password just entered while others return the retries for all | 1335 | * password just entered while others return the retries for all |
1741 | @@ -1456,3 +1461,99 @@ | |||
1742 | 1456 | out: | 1461 | out: |
1743 | 1457 | return str_arr; | 1462 | return str_arr; |
1744 | 1458 | } | 1463 | } |
1745 | 1464 | |||
1746 | 1465 | struct reply_radio_capability *g_ril_reply_parse_get_radio_capability( | ||
1747 | 1466 | GRil *gril, const struct ril_msg *message) | ||
1748 | 1467 | { | ||
1749 | 1468 | struct reply_radio_capability *reply; | ||
1750 | 1469 | struct parcel rilp; | ||
1751 | 1470 | char *modem_uuid; | ||
1752 | 1471 | |||
1753 | 1472 | reply = g_new0(struct reply_radio_capability, 1); | ||
1754 | 1473 | g_ril_init_parcel(message, &rilp); | ||
1755 | 1474 | |||
1756 | 1475 | reply->version = parcel_r_int32(&rilp); | ||
1757 | 1476 | reply->session = parcel_r_int32(&rilp); | ||
1758 | 1477 | reply->phase = parcel_r_int32(&rilp); | ||
1759 | 1478 | reply->rat = parcel_r_int32(&rilp); | ||
1760 | 1479 | modem_uuid = parcel_r_string(&rilp); | ||
1761 | 1480 | if (modem_uuid != NULL) | ||
1762 | 1481 | strcpy(reply->modem_uuid, modem_uuid); | ||
1763 | 1482 | |||
1764 | 1483 | reply->status = parcel_r_int32(&rilp); | ||
1765 | 1484 | |||
1766 | 1485 | if (rilp.malformed) { | ||
1767 | 1486 | ofono_error("%s: malformed parcel", __func__); | ||
1768 | 1487 | g_free(reply); | ||
1769 | 1488 | reply = NULL; | ||
1770 | 1489 | goto end; | ||
1771 | 1490 | } | ||
1772 | 1491 | |||
1773 | 1492 | g_ril_append_print_buf(gril, "{%d,%d,%s,[", | ||
1774 | 1493 | reply->version, reply->session, | ||
1775 | 1494 | ril_rc_phase_to_string(reply->phase)); | ||
1776 | 1495 | |||
1777 | 1496 | if (reply->rat & RIL_RAF_UNKNOWN) | ||
1778 | 1497 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1779 | 1498 | ril_radio_tech_to_string(RADIO_TECH_UNKNOWN)); | ||
1780 | 1499 | if (reply->rat & RIL_RAF_GPRS) | ||
1781 | 1500 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1782 | 1501 | ril_radio_tech_to_string(RADIO_TECH_GPRS)); | ||
1783 | 1502 | if (reply->rat & RIL_RAF_EDGE) | ||
1784 | 1503 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1785 | 1504 | ril_radio_tech_to_string(RADIO_TECH_EDGE)); | ||
1786 | 1505 | if (reply->rat & RIL_RAF_UMTS) | ||
1787 | 1506 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1788 | 1507 | ril_radio_tech_to_string(RADIO_TECH_UMTS)); | ||
1789 | 1508 | if (reply->rat & RIL_RAF_IS95A) | ||
1790 | 1509 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1791 | 1510 | ril_radio_tech_to_string(RADIO_TECH_IS95A)); | ||
1792 | 1511 | if (reply->rat & RIL_RAF_IS95B) | ||
1793 | 1512 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1794 | 1513 | ril_radio_tech_to_string(RADIO_TECH_IS95B)); | ||
1795 | 1514 | if (reply->rat & RIL_RAF_1xRTT) | ||
1796 | 1515 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1797 | 1516 | ril_radio_tech_to_string(RADIO_TECH_1xRTT)); | ||
1798 | 1517 | if (reply->rat & RIL_RAF_EVDO_0) | ||
1799 | 1518 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1800 | 1519 | ril_radio_tech_to_string(RADIO_TECH_EVDO_0)); | ||
1801 | 1520 | if (reply->rat & RIL_RAF_EVDO_A) | ||
1802 | 1521 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1803 | 1522 | ril_radio_tech_to_string(RADIO_TECH_EVDO_A)); | ||
1804 | 1523 | if (reply->rat & RIL_RAF_HSDPA) | ||
1805 | 1524 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1806 | 1525 | ril_radio_tech_to_string(RADIO_TECH_HSDPA)); | ||
1807 | 1526 | if (reply->rat & RIL_RAF_HSUPA) | ||
1808 | 1527 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1809 | 1528 | ril_radio_tech_to_string(RADIO_TECH_HSUPA)); | ||
1810 | 1529 | if (reply->rat & RIL_RAF_HSPA) | ||
1811 | 1530 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1812 | 1531 | ril_radio_tech_to_string(RADIO_TECH_HSPA)); | ||
1813 | 1532 | if (reply->rat & RIL_RAF_EVDO_B) | ||
1814 | 1533 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1815 | 1534 | ril_radio_tech_to_string(RADIO_TECH_EVDO_B)); | ||
1816 | 1535 | if (reply->rat & RIL_RAF_EHRPD) | ||
1817 | 1536 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1818 | 1537 | ril_radio_tech_to_string(RADIO_TECH_EHRPD)); | ||
1819 | 1538 | if (reply->rat & RIL_RAF_LTE) | ||
1820 | 1539 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1821 | 1540 | ril_radio_tech_to_string(RADIO_TECH_LTE)); | ||
1822 | 1541 | if (reply->rat & RIL_RAF_HSPAP) | ||
1823 | 1542 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1824 | 1543 | ril_radio_tech_to_string(RADIO_TECH_HSPAP)); | ||
1825 | 1544 | if (reply->rat & RIL_RAF_GSM) | ||
1826 | 1545 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1827 | 1546 | ril_radio_tech_to_string(RADIO_TECH_GSM)); | ||
1828 | 1547 | if (reply->rat & RIL_RAF_TD_SCDMA) | ||
1829 | 1548 | g_ril_append_print_buf(gril, "%s%s,", print_buf, | ||
1830 | 1549 | ril_radio_tech_to_string(RADIO_TECH_TD_SCDMA)); | ||
1831 | 1550 | |||
1832 | 1551 | g_ril_append_print_buf(gril, "%s],%s,%s}", print_buf, | ||
1833 | 1552 | reply->modem_uuid, | ||
1834 | 1553 | ril_rc_status_to_string(reply->status)); | ||
1835 | 1554 | |||
1836 | 1555 | g_ril_print_response(gril, message); | ||
1837 | 1556 | |||
1838 | 1557 | end: | ||
1839 | 1558 | return reply; | ||
1840 | 1559 | } | ||
1841 | 1459 | 1560 | ||
1842 | === modified file 'gril/grilreply.h' | |||
1843 | --- gril/grilreply.h 2015-03-18 14:05:58 +0000 | |||
1844 | +++ gril/grilreply.h 2016-07-01 17:24:58 +0000 | |||
1845 | @@ -97,6 +97,15 @@ | |||
1846 | 97 | void *data; | 97 | void *data; |
1847 | 98 | }; | 98 | }; |
1848 | 99 | 99 | ||
1849 | 100 | struct reply_radio_capability { | ||
1850 | 101 | int version; | ||
1851 | 102 | int session; | ||
1852 | 103 | int phase; | ||
1853 | 104 | int rat; | ||
1854 | 105 | char modem_uuid[RIL_MAX_UUID_LENGTH]; | ||
1855 | 106 | int status; | ||
1856 | 107 | }; | ||
1857 | 108 | |||
1858 | 100 | void g_ril_reply_free_avail_ops(struct reply_avail_ops *reply); | 109 | void g_ril_reply_free_avail_ops(struct reply_avail_ops *reply); |
1859 | 101 | 110 | ||
1860 | 102 | struct reply_avail_ops *g_ril_reply_parse_avail_ops(GRil *gril, | 111 | struct reply_avail_ops *g_ril_reply_parse_avail_ops(GRil *gril, |
1861 | @@ -178,6 +187,9 @@ | |||
1862 | 178 | struct parcel_str_array *g_ril_reply_oem_hook_strings(GRil *gril, | 187 | struct parcel_str_array *g_ril_reply_oem_hook_strings(GRil *gril, |
1863 | 179 | const struct ril_msg *message); | 188 | const struct ril_msg *message); |
1864 | 180 | 189 | ||
1865 | 190 | struct reply_radio_capability *g_ril_reply_parse_get_radio_capability( | ||
1866 | 191 | GRil *gril, const struct ril_msg *message); | ||
1867 | 192 | |||
1868 | 181 | #ifdef __cplusplus | 193 | #ifdef __cplusplus |
1869 | 182 | } | 194 | } |
1870 | 183 | #endif | 195 | #endif |
1871 | 184 | 196 | ||
1872 | === modified file 'gril/grilrequest.c' | |||
1873 | --- gril/grilrequest.c 2015-09-29 08:47:19 +0000 | |||
1874 | +++ gril/grilrequest.c 2016-07-01 17:24:58 +0000 | |||
1875 | @@ -112,6 +112,7 @@ | |||
1876 | 112 | unsigned char *comm_path = db_path; | 112 | unsigned char *comm_path = db_path; |
1877 | 113 | char *hex_path = NULL; | 113 | char *hex_path = NULL; |
1878 | 114 | int len = 0; | 114 | int len = 0; |
1879 | 115 | enum ofono_ril_vendor vendor = g_ril_vendor(ril); | ||
1880 | 115 | 116 | ||
1881 | 116 | if (path_len > 0 && path_len < 7) { | 117 | if (path_len > 0 && path_len < 7) { |
1882 | 117 | memcpy(db_path, path, path_len); | 118 | memcpy(db_path, path, path_len); |
1883 | @@ -133,7 +134,8 @@ | |||
1884 | 133 | * ETSI TS 102 221, section 8.4.2 (we are accessing the card in mode | 134 | * ETSI TS 102 221, section 8.4.2 (we are accessing the card in mode |
1885 | 134 | * "select by path from MF", see 3gpp 27.007, +CRSM). | 135 | * "select by path from MF", see 3gpp 27.007, +CRSM). |
1886 | 135 | */ | 136 | */ |
1888 | 136 | if (g_ril_vendor(ril) == OFONO_RIL_VENDOR_MTK && len >= (int) ROOTMF_SZ | 137 | if ((vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1889 | 138 | && len >= (int) ROOTMF_SZ | ||
1890 | 137 | && memcmp(db_path, ROOTMF, ROOTMF_SZ) == 0) { | 139 | && memcmp(db_path, ROOTMF, ROOTMF_SZ) == 0) { |
1891 | 138 | comm_path = db_path + ROOTMF_SZ; | 140 | comm_path = db_path + ROOTMF_SZ; |
1892 | 139 | len -= ROOTMF_SZ; | 141 | len -= ROOTMF_SZ; |
1893 | @@ -242,10 +244,11 @@ | |||
1894 | 242 | gchar *auth_str; | 244 | gchar *auth_str; |
1895 | 243 | gchar *profile_str; | 245 | gchar *profile_str; |
1896 | 244 | int num_param = SETUP_DATA_CALL_PARAMS; | 246 | int num_param = SETUP_DATA_CALL_PARAMS; |
1897 | 247 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1898 | 245 | 248 | ||
1899 | 246 | DBG(""); | 249 | DBG(""); |
1900 | 247 | 250 | ||
1902 | 248 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 251 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1903 | 249 | num_param = SETUP_DATA_CALL_PARAMS + 1; | 252 | num_param = SETUP_DATA_CALL_PARAMS + 1; |
1904 | 250 | 253 | ||
1905 | 251 | /* | 254 | /* |
1906 | @@ -281,7 +284,7 @@ | |||
1907 | 281 | profile_str = DATA_PROFILE_CBS_STR; | 284 | profile_str = DATA_PROFILE_CBS_STR; |
1908 | 282 | break; | 285 | break; |
1909 | 283 | case RIL_DATA_PROFILE_MTK_MMS: | 286 | case RIL_DATA_PROFILE_MTK_MMS: |
1911 | 284 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 287 | if (vendor == OFONO_RIL_VENDOR_MTK) { |
1912 | 285 | profile_str = DATA_PROFILE_MTK_MMS_STR; | 288 | profile_str = DATA_PROFILE_MTK_MMS_STR; |
1913 | 286 | break; | 289 | break; |
1914 | 287 | } | 290 | } |
1915 | @@ -335,7 +338,7 @@ | |||
1916 | 335 | auth_str, | 338 | auth_str, |
1917 | 336 | protocol_str); | 339 | protocol_str); |
1918 | 337 | 340 | ||
1920 | 338 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 341 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) { |
1921 | 339 | /* MTK request_cid parameter */ | 342 | /* MTK request_cid parameter */ |
1922 | 340 | char cid_str[MAX_CID_DIGITS + 1]; | 343 | char cid_str[MAX_CID_DIGITS + 1]; |
1923 | 341 | 344 | ||
1924 | @@ -361,6 +364,8 @@ | |||
1925 | 361 | const struct req_sim_read_info *req, | 364 | const struct req_sim_read_info *req, |
1926 | 362 | struct parcel *rilp) | 365 | struct parcel *rilp) |
1927 | 363 | { | 366 | { |
1928 | 367 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1929 | 368 | |||
1930 | 364 | parcel_init(rilp); | 369 | parcel_init(rilp); |
1931 | 365 | 370 | ||
1932 | 366 | parcel_w_int32(rilp, CMD_GET_RESPONSE); | 371 | parcel_w_int32(rilp, CMD_GET_RESPONSE); |
1933 | @@ -396,7 +401,7 @@ | |||
1934 | 396 | * It looks like this field selects one or another SIM application, but | 401 | * It looks like this field selects one or another SIM application, but |
1935 | 397 | * we use only one at a time so using zero here seems safe. | 402 | * we use only one at a time so using zero here seems safe. |
1936 | 398 | */ | 403 | */ |
1938 | 399 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 404 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1939 | 400 | parcel_w_int32(rilp, 0); | 405 | parcel_w_int32(rilp, 0); |
1940 | 401 | 406 | ||
1941 | 402 | return TRUE; | 407 | return TRUE; |
1942 | @@ -409,6 +414,8 @@ | |||
1943 | 409 | const struct req_sim_read_binary *req, | 414 | const struct req_sim_read_binary *req, |
1944 | 410 | struct parcel *rilp) | 415 | struct parcel *rilp) |
1945 | 411 | { | 416 | { |
1946 | 417 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1947 | 418 | |||
1948 | 412 | g_ril_append_print_buf(gril, | 419 | g_ril_append_print_buf(gril, |
1949 | 413 | "(cmd=0x%.2X,efid=0x%.4X,", | 420 | "(cmd=0x%.2X,efid=0x%.4X,", |
1950 | 414 | CMD_READ_BINARY, | 421 | CMD_READ_BINARY, |
1951 | @@ -430,7 +437,7 @@ | |||
1952 | 430 | parcel_w_string(rilp, req->aid_str); | 437 | parcel_w_string(rilp, req->aid_str); |
1953 | 431 | 438 | ||
1954 | 432 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ | 439 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ |
1956 | 433 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 440 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1957 | 434 | parcel_w_int32(rilp, 0); | 441 | parcel_w_int32(rilp, 0); |
1958 | 435 | 442 | ||
1959 | 436 | return TRUE; | 443 | return TRUE; |
1960 | @@ -443,6 +450,8 @@ | |||
1961 | 443 | const struct req_sim_read_record *req, | 450 | const struct req_sim_read_record *req, |
1962 | 444 | struct parcel *rilp) | 451 | struct parcel *rilp) |
1963 | 445 | { | 452 | { |
1964 | 453 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1965 | 454 | |||
1966 | 446 | parcel_init(rilp); | 455 | parcel_init(rilp); |
1967 | 447 | parcel_w_int32(rilp, CMD_READ_RECORD); | 456 | parcel_w_int32(rilp, CMD_READ_RECORD); |
1968 | 448 | parcel_w_int32(rilp, req->fileid); | 457 | parcel_w_int32(rilp, req->fileid); |
1969 | @@ -464,7 +473,7 @@ | |||
1970 | 464 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ | 473 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ |
1971 | 465 | 474 | ||
1972 | 466 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ | 475 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ |
1974 | 467 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 476 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1975 | 468 | parcel_w_int32(rilp, 0); | 477 | parcel_w_int32(rilp, 0); |
1976 | 469 | 478 | ||
1977 | 470 | return TRUE; | 479 | return TRUE; |
1978 | @@ -477,6 +486,7 @@ | |||
1979 | 477 | const struct req_sim_write_binary *req, | 486 | const struct req_sim_write_binary *req, |
1980 | 478 | struct parcel *rilp) | 487 | struct parcel *rilp) |
1981 | 479 | { | 488 | { |
1982 | 489 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
1983 | 480 | char *hex_data; | 490 | char *hex_data; |
1984 | 481 | int p1, p2; | 491 | int p1, p2; |
1985 | 482 | 492 | ||
1986 | @@ -503,7 +513,7 @@ | |||
1987 | 503 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ | 513 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ |
1988 | 504 | 514 | ||
1989 | 505 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ | 515 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ |
1991 | 506 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 516 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
1992 | 507 | parcel_w_int32(rilp, 0); | 517 | parcel_w_int32(rilp, 0); |
1993 | 508 | 518 | ||
1994 | 509 | g_ril_append_print_buf(gril, | 519 | g_ril_append_print_buf(gril, |
1995 | @@ -543,6 +553,7 @@ | |||
1996 | 543 | const struct req_sim_write_record *req, | 553 | const struct req_sim_write_record *req, |
1997 | 544 | struct parcel *rilp) | 554 | struct parcel *rilp) |
1998 | 545 | { | 555 | { |
1999 | 556 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
2000 | 546 | char *hex_data; | 557 | char *hex_data; |
2001 | 547 | int p2; | 558 | int p2; |
2002 | 548 | 559 | ||
2003 | @@ -568,7 +579,7 @@ | |||
2004 | 568 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ | 579 | parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */ |
2005 | 569 | 580 | ||
2006 | 570 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ | 581 | /* sessionId, specific to latest MTK modems (harmless for older ones) */ |
2008 | 571 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) | 582 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) |
2009 | 572 | parcel_w_int32(rilp, 0); | 583 | parcel_w_int32(rilp, 0); |
2010 | 573 | 584 | ||
2011 | 574 | g_ril_append_print_buf(gril, | 585 | g_ril_append_print_buf(gril, |
2012 | @@ -1103,6 +1114,7 @@ | |||
2013 | 1103 | const char *mccmnc, | 1114 | const char *mccmnc, |
2014 | 1104 | struct parcel *rilp) | 1115 | struct parcel *rilp) |
2015 | 1105 | { | 1116 | { |
2016 | 1117 | enum ofono_ril_vendor vendor = g_ril_vendor(gril); | ||
2017 | 1106 | const char *proto_str; | 1118 | const char *proto_str; |
2018 | 1107 | const int auth_type = RIL_AUTH_ANY; | 1119 | const int auth_type = RIL_AUTH_ANY; |
2019 | 1108 | 1120 | ||
2020 | @@ -1121,12 +1133,21 @@ | |||
2021 | 1121 | ril_authtype_to_string(auth_type), | 1133 | ril_authtype_to_string(auth_type), |
2022 | 1122 | user, passwd); | 1134 | user, passwd); |
2023 | 1123 | 1135 | ||
2025 | 1124 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) { | 1136 | if (vendor == OFONO_RIL_VENDOR_MTK || vendor == OFONO_RIL_VENDOR_MTK2) { |
2026 | 1125 | parcel_w_string(rilp, mccmnc); | 1137 | parcel_w_string(rilp, mccmnc); |
2030 | 1126 | g_ril_append_print_buf(gril, "%s,%s)", print_buf, mccmnc); | 1138 | g_ril_append_print_buf(gril, "%s,%s", print_buf, mccmnc); |
2031 | 1127 | } else { | 1139 | if (vendor == OFONO_RIL_VENDOR_MTK2) { |
2032 | 1128 | g_ril_append_print_buf(gril, "%s)", print_buf); | 1140 | int can_handle_ims = 0; |
2033 | 1141 | |||
2034 | 1142 | parcel_w_int32(rilp, can_handle_ims); | ||
2035 | 1143 | /* dualApnPlmnList */ | ||
2036 | 1144 | parcel_w_string(rilp, NULL); | ||
2037 | 1145 | g_ril_append_print_buf(gril, "%s,%d,(null)", print_buf, | ||
2038 | 1146 | can_handle_ims); | ||
2039 | 1147 | } | ||
2040 | 1129 | } | 1148 | } |
2041 | 1149 | |||
2042 | 1150 | g_ril_append_print_buf(gril, "%s)", print_buf); | ||
2043 | 1130 | } | 1151 | } |
2044 | 1131 | 1152 | ||
2045 | 1132 | void g_ril_request_set_uicc_subscription(GRil *gril, int slot_id, | 1153 | void g_ril_request_set_uicc_subscription(GRil *gril, int slot_id, |
2046 | 1133 | 1154 | ||
2047 | === modified file 'gril/grilunsol.c' | |||
2048 | --- gril/grilunsol.c 2016-03-11 04:20:17 +0000 | |||
2049 | +++ gril/grilunsol.c 2016-07-01 17:24:58 +0000 | |||
2050 | @@ -61,12 +61,22 @@ | |||
2051 | 61 | size = parcel_r_int32(&rilp); | 61 | size = parcel_r_int32(&rilp); |
2052 | 62 | version = parcel_r_int32(&rilp); | 62 | version = parcel_r_int32(&rilp); |
2053 | 63 | 63 | ||
2054 | 64 | /* | ||
2055 | 65 | * For something that looks like a bug we get an extra int in mtk2 | ||
2056 | 66 | * modems. RIL version is the second integer in this case. This | ||
2057 | 67 | * happens when we get duplicated connected events, which should | ||
2058 | 68 | * not happen either. In these cases the first event has the right | ||
2059 | 69 | * size, but not those appearing after. | ||
2060 | 70 | */ | ||
2061 | 71 | if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK2 && size > 1) | ||
2062 | 72 | version = parcel_r_int32(&rilp); | ||
2063 | 73 | |||
2064 | 64 | if (rilp.malformed) { | 74 | if (rilp.malformed) { |
2065 | 65 | ofono_error("%s: malformed parcel", __func__); | 75 | ofono_error("%s: malformed parcel", __func__); |
2066 | 66 | version = RIL_VERSION_UNSPECIFIED; | 76 | version = RIL_VERSION_UNSPECIFIED; |
2067 | 67 | } | 77 | } |
2068 | 68 | 78 | ||
2070 | 69 | g_ril_append_print_buf(gril, "{size:%d, [%d, ...]}", size, version); | 79 | g_ril_append_print_buf(gril, "{size: %d, [%d]}", size, version); |
2071 | 70 | g_ril_print_unsol(gril, message); | 80 | g_ril_print_unsol(gril, message); |
2072 | 71 | 81 | ||
2073 | 72 | return version; | 82 | return version; |
2074 | 73 | 83 | ||
2075 | === modified file 'gril/grilutil.c' | |||
2076 | --- gril/grilutil.c 2015-11-10 09:12:03 +0000 | |||
2077 | +++ gril/grilutil.c 2016-07-01 17:24:58 +0000 | |||
2078 | @@ -268,6 +268,10 @@ | |||
2079 | 268 | return "HSPAP"; | 268 | return "HSPAP"; |
2080 | 269 | case RADIO_TECH_GSM: | 269 | case RADIO_TECH_GSM: |
2081 | 270 | return "GSM"; | 270 | return "GSM"; |
2082 | 271 | case RADIO_TECH_TD_SCDMA: | ||
2083 | 272 | return "TD_SCDMA"; | ||
2084 | 273 | case RADIO_TECH_IWLAN: | ||
2085 | 274 | return "IWLAN"; | ||
2086 | 271 | case MTK_RADIO_TECH_HSDPAP: | 275 | case MTK_RADIO_TECH_HSDPAP: |
2087 | 272 | return "MTK_HSDPAP"; | 276 | return "MTK_HSDPAP"; |
2088 | 273 | case MTK_RADIO_TECH_HSDPAP_UPA: | 277 | case MTK_RADIO_TECH_HSDPAP_UPA: |
2089 | @@ -517,6 +521,54 @@ | |||
2090 | 517 | return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS"; | 521 | return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS"; |
2091 | 518 | case RIL_REQUEST_SET_INITIAL_ATTACH_APN: | 522 | case RIL_REQUEST_SET_INITIAL_ATTACH_APN: |
2092 | 519 | return "RIL_REQUEST_SET_INITIAL_ATTACH_APN"; | 523 | return "RIL_REQUEST_SET_INITIAL_ATTACH_APN"; |
2093 | 524 | case RIL_REQUEST_IMS_REGISTRATION_STATE: | ||
2094 | 525 | return "RIL_REQUEST_IMS_REGISTRATION_STATE"; | ||
2095 | 526 | case RIL_REQUEST_IMS_SEND_SMS: | ||
2096 | 527 | return "RIL_REQUEST_IMS_SEND_SMS"; | ||
2097 | 528 | case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: | ||
2098 | 529 | return "RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC"; | ||
2099 | 530 | case RIL_REQUEST_SIM_OPEN_CHANNEL: | ||
2100 | 531 | return "RIL_REQUEST_SIM_OPEN_CHANNEL"; | ||
2101 | 532 | case RIL_REQUEST_SIM_CLOSE_CHANNEL: | ||
2102 | 533 | return "RIL_REQUEST_SIM_CLOSE_CHANNEL"; | ||
2103 | 534 | case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: | ||
2104 | 535 | return "RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL"; | ||
2105 | 536 | case RIL_REQUEST_NV_READ_ITEM: | ||
2106 | 537 | return "RIL_REQUEST_NV_READ_ITEM"; | ||
2107 | 538 | case RIL_REQUEST_NV_WRITE_ITEM: | ||
2108 | 539 | return "RIL_REQUEST_NV_WRITE_ITEM"; | ||
2109 | 540 | case RIL_REQUEST_NV_WRITE_CDMA_PRL: | ||
2110 | 541 | return "RIL_REQUEST_NV_WRITE_CDMA_PRL"; | ||
2111 | 542 | case RIL_REQUEST_NV_RESET_CONFIG: | ||
2112 | 543 | return "RIL_REQUEST_NV_RESET_CONFIG"; | ||
2113 | 544 | case RIL_REQUEST_SET_UICC_SUBSCRIPTION : | ||
2114 | 545 | return "RIL_REQUEST_SET_UICC_SUBSCRIPTION "; | ||
2115 | 546 | case RIL_REQUEST_ALLOW_DATA : | ||
2116 | 547 | return "RIL_REQUEST_ALLOW_DATA "; | ||
2117 | 548 | case RIL_REQUEST_GET_HARDWARE_CONFIG: | ||
2118 | 549 | return "RIL_REQUEST_GET_HARDWARE_CONFIG"; | ||
2119 | 550 | case RIL_REQUEST_SIM_AUTHENTICATION: | ||
2120 | 551 | return "RIL_REQUEST_SIM_AUTHENTICATION"; | ||
2121 | 552 | case RIL_REQUEST_GET_DC_RT_INFO: | ||
2122 | 553 | return "RIL_REQUEST_GET_DC_RT_INFO"; | ||
2123 | 554 | case RIL_REQUEST_SET_DC_RT_INFO_RATE: | ||
2124 | 555 | return "RIL_REQUEST_SET_DC_RT_INFO_RATE"; | ||
2125 | 556 | case RIL_REQUEST_SET_DATA_PROFILE: | ||
2126 | 557 | return "RIL_REQUEST_SET_DATA_PROFILE"; | ||
2127 | 558 | case RIL_REQUEST_SHUTDOWN: | ||
2128 | 559 | return "RIL_REQUEST_SHUTDOWN"; | ||
2129 | 560 | case RIL_REQUEST_GET_RADIO_CAPABILITY: | ||
2130 | 561 | return "RIL_REQUEST_GET_RADIO_CAPABILITY"; | ||
2131 | 562 | case RIL_REQUEST_SET_RADIO_CAPABILITY: | ||
2132 | 563 | return "RIL_REQUEST_SET_RADIO_CAPABILITY"; | ||
2133 | 564 | case RIL_REQUEST_START_LCE: | ||
2134 | 565 | return "RIL_REQUEST_START_LCE"; | ||
2135 | 566 | case RIL_REQUEST_STOP_LCE: | ||
2136 | 567 | return "RIL_REQUEST_STOP_LCE"; | ||
2137 | 568 | case RIL_REQUEST_PULL_LCEDATA: | ||
2138 | 569 | return "RIL_REQUEST_PULL_LCEDATA"; | ||
2139 | 570 | case RIL_REQUEST_GET_ACTIVITY_INFO: | ||
2140 | 571 | return "RIL_REQUEST_GET_ACTIVITY_INFO"; | ||
2141 | 520 | default: | 572 | default: |
2142 | 521 | return "<INVALID>"; | 573 | return "<INVALID>"; |
2143 | 522 | } | 574 | } |
2144 | @@ -595,8 +647,30 @@ | |||
2145 | 595 | return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; | 647 | return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; |
2146 | 596 | case RIL_UNSOL_RIL_CONNECTED: | 648 | case RIL_UNSOL_RIL_CONNECTED: |
2147 | 597 | return "UNSOL_RIL_CONNECTED"; | 649 | return "UNSOL_RIL_CONNECTED"; |
2148 | 650 | case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED: | ||
2149 | 651 | return "RIL_UNSOL_VOICE_RADIO_TECH_CHANGED"; | ||
2150 | 652 | case RIL_UNSOL_CELL_INFO_LIST: | ||
2151 | 653 | return "RIL_UNSOL_CELL_INFO_LIST"; | ||
2152 | 654 | case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: | ||
2153 | 655 | return "RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED"; | ||
2154 | 656 | case RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED: | ||
2155 | 657 | return "RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED"; | ||
2156 | 658 | case RIL_UNSOL_SRVCC_STATE_NOTIFY: | ||
2157 | 659 | return "RIL_UNSOL_SRVCC_STATE_NOTIFY"; | ||
2158 | 660 | case RIL_UNSOL_HARDWARE_CONFIG_CHANGED: | ||
2159 | 661 | return "RIL_UNSOL_HARDWARE_CONFIG_CHANGED"; | ||
2160 | 662 | case RIL_UNSOL_DC_RT_INFO_CHANGED: | ||
2161 | 663 | return "RIL_UNSOL_DC_RT_INFO_CHANGED"; | ||
2162 | 664 | case RIL_UNSOL_RADIO_CAPABILITY: | ||
2163 | 665 | return "RIL_UNSOL_RADIO_CAPABILITY"; | ||
2164 | 666 | case RIL_UNSOL_ON_SS: | ||
2165 | 667 | return "RIL_UNSOL_ON_SS"; | ||
2166 | 668 | case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: | ||
2167 | 669 | return "RIL_UNSOL_STK_CC_ALPHA_NOTIFY"; | ||
2168 | 670 | case RIL_UNSOL_LCEDATA_RECV: | ||
2169 | 671 | return "RIL_UNSOL_LCEDATA_RECV"; | ||
2170 | 598 | default: | 672 | default: |
2172 | 599 | return "<unknown request>"; | 673 | return "<unknown event>"; |
2173 | 600 | } | 674 | } |
2174 | 601 | } | 675 | } |
2175 | 602 | 676 | ||
2176 | @@ -660,6 +734,38 @@ | |||
2177 | 660 | } | 734 | } |
2178 | 661 | } | 735 | } |
2179 | 662 | 736 | ||
2180 | 737 | const char *ril_rc_phase_to_string(int phase) | ||
2181 | 738 | { | ||
2182 | 739 | switch (phase) { | ||
2183 | 740 | case RIL_RC_PHASE_CONFIGURED: | ||
2184 | 741 | return "RIL_RC_PHASE_CONFIGURED"; | ||
2185 | 742 | case RIL_RC_PHASE_START: | ||
2186 | 743 | return "RIL_RC_PHASE_START"; | ||
2187 | 744 | case RIL_RC_PHASE_APPLY: | ||
2188 | 745 | return "RIL_RC_PHASE_APPLY"; | ||
2189 | 746 | case RIL_RC_PHASE_UNSOL_RSP: | ||
2190 | 747 | return "RIL_RC_PHASE_UNSOL_RSP"; | ||
2191 | 748 | case RIL_RC_PHASE_FINISH: | ||
2192 | 749 | return "RIL_RC_PHASE_FINISH"; | ||
2193 | 750 | default: | ||
2194 | 751 | return "<UNKNOWN RC PHASE>"; | ||
2195 | 752 | } | ||
2196 | 753 | } | ||
2197 | 754 | |||
2198 | 755 | const char *ril_rc_status_to_string(int status) | ||
2199 | 756 | { | ||
2200 | 757 | switch (status) { | ||
2201 | 758 | case RIL_RC_STATUS_NONE: | ||
2202 | 759 | return "RC_STATUS_NONE"; | ||
2203 | 760 | case RIL_RC_STATUS_SUCCESS: | ||
2204 | 761 | return "RC_STATUS_SUCCESS"; | ||
2205 | 762 | case RIL_RC_STATUS_FAIL: | ||
2206 | 763 | return "RC_STATUS_FAIL"; | ||
2207 | 764 | default: | ||
2208 | 765 | return "<UNKNOWN RC STATUS>"; | ||
2209 | 766 | } | ||
2210 | 767 | } | ||
2211 | 768 | |||
2212 | 663 | void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len, | 769 | void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len, |
2213 | 664 | GRilDebugFunc debugf, gpointer user_data) | 770 | GRilDebugFunc debugf, gpointer user_data) |
2214 | 665 | { | 771 | { |
2215 | 666 | 772 | ||
2216 | === modified file 'gril/grilutil.h' | |||
2217 | --- gril/grilutil.h 2015-11-10 09:11:52 +0000 | |||
2218 | +++ gril/grilutil.h 2016-07-01 17:24:58 +0000 | |||
2219 | @@ -44,6 +44,8 @@ | |||
2220 | 44 | const char *ril_request_id_to_string(int req); | 44 | const char *ril_request_id_to_string(int req); |
2221 | 45 | const char *ril_unsol_request_to_string(int request); | 45 | const char *ril_unsol_request_to_string(int request); |
2222 | 46 | const char *ril_pdp_fail_to_string(int status); | 46 | const char *ril_pdp_fail_to_string(int status); |
2223 | 47 | const char *ril_rc_phase_to_string(int phase); | ||
2224 | 48 | const char *ril_rc_status_to_string(int status); | ||
2225 | 47 | 49 | ||
2226 | 48 | void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len, | 50 | void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len, |
2227 | 49 | GRilDebugFunc debugf, gpointer user_data); | 51 | GRilDebugFunc debugf, gpointer user_data); |
2228 | 50 | 52 | ||
2229 | === modified file 'gril/ril_constants.h' | |||
2230 | --- gril/ril_constants.h 2016-03-11 04:20:17 +0000 | |||
2231 | +++ gril/ril_constants.h 2016-07-01 17:24:58 +0000 | |||
2232 | @@ -26,6 +26,8 @@ | |||
2233 | 26 | 26 | ||
2234 | 27 | #define RIL_VERSION_UNSPECIFIED 0 | 27 | #define RIL_VERSION_UNSPECIFIED 0 |
2235 | 28 | 28 | ||
2236 | 29 | #define RIL_MAX_UUID_LENGTH 64 | ||
2237 | 30 | |||
2238 | 29 | /* Error Codes */ | 31 | /* Error Codes */ |
2239 | 30 | #define RIL_E_SUCCESS 0 | 32 | #define RIL_E_SUCCESS 0 |
2240 | 31 | #define RIL_E_RADIO_NOT_AVAILABLE 1 | 33 | #define RIL_E_RADIO_NOT_AVAILABLE 1 |
2241 | @@ -140,6 +142,8 @@ | |||
2242 | 140 | #define RADIO_TECH_LTE 14 | 142 | #define RADIO_TECH_LTE 14 |
2243 | 141 | #define RADIO_TECH_HSPAP 15 | 143 | #define RADIO_TECH_HSPAP 15 |
2244 | 142 | #define RADIO_TECH_GSM 16 | 144 | #define RADIO_TECH_GSM 16 |
2245 | 145 | #define RADIO_TECH_TD_SCDMA 17 | ||
2246 | 146 | #define RADIO_TECH_IWLAN 18 | ||
2247 | 143 | /* MTK specific values for radio technologies */ | 147 | /* MTK specific values for radio technologies */ |
2248 | 144 | #define MTK_RADIO_TECH_BASE 128 | 148 | #define MTK_RADIO_TECH_BASE 128 |
2249 | 145 | #define MTK_RADIO_TECH_HSDPAP (MTK_RADIO_TECH_BASE + 1) | 149 | #define MTK_RADIO_TECH_HSDPAP (MTK_RADIO_TECH_BASE + 1) |
2250 | @@ -372,6 +376,30 @@ | |||
2251 | 372 | #define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107 | 376 | #define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107 |
2252 | 373 | #define RIL_REQUEST_VOICE_RADIO_TECH 108 | 377 | #define RIL_REQUEST_VOICE_RADIO_TECH 108 |
2253 | 374 | #define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111 | 378 | #define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111 |
2254 | 379 | #define RIL_REQUEST_IMS_REGISTRATION_STATE 112 | ||
2255 | 380 | #define RIL_REQUEST_IMS_SEND_SMS 113 | ||
2256 | 381 | #define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114 | ||
2257 | 382 | #define RIL_REQUEST_SIM_OPEN_CHANNEL 115 | ||
2258 | 383 | #define RIL_REQUEST_SIM_CLOSE_CHANNEL 116 | ||
2259 | 384 | #define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117 | ||
2260 | 385 | #define RIL_REQUEST_NV_READ_ITEM 118 | ||
2261 | 386 | #define RIL_REQUEST_NV_WRITE_ITEM 119 | ||
2262 | 387 | #define RIL_REQUEST_NV_WRITE_CDMA_PRL 120 | ||
2263 | 388 | #define RIL_REQUEST_NV_RESET_CONFIG 121 | ||
2264 | 389 | #define RIL_REQUEST_SET_UICC_SUBSCRIPTION 122 | ||
2265 | 390 | #define RIL_REQUEST_ALLOW_DATA 123 | ||
2266 | 391 | #define RIL_REQUEST_GET_HARDWARE_CONFIG 124 | ||
2267 | 392 | #define RIL_REQUEST_SIM_AUTHENTICATION 125 | ||
2268 | 393 | #define RIL_REQUEST_GET_DC_RT_INFO 126 | ||
2269 | 394 | #define RIL_REQUEST_SET_DC_RT_INFO_RATE 127 | ||
2270 | 395 | #define RIL_REQUEST_SET_DATA_PROFILE 128 | ||
2271 | 396 | #define RIL_REQUEST_SHUTDOWN 129 | ||
2272 | 397 | #define RIL_REQUEST_GET_RADIO_CAPABILITY 130 | ||
2273 | 398 | #define RIL_REQUEST_SET_RADIO_CAPABILITY 131 | ||
2274 | 399 | #define RIL_REQUEST_START_LCE 132 | ||
2275 | 400 | #define RIL_REQUEST_STOP_LCE 133 | ||
2276 | 401 | #define RIL_REQUEST_PULL_LCEDATA 134 | ||
2277 | 402 | #define RIL_REQUEST_GET_ACTIVITY_INFO 135 | ||
2278 | 375 | 403 | ||
2279 | 376 | /* RIL Unsolicited Messages */ | 404 | /* RIL Unsolicited Messages */ |
2280 | 377 | #define RIL_UNSOL_RESPONSE_BASE 1000 | 405 | #define RIL_UNSOL_RESPONSE_BASE 1000 |
2281 | @@ -411,6 +439,16 @@ | |||
2282 | 411 | #define RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE 1033 | 439 | #define RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE 1033 |
2283 | 412 | #define RIL_UNSOL_RIL_CONNECTED 1034 | 440 | #define RIL_UNSOL_RIL_CONNECTED 1034 |
2284 | 413 | #define RIL_UNSOL_VOICE_RADIO_TECH_CHANGED 1035 | 441 | #define RIL_UNSOL_VOICE_RADIO_TECH_CHANGED 1035 |
2285 | 442 | #define RIL_UNSOL_CELL_INFO_LIST 1036 | ||
2286 | 443 | #define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037 | ||
2287 | 444 | #define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038 | ||
2288 | 445 | #define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039 | ||
2289 | 446 | #define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040 | ||
2290 | 447 | #define RIL_UNSOL_DC_RT_INFO_CHANGED 1041 | ||
2291 | 448 | #define RIL_UNSOL_RADIO_CAPABILITY 1042 | ||
2292 | 449 | #define RIL_UNSOL_ON_SS 1043 | ||
2293 | 450 | #define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1044 | ||
2294 | 451 | #define RIL_UNSOL_LCEDATA_RECV 1045 | ||
2295 | 414 | 452 | ||
2296 | 415 | /* Suplementary services Service class*/ | 453 | /* Suplementary services Service class*/ |
2297 | 416 | #define SERVICE_CLASS_NONE 0 | 454 | #define SERVICE_CLASS_NONE 0 |
2298 | @@ -427,4 +465,36 @@ | |||
2299 | 427 | #define RIL_REG_STATE_EMERGENCY_DENIED 13 | 465 | #define RIL_REG_STATE_EMERGENCY_DENIED 13 |
2300 | 428 | #define RIL_REG_STATE_EMERGENCY_UNKNOWN 14 | 466 | #define RIL_REG_STATE_EMERGENCY_UNKNOWN 14 |
2301 | 429 | 467 | ||
2302 | 468 | /* Radio capability phases */ | ||
2303 | 469 | #define RIL_RC_PHASE_CONFIGURED 0 | ||
2304 | 470 | #define RIL_RC_PHASE_START 1 | ||
2305 | 471 | #define RIL_RC_PHASE_APPLY 2 | ||
2306 | 472 | #define RIL_RC_PHASE_UNSOL_RSP 3 | ||
2307 | 473 | #define RIL_RC_PHASE_FINISH 4 | ||
2308 | 474 | |||
2309 | 475 | /* Radio access family, as flag */ | ||
2310 | 476 | #define RIL_RAF_UNKNOWN (1 << RADIO_TECH_UNKNOWN) | ||
2311 | 477 | #define RIL_RAF_GPRS (1 << RADIO_TECH_GPRS) | ||
2312 | 478 | #define RIL_RAF_EDGE (1 << RADIO_TECH_EDGE) | ||
2313 | 479 | #define RIL_RAF_UMTS (1 << RADIO_TECH_UMTS) | ||
2314 | 480 | #define RIL_RAF_IS95A (1 << RADIO_TECH_IS95A) | ||
2315 | 481 | #define RIL_RAF_IS95B (1 << RADIO_TECH_IS95B) | ||
2316 | 482 | #define RIL_RAF_1xRTT (1 << RADIO_TECH_1xRTT) | ||
2317 | 483 | #define RIL_RAF_EVDO_0 (1 << RADIO_TECH_EVDO_0) | ||
2318 | 484 | #define RIL_RAF_EVDO_A (1 << RADIO_TECH_EVDO_A) | ||
2319 | 485 | #define RIL_RAF_HSDPA (1 << RADIO_TECH_HSDPA) | ||
2320 | 486 | #define RIL_RAF_HSUPA (1 << RADIO_TECH_HSUPA) | ||
2321 | 487 | #define RIL_RAF_HSPA (1 << RADIO_TECH_HSPA) | ||
2322 | 488 | #define RIL_RAF_EVDO_B (1 << RADIO_TECH_EVDO_B) | ||
2323 | 489 | #define RIL_RAF_EHRPD (1 << RADIO_TECH_EHRPD) | ||
2324 | 490 | #define RIL_RAF_LTE (1 << RADIO_TECH_LTE) | ||
2325 | 491 | #define RIL_RAF_HSPAP (1 << RADIO_TECH_HSPAP) | ||
2326 | 492 | #define RIL_RAF_GSM (1 << RADIO_TECH_GSM) | ||
2327 | 493 | #define RIL_RAF_TD_SCDMA (1 << RADIO_TECH_TD_SCDMA) | ||
2328 | 494 | |||
2329 | 495 | /* Radio capability status */ | ||
2330 | 496 | #define RIL_RC_STATUS_NONE 0 | ||
2331 | 497 | #define RIL_RC_STATUS_SUCCESS 1 | ||
2332 | 498 | #define RIL_RC_STATUS_FAIL 2 | ||
2333 | 499 | |||
2334 | 430 | #endif /*__RIL_CONSTANTS_H*/ | 500 | #endif /*__RIL_CONSTANTS_H*/ |
2335 | 431 | 501 | ||
2336 | === modified file 'include/modem.h' | |||
2337 | --- include/modem.h 2015-07-31 12:37:46 +0000 | |||
2338 | +++ include/modem.h 2016-07-01 17:24:58 +0000 | |||
2339 | @@ -72,9 +72,6 @@ | |||
2340 | 72 | 72 | ||
2341 | 73 | /* Populate the atoms available online */ | 73 | /* Populate the atoms available online */ |
2342 | 74 | void (*post_online)(struct ofono_modem *modem); | 74 | void (*post_online)(struct ofono_modem *modem); |
2343 | 75 | |||
2344 | 76 | /* Is it a multi-SIM standby modem? */ | ||
2345 | 77 | ofono_bool_t (*is_standby)(struct ofono_modem *modem); | ||
2346 | 78 | }; | 75 | }; |
2347 | 79 | 76 | ||
2348 | 80 | void ofono_modem_add_interface(struct ofono_modem *modem, | 77 | void ofono_modem_add_interface(struct ofono_modem *modem, |
2349 | @@ -122,8 +119,6 @@ | |||
2350 | 122 | ofono_bool_t value); | 119 | ofono_bool_t value); |
2351 | 123 | ofono_bool_t ofono_modem_get_driver_watches_sim(struct ofono_modem *modem); | 120 | ofono_bool_t ofono_modem_get_driver_watches_sim(struct ofono_modem *modem); |
2352 | 124 | 121 | ||
2353 | 125 | ofono_bool_t ofono_modem_is_standby(struct ofono_modem *modem); | ||
2354 | 126 | |||
2355 | 127 | int ofono_modem_driver_register(const struct ofono_modem_driver *); | 122 | int ofono_modem_driver_register(const struct ofono_modem_driver *); |
2356 | 128 | void ofono_modem_driver_unregister(const struct ofono_modem_driver *); | 123 | void ofono_modem_driver_unregister(const struct ofono_modem_driver *); |
2357 | 129 | 124 | ||
2358 | 130 | 125 | ||
2359 | === modified file 'plugins/infineon.c' | |||
2360 | --- plugins/infineon.c 2015-09-29 08:48:01 +0000 | |||
2361 | +++ plugins/infineon.c 2016-07-01 17:24:58 +0000 | |||
2362 | @@ -32,11 +32,12 @@ | |||
2363 | 32 | #include "ofono.h" | 32 | #include "ofono.h" |
2364 | 33 | 33 | ||
2365 | 34 | #include "drivers/rilmodem/vendor.h" | 34 | #include "drivers/rilmodem/vendor.h" |
2366 | 35 | #include "gril.h" | ||
2367 | 35 | #include "ril.h" | 36 | #include "ril.h" |
2368 | 36 | 37 | ||
2369 | 37 | static int inf_probe(struct ofono_modem *modem) | 38 | static int inf_probe(struct ofono_modem *modem) |
2370 | 38 | { | 39 | { |
2372 | 39 | return ril_create(modem, OFONO_RIL_VENDOR_INFINEON); | 40 | return ril_create(modem, OFONO_RIL_VENDOR_INFINEON, NULL, NULL, NULL); |
2373 | 40 | } | 41 | } |
2374 | 41 | 42 | ||
2375 | 42 | static struct ofono_modem_driver infineon_driver = { | 43 | static struct ofono_modem_driver infineon_driver = { |
2376 | 43 | 44 | ||
2377 | === modified file 'plugins/mtk.c' | |||
2378 | --- plugins/mtk.c 2015-09-29 08:48:01 +0000 | |||
2379 | +++ plugins/mtk.c 2016-07-01 17:24:58 +0000 | |||
2380 | @@ -62,6 +62,7 @@ | |||
2381 | 62 | #include <grilrequest.h> | 62 | #include <grilrequest.h> |
2382 | 63 | #include <grilunsol.h> | 63 | #include <grilunsol.h> |
2383 | 64 | 64 | ||
2384 | 65 | #include "drivers/rilmodem/rilutil.h" | ||
2385 | 65 | #include "drivers/rilmodem/rilmodem.h" | 66 | #include "drivers/rilmodem/rilmodem.h" |
2386 | 66 | #include "drivers/rilmodem/vendor.h" | 67 | #include "drivers/rilmodem/vendor.h" |
2387 | 67 | 68 | ||
2388 | @@ -1669,11 +1670,6 @@ | |||
2389 | 1669 | return 0; | 1670 | return 0; |
2390 | 1670 | } | 1671 | } |
2391 | 1671 | 1672 | ||
2392 | 1672 | static ofono_bool_t mtk_is_standby(struct ofono_modem *modem) | ||
2393 | 1673 | { | ||
2394 | 1674 | return TRUE; | ||
2395 | 1675 | } | ||
2396 | 1676 | |||
2397 | 1677 | static struct ofono_modem_driver mtk_driver = { | 1673 | static struct ofono_modem_driver mtk_driver = { |
2398 | 1678 | .name = "mtk", | 1674 | .name = "mtk", |
2399 | 1679 | .probe = mtk_probe, | 1675 | .probe = mtk_probe, |
2400 | @@ -1684,7 +1680,6 @@ | |||
2401 | 1684 | .post_sim = mtk_post_sim, | 1680 | .post_sim = mtk_post_sim, |
2402 | 1685 | .post_online = mtk_post_online, | 1681 | .post_online = mtk_post_online, |
2403 | 1686 | .set_online = mtk_set_online, | 1682 | .set_online = mtk_set_online, |
2404 | 1687 | .is_standby = mtk_is_standby, | ||
2405 | 1688 | }; | 1683 | }; |
2406 | 1689 | 1684 | ||
2407 | 1690 | static int mtk_init(void) | 1685 | static int mtk_init(void) |
2408 | 1691 | 1686 | ||
2409 | === added file 'plugins/mtk2.c' | |||
2410 | --- plugins/mtk2.c 1970-01-01 00:00:00 +0000 | |||
2411 | +++ plugins/mtk2.c 2016-07-01 17:24:58 +0000 | |||
2412 | @@ -0,0 +1,93 @@ | |||
2413 | 1 | /* | ||
2414 | 2 | * | ||
2415 | 3 | * oFono - Open Source Telephony - RIL-based devices | ||
2416 | 4 | * | ||
2417 | 5 | * Copyright (C) 2016 Canonical Ltd. | ||
2418 | 6 | * | ||
2419 | 7 | * This program is free software; you can redistribute it and/or modify | ||
2420 | 8 | * it under the terms of the GNU General Public License version 2 as | ||
2421 | 9 | * published by the Free Software Foundation. | ||
2422 | 10 | * | ||
2423 | 11 | * This program is distributed in the hope that it will be useful, | ||
2424 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2425 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2426 | 14 | * GNU General Public License for more details. | ||
2427 | 15 | * | ||
2428 | 16 | * You should have received a copy of the GNU General Public License | ||
2429 | 17 | * along with this program; if not, write to the Free Software | ||
2430 | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
2431 | 19 | * | ||
2432 | 20 | */ | ||
2433 | 21 | |||
2434 | 22 | #ifdef HAVE_CONFIG_H | ||
2435 | 23 | #include <config.h> | ||
2436 | 24 | #endif | ||
2437 | 25 | |||
2438 | 26 | #define OFONO_API_SUBJECT_TO_CHANGE | ||
2439 | 27 | |||
2440 | 28 | #include <ofono/plugin.h> | ||
2441 | 29 | #include <ofono/log.h> | ||
2442 | 30 | #include <ofono/modem.h> | ||
2443 | 31 | |||
2444 | 32 | #include "ofono.h" | ||
2445 | 33 | |||
2446 | 34 | #include "drivers/rilmodem/rilmodem.h" | ||
2447 | 35 | #include "drivers/rilmodem/vendor.h" | ||
2448 | 36 | #include "drivers/mtk2modem/mtk2modem.h" | ||
2449 | 37 | #include "drivers/mtk2modem/mtk2util.h" | ||
2450 | 38 | #include "gril.h" | ||
2451 | 39 | #include "ril.h" | ||
2452 | 40 | |||
2453 | 41 | static const char *mtk2_get_driver_type(enum ofono_atom_type atom) | ||
2454 | 42 | { | ||
2455 | 43 | switch (atom) { | ||
2456 | 44 | case OFONO_ATOM_TYPE_VOICECALL: | ||
2457 | 45 | case OFONO_ATOM_TYPE_GPRS: | ||
2458 | 46 | return MTK2MODEM; | ||
2459 | 47 | default: | ||
2460 | 48 | return RILMODEM; | ||
2461 | 49 | } | ||
2462 | 50 | } | ||
2463 | 51 | |||
2464 | 52 | static int mtk2_probe(struct ofono_modem *modem) | ||
2465 | 53 | { | ||
2466 | 54 | return ril_create(modem, OFONO_RIL_VENDOR_MTK2, | ||
2467 | 55 | mtk2_request_id_to_string, | ||
2468 | 56 | mtk2_unsol_request_to_string, | ||
2469 | 57 | mtk2_get_driver_type); | ||
2470 | 58 | } | ||
2471 | 59 | |||
2472 | 60 | static struct ofono_modem_driver mtk2_driver = { | ||
2473 | 61 | .name = "mtk2", | ||
2474 | 62 | .probe = mtk2_probe, | ||
2475 | 63 | .remove = ril_remove, | ||
2476 | 64 | .enable = ril_enable, | ||
2477 | 65 | .disable = ril_disable, | ||
2478 | 66 | .pre_sim = ril_pre_sim, | ||
2479 | 67 | .post_sim = ril_post_sim, | ||
2480 | 68 | .post_online = ril_post_online, | ||
2481 | 69 | .set_online = ril_set_online, | ||
2482 | 70 | }; | ||
2483 | 71 | |||
2484 | 72 | /* | ||
2485 | 73 | * This plugin is a device plugin for MTK modems. It can handle newer modems | ||
2486 | 74 | * than those that use the old mtk.c plugin, therefore the name mtk2. | ||
2487 | 75 | */ | ||
2488 | 76 | static int mtk2_init(void) | ||
2489 | 77 | { | ||
2490 | 78 | int retval = ofono_modem_driver_register(&mtk2_driver); | ||
2491 | 79 | |||
2492 | 80 | if (retval) | ||
2493 | 81 | DBG("ofono_modem_driver_register returned: %d", retval); | ||
2494 | 82 | |||
2495 | 83 | return retval; | ||
2496 | 84 | } | ||
2497 | 85 | |||
2498 | 86 | static void mtk2_exit(void) | ||
2499 | 87 | { | ||
2500 | 88 | DBG(""); | ||
2501 | 89 | ofono_modem_driver_unregister(&mtk2_driver); | ||
2502 | 90 | } | ||
2503 | 91 | |||
2504 | 92 | OFONO_PLUGIN_DEFINE(mtk2, "MTK v2 modem plugin", | ||
2505 | 93 | VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT, mtk2_init, mtk2_exit) | ||
2506 | 0 | 94 | ||
2507 | === modified file 'plugins/qcom-msim.c' | |||
2508 | --- plugins/qcom-msim.c 2016-03-10 10:15:39 +0000 | |||
2509 | +++ plugins/qcom-msim.c 2016-07-01 17:24:58 +0000 | |||
2510 | @@ -31,9 +31,23 @@ | |||
2511 | 31 | 31 | ||
2512 | 32 | #include "ofono.h" | 32 | #include "ofono.h" |
2513 | 33 | 33 | ||
2514 | 34 | #include "drivers/rilmodem/rilmodem.h" | ||
2515 | 34 | #include "drivers/rilmodem/vendor.h" | 35 | #include "drivers/rilmodem/vendor.h" |
2516 | 36 | #include "drivers/qcommsimmodem/qcom_msim_modem.h" | ||
2517 | 37 | #include "gril.h" | ||
2518 | 35 | #include "ril.h" | 38 | #include "ril.h" |
2519 | 36 | 39 | ||
2520 | 40 | static const char *qcom_msim_get_driver_type(enum ofono_atom_type atom) | ||
2521 | 41 | { | ||
2522 | 42 | switch (atom) { | ||
2523 | 43 | case OFONO_ATOM_TYPE_GPRS: | ||
2524 | 44 | case OFONO_ATOM_TYPE_RADIO_SETTINGS: | ||
2525 | 45 | return QCOMMSIMMODEM; | ||
2526 | 46 | default: | ||
2527 | 47 | return RILMODEM; | ||
2528 | 48 | } | ||
2529 | 49 | } | ||
2530 | 50 | |||
2531 | 37 | static int qcom_msim_probe(struct ofono_modem *modem) | 51 | static int qcom_msim_probe(struct ofono_modem *modem) |
2532 | 38 | { | 52 | { |
2533 | 39 | int slot_id = ofono_modem_get_integer(modem, "Slot"); | 53 | int slot_id = ofono_modem_get_integer(modem, "Slot"); |
2534 | @@ -48,7 +62,8 @@ | |||
2535 | 48 | g_free(socket); | 62 | g_free(socket); |
2536 | 49 | } | 63 | } |
2537 | 50 | 64 | ||
2539 | 51 | return ril_create(modem, OFONO_RIL_VENDOR_QCOM_MSIM); | 65 | return ril_create(modem, OFONO_RIL_VENDOR_QCOM_MSIM, NULL, NULL, |
2540 | 66 | qcom_msim_get_driver_type); | ||
2541 | 52 | } | 67 | } |
2542 | 53 | 68 | ||
2543 | 54 | static struct ofono_modem_driver qcom_msim_driver = { | 69 | static struct ofono_modem_driver qcom_msim_driver = { |
2544 | 55 | 70 | ||
2545 | === modified file 'plugins/ril.c' | |||
2546 | --- plugins/ril.c 2016-03-14 08:16:40 +0000 | |||
2547 | +++ plugins/ril.c 2016-07-01 17:24:58 +0000 | |||
2548 | @@ -64,9 +64,13 @@ | |||
2549 | 64 | 64 | ||
2550 | 65 | #include "ril.h" | 65 | #include "ril.h" |
2551 | 66 | #include "drivers/rilmodem/rilmodem.h" | 66 | #include "drivers/rilmodem/rilmodem.h" |
2552 | 67 | #include "drivers/rilmodem/rilutil.h" | ||
2553 | 67 | #include "drivers/rilmodem/vendor.h" | 68 | #include "drivers/rilmodem/vendor.h" |
2554 | 68 | #include "drivers/qcommsimmodem/qcom_msim_modem.h" | 69 | #include "drivers/qcommsimmodem/qcom_msim_modem.h" |
2555 | 69 | 70 | ||
2556 | 71 | #define MULTISIM_SLOT_0 0 | ||
2557 | 72 | #define MULTISIM_SLOT_1 1 | ||
2558 | 73 | |||
2559 | 70 | #define MAX_SIM_STATUS_RETRIES 15 | 74 | #define MAX_SIM_STATUS_RETRIES 15 |
2560 | 71 | 75 | ||
2561 | 72 | /* this gives 30s for rild to initialize */ | 76 | /* this gives 30s for rild to initialize */ |
2562 | @@ -77,14 +81,37 @@ | |||
2563 | 77 | GRil *ril; | 81 | GRil *ril; |
2564 | 78 | enum ofono_ril_vendor vendor; | 82 | enum ofono_ril_vendor vendor; |
2565 | 79 | int sim_status_retries; | 83 | int sim_status_retries; |
2567 | 80 | ofono_bool_t connected; | 84 | ofono_bool_t init_state; |
2568 | 81 | ofono_bool_t ofono_online; | 85 | ofono_bool_t ofono_online; |
2569 | 82 | int radio_state; | 86 | int radio_state; |
2570 | 83 | struct ofono_sim *sim; | 87 | struct ofono_sim *sim; |
2571 | 84 | struct ofono_radio_settings *radio_settings; | ||
2572 | 85 | int rild_connect_retries; | 88 | int rild_connect_retries; |
2573 | 89 | GRilMsgIdToStrFunc request_id_to_string; | ||
2574 | 90 | GRilMsgIdToStrFunc unsol_request_to_string; | ||
2575 | 91 | ril_get_driver_type_func get_driver_type; | ||
2576 | 92 | struct cb_data *set_online_cbd; | ||
2577 | 86 | }; | 93 | }; |
2578 | 87 | 94 | ||
2579 | 95 | /* | ||
2580 | 96 | * Some times we need to access slot B from slot A in dual-SIM modems, so we | ||
2581 | 97 | * need these global variables. | ||
2582 | 98 | */ | ||
2583 | 99 | static struct ril_data *ril_data_0; | ||
2584 | 100 | static struct ril_data *ril_data_1; | ||
2585 | 101 | |||
2586 | 102 | /* Get complementary GRil */ | ||
2587 | 103 | GRil *ril_get_gril_complement(struct ofono_modem *modem) | ||
2588 | 104 | { | ||
2589 | 105 | struct ril_data *rd = ofono_modem_get_data(modem); | ||
2590 | 106 | |||
2591 | 107 | if (rd == ril_data_0 && ril_data_1 != NULL) | ||
2592 | 108 | return ril_data_1->ril; | ||
2593 | 109 | else if (rd == ril_data_1 && ril_data_0 != NULL) | ||
2594 | 110 | return ril_data_0->ril; | ||
2595 | 111 | |||
2596 | 112 | return NULL; | ||
2597 | 113 | } | ||
2598 | 114 | |||
2599 | 88 | static void ril_debug(const char *str, void *user_data) | 115 | static void ril_debug(const char *str, void *user_data) |
2600 | 89 | { | 116 | { |
2601 | 90 | struct ril_data *rd = user_data; | 117 | struct ril_data *rd = user_data; |
2602 | @@ -92,6 +119,46 @@ | |||
2603 | 92 | ofono_info("Device %d: %s", g_ril_get_slot(rd->ril), str); | 119 | ofono_info("Device %d: %s", g_ril_get_slot(rd->ril), str); |
2604 | 93 | } | 120 | } |
2605 | 94 | 121 | ||
2606 | 122 | static const char *get_driver_type(struct ril_data *rd, | ||
2607 | 123 | enum ofono_atom_type atom) | ||
2608 | 124 | { | ||
2609 | 125 | if (rd->get_driver_type != NULL) | ||
2610 | 126 | return rd->get_driver_type(atom); | ||
2611 | 127 | |||
2612 | 128 | return RILMODEM; | ||
2613 | 129 | } | ||
2614 | 130 | |||
2615 | 131 | static void ril_send_power(struct ril_data *rd, ofono_bool_t online, | ||
2616 | 132 | GRilResponseFunc func, gpointer user_data) | ||
2617 | 133 | { | ||
2618 | 134 | struct parcel rilp; | ||
2619 | 135 | |||
2620 | 136 | DBG("(online = 1, offline = 0)): %d", online); | ||
2621 | 137 | |||
2622 | 138 | g_ril_request_power(rd->ril, (const gboolean) online, &rilp); | ||
2623 | 139 | |||
2624 | 140 | if (g_ril_send(rd->ril, RIL_REQUEST_RADIO_POWER, &rilp, | ||
2625 | 141 | func, user_data, NULL) == 0 && func != NULL) { | ||
2626 | 142 | ofono_error("%s: could not set radio to %d", __func__, online); | ||
2627 | 143 | func(NULL, user_data); | ||
2628 | 144 | } | ||
2629 | 145 | } | ||
2630 | 146 | |||
2631 | 147 | static void ril_set_powered_off_cb(struct ril_msg *message, gpointer user_data) | ||
2632 | 148 | { | ||
2633 | 149 | struct ofono_modem *modem = user_data; | ||
2634 | 150 | struct ril_data *rd = ofono_modem_get_data(modem); | ||
2635 | 151 | |||
2636 | 152 | if (message == NULL) | ||
2637 | 153 | return; | ||
2638 | 154 | |||
2639 | 155 | if (message->error == RIL_E_SUCCESS) | ||
2640 | 156 | g_ril_print_response_no_args(rd->ril, message); | ||
2641 | 157 | else | ||
2642 | 158 | ofono_error("%s: RIL error %s", __func__, | ||
2643 | 159 | ril_error_to_string(message->error)); | ||
2644 | 160 | } | ||
2645 | 161 | |||
2646 | 95 | static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data) | 162 | static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data) |
2647 | 96 | { | 163 | { |
2648 | 97 | struct ofono_modem *modem = user_data; | 164 | struct ofono_modem *modem = user_data; |
2649 | @@ -99,63 +166,76 @@ | |||
2650 | 99 | int radio_state = g_ril_unsol_parse_radio_state_changed(rd->ril, | 166 | int radio_state = g_ril_unsol_parse_radio_state_changed(rd->ril, |
2651 | 100 | message); | 167 | message); |
2652 | 101 | 168 | ||
2703 | 102 | if (radio_state != rd->radio_state) { | 169 | ofono_info("%s: state: %s, init: %d, rd->ofono_online: %d", |
2704 | 103 | 170 | __func__, ril_radio_state_to_string(radio_state), | |
2705 | 104 | ofono_info("%s: state: %s rd->ofono_online: %d", | 171 | rd->init_state, rd->ofono_online); |
2706 | 105 | __func__, | 172 | |
2707 | 106 | ril_radio_state_to_string(radio_state), | 173 | rd->radio_state = radio_state; |
2708 | 107 | rd->ofono_online); | 174 | |
2709 | 108 | 175 | /* | |
2710 | 109 | rd->radio_state = radio_state; | 176 | * Before showing the modem as powered we make sure the radio is off so |
2711 | 110 | 177 | * we start in a sane state (as in AOSP). Note that we must always | |
2712 | 111 | switch (radio_state) { | 178 | * receive an event with the current radio state on initialization |
2713 | 112 | case RADIO_STATE_ON: | 179 | * and also that power state has changed effectively when the event with |
2714 | 113 | 180 | * the new radio state has been received (we cannot rely on the reply to | |
2715 | 114 | if (rd->radio_settings == NULL) { | 181 | * RIL_REQUEST_RADIO_POWER). Finally, note that powering off on start is |
2716 | 115 | char *rs_driver; | 182 | * a must for turbo devices (otherwise radio state never moves from |
2717 | 116 | struct ril_radio_settings_driver_data | 183 | * unavailable). |
2718 | 117 | rs_data = { rd->ril, modem }; | 184 | */ |
2719 | 118 | 185 | if (rd->init_state) { | |
2720 | 119 | if (rd->vendor == OFONO_RIL_VENDOR_QCOM_MSIM) | 186 | if (radio_state != RADIO_STATE_OFF) { |
2721 | 120 | rs_driver = QCOMMSIMMODEM; | 187 | DBG("powering off radio on init"); |
2722 | 121 | else | 188 | |
2723 | 122 | rs_driver = RILMODEM; | 189 | ril_send_power(rd, FALSE, ril_set_powered_off_cb, modem); |
2724 | 123 | 190 | } else { | |
2725 | 124 | rd->radio_settings = | 191 | DBG("calling set_powered(TRUE)"); |
2726 | 125 | ofono_radio_settings_create(modem, | 192 | rd->init_state = FALSE; |
2727 | 126 | rd->vendor, rs_driver, | 193 | |
2728 | 127 | &rs_data); | 194 | /* Note that modem hw is powered, but radio is off */ |
2729 | 128 | } | 195 | ofono_modem_set_powered(modem, TRUE); |
2680 | 129 | |||
2681 | 130 | break; | ||
2682 | 131 | |||
2683 | 132 | case RADIO_STATE_UNAVAILABLE: | ||
2684 | 133 | case RADIO_STATE_OFF: | ||
2685 | 134 | |||
2686 | 135 | /* | ||
2687 | 136 | * Unexpected radio state change, as we are supposed to | ||
2688 | 137 | * be online. UNAVAILABLE has been seen occassionally | ||
2689 | 138 | * when powering off the phone. We wait 5 secs to avoid | ||
2690 | 139 | * too fast re-spawns, then exit with error to make | ||
2691 | 140 | * upstart re-start ofono. | ||
2692 | 141 | */ | ||
2693 | 142 | if (rd->ofono_online) { | ||
2694 | 143 | ofono_error("%s: radio self-powered off!", | ||
2695 | 144 | __func__); | ||
2696 | 145 | sleep(5); | ||
2697 | 146 | exit(1); | ||
2698 | 147 | } | ||
2699 | 148 | break; | ||
2700 | 149 | default: | ||
2701 | 150 | /* Malformed parcel; no radio state == broken rild */ | ||
2702 | 151 | g_assert(FALSE); | ||
2730 | 152 | } | 196 | } |
2731 | 197 | return; | ||
2732 | 198 | } | ||
2733 | 199 | |||
2734 | 200 | /* We process pending callbacks */ | ||
2735 | 201 | if (rd->set_online_cbd != NULL && ( | ||
2736 | 202 | (rd->ofono_online && radio_state == RADIO_STATE_ON) || | ||
2737 | 203 | (!rd->ofono_online && radio_state == RADIO_STATE_OFF)) | ||
2738 | 204 | ) { | ||
2739 | 205 | ofono_modem_online_cb_t cb = rd->set_online_cbd->cb; | ||
2740 | 206 | |||
2741 | 207 | DBG("%s: set_online OK: rd->ofono_online: %d", | ||
2742 | 208 | __func__, rd->ofono_online); | ||
2743 | 209 | CALLBACK_WITH_SUCCESS(cb, rd->set_online_cbd->data); | ||
2744 | 210 | |||
2745 | 211 | g_free(rd->set_online_cbd); | ||
2746 | 212 | rd->set_online_cbd = NULL; | ||
2747 | 213 | } | ||
2748 | 214 | |||
2749 | 215 | if ((radio_state == RADIO_STATE_UNAVAILABLE || | ||
2750 | 216 | radio_state == RADIO_STATE_OFF) | ||
2751 | 217 | && rd->ofono_online | ||
2752 | 218 | && rd->vendor != OFONO_RIL_VENDOR_MTK2) { | ||
2753 | 219 | /* | ||
2754 | 220 | * Unexpected radio state change, as we are supposed to | ||
2755 | 221 | * be online. UNAVAILABLE has been seen occassionally | ||
2756 | 222 | * when powering off the phone. We wait 5 secs to avoid | ||
2757 | 223 | * too fast re-spawns, then exit with error to make | ||
2758 | 224 | * upstart re-start ofono. In midori we receive an OFF | ||
2759 | 225 | * event and immediately after that an ON event when we | ||
2760 | 226 | * enter the SIM PIN, so do nothing for that device. | ||
2761 | 227 | */ | ||
2762 | 228 | ofono_error("%s: radio self-powered off!", __func__); | ||
2763 | 229 | sleep(5); | ||
2764 | 230 | exit(1); | ||
2765 | 153 | } | 231 | } |
2766 | 154 | } | 232 | } |
2767 | 155 | 233 | ||
2769 | 156 | int ril_create(struct ofono_modem *modem, enum ofono_ril_vendor vendor) | 234 | int ril_create(struct ofono_modem *modem, enum ofono_ril_vendor vendor, |
2770 | 235 | GRilMsgIdToStrFunc request_id_to_string, | ||
2771 | 236 | GRilMsgIdToStrFunc unsol_request_to_string, | ||
2772 | 237 | ril_get_driver_type_func get_driver_type) | ||
2773 | 157 | { | 238 | { |
2774 | 158 | ofono_bool_t lte_cap; | ||
2775 | 159 | struct ril_data *rd = g_try_new0(struct ril_data, 1); | 239 | struct ril_data *rd = g_try_new0(struct ril_data, 1); |
2776 | 160 | if (rd == NULL) { | 240 | if (rd == NULL) { |
2777 | 161 | errno = ENOMEM; | 241 | errno = ENOMEM; |
2778 | @@ -167,9 +247,10 @@ | |||
2779 | 167 | rd->vendor = vendor; | 247 | rd->vendor = vendor; |
2780 | 168 | rd->ofono_online = FALSE; | 248 | rd->ofono_online = FALSE; |
2781 | 169 | rd->radio_state = RADIO_STATE_UNAVAILABLE; | 249 | rd->radio_state = RADIO_STATE_UNAVAILABLE; |
2785 | 170 | 250 | rd->request_id_to_string = request_id_to_string; | |
2786 | 171 | lte_cap = getenv("OFONO_RIL_RAT_LTE") ? TRUE : FALSE; | 251 | rd->unsol_request_to_string = unsol_request_to_string; |
2787 | 172 | ofono_modem_set_boolean(modem, MODEM_PROP_LTE_CAPABLE, lte_cap); | 252 | rd->get_driver_type = get_driver_type; |
2788 | 253 | rd->init_state = TRUE; | ||
2789 | 173 | 254 | ||
2790 | 174 | ofono_modem_set_data(modem, rd); | 255 | ofono_modem_set_data(modem, rd); |
2791 | 175 | 256 | ||
2792 | @@ -183,7 +264,7 @@ | |||
2793 | 183 | 264 | ||
2794 | 184 | static int ril_probe(struct ofono_modem *modem) | 265 | static int ril_probe(struct ofono_modem *modem) |
2795 | 185 | { | 266 | { |
2797 | 186 | return ril_create(modem, OFONO_RIL_VENDOR_AOSP); | 267 | return ril_create(modem, OFONO_RIL_VENDOR_AOSP, NULL, NULL, NULL); |
2798 | 187 | } | 268 | } |
2799 | 188 | 269 | ||
2800 | 189 | void ril_remove(struct ofono_modem *modem) | 270 | void ril_remove(struct ofono_modem *modem) |
2801 | @@ -205,42 +286,84 @@ | |||
2802 | 205 | struct ril_data *rd = ofono_modem_get_data(modem); | 286 | struct ril_data *rd = ofono_modem_get_data(modem); |
2803 | 206 | struct ril_voicecall_driver_data vc_data = { rd->ril, modem }; | 287 | struct ril_voicecall_driver_data vc_data = { rd->ril, modem }; |
2804 | 207 | struct ril_sim_data sim_data; | 288 | struct ril_sim_data sim_data; |
2805 | 289 | struct ril_radio_settings_driver_data rs_data = { rd->ril, modem }; | ||
2806 | 208 | 290 | ||
2807 | 209 | DBG(""); | 291 | DBG(""); |
2808 | 210 | 292 | ||
2812 | 211 | ofono_devinfo_create(modem, rd->vendor, RILMODEM, rd->ril); | 293 | ofono_devinfo_create(modem, rd->vendor, |
2813 | 212 | ofono_voicecall_create(modem, rd->vendor, RILMODEM, &vc_data); | 294 | get_driver_type(rd, OFONO_ATOM_TYPE_DEVINFO), |
2814 | 213 | ofono_call_volume_create(modem, rd->vendor, RILMODEM, rd->ril); | 295 | rd->ril); |
2815 | 296 | ofono_voicecall_create(modem, rd->vendor, | ||
2816 | 297 | get_driver_type(rd, OFONO_ATOM_TYPE_VOICECALL), | ||
2817 | 298 | &vc_data); | ||
2818 | 299 | ofono_call_volume_create(modem, rd->vendor, | ||
2819 | 300 | get_driver_type(rd, OFONO_ATOM_TYPES_CALL_VOLUME), | ||
2820 | 301 | rd->ril); | ||
2821 | 214 | 302 | ||
2822 | 215 | sim_data.gril = rd->ril; | 303 | sim_data.gril = rd->ril; |
2823 | 216 | sim_data.modem = modem; | 304 | sim_data.modem = modem; |
2824 | 217 | sim_data.ril_state_watch = NULL; | 305 | sim_data.ril_state_watch = NULL; |
2825 | 218 | 306 | ||
2828 | 219 | rd->sim = ofono_sim_create(modem, rd->vendor, RILMODEM, &sim_data); | 307 | rd->sim = ofono_sim_create(modem, rd->vendor, |
2829 | 220 | g_assert(rd->sim != NULL); | 308 | get_driver_type(rd, OFONO_ATOM_TYPE_SIM), &sim_data); |
2830 | 309 | |||
2831 | 310 | /* | ||
2832 | 311 | * We need to create radio settings here so FastDormancy property is | ||
2833 | 312 | * available even when there is no SIM (no SIM -> post_sim and | ||
2834 | 313 | * post_online are not called) so we can make the modem enter low power | ||
2835 | 314 | * state in that case. | ||
2836 | 315 | */ | ||
2837 | 316 | ofono_radio_settings_create(modem, rd->vendor, | ||
2838 | 317 | get_driver_type(rd, OFONO_ATOM_TYPE_RADIO_SETTINGS), | ||
2839 | 318 | &rs_data); | ||
2840 | 221 | } | 319 | } |
2841 | 222 | 320 | ||
2842 | 223 | void ril_post_sim(struct ofono_modem *modem) | 321 | void ril_post_sim(struct ofono_modem *modem) |
2843 | 224 | { | 322 | { |
2844 | 225 | struct ril_data *rd = ofono_modem_get_data(modem); | 323 | struct ril_data *rd = ofono_modem_get_data(modem); |
2845 | 324 | struct ofono_message_waiting *mw; | ||
2846 | 325 | |||
2847 | 326 | ofono_sms_create(modem, rd->vendor, | ||
2848 | 327 | get_driver_type(rd, OFONO_ATOM_TYPE_SMS), rd->ril); | ||
2849 | 328 | |||
2850 | 329 | mw = ofono_message_waiting_create(modem); | ||
2851 | 330 | if (mw) | ||
2852 | 331 | ofono_message_waiting_register(mw); | ||
2853 | 332 | |||
2854 | 333 | ofono_phonebook_create(modem, rd->vendor, | ||
2855 | 334 | get_driver_type(rd, OFONO_ATOM_TYPE_PHONEBOOK), modem); | ||
2856 | 335 | } | ||
2857 | 336 | |||
2858 | 337 | static void create_post_online_atoms(struct ofono_modem *modem) | ||
2859 | 338 | { | ||
2860 | 339 | struct ril_data *rd = ofono_modem_get_data(modem); | ||
2861 | 226 | struct ofono_gprs *gprs; | 340 | struct ofono_gprs *gprs; |
2862 | 227 | struct ofono_gprs_context *gc; | 341 | struct ofono_gprs_context *gc; |
2863 | 228 | struct ofono_message_waiting *mw; | ||
2864 | 229 | struct ril_gprs_driver_data gprs_data = { rd->ril, modem }; | 342 | struct ril_gprs_driver_data gprs_data = { rd->ril, modem }; |
2865 | 230 | struct ril_gprs_context_data | 343 | struct ril_gprs_context_data |
2866 | 231 | inet_ctx = { rd->ril, modem, OFONO_GPRS_CONTEXT_TYPE_INTERNET }; | 344 | inet_ctx = { rd->ril, modem, OFONO_GPRS_CONTEXT_TYPE_INTERNET }; |
2867 | 232 | struct ril_gprs_context_data | 345 | struct ril_gprs_context_data |
2868 | 233 | mms_ctx = { rd->ril, modem, OFONO_GPRS_CONTEXT_TYPE_MMS }; | 346 | mms_ctx = { rd->ril, modem, OFONO_GPRS_CONTEXT_TYPE_MMS }; |
2869 | 234 | 347 | ||
2879 | 235 | /* TODO: this function should setup: | 348 | ofono_netreg_create(modem, rd->vendor, |
2880 | 236 | * - phonebook | 349 | get_driver_type(rd, OFONO_ATOM_TYPE_NETREG), rd->ril); |
2881 | 237 | * - stk ( SIM toolkit ) | 350 | ofono_ussd_create(modem, rd->vendor, |
2882 | 238 | * - radio_settings | 351 | get_driver_type(rd, OFONO_ATOM_TYPE_USSD), rd->ril); |
2883 | 239 | */ | 352 | ofono_call_settings_create(modem, rd->vendor, |
2884 | 240 | ofono_sms_create(modem, rd->vendor, RILMODEM, rd->ril); | 353 | get_driver_type(rd, OFONO_ATOM_TYPE_CALL_SETTINGS), |
2885 | 241 | 354 | rd->ril); | |
2886 | 242 | gprs = ofono_gprs_create(modem, rd->vendor, RILMODEM, &gprs_data); | 355 | ofono_call_barring_create(modem, rd->vendor, |
2887 | 243 | gc = ofono_gprs_context_create(modem, rd->vendor, RILMODEM, &inet_ctx); | 356 | get_driver_type(rd, OFONO_ATOM_TYPE_CALL_BARRING), |
2888 | 357 | rd->ril); | ||
2889 | 358 | ofono_call_forwarding_create(modem, rd->vendor, | ||
2890 | 359 | get_driver_type(rd, OFONO_ATOM_TYPE_CALL_FORWARDING), | ||
2891 | 360 | rd->ril); | ||
2892 | 361 | gprs = ofono_gprs_create(modem, rd->vendor, | ||
2893 | 362 | get_driver_type(rd, OFONO_ATOM_TYPE_GPRS), | ||
2894 | 363 | &gprs_data); | ||
2895 | 364 | gc = ofono_gprs_context_create(modem, rd->vendor, | ||
2896 | 365 | get_driver_type(rd, OFONO_ATOM_TYPE_GPRS_CONTEXT), | ||
2897 | 366 | &inet_ctx); | ||
2898 | 244 | 367 | ||
2899 | 245 | if (gc) { | 368 | if (gc) { |
2900 | 246 | ofono_gprs_context_set_type(gc, | 369 | ofono_gprs_context_set_type(gc, |
2901 | @@ -248,69 +371,93 @@ | |||
2902 | 248 | ofono_gprs_add_context(gprs, gc); | 371 | ofono_gprs_add_context(gprs, gc); |
2903 | 249 | } | 372 | } |
2904 | 250 | 373 | ||
2906 | 251 | gc = ofono_gprs_context_create(modem, rd->vendor, RILMODEM, &mms_ctx); | 374 | gc = ofono_gprs_context_create(modem, rd->vendor, |
2907 | 375 | get_driver_type(rd, OFONO_ATOM_TYPE_GPRS_CONTEXT), | ||
2908 | 376 | &mms_ctx); | ||
2909 | 252 | 377 | ||
2910 | 253 | if (gc) { | 378 | if (gc) { |
2911 | 254 | ofono_gprs_context_set_type(gc, | 379 | ofono_gprs_context_set_type(gc, |
2912 | 255 | OFONO_GPRS_CONTEXT_TYPE_MMS); | 380 | OFONO_GPRS_CONTEXT_TYPE_MMS); |
2913 | 256 | ofono_gprs_add_context(gprs, gc); | 381 | ofono_gprs_add_context(gprs, gc); |
2914 | 257 | } | 382 | } |
2923 | 258 | 383 | } | |
2924 | 259 | mw = ofono_message_waiting_create(modem); | 384 | |
2925 | 260 | if (mw) | 385 | static void get_radio_caps_cb(struct ril_msg *message, gpointer user_data) |
2926 | 261 | ofono_message_waiting_register(mw); | 386 | { |
2927 | 262 | 387 | struct ofono_modem *modem = user_data; | |
2928 | 263 | ofono_call_forwarding_create(modem, rd->vendor, RILMODEM, rd->ril); | 388 | struct ril_data *rd = ofono_modem_get_data(modem); |
2929 | 264 | 389 | struct reply_radio_capability *caps; | |
2930 | 265 | ofono_phonebook_create(modem, rd->vendor, RILMODEM, modem); | 390 | |
2931 | 391 | if (message->error == RIL_E_SUCCESS) { | ||
2932 | 392 | caps = g_ril_reply_parse_get_radio_capability(rd->ril, message); | ||
2933 | 393 | if (caps != NULL && (caps->rat & RIL_RAF_LTE)) { | ||
2934 | 394 | ofono_modem_set_boolean(modem, | ||
2935 | 395 | MODEM_PROP_LTE_CAPABLE, TRUE); | ||
2936 | 396 | g_free(caps); | ||
2937 | 397 | } | ||
2938 | 398 | } else { | ||
2939 | 399 | ofono_error("%s: RIL error %s", __func__, | ||
2940 | 400 | ril_error_to_string(message->error)); | ||
2941 | 401 | } | ||
2942 | 402 | |||
2943 | 403 | create_post_online_atoms(modem); | ||
2944 | 266 | } | 404 | } |
2945 | 267 | 405 | ||
2946 | 268 | void ril_post_online(struct ofono_modem *modem) | 406 | void ril_post_online(struct ofono_modem *modem) |
2947 | 269 | { | 407 | { |
2948 | 270 | struct ril_data *rd = ofono_modem_get_data(modem); | 408 | struct ril_data *rd = ofono_modem_get_data(modem); |
2954 | 271 | 409 | ofono_bool_t lte_cap; | |
2955 | 272 | ofono_netreg_create(modem, rd->vendor, RILMODEM, rd->ril); | 410 | |
2956 | 273 | ofono_ussd_create(modem, rd->vendor, RILMODEM, rd->ril); | 411 | /* Radio ON -> we can ask for capabilities */ |
2957 | 274 | ofono_call_settings_create(modem, rd->vendor, RILMODEM, rd->ril); | 412 | if (g_ril_get_version(rd->ril) >= 11) { |
2958 | 275 | ofono_call_barring_create(modem, rd->vendor, RILMODEM, rd->ril); | 413 | if (g_ril_send(rd->ril, RIL_REQUEST_GET_RADIO_CAPABILITY, NULL, |
2959 | 414 | get_radio_caps_cb, modem, NULL)) | ||
2960 | 415 | return; | ||
2961 | 416 | |||
2962 | 417 | ofono_error("%s: error sending GET_RADIO_CAPABILITY", __func__); | ||
2963 | 418 | } | ||
2964 | 419 | |||
2965 | 420 | lte_cap = getenv("OFONO_RIL_RAT_LTE") ? TRUE : FALSE; | ||
2966 | 421 | ofono_modem_set_boolean(modem, MODEM_PROP_LTE_CAPABLE, lte_cap); | ||
2967 | 422 | |||
2968 | 423 | create_post_online_atoms(modem); | ||
2969 | 276 | } | 424 | } |
2970 | 277 | 425 | ||
2971 | 278 | static void ril_set_online_cb(struct ril_msg *message, gpointer user_data) | 426 | static void ril_set_online_cb(struct ril_msg *message, gpointer user_data) |
2972 | 279 | { | 427 | { |
2973 | 428 | struct ril_data *rd = user_data; | ||
2974 | 429 | |||
2975 | 430 | if (message != NULL && message->error == RIL_E_SUCCESS) { | ||
2976 | 431 | g_ril_print_response_no_args(rd->ril, message); | ||
2977 | 432 | |||
2978 | 433 | /* | ||
2979 | 434 | * Wait for radio state change event now, as that is the real | ||
2980 | 435 | * moment when radio state changes. | ||
2981 | 436 | */ | ||
2982 | 437 | } else { | ||
2983 | 438 | ofono_modem_online_cb_t cb = rd->set_online_cbd->cb; | ||
2984 | 439 | |||
2985 | 440 | ofono_error("%s: set_online: %d failed", __func__, | ||
2986 | 441 | rd->ofono_online); | ||
2987 | 442 | CALLBACK_WITH_FAILURE(cb, rd->set_online_cbd->data); | ||
2988 | 443 | |||
2989 | 444 | g_free(rd->set_online_cbd); | ||
2990 | 445 | rd->set_online_cbd = NULL; | ||
2991 | 446 | } | ||
2992 | 447 | } | ||
2993 | 448 | |||
2994 | 449 | static gboolean set_online_done_cb(gpointer user_data) | ||
2995 | 450 | { | ||
2996 | 280 | struct cb_data *cbd = user_data; | 451 | struct cb_data *cbd = user_data; |
2997 | 281 | struct ril_data *rd = cbd->user; | 452 | struct ril_data *rd = cbd->user; |
2998 | 282 | ofono_modem_online_cb_t cb = cbd->cb; | 453 | ofono_modem_online_cb_t cb = cbd->cb; |
2999 | 283 | 454 | ||
3012 | 284 | if (message != NULL && message->error == RIL_E_SUCCESS) { | 455 | DBG("%s: set_online OK: rd->ofono_online: %d", |
3013 | 285 | g_ril_print_response_no_args(rd->ril, message); | 456 | __func__, rd->ofono_online); |
3014 | 286 | 457 | CALLBACK_WITH_SUCCESS(cb, cbd->data); | |
3003 | 287 | DBG("%s: set_online OK: rd->ofono_online: %d", __func__, | ||
3004 | 288 | rd->ofono_online); | ||
3005 | 289 | CALLBACK_WITH_SUCCESS(cb, cbd->data); | ||
3006 | 290 | } else { | ||
3007 | 291 | ofono_error("%s: set_online: %d failed", __func__, | ||
3008 | 292 | rd->ofono_online); | ||
3009 | 293 | CALLBACK_WITH_FAILURE(cb, cbd->data); | ||
3010 | 294 | } | ||
3011 | 295 | |||
3015 | 296 | g_free(cbd); | 458 | g_free(cbd); |
3033 | 297 | } | 459 | |
3034 | 298 | 460 | return FALSE; | |
3018 | 299 | static void ril_send_power(struct ril_data *rd, ofono_bool_t online, | ||
3019 | 300 | GRilResponseFunc func, | ||
3020 | 301 | gpointer user_data) | ||
3021 | 302 | { | ||
3022 | 303 | struct parcel rilp; | ||
3023 | 304 | |||
3024 | 305 | DBG("(online = 1, offline = 0)): %i", online); | ||
3025 | 306 | |||
3026 | 307 | g_ril_request_power(rd->ril, (const gboolean) online, &rilp); | ||
3027 | 308 | |||
3028 | 309 | if (g_ril_send(rd->ril, RIL_REQUEST_RADIO_POWER, &rilp, | ||
3029 | 310 | func, user_data, NULL) == 0 && func != NULL) { | ||
3030 | 311 | |||
3031 | 312 | func(NULL, user_data); | ||
3032 | 313 | } | ||
3035 | 314 | } | 461 | } |
3036 | 315 | 462 | ||
3037 | 316 | void ril_set_online(struct ofono_modem *modem, ofono_bool_t online, | 463 | void ril_set_online(struct ofono_modem *modem, ofono_bool_t online, |
3038 | @@ -323,20 +470,13 @@ | |||
3039 | 323 | 470 | ||
3040 | 324 | DBG("setting rd->ofono_online to: %d", online); | 471 | DBG("setting rd->ofono_online to: %d", online); |
3041 | 325 | 472 | ||
3056 | 326 | ril_send_power(rd, online, ril_set_online_cb, cbd); | 473 | if ((online && rd->radio_state == RADIO_STATE_ON) || |
3057 | 327 | } | 474 | (!online && rd->radio_state == RADIO_STATE_OFF)) { |
3058 | 328 | 475 | g_idle_add(set_online_done_cb, cbd); | |
3059 | 329 | static void ril_set_powered_off_cb(struct ril_msg *message, gpointer user_data) | 476 | } else { |
3060 | 330 | { | 477 | rd->set_online_cbd = cbd; |
3061 | 331 | struct ofono_modem *modem = user_data; | 478 | ril_send_power(rd, online, ril_set_online_cb, rd); |
3062 | 332 | struct ril_data *rd = ofono_modem_get_data(modem); | 479 | } |
3049 | 333 | |||
3050 | 334 | if (message != NULL && message->error == RIL_E_SUCCESS) | ||
3051 | 335 | g_ril_print_response_no_args(rd->ril, message); | ||
3052 | 336 | |||
3053 | 337 | DBG("calling set_powered(TRUE)"); | ||
3054 | 338 | |||
3055 | 339 | ofono_modem_set_powered(modem, TRUE); | ||
3063 | 340 | } | 480 | } |
3064 | 341 | 481 | ||
3065 | 342 | static void ril_connected(struct ril_msg *message, gpointer user_data) | 482 | static void ril_connected(struct ril_msg *message, gpointer user_data) |
3066 | @@ -345,18 +485,21 @@ | |||
3067 | 345 | struct ril_data *rd = ofono_modem_get_data(modem); | 485 | struct ril_data *rd = ofono_modem_get_data(modem); |
3068 | 346 | int version; | 486 | int version; |
3069 | 347 | 487 | ||
3070 | 488 | /* | ||
3071 | 489 | * We will use RIL version to check for presence of some features. The | ||
3072 | 490 | * version is updated in AOSP after major changes. For instance: | ||
3073 | 491 | * | ||
3074 | 492 | * Version 9 -> AOSP 4.4 | ||
3075 | 493 | * Version 10 -> AOSP 5.0.0 | ||
3076 | 494 | * Version 11 -> AOSP 6.0.0 | ||
3077 | 495 | * | ||
3078 | 496 | * Note that all Ubuntu phones are based on BSP >= 4.4. | ||
3079 | 497 | */ | ||
3080 | 348 | version = g_ril_unsol_parse_connected(rd->ril, message); | 498 | version = g_ril_unsol_parse_connected(rd->ril, message); |
3081 | 349 | g_ril_set_version(rd->ril, version); | 499 | g_ril_set_version(rd->ril, version); |
3082 | 350 | 500 | ||
3083 | 351 | ofono_info("[%d,UNSOL]< %s, version %d", g_ril_get_slot(rd->ril), | 501 | ofono_info("[%d,UNSOL]< %s, version %d", g_ril_get_slot(rd->ril), |
3084 | 352 | g_ril_unsol_request_to_string(rd->ril, message->req), version); | 502 | g_ril_unsol_request_to_string(rd->ril, message->req), version); |
3085 | 353 | |||
3086 | 354 | /* TODO: need a disconnect function to restart things! */ | ||
3087 | 355 | rd->connected = TRUE; | ||
3088 | 356 | |||
3089 | 357 | DBG("calling set_powered(FALSE) on connected"); | ||
3090 | 358 | |||
3091 | 359 | ril_send_power(rd, FALSE, ril_set_powered_off_cb, modem); | ||
3092 | 360 | } | 503 | } |
3093 | 361 | 504 | ||
3094 | 362 | static int create_gril(struct ofono_modem *modem) | 505 | static int create_gril(struct ofono_modem *modem) |
3095 | @@ -368,19 +511,28 @@ | |||
3096 | 368 | ofono_info("Using %s as socket for slot %d.", socket, slot_id); | 511 | ofono_info("Using %s as socket for slot %d.", socket, slot_id); |
3097 | 369 | rd->ril = g_ril_new(socket, rd->vendor); | 512 | rd->ril = g_ril_new(socket, rd->vendor); |
3098 | 370 | 513 | ||
3100 | 371 | /* NOTE: Since AT modems open a tty, and then call | 514 | /* |
3101 | 515 | * NOTE: Since AT modems open a tty, and then call | ||
3102 | 372 | * g_at_chat_new(), they're able to return -EIO if | 516 | * g_at_chat_new(), they're able to return -EIO if |
3103 | 373 | * the first fails, and -ENOMEM if the second fails. | 517 | * the first fails, and -ENOMEM if the second fails. |
3104 | 374 | * in our case, we already return -EIO if the ril_new | 518 | * in our case, we already return -EIO if the ril_new |
3105 | 375 | * fails. If this is important, we can create a ril_socket | 519 | * fails. If this is important, we can create a ril_socket |
3106 | 376 | * abstraction... ( probaby not a bad idea ). | 520 | * abstraction... ( probaby not a bad idea ). |
3107 | 377 | */ | 521 | */ |
3108 | 378 | |||
3109 | 379 | if (rd->ril == NULL) { | 522 | if (rd->ril == NULL) { |
3110 | 380 | ofono_error("g_ril_new() failed to create modem!"); | 523 | ofono_error("g_ril_new() failed to create modem!"); |
3111 | 381 | return -EIO; | 524 | return -EIO; |
3112 | 382 | } | 525 | } |
3113 | 526 | |||
3114 | 527 | if (slot_id == MULTISIM_SLOT_0) | ||
3115 | 528 | ril_data_0 = rd; | ||
3116 | 529 | else | ||
3117 | 530 | ril_data_1 = rd; | ||
3118 | 531 | |||
3119 | 383 | g_ril_set_slot(rd->ril, slot_id); | 532 | g_ril_set_slot(rd->ril, slot_id); |
3120 | 533 | g_ril_set_vendor_print_msg_id_funcs(rd->ril, | ||
3121 | 534 | rd->request_id_to_string, | ||
3122 | 535 | rd->unsol_request_to_string); | ||
3123 | 384 | 536 | ||
3124 | 385 | if (getenv("OFONO_RIL_TRACE")) | 537 | if (getenv("OFONO_RIL_TRACE")) |
3125 | 386 | g_ril_set_trace(rd->ril, TRUE); | 538 | g_ril_set_trace(rd->ril, TRUE); |
3126 | 387 | 539 | ||
3127 | === modified file 'plugins/ril.h' | |||
3128 | --- plugins/ril.h 2014-07-14 12:47:48 +0000 | |||
3129 | +++ plugins/ril.h 2016-07-01 17:24:58 +0000 | |||
3130 | @@ -19,7 +19,12 @@ | |||
3131 | 19 | * | 19 | * |
3132 | 20 | */ | 20 | */ |
3133 | 21 | 21 | ||
3135 | 22 | int ril_create(struct ofono_modem *modem, enum ofono_ril_vendor vendor); | 22 | typedef const char *(*ril_get_driver_type_func)(enum ofono_atom_type atom); |
3136 | 23 | |||
3137 | 24 | int ril_create(struct ofono_modem *modem, enum ofono_ril_vendor vendor, | ||
3138 | 25 | GRilMsgIdToStrFunc request_id_to_string, | ||
3139 | 26 | GRilMsgIdToStrFunc unsol_request_to_string, | ||
3140 | 27 | ril_get_driver_type_func get_driver_type); | ||
3141 | 23 | void ril_remove(struct ofono_modem *modem); | 28 | void ril_remove(struct ofono_modem *modem); |
3142 | 24 | int ril_enable(struct ofono_modem *modem); | 29 | int ril_enable(struct ofono_modem *modem); |
3143 | 25 | int ril_disable(struct ofono_modem *modem); | 30 | int ril_disable(struct ofono_modem *modem); |
3144 | @@ -28,3 +33,5 @@ | |||
3145 | 28 | void ril_post_online(struct ofono_modem *modem); | 33 | void ril_post_online(struct ofono_modem *modem); |
3146 | 29 | void ril_set_online(struct ofono_modem *modem, ofono_bool_t online, | 34 | void ril_set_online(struct ofono_modem *modem, ofono_bool_t online, |
3147 | 30 | ofono_modem_online_cb_t callback, void *data); | 35 | ofono_modem_online_cb_t callback, void *data); |
3148 | 36 | |||
3149 | 37 | GRil *ril_get_gril_complement(struct ofono_modem *modem); | ||
3150 | 31 | 38 | ||
3151 | === modified file 'plugins/rildev.c' | |||
3152 | --- plugins/rildev.c 2016-03-09 10:35:25 +0000 | |||
3153 | +++ plugins/rildev.c 2016-07-01 17:24:58 +0000 | |||
3154 | @@ -55,10 +55,14 @@ | |||
3155 | 55 | return -ENODEV; | 55 | return -ENODEV; |
3156 | 56 | } | 56 | } |
3157 | 57 | 57 | ||
3158 | 58 | modem_list = g_slist_prepend(modem_list, modem); | ||
3159 | 59 | |||
3160 | 60 | ofono_modem_set_integer(modem, "Slot", slot); | 58 | ofono_modem_set_integer(modem, "Slot", slot); |
3161 | 61 | 59 | ||
3162 | 60 | /* | ||
3163 | 61 | * We assume all slots of this type belong to a single physical modem | ||
3164 | 62 | * that works in standby mode. | ||
3165 | 63 | */ | ||
3166 | 64 | ofono_modem_set_string(modem, "StandbyGroup", ril_type); | ||
3167 | 65 | |||
3168 | 62 | /* AOSP has socket path "rild", "rild2"..., while others may differ */ | 66 | /* AOSP has socket path "rild", "rild2"..., while others may differ */ |
3169 | 63 | if (slot != 0) | 67 | if (slot != 0) |
3170 | 64 | socket = g_strdup_printf("/dev/socket/rild%d", slot + 1); | 68 | socket = g_strdup_printf("/dev/socket/rild%d", slot + 1); |
3171 | @@ -73,9 +77,12 @@ | |||
3172 | 73 | if (retval != 0) { | 77 | if (retval != 0) { |
3173 | 74 | ofono_error("%s: ofono_modem_register returned: %d", | 78 | ofono_error("%s: ofono_modem_register returned: %d", |
3174 | 75 | __func__, retval); | 79 | __func__, retval); |
3175 | 80 | ofono_modem_remove(modem); | ||
3176 | 76 | return retval; | 81 | return retval; |
3177 | 77 | } | 82 | } |
3178 | 78 | 83 | ||
3179 | 84 | modem_list = g_slist_prepend(modem_list, modem); | ||
3180 | 85 | |||
3181 | 79 | /* | 86 | /* |
3182 | 80 | * kickstart the modem: | 87 | * kickstart the modem: |
3183 | 81 | * causes core modem code to call | 88 | * causes core modem code to call |
3184 | 82 | 89 | ||
3185 | === modified file 'src/gprs.c' | |||
3186 | --- src/gprs.c 2016-04-13 14:35:57 +0000 | |||
3187 | +++ src/gprs.c 2016-07-01 17:24:58 +0000 | |||
3188 | @@ -1824,11 +1824,17 @@ | |||
3189 | 1824 | struct ofono_modem *modem_notif = data; | 1824 | struct ofono_modem *modem_notif = data; |
3190 | 1825 | DBusConnection *conn; | 1825 | DBusConnection *conn; |
3191 | 1826 | const char *path = ofono_modem_get_path(modem); | 1826 | const char *path = ofono_modem_get_path(modem); |
3192 | 1827 | const char *standby_group, *modem_group; | ||
3193 | 1827 | 1828 | ||
3194 | 1828 | if (strcmp(path, ofono_modem_get_path(modem_notif)) == 0) | 1829 | if (strcmp(path, ofono_modem_get_path(modem_notif)) == 0) |
3195 | 1829 | return; | 1830 | return; |
3196 | 1830 | 1831 | ||
3198 | 1831 | if (!ofono_modem_is_standby(modem)) | 1832 | standby_group = ofono_modem_get_string(modem_notif, "StandbyGroup"); |
3199 | 1833 | if (standby_group == NULL) | ||
3200 | 1834 | return; | ||
3201 | 1835 | |||
3202 | 1836 | modem_group = ofono_modem_get_string(modem, "StandbyGroup"); | ||
3203 | 1837 | if (g_strcmp0(standby_group, modem_group) != 0) | ||
3204 | 1832 | return; | 1838 | return; |
3205 | 1833 | 1839 | ||
3206 | 1834 | atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS); | 1840 | atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS); |
3207 | @@ -1984,9 +1990,10 @@ | |||
3208 | 1984 | gprs->settings); | 1990 | gprs->settings); |
3209 | 1985 | } | 1991 | } |
3210 | 1986 | 1992 | ||
3211 | 1987 | gprs_netreg_update(gprs); | ||
3212 | 1988 | |||
3213 | 1989 | notify_powered_change(gprs); | 1993 | notify_powered_change(gprs); |
3214 | 1994 | |||
3215 | 1995 | gprs_netreg_update(gprs); | ||
3216 | 1996 | |||
3217 | 1990 | } else { | 1997 | } else { |
3218 | 1991 | return __ofono_error_invalid_args(msg); | 1998 | return __ofono_error_invalid_args(msg); |
3219 | 1992 | } | 1999 | } |
3220 | 1993 | 2000 | ||
3221 | === modified file 'src/modem.c' | |||
3222 | --- src/modem.c 2015-11-02 09:18:14 +0000 | |||
3223 | +++ src/modem.c 2016-07-01 17:24:58 +0000 | |||
3224 | @@ -2278,11 +2278,3 @@ | |||
3225 | 2278 | out: | 2278 | out: |
3226 | 2279 | modem->emergency--; | 2279 | modem->emergency--; |
3227 | 2280 | } | 2280 | } |
3228 | 2281 | |||
3229 | 2282 | ofono_bool_t ofono_modem_is_standby(struct ofono_modem *modem) | ||
3230 | 2283 | { | ||
3231 | 2284 | if (modem->driver->is_standby == NULL) | ||
3232 | 2285 | return FALSE; | ||
3233 | 2286 | |||
3234 | 2287 | return modem->driver->is_standby(modem); | ||
3235 | 2288 | } | ||
3236 | 2289 | 2281 | ||
3237 | === modified file 'src/voicecall.c' | |||
3238 | --- src/voicecall.c 2016-03-14 08:16:40 +0000 | |||
3239 | +++ src/voicecall.c 2016-07-01 17:24:58 +0000 | |||
3240 | @@ -118,7 +118,7 @@ | |||
3241 | 118 | 118 | ||
3242 | 119 | static const char *default_en_list[] = { "911", "112", NULL }; | 119 | static const char *default_en_list[] = { "911", "112", NULL }; |
3243 | 120 | static const char *default_en_list_no_sim[] = { "119", "118", "999", "110", | 120 | static const char *default_en_list_no_sim[] = { "119", "118", "999", "110", |
3245 | 121 | "08", "000", NULL }; | 121 | "08", "000", "120", "122", NULL }; |
3246 | 122 | 122 | ||
3247 | 123 | static void send_ciev_after_swap_callback(const struct ofono_error *error, | 123 | static void send_ciev_after_swap_callback(const struct ofono_error *error, |
3248 | 124 | void *data); | 124 | void *data); |
3249 | @@ -2504,10 +2504,6 @@ | |||
3250 | 2504 | vc->en_list = g_hash_table_new_full(g_str_hash, g_str_equal, | 2504 | vc->en_list = g_hash_table_new_full(g_str_hash, g_str_equal, |
3251 | 2505 | g_free, NULL); | 2505 | g_free, NULL); |
3252 | 2506 | 2506 | ||
3253 | 2507 | /* Emergency numbers from modem/network */ | ||
3254 | 2508 | if (vc->nw_en_list) | ||
3255 | 2509 | add_to_en_list(vc, vc->nw_en_list); | ||
3256 | 2510 | |||
3257 | 2511 | /* Emergency numbers read from SIM */ | 2507 | /* Emergency numbers read from SIM */ |
3258 | 2512 | if (vc->flags & VOICECALL_FLAG_SIM_ECC_READY) { | 2508 | if (vc->flags & VOICECALL_FLAG_SIM_ECC_READY) { |
3259 | 2513 | GSList *l; | 2509 | GSList *l; |
3260 | @@ -2515,9 +2511,16 @@ | |||
3261 | 2515 | for (l = vc->sim_en_list; l; l = l->next) | 2511 | for (l = vc->sim_en_list; l; l = l->next) |
3262 | 2516 | g_hash_table_insert(vc->en_list, g_strdup(l->data), | 2512 | g_hash_table_insert(vc->en_list, g_strdup(l->data), |
3263 | 2517 | NULL); | 2513 | NULL); |
3265 | 2518 | } else | 2514 | } |
3266 | 2515 | |||
3267 | 2516 | /* add the default emergency number, if there no number from SIM */ | ||
3268 | 2517 | if (g_hash_table_size(vc->en_list) == 0) | ||
3269 | 2519 | add_to_en_list(vc, (char **) default_en_list_no_sim); | 2518 | add_to_en_list(vc, (char **) default_en_list_no_sim); |
3270 | 2520 | 2519 | ||
3271 | 2520 | /* Emergency numbers from modem/network */ | ||
3272 | 2521 | if (vc->nw_en_list) | ||
3273 | 2522 | add_to_en_list(vc, vc->nw_en_list); | ||
3274 | 2523 | |||
3275 | 2521 | /* Default emergency numbers */ | 2524 | /* Default emergency numbers */ |
3276 | 2522 | add_to_en_list(vc, (char **) default_en_list); | 2525 | add_to_en_list(vc, (char **) default_en_list); |
3277 | 2523 | 2526 |
LGTM however I have a few uncertainties - check the questions in comments.