Compare commits

..

169 Commits

Author SHA1 Message Date
Tommi Kenakkala
8bda4032ca Merge pull request #269 from tkenakka/master
[rilmodem] Log ril version
2014-12-12 10:40:53 +02:00
Tommi Kenakkala
b2f4bd7603 [rilmodem] Log ril version 2014-12-12 10:22:11 +02:00
Tommi Kenakkala
1bea99ac56 Merge pull request #267 from jpoutiai/ipv6
Ipv6
2014-12-10 13:46:16 +02:00
Jarko Poutiainen
aab24b3f24 Merge pull request #268 from hedayat/master
Re-enable CBS in n900 plugin and fix CBS related crash in N9
2014-12-09 07:47:42 +02:00
Jarko Poutiainen
65eea56efe [RILMODEM] use glib to split string to array and some style fixes
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-12-08 15:54:55 +02:00
Jarko Poutiainen
8ac7e502b7 [GRIL] use glib to split string to array
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-12-08 15:53:06 +02:00
Hedayat Vatankhah
9e8bdf0d64 [packaging] Fix error in changelog date format preventing mb2 builds 2014-12-08 01:46:41 +03:30
Hedayat Vatankhah
70e99152a3 Fix cbs related n900/isimodem crash
Don't remove cbs data during shutdown sequence in isimodem driver, since
it is already being removed.

[n900] Fix cbs related crash
2014-12-08 01:46:41 +03:30
Hedayat Vatankhah
a90fc92665 Revert "Remove the cbs creation for n900 plugin, this lead to crashes on n9 ofono init."
This reverts commit 804bef98ad.
2014-12-08 01:46:41 +03:30
Jarko Poutiainen
1d23793eb0 Merge pull request #266 from locusf/master
Remove the cbs creation for n900 plugin, this lead to crashes on n9 ofon...
2014-12-01 07:58:33 +02:00
Aleksi Suomalainen
804bef98ad Remove the cbs creation for n900 plugin, this lead to crashes on n9 ofono init.
For the latest release of ofono for Nemo Mobile, the modem fails to initialize
with the isimodem driver enabled. This is due to a segmentation fault occurring
in the flush of the atoms of the modem in cbs_assembly_free function. This
resulted in a segmentation fault when using n900 driver.

[n900] Remove cbs creation.
2014-11-30 16:06:58 +00:00
Jarko Poutiainen
1fdde8fecb [RILMODEM] gprs dual mode support
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-26 14:38:06 +02:00
Jarko Poutiainen
1c484a6d04 [GRIL] in reply parse all datacall settings
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-26 13:55:13 +02:00
Jarko Poutiainen
64e888ef04 [RILMODEM] ipv6 support
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-20 09:54:33 +02:00
Jarko Poutiainen
b33e0061d0 Merge pull request #263 from jpoutiai/sim-fix
[RILMODEM] fix hotswap regression
2014-11-18 15:27:29 +02:00
Jarko Poutiainen
2babf82823 [RILMODEM] fix hotswap regression
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-18 14:10:20 +02:00
Jarko Poutiainen
87a35d5d83 Merge pull request #262 from nemomobile-packages/no-fake
No fake
2014-11-17 15:48:17 +02:00
Jarko Poutiainen
3d264276de [RILMODEM] style fixes
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-17 15:31:51 +02:00
Jarko Poutiainen
d6bd24add3 [RILMODEM] remove gprs state faking
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-11-13 10:33:55 +02:00
Jarko Poutiainen
9624eb9ace [gprs] publish ofono_gprs_get_modem
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-31 14:55:08 +02:00
Jarko Poutiainen
14672319d2 [gprs] implement ofono_gprs_get_modem
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-31 14:54:39 +02:00
Jarko Poutiainen
0d8b576ab6 Merge pull request #261 from jpoutiai/sim-fix
[RILMODEM] query password state and prevent double sim initialisation
2014-10-30 13:59:09 +02:00
Jarko Poutiainen
c16121469b [RILMODEM] query password state and prevent double sim initialisation
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-29 10:04:06 +02:00
Jarko Poutiainen
812f552ace Merge pull request #260 from jpoutiai/vc-delay-nro-storing
[voicecall] src/voicecall.c MO call delay storing number
2014-10-28 10:38:24 +02:00
Jarko Poutiainen
fe52d1dc53 [voicecall] src/voicecall.c MO call delay storing number
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-22 11:43:14 +03:00
Jarko Poutiainen
8be724836e Merge pull request #259 from jpoutiai/gprs
rilmodem gprs fixes
2014-10-22 10:58:42 +03:00
Jarko Poutiainen
8c96a7e091 Merge pull request #258 from jpoutiai/roaming-fix
Roaming fix
2014-10-22 10:13:01 +03:00
Jarko Poutiainen
f9bd555dc0 [RILMODEM] style fix
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-22 09:16:18 +03:00
Jarko Poutiainen
71fd5c148a [RILMODEM] recheck status also in ril_data_probe_reg_cb
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-20 10:29:18 +03:00
Jarko Poutiainen
476e440f47 [RILMODEM] recheck status value before using it
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-20 10:26:54 +03:00
Jarko Poutiainen
35440277d1 [RILMODEM] prevent datacall slipping through when roaming disabled
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-20 09:56:07 +03:00
Jarko Poutiainen
4f67e6743e [RILMODEM]publish get_current_network_status
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-20 09:55:40 +03:00
Jarko Poutiainen
c9ba23ae3d [RILMODEM] get network status from core
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-20 09:50:15 +03:00
Jarko Poutiainen
dcdddee5c5 [RILMODEM] introduce ril_roaming_allowed
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-14 09:31:37 +03:00
Jarko Poutiainen
195c2c6a1e [RILMODEM] prepare ril_roaming_allowed to be published
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-14 09:30:53 +03:00
Jarko Poutiainen
51cf33c206 Merge pull request #257 from jpoutiai/master
[RILMODEM] free before calling g_strdup to avoid mem leak
2014-10-10 11:08:50 +03:00
Jarko Poutiainen
08ddddc8d2 [RILMODEM] free before calling g_strdup to avoid mem leak
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-10-10 10:51:02 +03:00
Tommi Kenakkala
dc5eed9c24 Merge pull request #256 from tkenakka/log-gprs
[rilmodem] Logging improvements to gprs
2014-10-09 15:29:08 +03:00
Tommi Kenakkala
72e656e1fb [rilmodem] Logging improvements to gprs
Rilmodem gprs logic slightly touched to store latest reg status
always to gprs_data struct. Reg status logged only when it changes
instead of always.
2014-10-08 15:26:00 +03:00
Tommi Kenakkala
af1717977d Merge pull request #255 from tkenakka/loggingnetreg
[rilmodem] Logging updates to netreg
2014-09-19 11:48:55 +03:00
Tommi Kenakkala
cb48cfa9c3 [rilmodem] Logging updates to netreg 2014-09-18 08:22:38 +03:00
Tommi Kenakkala
759c0bbde4 Merge pull request #253 from tkenakka/logging2
Minor logging improvements to rilmodem
2014-09-18 08:18:27 +03:00
Tommi Kenakkala
300695d069 Merge pull request #254 from tkenakka/ussdnotifycrash
[rilmodem] Fix ussd notify ofono crash
2014-09-18 08:02:31 +03:00
Tommi Kenakkala
f88c1c3ab2 [rilmodem] Fix ussd notify ofono crash
Fixup e23e6ac
2014-09-18 07:56:09 +03:00
Jarko Poutiainen
7415ef7418 Merge pull request #252 from mkuukkane/fix_ofono_cleanup
[ofono] Fix ofono cleanup
2014-09-17 10:11:18 +03:00
Tommi Kenakkala
887d9cf5d1 [rilmodem] Logging updates to radiosettings 2014-09-16 14:06:05 +03:00
Tommi Kenakkala
6231d5cc1c [rilmodem] Minor logging update to voicecall 2014-09-16 14:06:05 +03:00
Tommi Kenakkala
5b1f978a5c [rilmodem] Minor logging update to ussd 2014-09-16 14:06:05 +03:00
Marko Kuukkanen
1d1b9df844 [ofono] Fix ofono cleanup 2014-09-16 10:14:42 +03:00
Tommi Kenakkala
0adfefa0c4 Merge pull request #250 from tkenakka/gprs
[rilmodem] Gprs fake timer fixes
2014-09-05 12:22:21 +03:00
Tommi Kenakkala
7c8db19341 Merge pull request #249 from jpoutiai/master
[RILMODEM] fix sim mem leak and code cleaning
2014-09-02 13:35:16 +03:00
Jarko Poutiainen
37ec5f9221 [RILMODEM] fix sim mem leak and code cleaning
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-09-02 13:31:45 +03:00
Tommi Kenakkala
d2d6f57b5f [rilmodem] Gprs fake timer fixes
Fixes timer cancelation logic and a mem leak on timer
callback data cleanup.
2014-09-02 13:23:42 +03:00
Tommi Kenakkala
6a272bf700 Merge pull request #248 from tkenakka/leakfixes
Mem leak fixes
2014-09-01 14:15:43 +03:00
Tommi Kenakkala
e1c8e2e2dc [rilmodem] Call fwd mem leak fix
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-09-01 13:10:54 +03:00
Tommi Kenakkala
5fb138dc13 [rilmodem] Nw selection mem leak fix
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-09-01 12:14:48 +03:00
Tommi Kenakkala
e2790ae176 Merge pull request #247 from tkenakka/leak
Fix rilmodem memory leaks
2014-08-29 10:10:01 +03:00
Tommi Kenakkala
516700c84c [rilmodem] Fix supplementary service mem leak
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-08-28 14:32:42 +03:00
Tommi Kenakkala
e23e6aceae [rilmodem] Fix ussd mem leaks
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-08-28 14:31:34 +03:00
Tommi Kenakkala
0532e2a6ea [rilmodem] Fix stk mem leaks 2014-08-28 14:31:11 +03:00
Tommi Kenakkala
ce2f0f3642 Merge pull request #246 from tkenakka/leaksms
[rilmodem] Mem leak fixes to sms sending and receiving
2014-08-27 14:34:52 +03:00
Tommi Kenakkala
0400b250c9 [rilmodem] Mem leak fixes to sms sending and receiving
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-08-27 12:39:37 +03:00
Tommi Kenakkala
bfcad4f346 Merge pull request #245 from tkenakka/master
Minor code cleanup
2014-08-27 09:32:30 +03:00
Tommi Kenakkala
9d49e2cee1 [rilmodem] Updated devinfo comments
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-08-26 11:05:15 +03:00
Tommi Kenakkala
c99e70f97a [rilmodem] Minor phonebook code cleanup
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-08-26 11:05:06 +03:00
Tommi Kenakkala
edc0035d18 Merge pull request #244 from jpoutiai/master
Fix memory leaks in sms and phonebook
2014-08-25 14:19:08 +03:00
Jarko Poutiainen
121f308cdb [RILMODEM] fix memory leak in sms sca query
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-08-25 10:58:26 +03:00
Jarko Poutiainen
2fcf1aee03 [RILMODEM] fix phonebook memory leaks
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-08-25 10:57:08 +03:00
Tommi Kenakkala
a14ebf50e0 Merge pull request #243 from jpoutiai/master
[RILMODEM] return failure to manufacturer and model queries
2014-08-25 10:24:59 +03:00
Jarko Poutiainen
1b0d419355 [RILMODEM] return failure to manufacturer and model queries
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-08-21 09:25:36 +03:00
Tommi Kenakkala
43f444db00 Merge pull request #242 from tigeli/master
[gprs] limit internet interface MTU by 1280
2014-08-14 09:42:10 +03:00
Pasi Sjöholm
1eb6243bc9 [gprs] limit internet interface MTU by 1280 2014-08-14 09:30:46 +03:00
Tommi Kenakkala
6ed50ecab7 Merge pull request #241 from jpoutiai/master
[RILMODEM] PB crash fix
2014-08-08 15:38:05 +03:00
Jarko Poutiainen
17ddc04788 [RILMODEM] PB crash fix add logging
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-08-08 10:26:27 +03:00
Jarko Poutiainen
4fd3c6386a [RILMODEM] PB crash fix
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-08-07 15:13:37 +03:00
Jarko Poutiainen
a069557b27 Merge pull request #240 from monich/data_calls
Fixed a problem with multiple data calls
2014-08-05 12:49:49 +03:00
Tommi Kenakkala
da81a85578 Merge pull request #239 from monich/warnings
Fixed compilation warnings
2014-08-04 15:17:11 +03:00
Slava Monich
79e18f9d77 [ofono] Fixed a problem with multiple data calls
When two contexts were active simultaneously, deactivating one of them
would mark the second one as disconnected although its data call would
actually remain active.
2014-07-21 13:46:49 +03:00
Slava Monich
38f4886a97 Fixed compilation warnings 2014-07-21 13:43:50 +03:00
Tommi Kenakkala
b154268fd9 Merge pull request #238 from tkenakka/merge1.14part
Merge upstream ofono 1.14 changes up to 9bbc986
2014-06-26 16:41:59 +03:00
Tommi Kenakkala
cb3a89a702 Merge remote-tracking branch 'martti/merge1.14' into merge1.14part 2014-06-26 13:58:35 +03:00
Tommi Kenakkala
133d92f265 Merge pull request #236 from special/master
[ofono] Encode SMS as UTF-16 instead of UCS-2
2014-06-26 08:56:29 +03:00
Tommi Kenakkala
ad6fd49dbc Merge pull request #237 from martinjones/cfu_change
[ofono] Fix call forwarding unconditional change signal emission.
Wrong property names signalled for conditional call forwarding types when status of unconditional type changed.
2014-06-24 14:01:06 +03:00
Martin Jones
888e857779 [ofono] Fix call forwarding unconditional change signal emission.
When toggling cfu the change signals for the other types didn't have the
prefix applied.
2014-06-20 02:01:37 +00:00
Tommi Kenakkala
e189cd138b Merge pull request #235 from jpoutiai/sms-on-sim
[RILMODEM] initial support to read and delete sms from sim (class2, voicemail mwi)
2014-06-18 16:21:14 +03:00
John Brooks
6b8b5d29a1 [ofono] Encode SMS as UTF-16 instead of UCS-2
UCS-2 is an older 16-bit encoding compatible with the unicode BMP.
UTF-16 extends UCS-2 to add support for surrogate pairs and the rest of
the unicode set. All valid UCS-2 text is also valid UTF-16 text, and all
UTF-16 text not containing surrogate pairs is valid UCS-2.

We decode incoming SMS as UTF-16 instead of UCS-2 to add support for
these extended characters. We should do the same for encoding outgoing
SMS messages.
2014-06-18 06:04:38 -06:00
Jarko Poutiainen
960ef29014 [RILMODEM] removing unnecessary empty lines and null check
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-06-17 15:14:10 +03:00
Jarko Poutiainen
30f3dd2c53 [RILMODEM] change cb_data_new2 to abort in failure
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-06-17 15:13:49 +03:00
Jarko Poutiainen
feb1126123 [RILMODEM] initial support to read and delete sms from sim
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-06-17 11:57:44 +03:00
Tommi Kenakkala
420651829a Merge pull request #234 from mkuukkane/remove-dundee
Remove dundee from ofono compilation.
2014-06-16 12:32:05 +03:00
Jarko Poutiainen
0835875b65 Merge pull request #233 from tkenakka/netregfix
[rilmodem] Null netreg pointer on netreg remove
2014-06-13 15:00:28 +03:00
Tommi Kenakkala
153599eb70 [rilmodem] Null netreg pointer on netreg remove
Netreg driver has a static copy of the netreg pointer.
Missing NULLing may cause problems on corner cases after
netreg is freed (when core atom is flushed).

Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-06-13 10:52:24 +03:00
Marko Kuukkanen
fafef8bfd3 [ofono] Remove dundee (service) 2014-06-12 10:40:27 +03:00
Jarko Poutiainen
3bce306f6e Merge pull request #231 from jpoutiai/gprs
[RILMODEM] gprs set detach notified only for callback
2014-06-09 10:14:00 +03:00
Tommi Kenakkala
68767f6ea2 Merge pull request #232 from mkuukkane/ussd
[rilmodem] Don't send <CR> with USSD string
2014-06-06 15:05:58 +03:00
Marko Kuukkanen
a3cd7b0898 [rilmodem] Don't send <CR> with USSD string 2014-06-06 15:00:04 +03:00
Jarko Poutiainen
d0364f89cd [RILMODEM] gprs set detach notified only for callback
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-06-05 15:05:58 +03:00
Jarko Poutiainen
9aa8375233 Merge pull request #230 from martinjones/master
[voicecall] Cancel pending DTMF tones before hanging up call.
2014-06-04 12:57:54 +03:00
Martin Jones
77b3adfd60 [voicecall] Cancel pending DTMF tones before hanging up call. 2014-06-04 09:27:43 +00:00
Marko Kuukkanen
b4bb7e72d8 Merge pull request #229 from mkuukkane/transfer
Explicit call transfer rilmodem implementation
2014-06-02 14:23:45 +03:00
Marko Kuukkanen
8e20975660 [rilmodem] Explicit call transfer driver implementation 2014-06-02 08:39:55 +03:00
Marko Kuukkanen
0e8a53bdf0 [test] Add test script for explicit call transfer 2014-06-02 08:38:31 +03:00
Jarko Poutiainen
9a29fdde06 Merge pull request #228 from jpoutiai/master
Refactoring rilmodem gprs implementation
2014-05-30 14:09:37 +03:00
Jarko Poutiainen
269fa3db0e [RILMODEM] fake also roaming
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-27 12:42:56 +03:00
Jarko Poutiainen
64dab08751 [RILMODEM] code review and checkpatch cleaning
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-27 12:39:50 +03:00
Jarko Poutiainen
7a72726d9a [RILMODEM] code review and checkpatch cleaning
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-27 12:39:39 +03:00
Jarko Poutiainen
b6fb89c3a0 [RILMODEM] refactor gprs-context driver
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-26 11:17:34 +03:00
Jarko Poutiainen
d51d858cd6 [RILMODEM] refactor gprs driver
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-26 11:17:15 +03:00
Tommi Kenakkala
24d1be80c5 Merge pull request #227 from tkenakka/logging
[rilmodem] Improve ril.c logging
2014-05-26 09:23:03 +03:00
Tommi Kenakkala
19c2a6fc64 [rilmodem] Improve ril.c logging
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-05-23 23:58:41 +03:00
Martti Piirainen
6e3236b739 Merge pull request #226 from jpoutiai/master
more default logging
2014-05-20 14:21:43 +03:00
Martti Piirainen
22b20efdc4 [test] Port remaining test scripts to Python3 2014-05-20 12:01:32 +03:00
Martti Piirainen
ce1ed053fd [rpm] Make test scripts depend on Python3 2014-05-20 11:22:13 +03:00
Martti Piirainen
e9d562e4a3 Merge branch 'ofono1.14' into merge1.14
Conflicts:
	ofono/test/test-ss-control-cb
	ofono/unit/test-simutil.c
2014-05-20 11:21:19 +03:00
Jarko Poutiainen
e5223ac8af [RILMODEM] add more logging
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-19 10:28:18 +03:00
Jarko Poutiainen
9505b6baf3 [RILMODEM] add more logging
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-19 10:28:04 +03:00
Jarko Poutiainen
4c268731b9 [RILMODEM] add more logging
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-19 10:27:50 +03:00
Martti Piirainen
5b158c3a28 Merge pull request #224 from jpoutiai/master
[RILMODEM] prevent ofono crash when sim removed while reading
2014-05-19 09:51:34 +03:00
Jarko Poutiainen
b319c77bcc [RILMODEM] prevent ofono crash when sim removed while reading
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-05-14 14:08:21 +03:00
Andrew Earl
9bbc98651f handsfree: correct crash on connect of hfp 2014-04-22 13:10:32 -05:00
Denis Kenzior
516165c311 handsfree: Rename driver function
To be more consistent with others in the same file
2014-04-10 10:04:36 -05:00
Denis Kenzior
b37f5e842d handsfree: Simplify logic 2014-04-10 10:04:12 -05:00
Andrew Earl
e7f055385f hfp: Add CNUM query to handsfree interface for subscriber number 2014-04-10 09:52:11 -05:00
Denis Kenzior
8cfcfa4519 handsfree: Rename variable 2014-04-10 09:43:47 -05:00
Denis Kenzior
ca3ae87d0a handsfree: Reflow logic 2014-04-10 09:43:44 -05:00
Denis Kenzior
02138901d3 handsfree: Remove function
No need for one line functions that are only used once
2014-04-10 09:43:41 -05:00
Denis Kenzior
24e87d2580 handsfree: Rename function
No need for the ofono_ prefix here
2014-04-10 09:31:58 -05:00
Denis Kenzior
057c4d788f handsfree: Remove unneeded variable 2014-04-10 09:29:32 -05:00
Denis Kenzior
805c3068be handsfree: Remove unneeded variable i 2014-04-10 09:29:11 -05:00
Denis Kenzior
eb4fd9f5aa handsfree: style fixes for previous commit 2014-04-10 09:25:30 -05:00
Andrew Earl
8327d528a9 hfp: Add subscriber number to handsfree properties 2014-04-10 09:21:23 -05:00
Andrew Earl
7420d327e3 include: Add subscriber number to handsfree API 2014-04-10 09:18:15 -05:00
Andrew Earl
e589094113 doc: Add subscriber number to handsfree-api 2014-04-10 09:17:47 -05:00
Denis Kenzior
ca5b269002 AUTHORS: Mention Jussi's contributions 2014-03-27 09:51:49 -05:00
Denis Kenzior
910ec60927 phonesim: Fixup whitespace 2014-03-27 09:51:49 -05:00
Jussi Pakkanen
5f76525961 phonesim: Add conf file override
OFONO_PHONESIM_CONFIG allows the configuration file location to be
overriden from the default $CONFIGDIR/phonesim.conf (typically /etc)
2014-03-27 09:51:49 -05:00
Claudio Takahasi
6fdcfc309c gdbus: Add g_dbus_proxy_set_property_array
This patch adds a new gdbus utility function to allow setting a property
of fixed, and non-fixed values array.
2014-03-24 14:27:51 -07:00
Denis Kenzior
4585969568 he910: Fix unused variable warning
plugins/he910.c: In function ‘qss_query_cb’:
plugins/he910.c:174:21: error: unused variable ‘data’
[-Werror=unused-variable]
2014-03-20 12:55:20 -05:00
Denis Kenzior
f8819b588b he910: Switch to permissive parser
Seems the CCFC implementation on Telit firmware is not v.250 compliant:
ofonod[445]: Aux: > AT+CCFC=0,2\r
ofonod[445]: Aux: < \r\n\r\n+CCFC:0,7\r\n\r\nOK\r\n
2014-03-19 10:30:10 -05:00
Denis Kenzior
c3f528908d he910: Fixup SIM detection
In certain cases the #QSS notification is never sent, or sent too early.
Make sure that we enable #QSS notification only after the modem has been
set as powered.  Also make sure that we explicitly query #QSS in case we
missed the earlier #QSS notification.
2014-03-19 10:30:05 -05:00
Denis Kenzior
29fefe6450 hfp: Use enum from hfp.h 2014-03-19 10:24:57 -05:00
Denis Kenzior
65e6df8e50 hfp: Fixup variable names 2014-03-19 10:20:28 -05:00
Krzysztof Wilk
8a7b8b0521 hfp: Add CHLD features to drver data 2014-03-19 10:19:53 -05:00
Denis Kenzior
5705a0078e handsfree: Fixup variable names 2014-03-19 10:19:35 -05:00
Krzysztof Wilk
b2b3943717 hfp: extend Features to three way calling and CHLD 2014-03-19 10:15:55 -05:00
Krzysztof Wilk
6b8f46a916 include: Declaration function to set CHLD features 2014-03-19 10:13:15 -05:00
Krzysztof Wilk
2e78ea1830 hfp: Define hfp_ag_chld_feature 2014-03-19 10:12:16 -05:00
Krzysztof Wilk
dafbd0da25 doc: Extend Features property 2014-03-19 10:11:40 -05:00
Denis Kenzior
13ce99e360 AUTHORS: Mention Alfonso's contributions 2014-03-14 12:24:54 -05:00
Alfonso Sanchez-Beato
352e3ebb76 unit: Fix test to use valid EF_PNN
test-simutil was not using EF_PNN files with a valid format.
2014-03-14 12:24:26 -05:00
Alfonso Sanchez-Beato
46de4df677 simutil: Fix EF_PNN access
EF_PNN was not being read properly (see TS 24.008, section 10.5.3.5a,
for network names format), which affected the displayed PLMN name for
some MVNOs. Some modems already read the file and return the right
string: these do not show the problem.
2014-03-14 12:24:26 -05:00
Denis Kenzior
6a96eea978 stktest: Remove some unneeded output 2014-03-14 10:32:32 -05:00
Denis Kenzior
ebe25412a4 test: Make sure test-stk-menu works with python3 2014-03-14 10:32:06 -05:00
Denis Kenzior
c94c4fad54 AUTHORS: Mention Martin's contributions 2014-03-11 19:34:45 -05:00
Martin Pitt
c027ab9fbc test: Convert to Python 3
Change raw_input() to input() and unicode to str. This is *not*
compatible with Python 2. Update the hashbangs to run with Python 3.
2014-03-11 19:34:08 -05:00
Martin Pitt
ad4f90684f test: Move from static gobject bindings to GI
Use GLib gobject-introspection bindings so that we can also use the
scripts with Python 3.
2014-03-11 19:33:16 -05:00
Martin Pitt
5bf5cf8ddd test: Replace obsolete has_key() with "in"
In order to also work with Python 3
2014-03-11 19:33:04 -05:00
Martin Pitt
0393a41e35 test: Make exceptions compatible with Python 3
Use "except Type as var" syntax to work with both Python >= 2.6
and Python 3.
2014-03-11 19:32:46 -05:00
Martin Pitt
0c1fcd2b50 test: Make print calls compatible with Python 3
Turn print calls into print() function calls and avoid using
comma-separated arguments, so that they work and look the same with
both Python 2 and 3.
2014-03-11 19:32:18 -05:00
Denis Kenzior
c54e4763f8 he910: Fix whitespace 2014-03-10 11:53:22 -05:00
Claudio Takahasi
ea2b34eacd gdbus: Add g_dbus_client_set_ready_watch()
This patch adds a new gdbus helper to notify the clients that
GetManagedObjects reply was received and the last proxy has been
informed previously by the proxy_added callback.
2014-03-06 09:36:48 -08:00
Denis Kenzior
472e6650d4 AUTHORS: Mention Tony's contributions 2014-03-05 08:51:06 -06:00
Tony Espy
201d34b0a1 idmap: use UL for bitshift literals
The current bitshift logic in idmap incorrectly uses
the literal 1 for the value to shift in idmap_alloc(),
idmap_take(), and idmap_alloc_next().  This causes the
resulting value to be an int instead of a long, which
results in the wrong bit being set once the number of
bits to shift operand exceeds sizeof(int).  Also
on some platforms, the behavior of the left bitshift
operator is undefined when this overflow occurs.
2014-03-05 08:49:50 -06:00
Luiz Augusto von Dentz
76a7f9014d gdbus: Replace g_timeout_add with g_idle_add
Passing 0 as timeout to g_timeout_add should equivalent to g_idle_add.
2014-02-18 23:13:53 -08:00
Anderson Lizardo
29401d8587 gdbus: Fix incorrect DBusConnection reference counting
Commit abfc2b0dd5c3e33abfdf1a815b16d492c1751c06 attempted to fix a crash
related to improper reference counting, but the main issue was that the
reference was taken only during the function call (which is usually
unnecessary for single thread), but still passed a pointer to
DBusConnection to a function that is called by the mainloop. This left a
window where the DBusConnection can be destroyed.

Fixes this crash on unit/test-gdbus-client:

==32642== Invalid read of size 4
==32642==    at 0x690D0A6: dbus_connection_ref (in
/lib/i386-linux-gnu/libdbus-1.so.3.7.6)
==32642==    by 0x804CEDB: message_dispatch (mainloop.c:73)
==32642==    by 0x684580E: g_timeout_dispatch (gmain.c:4450)
==32642==    by 0x6844A75: g_main_context_dispatch (gmain.c:3065)
==32642==    by 0x6844E14: g_main_context_iterate.isra.23 (gmain.c:3712)
==32642==    by 0x68452FA: g_main_loop_run (gmain.c:3906)
==32642==    by 0x804C7D3: client_connect_disconnect
(test-gdbus-client.c:188)
==32642==    by 0x6868DB2: g_test_run_suite_internal (gtestutils.c:2067)
==32642==    by 0x6868F8D: g_test_run_suite_internal (gtestutils.c:2138)
==32642==    by 0x6869320: g_test_run_suite (gtestutils.c:2189)
==32642==    by 0x686936B: g_test_run (gtestutils.c:1508)
==32642==    by 0x696D4D2: (below main) (libc-start.c:226)
==32642==  Address 0x709c6e4 is 140 bytes inside a block of size 144
free'd
==32642==    at 0x67E806C: free (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==32642==    by 0x692D62E: dbus_free (in
/lib/i386-linux-gnu/libdbus-1.so.3.7.6)
==32642==    by 0x690E1C2: ??? (in
/lib/i386-linux-gnu/libdbus-1.so.3.7.6)
==32642==    by 0x804AAEC: destroy_context (test-gdbus-client.c:104)
==32642==    by 0x6868DB2: g_test_run_suite_internal (gtestutils.c:2067)
==32642==    by 0x6868F8D: g_test_run_suite_internal (gtestutils.c:2138)
==32642==    by 0x6869320: g_test_run_suite (gtestutils.c:2189)
==32642==    by 0x686936B: g_test_run (gtestutils.c:1508)
==32642==    by 0x696D4D2: (below main) (libc-start.c:226)
2014-02-18 23:13:53 -08:00
Anderson Lizardo
90abd44ead gdbus: Fix memory leak
data->conn and data->path must be destroyed before freeing "data".
2014-02-18 23:13:53 -08:00
Slava Monich
278dba2ec8 mbpi: Pop subparser stack after mmsc and mmsproxy 2014-02-07 08:56:44 -06:00
Marcel Holtmann
f83233d295 gatchat: Fix handling of WRITE_SCHEDULER_DEBUG 2014-01-19 16:48:04 -08:00
Slava Monich
c2e58405ee include: Be more const-correct in ofono_dbus_* 2014-01-13 10:19:54 -06:00
144 changed files with 2280 additions and 1186 deletions

View File

@@ -92,3 +92,7 @@ Jesper Larsen <jesper.larsen@ixonos.com>
Slava Monich <slava.monich@jolla.com>
Andrew Earl <andrewx.earl@intel.com>
Krzysztof Wilk <krzysztofx.wilk@intel.com>
Tony Espy <espy@canonical.com>
Martin Pitt <martin.pitt@ubuntu.com>
Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
Jussi Pakkanen <jussi.pakkanen@canonical.com>

View File

@@ -720,6 +720,7 @@ test_scripts = test/backtrace \
test/set-context-property \
test/test-gnss \
test/swap-calls \
test/transfer-call \
test/release-and-answer \
test/release-and-swap \
test/hold-and-answer \

View File

@@ -45,6 +45,12 @@ Properties array{string} Features [readonly]
"voice-recognition"
"attach-voice-tag"
"echo-canceling-and-noise-reduction"
"three-way-calling"
"release-all-held"
"release-specified-active-call"
"private-chat"
"create-multiparty"
"transfer"
boolean InbandRinging [readonly]
@@ -70,3 +76,7 @@ Properties array{string} Features [readonly]
The current charge level of the battery. The value
can be between 0 and 5 respectively.
array{string} SubscriberNumbers [readonly]
List of subscriber numbers provided by the AG.

View File

@@ -49,6 +49,7 @@ static const char *bvra_prefix[] = { "+BVRA:", NULL };
struct hf_data {
GAtChat *chat;
unsigned int ag_features;
unsigned int ag_chld_features;
int battchg_index;
guint register_source;
};
@@ -124,6 +125,87 @@ static void ciev_notify(GAtResult *result, gpointer user_data)
ofono_handsfree_battchg_notify(hf, value);
}
static void cnum_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_handsfree_cnum_query_cb_t cb = cbd->cb;
GAtResultIter iter;
struct ofono_phone_number *list = NULL;
int num = 0;
struct ofono_error error;
decode_at_error(&error, g_at_result_final_response(result));
if (!ok)
goto out;
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+CNUM:"))
num++;
if (num == 0)
goto out;
list = g_new0(struct ofono_phone_number, num);
g_at_result_iter_init(&iter, result);
for (num = 0; g_at_result_iter_next(&iter, "+CNUM:"); ) {
const char *number;
int service;
int type;
if (!g_at_result_iter_skip_next(&iter))
continue;
if (!g_at_result_iter_next_string(&iter, &number))
continue;
if (!g_at_result_iter_next_number(&iter, &type))
continue;
if (!g_at_result_iter_skip_next(&iter))
continue;
if (!g_at_result_iter_next_number(&iter, &service))
continue;
/* We are only interested in Voice services */
if (service != 4)
continue;
strncpy(list[num].number, number,
OFONO_MAX_PHONE_NUMBER_LENGTH);
list[num].number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
list[num].type = type;
DBG("cnum_notify:%s", list[num].number);
num++;
}
out:
cb(&error, num, list, cbd->data);
g_free(list);
}
static void hfp_cnum_query(struct ofono_handsfree *hf,
ofono_handsfree_cnum_query_cb_t cb, void *data)
{
struct hf_data *hd = ofono_handsfree_get_data(hf);
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(hd->chat, "AT+CNUM", NULL,
cnum_query_cb, cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, NULL, data);
}
static gboolean hfp_handsfree_register(gpointer user_data)
{
struct ofono_handsfree *hf = user_data;
@@ -139,6 +221,7 @@ static gboolean hfp_handsfree_register(gpointer user_data)
ofono_handsfree_set_inband_ringing(hf, TRUE);
ofono_handsfree_set_ag_features(hf, hd->ag_features);
ofono_handsfree_set_ag_chld_features(hf, hd->ag_chld_features);
ofono_handsfree_register(hf);
return FALSE;
@@ -154,6 +237,7 @@ static int hfp_handsfree_probe(struct ofono_handsfree *hf,
hd = g_new0(struct hf_data, 1);
hd->chat = g_at_chat_clone(info->chat);
hd->ag_features = info->ag_features;
hd->ag_chld_features = info->ag_mpty_features;
ofono_handsfree_set_data(hf, hd);
@@ -280,6 +364,7 @@ static struct ofono_handsfree_driver driver = {
.name = "hfpmodem",
.probe = hfp_handsfree_probe,
.remove = hfp_handsfree_remove,
.cnum_query = hfp_cnum_query,
.request_phone_number = hfp_request_phone_number,
.voice_recognition = hfp_voice_recognition,
.disable_nrec = hfp_disable_nrec,

View File

@@ -128,19 +128,19 @@ static void chld_cb(gboolean ok, GAtResult *result, gpointer user_data)
while (g_at_result_iter_next_unquoted_string(&iter, &str)) {
if (!strcmp(str, "0"))
ag_mpty_feature |= AG_CHLD_0;
ag_mpty_feature |= HFP_AG_CHLD_0;
else if (!strcmp(str, "1"))
ag_mpty_feature |= AG_CHLD_1;
ag_mpty_feature |= HFP_AG_CHLD_1;
else if (!strcmp(str, "1x"))
ag_mpty_feature |= AG_CHLD_1x;
ag_mpty_feature |= HFP_AG_CHLD_1x;
else if (!strcmp(str, "2"))
ag_mpty_feature |= AG_CHLD_2;
ag_mpty_feature |= HFP_AG_CHLD_2;
else if (!strcmp(str, "2x"))
ag_mpty_feature |= AG_CHLD_2x;
ag_mpty_feature |= HFP_AG_CHLD_2x;
else if (!strcmp(str, "3"))
ag_mpty_feature |= AG_CHLD_3;
ag_mpty_feature |= HFP_AG_CHLD_3;
else if (!strcmp(str, "4"))
ag_mpty_feature |= AG_CHLD_4;
ag_mpty_feature |= HFP_AG_CHLD_4;
}
if (!g_at_result_iter_close_list(&iter))

View File

@@ -19,14 +19,6 @@
*
*/
#define AG_CHLD_0 0x01
#define AG_CHLD_1 0x02
#define AG_CHLD_1x 0x04
#define AG_CHLD_2 0x08
#define AG_CHLD_2x 0x10
#define AG_CHLD_3 0x20
#define AG_CHLD_4 0x40
enum hfp_indicator {
HFP_INDICATOR_SERVICE = 0,
HFP_INDICATOR_CALL,

View File

@@ -37,6 +37,7 @@
#include <ofono/voicecall.h>
#include "common.h"
#include "hfp.h"
#include "hfpmodem.h"
#include "slc.h"
@@ -447,7 +448,7 @@ static void hfp_hold_all_active(struct ofono_voicecall *vc,
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
if (vd->ag_mpty_features & AG_CHLD_2) {
if (vd->ag_mpty_features & HFP_AG_CHLD_2) {
hfp_template("AT+CHLD=2", vc, generic_cb, 0, cb, data);
return;
}
@@ -461,7 +462,7 @@ static void hfp_release_all_held(struct ofono_voicecall *vc,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
unsigned int held_status = 1 << CALL_STATUS_HELD;
if (vd->ag_mpty_features & AG_CHLD_0) {
if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
hfp_template("AT+CHLD=0", vc, generic_cb, held_status,
cb, data);
return;
@@ -476,7 +477,7 @@ static void hfp_set_udub(struct ofono_voicecall *vc,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
unsigned int incoming_or_waiting = 1 << CALL_STATUS_WAITING;
if (vd->ag_mpty_features & AG_CHLD_0) {
if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
hfp_template("AT+CHLD=0", vc, generic_cb, incoming_or_waiting,
cb, data);
return;
@@ -528,7 +529,7 @@ static void hfp_release_all_active(struct ofono_voicecall *vc,
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
if (vd->ag_mpty_features & AG_CHLD_1) {
if (vd->ag_mpty_features & HFP_AG_CHLD_1) {
hfp_template("AT+CHLD=1", vc, release_all_active_cb, 0x1, cb,
data);
return;
@@ -559,7 +560,7 @@ static void hfp_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = NULL;
char buf[32];
if (!(vd->ag_mpty_features & AG_CHLD_1x))
if (!(vd->ag_mpty_features & HFP_AG_CHLD_1x))
goto error;
req = g_try_new0(struct release_id_req, 1);
@@ -590,7 +591,7 @@ static void hfp_private_chat(struct ofono_voicecall *vc, int id,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
char buf[32];
if (vd->ag_mpty_features & AG_CHLD_2x) {
if (vd->ag_mpty_features & HFP_AG_CHLD_2x) {
snprintf(buf, sizeof(buf), "AT+CHLD=2%d", id);
hfp_template(buf, vc, generic_cb, 0, cb, data);
@@ -606,7 +607,7 @@ static void hfp_create_multiparty(struct ofono_voicecall *vc,
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
if (vd->ag_mpty_features & AG_CHLD_3) {
if (vd->ag_mpty_features & HFP_AG_CHLD_3) {
hfp_template("AT+CHLD=3", vc, generic_cb, 0, cb, data);
return;
@@ -625,7 +626,7 @@ static void hfp_transfer(struct ofono_voicecall *vc,
*/
unsigned int transfer = 0x1 | 0x2 | 0x4 | 0x8;
if (vd->ag_mpty_features & AG_CHLD_4) {
if (vd->ag_mpty_features & HFP_AG_CHLD_4) {
hfp_template("AT+CHLD=4", vc, generic_cb, transfer, cb, data);
return;

View File

@@ -134,7 +134,9 @@ static void routing_resp_cb(const GIsiMessage *msg, void *data)
struct cbs_data *cd = ofono_cbs_get_data(cbs);
if (!check_resp(msg, SMS_GSM_CB_ROUTING_RESP)) {
ofono_cbs_remove(cbs);
/* on shutdown, cbs is already being removed */
if (g_isi_msg_error(msg) != -ESHUTDOWN)
ofono_cbs_remove(cbs);
return;
}

View File

@@ -214,7 +214,7 @@ static void ril_query_cb(struct ril_msg *message, gpointer user_data)
nmbr_of_resps);
for (i = 0; i < nmbr_of_resps; i++) {
const char *str;
char *str = NULL;
list[i].status = parcel_r_int32(&rilp);
@@ -225,16 +225,14 @@ static void ril_query_cb(struct ril_msg *message, gpointer user_data)
list[i].phone_number.type = parcel_r_int32(&rilp);
str = parcel_r_string(&rilp);
if (str) {
strncpy(list[i].phone_number.number,
str,
OFONO_MAX_PHONE_NUMBER_LENGTH);
list[i].phone_number.number[
OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
g_free(str);
}
list[i].time = parcel_r_int32(&rilp);
}

View File

@@ -42,9 +42,8 @@
#include "rilmodem.h"
/*
* TODO: The functions in this file are stubbed out, and
* will need to be re-worked to talk to the /gril layer
* in order to get real values from RILD.
* TODO: No public RIL api to query manufacturer or model.
* Check where to get, could /system/build.prop be updated to have good values?
*/
guint timer_id;
@@ -52,30 +51,14 @@ static void ril_query_manufacturer(struct ofono_devinfo *info,
ofono_devinfo_query_cb_t cb,
void *data)
{
const char *attr = "Fake Manufacturer";
struct cb_data *cbd = cb_data_new(cb, data);
struct ofono_error error;
decode_ril_error(&error, "OK");
cb(&error, attr, cbd->data);
/* Note: this will need to change if cbd passed to gril layer */
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, "", data);
}
static void ril_query_model(struct ofono_devinfo *info,
ofono_devinfo_query_cb_t cb,
void *data)
{
const char *attr = "Fake Modem Model";
struct cb_data *cbd = cb_data_new(cb, data);
struct ofono_error error;
decode_ril_error(&error, "OK");
cb(&error, attr, cbd->data);
/* Note: this will need to change if cbd passed to gril layer */
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, "", data);
}
static void query_revision_cb(struct ril_msg *message, gpointer user_data)

View File

@@ -43,8 +43,16 @@
#include "grilrequest.h"
#include "grilunsol.h"
#include "common.h"
#include "rilmodem.h"
enum data_call_state {
DATA_CALL_INACTIVE,
DATA_CALL_LINK_DOWN,
DATA_CALL_ACTIVE,
};
enum state {
STATE_IDLE,
STATE_ENABLING,
@@ -60,22 +68,112 @@ struct gprs_context_data {
guint regid;
};
static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
unsigned int id,
ofono_gprs_context_cb_t cb, void *data);
static void set_context_disconnected(struct gprs_context_data *gcd)
{
DBG("");
gcd->active_ctx_cid = -1;
gcd->active_rild_cid = -1;
gcd->state = STATE_IDLE;
}
static void disconnect_context(struct ofono_gprs_context *gc)
static void ril_gprs_split_ip_by_protocol(char **ip_array,
char ***split_ip_addr,
char ***split_ipv6_addr,
char **ip_addr)
{
ril_gprs_context_deactivate_primary(gc, 0, NULL, NULL);
const char ipv6_delimiter = ':';
const char ip_delimiter = '.';
int i;
*split_ipv6_addr = *split_ip_addr = NULL;
for (i=0; i< g_strv_length(ip_array); i++) {
if (strchr(ip_array[i], ipv6_delimiter)) {
if (*split_ipv6_addr == NULL) {
*split_ipv6_addr = g_strsplit(
ip_array[i], "/",2);
}
} else if (strchr(ip_array[i], ip_delimiter)) {
if (*split_ip_addr == NULL) {
*ip_addr = g_strdup(ip_array[i]);
*split_ip_addr = g_strsplit(
ip_array[i], "/", 2);
}
}
}
}
static void ril_gprs_split_gw_by_protocol(char **gw_array, char **ip_gw,
char **ipv6_gw)
{
const char ipv6_delimiter = ':';
const char ip_delimiter = '.';
int i;
*ip_gw = *ipv6_gw = NULL;
for (i=0; i< g_strv_length(gw_array); i++) {
if (strchr(gw_array[i],ipv6_delimiter)) {
if (*ipv6_gw == NULL) {
*ipv6_gw = g_strdup(gw_array[0]);
}
} else if (strchr(gw_array[i],ip_delimiter)) {
if (*ip_gw == NULL)
*ip_gw = g_strdup(gw_array[0]);
}
}
}
static void ril_gprs_split_dns_by_protocol(char **dns_array, char ***dns_addr,
char ***dns_ipv6_addr)
{
const char ipv6_delimiter = ':';
const char ip_delimiter = '.';
const char dns_delimiter = ',';
char *temp = NULL;
char *temp1 = NULL;
char *dnsip = NULL;
char *dnsipv6 = NULL;
int i, dnsip_len, dnsipv6_len;
dnsip_len = dnsipv6_len = 0;
for (i=0; i< g_strv_length(dns_array); i++) {
if (strchr(dns_array[i],ipv6_delimiter)) {
if (dnsipv6 == NULL) {
dnsipv6 = g_strdup(dns_array[i]);
} else {
temp = g_strconcat(dnsipv6, ",", NULL);
g_free(dnsipv6);
temp1 = g_strconcat(temp, dns_array[i], NULL);
g_free(temp);
dnsipv6 = temp1;
}
dnsipv6_len++;
} else if (strchr(dns_array[i],ip_delimiter)) {
if (dnsip == NULL) {
dnsip = g_strdup(dns_array[i]);
} else {
temp = g_strconcat(dnsip, ",", NULL);
g_free(dnsip);
temp1 = g_strconcat(temp, dns_array[i], NULL);
g_free(temp);
dnsip = temp1;
}
dnsip_len++;
}
}
if (dnsip){
if (strchr(dnsip,dns_delimiter))
*dns_addr = g_strsplit(dnsip, ",", dnsip_len);
}
if (dnsipv6) {
if (strchr(dnsipv6,dns_delimiter))
*dns_ipv6_addr = g_strsplit(dnsipv6, ",", dnsipv6_len);
}
g_free(dnsip);
g_free(dnsipv6);
}
static void ril_gprs_context_call_list_changed(struct ril_msg *message,
@@ -85,7 +183,6 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct data_call *call = NULL;
struct unsol_data_call_list *unsol;
gboolean active_cid_found = FALSE;
gboolean disconnect = FALSE;
GSList *iterator = NULL;
struct ofono_error error;
@@ -100,19 +197,133 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
for (iterator = unsol->call_list; iterator; iterator = iterator->next) {
call = (struct data_call *) iterator->data;
if (call->cid == gcd->active_rild_cid) {
active_cid_found = TRUE;
/*
* Every context receives notifications about all data calls
* but should only handle its own.
*/
if (call->cid != gcd->active_rild_cid)
continue;
if (call->active == 0) {
disconnect = TRUE;
ofono_gprs_context_deactivated(gc, gcd->active_ctx_cid);
if (call->status != 0)
ofono_info("data call status:%d", call->status);
if (call->active == DATA_CALL_INACTIVE) {
disconnect = TRUE;
ofono_gprs_context_deactivated(gc, gcd->active_ctx_cid);
break;
}
if (call->active == DATA_CALL_ACTIVE) {
int protocol = -1;
if (call->type)
protocol = ril_protocol_string_to_ofono_protocol(call->type);
if (call->ifname)
ofono_gprs_context_set_interface(gc,
call->ifname);
if (call->addresses) {
char **split_ip_addr = NULL;
char **ip_array = NULL;
char **split_ipv6_addr = NULL;
char *ip_addr = NULL;
/*addresses to an array*/
ip_array = g_strsplit(call->addresses, " ",-1);
/*pick 1 address of each protocol*/
ril_gprs_split_ip_by_protocol(ip_array,
&split_ip_addr,
&split_ipv6_addr,
&ip_addr);
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IPV6)
&& split_ipv6_addr != NULL){
ofono_gprs_context_set_ipv6_address(gc,
split_ipv6_addr[0]);
}
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IP)
&& split_ip_addr != NULL) {
ofono_gprs_context_set_ipv4_netmask(gc,
ril_util_get_netmask(ip_addr));
ofono_gprs_context_set_ipv4_address(gc,
split_ip_addr[0], TRUE);
}
g_strfreev(split_ip_addr);
g_strfreev(split_ipv6_addr);
g_strfreev(ip_array);
g_free(ip_addr);
}
if (call->gateways) {
char **gw_array = NULL;
char *ip_gw = NULL;
char *ipv6_gw = NULL;
/*addresses to an array*/
gw_array = g_strsplit(call->gateways, " ", -1);
/*pick 1 gw for each protocol*/
ril_gprs_split_gw_by_protocol(gw_array, &ip_gw,
&ipv6_gw);
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IPV6)
&& ipv6_gw != NULL)
ofono_gprs_context_set_ipv6_gateway(gc,
ipv6_gw);
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IP)
&& ip_gw != NULL)
ofono_gprs_context_set_ipv4_gateway(gc,
ip_gw);
g_strfreev(gw_array);
g_free(ip_gw);
g_free(ipv6_gw);
}
if (call->dnses) {
char **dns_array = NULL;
char **dns_ip = NULL;
char **dns_ipv6 = NULL;
/*addresses to an array*/
dns_array = g_strsplit(call->dnses, " ", -1);
/*split based on protocol*/
ril_gprs_split_dns_by_protocol(dns_array,
&dns_ip,
&dns_ipv6);
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IPV6)
&& dns_ipv6 != NULL)
ofono_gprs_context_set_ipv6_dns_servers(
gc, (const char **) dns_ipv6);
if ((protocol == OFONO_GPRS_PROTO_IPV4V6 ||
protocol == OFONO_GPRS_PROTO_IP)
&& dns_ip != NULL)
ofono_gprs_context_set_ipv4_dns_servers(
gc, (const char**)dns_ip);
g_strfreev(dns_ip);
g_strfreev(dns_ipv6);
g_strfreev(dns_array);
}
break;
}
}
if (disconnect || active_cid_found == FALSE) {
if (disconnect) {
ofono_error("Clearing active context");
set_context_disconnected(gcd);
}
@@ -130,6 +341,12 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
struct ofono_error error;
struct reply_setup_data_call *reply = NULL;
char **split_ip_addr = NULL;
char **split_ipv6_addr = NULL;
char* ip_addr = NULL;
char* ip_gw = NULL;
char* ipv6_gw = NULL;
char** dns_addr = NULL;
char** dns_ipv6_addr = NULL;
ofono_info("setting up data call");
@@ -149,10 +366,7 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
gcd->active_rild_cid = reply->cid;
if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
if (gcd->active_rild_cid != -1) {
ofono_error("no active context. disconnect");
disconnect_context(gc);
}
ofono_error("no active context. disconnect");
goto error;
}
@@ -164,24 +378,16 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
error.type = OFONO_ERROR_TYPE_FAILURE;
error.error = reply->status;
set_context_disconnected(gcd);
goto error;
}
/*
* TODO: consier moving this into parse_data_reply
*
* Note - the address may optionally include a prefix size
* ( Eg. "/30" ). As this confuses NetworkManager, we
* explicitly strip any prefix after calculating the netmask.
*/
split_ip_addr = g_strsplit(reply->ip_addrs[0], "/", 2);
/*check the ip address protocol*/
ril_gprs_split_ip_by_protocol(reply->ip_addrs, &split_ip_addr,
&split_ipv6_addr, &ip_addr);
/* TODO: see note above re: invalid messages... */
if (split_ip_addr[0] == NULL) {
ofono_error("%s: invalid IP address field returned: %s",
__func__,
reply->ip_addrs[0]);
if (split_ip_addr == NULL && split_ipv6_addr == NULL) {
ofono_error("%s: No IP address returned",
__func__);
error.type = OFONO_ERROR_TYPE_FAILURE;
error.error = EINVAL;
@@ -194,33 +400,55 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
ofono_gprs_context_set_interface(gc, reply->ifname);
ril_gprs_split_gw_by_protocol(reply->gateways, &ip_gw, &ipv6_gw);
ril_gprs_split_dns_by_protocol(reply->dns_addresses, &dns_addr,
&dns_ipv6_addr);
/* TODO:
* RILD can return multiple addresses; oFono only supports
* setting a single IPv4 address. At this time, we only
* use the first address. It's possible that a RIL may
* just specify the end-points of the point-to-point
* connection, in which case this code will need to
* changed to handle such a device.
* RILD can return multiple addresses; oFono only supports setting
* a single IPv4 and single IPV6 address. At this time, we only use
* the first address. It's possible that a RIL may just specify
* the end-points of the point-to-point connection, in which case this
* code will need to changed to handle such a device.
*/
ofono_gprs_context_set_ipv4_netmask(gc,
ril_util_get_netmask(reply->ip_addrs[0]));
ofono_gprs_context_set_ipv4_address(gc, split_ip_addr[0], TRUE);
ofono_gprs_context_set_ipv4_gateway(gc, reply->gateways[0]);
if (split_ipv6_addr != NULL &&
(reply->protocol == OFONO_GPRS_PROTO_IPV6 ||
reply->protocol == OFONO_GPRS_PROTO_IPV4V6)) {
ofono_gprs_context_set_ipv4_dns_servers(gc,
(const char **) reply->dns_addresses);
ofono_gprs_context_set_ipv6_address(gc, split_ipv6_addr[0]);
ofono_gprs_context_set_ipv6_gateway(gc, ipv6_gw);
ofono_gprs_context_set_ipv6_dns_servers(gc,
(const char **) dns_ipv6_addr);
}
if (split_ip_addr != NULL &&
(reply->protocol == OFONO_GPRS_PROTO_IP ||
reply->protocol == OFONO_GPRS_PROTO_IPV4V6)) {
ofono_gprs_context_set_ipv4_netmask(gc,
ril_util_get_netmask(ip_addr));
ofono_gprs_context_set_ipv4_address(gc, split_ip_addr[0], TRUE);
ofono_gprs_context_set_ipv4_gateway(gc, ip_gw);
ofono_gprs_context_set_ipv4_dns_servers(gc,
(const char **) dns_addr);
}
error:
g_ril_reply_free_setup_data_call(reply);
g_strfreev(split_ip_addr);
g_strfreev(split_ipv6_addr);
g_strfreev(dns_addr);
g_strfreev(dns_ipv6_addr);
g_free(ip_addr);
g_free(ip_gw);
g_free(ipv6_gw);
cb(&error, cbd->data);
}
static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
const struct ofono_gprs_primary_context *ctx,
ofono_gprs_context_cb_t cb, void *data)
const struct ofono_gprs_primary_context *ctx,
ofono_gprs_context_cb_t cb, void *data)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
@@ -229,9 +457,19 @@ static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
struct ofono_error error;
int reqid = RIL_REQUEST_SETUP_DATA_CALL;
int ret = 0;
int netreg_status;
int roaming = NETWORK_REGISTRATION_STATUS_ROAMING;
ofono_info("Activating context: %d", ctx->cid);
/* Let's make sure that we aren't connecting when roaming not allowed */
netreg_status = get_current_network_status();
if (netreg_status == roaming) {
if (!ril_roaming_allowed() && (roaming
== check_if_really_roaming(netreg_status)))
goto exit;
}
cbd->user = gc;
/* TODO: implement radio technology selection. */
@@ -245,6 +483,7 @@ static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
request.username = g_strdup(ctx->username);
request.password = g_strdup(ctx->password);
request.auth_type = RIL_AUTH_BOTH;
request.protocol = ctx->proto;
if (g_ril_request_setup_data_call(gcd->ril,
@@ -273,7 +512,7 @@ error:
g_free(request.apn);
g_free(request.username);
g_free(request.password);
exit:
if (ret <= 0) {
ofono_error("Send RIL_REQUEST_SETUP_DATA_CALL failed.");
@@ -284,7 +523,8 @@ error:
}
}
static void ril_deactivate_data_call_cb(struct ril_msg *message, gpointer user_data)
static void ril_deactivate_data_call_cb(struct ril_msg *message,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_gprs_context_cb_t cb = cbd->cb;
@@ -322,7 +562,8 @@ static void ril_deactivate_data_call_cb(struct ril_msg *message, gpointer user_d
static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
unsigned int id,
ofono_gprs_context_cb_t cb, void *data)
ofono_gprs_context_cb_t cb,
void *data)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = NULL;
@@ -375,6 +616,7 @@ error:
if (ret <= 0) {
ofono_error("Send RIL_REQUEST_DEACTIVATE_DATA_CALL failed.");
g_free(cbd);
if (cb)
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -402,7 +644,6 @@ static int ril_gprs_context_probe(struct ofono_gprs_context *gc,
set_context_disconnected(gcd);
ofono_gprs_context_set_data(gc, gcd);
gcd->regid = -1;
gcd->regid = g_ril_register(gcd->ril, RIL_UNSOL_DATA_CALL_LIST_CHANGED,
ril_gprs_context_call_list_changed, gc);
@@ -415,14 +656,13 @@ static void ril_gprs_context_remove(struct ofono_gprs_context *gc)
DBG("");
if (gcd->state != STATE_IDLE) {
if (gcd->state != STATE_IDLE)
ril_gprs_context_detach_shutdown(gc, 0);
}
ofono_gprs_context_set_data(gc, NULL);
if (gcd->regid != -1)
g_ril_unregister(gcd->ril,gcd->regid);
g_ril_unregister(gcd->ril, gcd->regid);
g_ril_unref(gcd->ril);
g_free(gcd);
@@ -432,9 +672,9 @@ static struct ofono_gprs_context_driver driver = {
.name = RILMODEM,
.probe = ril_gprs_context_probe,
.remove = ril_gprs_context_remove,
.activate_primary = ril_gprs_context_activate_primary,
.deactivate_primary = ril_gprs_context_deactivate_primary,
.detach_shutdown = ril_gprs_context_detach_shutdown,
.activate_primary = ril_gprs_context_activate_primary,
.deactivate_primary = ril_gprs_context_deactivate_primary,
.detach_shutdown = ril_gprs_context_detach_shutdown,
};
void ril_gprs_context_init(void)

View File

@@ -45,6 +45,8 @@
#include "rilmodem.h"
#include <ofono/netreg.h>
#include <ofono/sim.h>
#include "storage.h"
/*
* This module is the ofono_gprs_driver implementation for rilmodem.
@@ -67,12 +69,18 @@ struct gprs_data {
GRil *ril;
gboolean ofono_attached;
int max_cids;
int rild_status;
gboolean notified;
int rild_status; /* Driver Status */
guint registerid;
guint timer_id;
};
/* Following constants are purely to improve readability */
static const int roaming = NETWORK_REGISTRATION_STATUS_ROAMING;
static const int registered = NETWORK_REGISTRATION_STATUS_REGISTERED;
/*if we have called ofono_gprs_register or not*/
static gboolean ofono_registered;
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
ofono_gprs_status_cb_t cb,
void *data);
@@ -81,7 +89,10 @@ static void ril_gprs_state_change(struct ril_msg *message, gpointer user_data)
{
struct ofono_gprs *gprs = user_data;
g_assert(message->req == RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
g_assert(message->req ==
RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
DBG("");
/* We need to notify core always to cover situations when
* connection drops temporarily for example when user is
@@ -97,6 +108,7 @@ static gboolean ril_gprs_set_attached_callback(gpointer user_data)
ofono_gprs_cb_t cb = cbd->cb;
struct ofono_gprs *gprs = cbd->user;
struct gprs_data *gd = ofono_gprs_get_data(gprs);
DBG("");
gd->timer_id = 0;
@@ -133,7 +145,6 @@ static void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached,
cbd->user = gprs;
ril_gprs_registration_status(gprs, NULL, NULL);
/*
* However we cannot respond immediately, since core sets the
* value of driver_attached after calling set_attached and that
@@ -144,6 +155,30 @@ static void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached,
cbd);
}
gboolean ril_roaming_allowed()
{
GError *error;
error = NULL;
GKeyFile *settings;
struct ofono_sim *sim;
sim = get_sim();
const char *imsi = ofono_sim_get_imsi(sim);
settings = storage_open(imsi, "gprs");
gboolean roaming_allowed = g_key_file_get_boolean(settings,
"Settings",
"RoamingAllowed",
&error);
if (error)
g_error_free(error);
storage_close(imsi, "gprs", settings, FALSE);
DBG("roaming_allowed: %d", roaming_allowed);
return roaming_allowed;
}
static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
@@ -151,9 +186,9 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
struct ofono_gprs *gprs = cbd->user;
struct gprs_data *gd = ofono_gprs_get_data(gprs);
struct ofono_error error;
int status, lac, ci, tech;
int lac, ci, tech;
int max_cids = 1;
int id = RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED;
int status = -1;
if (gd && message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
@@ -162,24 +197,22 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
ril_error_to_string(message->error));
decode_ril_error(&error, "FAIL");
error.error = message->error;
status = -1;
goto error;
goto exit;
}
if (ril_util_parse_reg(gd->ril, message, &status,
&lac, &ci, &tech, &max_cids) == FALSE) {
ofono_error("Failure parsing data registration response.");
decode_ril_error(&error, "FAIL");
status = -1;
goto error;
goto exit;
}
if (gd->rild_status == -1) {
ofono_gprs_register(gprs);
if (status > 10)
status = status - 10;
DBG("Starting to listen network status");
gd->registerid = g_ril_register(gd->ril,
id, ril_gprs_state_change, gprs);
if (!ofono_registered) {
ofono_gprs_register(gprs);
ofono_registered = TRUE;
}
if (max_cids > gd->max_cids) {
@@ -188,70 +221,129 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
ofono_gprs_set_cid_range(gprs, 1, max_cids);
}
ofono_info("data registration status is %d", status);
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
if (status == roaming)
status = check_if_really_roaming(status);
if (gd->ofono_attached && !gd->notified) {
if (status == NETWORK_REGISTRATION_STATUS_ROAMING ||
status == NETWORK_REGISTRATION_STATUS_REGISTERED) {
DBG("connection becomes available");
/* Let's minimize logging */
if (status != gd->rild_status)
ofono_info("data reg changes %d (%d), attached %d",
status, gd->rild_status, gd->ofono_attached);
/* Must be attached if registered or roaming */
if ((gd->rild_status != registered) && (gd->rild_status != roaming)) {
if (status == registered)
gd->ofono_attached = TRUE;
else if ((status == roaming) && (ril_roaming_allowed() == TRUE))
gd->ofono_attached = TRUE;
ofono_gprs_status_notify(gprs, status);
gd->notified = TRUE;
gd->rild_status = status;
}
goto error;
}
if (gd->ofono_attached &&
status != NETWORK_REGISTRATION_STATUS_SEARCHING) {
DBG("ofono attached, start faking responses");
if (status != NETWORK_REGISTRATION_STATUS_ROAMING) {
if (!ofono_modem_get_online(ofono_gprs_get_modem(gprs)))
gd->ofono_attached = FALSE;
/* if unsolicitated and no state change let's not notify core */
if ((status == gd->rild_status) && gd->ofono_attached)
goto cb_out;
if (!gd->ofono_attached) {
if (!cb) {
if (status == roaming) {
if (ril_roaming_allowed() == FALSE)
ofono_gprs_detached_notify(gprs);
/*
* This prevents core ending
* into eternal loop with driver
*/
decode_ril_error(&error, "FAIL");
}
ofono_gprs_status_notify(gprs, status);
} else {
/*
* Only core can succesfully drop the connection
* If we drop the connection from here it leads
* to race situation where core asks context
* deactivation and at the same time we get
* Registered notification from modem.
*/
status = NETWORK_REGISTRATION_STATUS_REGISTERED;
* This prevents core ending
* into eternal loop with driver
*/
decode_ril_error(&error, "FAIL");
}
if (gd->registerid != -1)
g_ril_unregister(gd->ril, gd->registerid);
gd->registerid = -1;
} else {
/*
* Client is not approving succesful result
* This covers the situation when context is
* active in roaming situation and client closes
* it directly by calling RoamingAllowed in API
*/
DBG("data registration status is %d", status);
if (status != NETWORK_REGISTRATION_STATUS_SEARCHING) {
DBG("ofono not attached, notify core");
status = NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
ofono_gprs_detached_notify(gprs);
gd->notified = FALSE;
gd->ofono_attached = FALSE;
} else if (gd->notified && check_if_ok_to_attach()) {
DBG("hide the searching state");
status = NETWORK_REGISTRATION_STATUS_REGISTERED;
ofono_gprs_status_notify(gprs, status);
gd->ofono_attached = TRUE;
}
gd->rild_status = status;
goto exit;
}
if (!cb)
ofono_gprs_status_notify(gprs, status);
gd->rild_status = status;
error:
exit:
DBG("data reg status %d, rild_status %d, attached %d",
status, gd->rild_status, gd->ofono_attached);
cb_out:
if (cb)
cb(&error, status, cbd->data);
}
static void ril_data_probe_reg_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
struct ofono_gprs *gprs = cbd->user;
struct gprs_data *gd = ofono_gprs_get_data(gprs);
struct ofono_error error;
int status, lac, ci, tech;
int max_cids = 1;
int id = RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED;
DBG("");
if (!(gd && message->error == RIL_E_SUCCESS)) {
ofono_error("ril_data_reg_cb: reply failure: %s",
ril_error_to_string(message->error));
decode_ril_error(&error, "FAIL");
error.error = message->error;
status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
goto out;
}
decode_ril_error(&error, "OK");
status = -1;
if (ril_util_parse_reg(gd->ril, message, &status,
&lac, &ci, &tech, &max_cids) == FALSE) {
ofono_error("Failure parsing data registration response.");
decode_ril_error(&error, "FAIL");
if (status == -1)
status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
goto out;
}
if (status > 10)
status = status - 10;
ofono_gprs_register(gprs);
ofono_registered = TRUE;
if (max_cids > gd->max_cids) {
DBG("Setting max cids to %d", max_cids);
gd->max_cids = max_cids;
ofono_gprs_set_cid_range(gprs, 1, max_cids);
}
if (status == roaming)
status = check_if_really_roaming(status);
out:
ofono_info("data reg status probed %d", status);
gd->registerid = g_ril_register(gd->ril,
id, ril_gprs_state_change, gprs);
gd->rild_status = status;
}
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
ofono_gprs_status_cb_t cb,
void *data)
@@ -261,20 +353,27 @@ static void ril_gprs_registration_status(struct ofono_gprs *gprs,
int request = RIL_REQUEST_DATA_REGISTRATION_STATE;
guint ret;
DBG("");
if (gd == NULL || cbd == NULL)
return;
cbd->user = gprs;
ret = g_ril_send(gd->ril, request,
NULL, 0, ril_data_reg_cb, cbd, g_free);
NULL, 0,
((gd->rild_status == -1)
? ril_data_probe_reg_cb
: ril_data_reg_cb), cbd, g_free);
g_ril_print_request_no_args(gd->ril, ret, request);
if (ret <= 0) {
ofono_error("Send RIL_REQUEST_DATA_RESTISTRATION_STATE failed.");
ofono_error("Send RIL_REQUEST_DATA_RESTISTRATION_STATE fail.");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, data);
if (cb)
CALLBACK_WITH_FAILURE(cb, -1, data);
}
}
@@ -292,9 +391,11 @@ static int ril_gprs_probe(struct ofono_gprs *gprs,
gd->ofono_attached = FALSE;
gd->max_cids = 0;
gd->rild_status = -1;
gd->notified = FALSE;
gd->registerid = -1;
gd->timer_id = 0;
ofono_registered = FALSE;
ofono_gprs_set_data(gprs, gd);
ril_gprs_registration_status(gprs, NULL, NULL);

View File

@@ -55,6 +55,7 @@ struct netreg_data {
guint nitz_timeout;
unsigned int vendor;
guint timer_id;
int corestatus; /* Registration status previously reported to core */
};
/* 27.007 Section 7.3 <stat> */
@@ -78,25 +79,20 @@ static void extract_mcc_mnc(const char *str, char *mcc, char *mnc)
mnc[OFONO_MAX_MNC_LENGTH] = '\0';
}
/*
* TODO: The functions in this file are stubbed out, and
* will need to be re-worked to talk to the /gril layer
* in order to get real values from RILD.
*/
static void ril_creg_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_netreg_status_cb_t cb = cbd->cb;
struct netreg_data *nd = cbd->user;
struct ofono_error error;
int status, lac, ci, tech;
int status, logstatus, lac, ci, tech;
DBG("");
if (message->error != RIL_E_SUCCESS) {
decode_ril_error(&error, "FAIL");
ofono_error("Failed to pull registration state");
ofono_error("voice registration status query fail");
nd->corestatus = -1;
cb(&error, -1, -1, -1, -1, cbd->data);
return;
}
@@ -105,20 +101,31 @@ static void ril_creg_cb(struct ril_msg *message, gpointer user_data)
if (ril_util_parse_reg(nd->ril, message, &status,
&lac, &ci, &tech, NULL) == FALSE) {
DBG("voice registration status parsing fail");
nd->corestatus = -1;
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data);
return;
}
DBG("voice registration status is %d", status);
if (status > 10)
status = status - 10;
logstatus = status;
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
status = check_if_really_roaming(status);
ofono_info("voice registration status is %d", status);
DBG("status:%d corestatus:%d", status, nd->corestatus);
if (status != logstatus)
ofono_info("voice registration modified %d (%d)",
status, logstatus);
if (nd->corestatus != status)
ofono_info("voice registration changes %d (%d)",
status, nd->corestatus);
nd->corestatus = status;
nd->tech = tech;
cb(&error, status, lac, ci, tech, cbd->data);
}
@@ -128,15 +135,16 @@ static void ril_creg_notify(struct ofono_error *error, int status, int lac,
{
struct ofono_netreg *netreg = user_data;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("Error during status notification");
return;
}
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("Error during status notification");
return;
}
ofono_netreg_status_notify(netreg, status, lac, ci, tech);
}
static void ril_network_state_change(struct ril_msg *message, gpointer user_data)
static void ril_network_state_change(struct ril_msg *message,
gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
struct netreg_data *nd = ofono_netreg_get_data(netreg);
@@ -364,6 +372,7 @@ static void ril_cops_list_cb(struct ril_msg *message, gpointer user_data)
cb(&error, noperators, list, cbd->data);
g_free(list);
return;
error:
@@ -405,7 +414,8 @@ static void ril_register_cb(struct ril_msg *message, gpointer user_data)
g_ril_print_response_no_args(nd->ril, message);
} else {
ofono_error("registration failed");
ofono_error("registration failed, ril result %d",
message->error);
decode_ril_error(&error, "FAIL");
}
@@ -421,6 +431,8 @@ static void ril_register_auto(struct ofono_netreg *netreg,
int ret;
cbd->user = nd;
ofono_info("nw select automatic");
ret = g_ril_send(nd->ril, request,
NULL, 0, ril_register_cb, cbd, g_free);
@@ -444,6 +456,8 @@ static void ril_register_manual(struct ofono_netreg *netreg,
int request = RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL;
int ret;
ofono_info("nw select manual: %s%s", mcc, mnc);
/* add *netreg_data to callback */
cbd->user = nd;
@@ -591,14 +605,20 @@ gint check_if_really_roaming(gint status)
struct sim_spdi *spdi = ofono_netreg_get_spdi(current_netreg);
if (spdi && net_mcc && net_mnc) {
if (sim_spdi_lookup(spdi, net_mcc, net_mnc))
if (sim_spdi_lookup(spdi, net_mcc, net_mnc)) {
ofono_info("voice reg: not roaming based on spdi");
return NETWORK_REGISTRATION_STATUS_REGISTERED;
else
} else
return status;
} else
return status;
}
gint get_current_network_status()
{
return ofono_netreg_get_status(current_netreg);
}
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
@@ -643,6 +663,7 @@ static int ril_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
nd->time.year = -1;
nd->time.dst = 0;
nd->time.utcoff = 0;
nd->corestatus = -1;
current_netreg = netreg;
ofono_netreg_set_data(netreg, nd);
@@ -669,6 +690,7 @@ static void ril_netreg_remove(struct ofono_netreg *netreg)
g_source_remove(nd->nitz_timeout);
ofono_netreg_set_data(netreg, NULL);
current_netreg = NULL;
if (nd->timer_id > 0)
g_source_remove(nd->timer_id);

View File

@@ -6,7 +6,6 @@
* Copyright (C) ST-Ericsson SA 2010.
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2013 Jolla Ltd
* Contact: Jussi Kangas <jussi.kangas@tieto.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -345,7 +344,7 @@ void handle_anr(size_t len,const unsigned char *msg,char *anr,
prefix = 0;
if ((msg[2] & TON_MASK) ==
TON_INTERNATIONAL) {
TON_INTERNATIONAL) {
anr[0] = '+';
prefix = 1;
}
@@ -518,7 +517,7 @@ void handle_ext1(struct pb_data *pbd, const unsigned char *msg,
list_entry->data;
if (entry) {
strcat(entry->anr,
ext_number);
ext_number);
}
}
}
@@ -634,8 +633,10 @@ static void pb_adn_sim_data_cb(const struct ofono_error *error,
file_info = cbd_outer->user;
cbd = cbd_outer->data;
if (!cbd)
if (!cbd) {
g_free(cbd_outer);
return;
}
pb = cbd->user;
cb = cbd->cb;
@@ -718,8 +719,10 @@ static void pb_adn_sim_data_cb(const struct ofono_error *error,
g_slist_free(phonebook_entry_start);
g_slist_free(pb_files);
g_free(cbd_outer);
void *pb = cbd->data;
g_free(cbd);
DBG("Finally all PB data read");
CALLBACK_WITH_SUCCESS(cb, cbd->data);
CALLBACK_WITH_SUCCESS(cb, pb);
return;
}
}
@@ -744,9 +747,6 @@ static void pb_adn_sim_info_cb(const struct ofono_error *error,
if (!cbd)
goto error;
pb = cbd->user;
cb = cbd->cb;
pbd = ofono_phonebook_get_data(pb);
file_info = NULL;
if (!pbd)
@@ -789,8 +789,12 @@ static void pb_adn_sim_info_cb(const struct ofono_error *error,
return;
error:
if (cb && cbd)
CALLBACK_WITH_FAILURE(cb, cbd->data);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
}
static gboolean is_reading_required(uint8_t file_type)
@@ -823,9 +827,28 @@ static void pb_content_data_cb(const struct ofono_error *error,
if (extension_file_info)
file_info = decode_read_response(extension_file_info, sdata,
length, pb);
else
else {
/*
* These checks are crash hacks.
* AFAIK there's a possibility that we end up here and pb_next is NULL
* in case remove has been called while phonebook reading is in
* process. If you find better solution to this issue feel free to
* change this.
*/
if (pb_next == NULL) {
ofono_error("phonebook reading failed");
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb && pbd)
CALLBACK_WITH_FAILURE(cb, pb);
}
return;
}
file_info =
decode_read_response(pb_next->data, sdata, length, pb);
}
if (file_info) {
DBG("Reading extension file %04X, record %d, structure %d",
@@ -879,7 +902,7 @@ static void pb_content_data_cb(const struct ofono_error *error,
DBG("All data requested, start vCard creation");
while (list_entry) {
struct phonebook_entry *entry =
list_entry->data;
list_entry->data;
if (entry) {
DBG("vCard:\nname=%s\n",
@@ -916,8 +939,10 @@ static void pb_content_data_cb(const struct ofono_error *error,
g_slist_free(phonebook_entry_start);
g_slist_free(pb_files);
void *pb = cbd->data;
g_free(cbd);
DBG("Finally all PB data read");
CALLBACK_WITH_SUCCESS(cb, cbd->data);
CALLBACK_WITH_SUCCESS(cb, pb);
return;
}
@@ -982,8 +1007,12 @@ static void pb_content_data_read(struct pb_data *pbd,
return;
error:
if (cb && cbd)
CALLBACK_WITH_FAILURE(cb, cbd->data);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
out:
DBG("Exiting");
@@ -1056,9 +1085,11 @@ static void pb_content_info_cb(const struct ofono_error *error,
return;
error:
if (cb && cbd) {
DBG("Error cbd=%p, pbd=%p, file_info=%p", cbd, pbd, file_info);
CALLBACK_WITH_FAILURE(cb, cbd->data);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
}
@@ -1173,8 +1204,12 @@ static void pb_reference_data_cb(const struct ofono_error *error,
return;
error:
if (cb && cbd)
CALLBACK_WITH_FAILURE(cb, cbd->data);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
}
static void pb_reference_info_cb(const struct ofono_error *error,
@@ -1225,8 +1260,12 @@ static void pb_reference_info_cb(const struct ofono_error *error,
pb_reference_data_cb, cbd);
return;
error:
if (cb && cbd)
CALLBACK_WITH_FAILURE(cb, cbd->data);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
}
static void ril_export_entries(struct ofono_phonebook *pb,
@@ -1265,10 +1304,12 @@ static void ril_export_entries(struct ofono_phonebook *pb,
error:
if (cb && cbd)
CALLBACK_WITH_FAILURE(cb, cbd->data);
g_free(cbd);
if (cbd){
void *pb = cbd->data;
g_free(cbd);
if(cb)
CALLBACK_WITH_FAILURE(cb, pb);
}
}
static gboolean ril_delayed_register(gpointer user_data)
@@ -1316,7 +1357,7 @@ static struct ofono_phonebook_driver driver = {
.name = "rilmodem",
.probe = ril_phonebook_probe,
.remove = ril_phonebook_remove,
.export_entries = ril_export_entries
.export_entries = ril_export_entries
};
void ril_phonebook_init(void)

View File

@@ -75,7 +75,7 @@ static void ril_set_rat_mode(struct ofono_radio_settings *rs,
int pref = rd->ratmode;
int ret = 0;
ofono_info("setting rat mode:%d", mode);
ofono_info("rat mode set %d", mode);
parcel_init(&rilp);
@@ -116,6 +116,8 @@ static void ril_force_rat_mode(struct radio_data *rd, int pref)
if (pref == rd->ratmode)
return;
DBG("pref ril rat mode %d, ril current %d", pref, rd->ratmode);
parcel_init(&rilp);
parcel_w_int32(&rilp, 1);
parcel_w_int32(&rilp, rd->ratmode);
@@ -137,7 +139,7 @@ static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS) {
ril_util_init_parcel(message, &rilp);
/*first item in int[] is len so let's skip that*/
/* first item in int[] is len so let's skip that */
parcel_r_int32(&rilp);
pref = parcel_r_int32(&rilp);
@@ -167,6 +169,7 @@ static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
default:
break;
}
ofono_info("rat mode %d (ril %d)", mode, pref);
if (cb)
CALLBACK_WITH_SUCCESS(cb, mode, cbd->data);
} else {
@@ -287,6 +290,7 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
storage_close(NULL, RIL_STORE, keyfile, TRUE);
DBG("needsconfig %d, rat mode %d", needsconfig, rsd->ratmode);
return needsconfig;
}

View File

@@ -123,8 +123,12 @@ struct ofono_sim *get_sim();
gint check_if_really_roaming(gint status);
gboolean ril_roaming_allowed();
gboolean check_if_ok_to_attach();
gint get_current_network_status();
void ril_util_free_sim_apps(struct sim_app **apps, guint num_apps);
struct cb_data {
@@ -149,7 +153,7 @@ static inline struct cb_data *cb_data_new2(void *user, void *cb,
{
struct cb_data *ret;
ret = g_try_new0(struct cb_data, 1);
ret = g_new0(struct cb_data, 1);
if (ret) {
ret->cb = cb;

View File

@@ -103,6 +103,8 @@ struct sim_data {
enum ofono_sim_password_type passwd_state;
guint card_state;
guint idle_id;
gboolean initialized;
gboolean removed;
};
static void ril_pin_change_state_cb(struct ril_msg *message,
@@ -180,6 +182,15 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
DBG("");
/* In case sim card has been removed prior to this callback has been
* called we must not call the core call back method as otherwise the
* core will crash.
*/
if (sd->removed == TRUE) {
ofono_error("RIL_CARDSTATE_ABSENT");
return;
}
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
@@ -315,7 +326,7 @@ static void ril_file_io_cb(struct ril_msg *message, gpointer user_data)
decode_ril_error(&error, "OK");
} else {
ofono_error("RILD reply failure: %s",
ril_error_to_string(message->error));
ril_error_to_string(message->error));
goto error;
}
@@ -551,8 +562,13 @@ static void configure_active_app(struct sim_data *sd,
guint index)
{
sd->app_type = app->app_type;
g_free(sd->aid_str);
sd->aid_str = g_strdup(app->aid_str);
g_free(sd->app_str);
sd->app_str = g_strdup(app->app_str);
sd->app_index = index;
DBG("setting aid_str (AID) to: %s", sd->aid_str);
@@ -623,7 +639,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
DBG("");
if (ril_util_parse_sim_status(sd->ril, message, &status, apps) &&
if (ril_util_parse_sim_status(sd->ril, message, &status, apps) &&
status.num_apps) {
DBG("num_apps: %d gsm_umts_index: %d", status.num_apps,
@@ -659,6 +675,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
if (sd->card_state != RIL_CARDSTATE_PRESENT) {
ofono_sim_inserted_notify(sim, TRUE);
sd->card_state = RIL_CARDSTATE_PRESENT;
sd->removed = FALSE;
}
}
@@ -690,12 +707,11 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
if (current_online_state == RIL_ONLINE_PREF) {
parcel_init(&rilp);
parcel_init(&rilp);
parcel_w_int32(&rilp, 1);
parcel_w_int32(&rilp, 1);
ofono_info("RIL_REQUEST_RADIO_POWER ON");
g_ril_send(sd->ril,
RIL_REQUEST_RADIO_POWER,
rilp.data,
@@ -715,11 +731,16 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
if (status.card_state == RIL_CARDSTATE_ABSENT) {
DBG("sd->card_state:%u,status.card_state:%u,",
sd->card_state, status.card_state);
ofono_info("RIL_CARDSTATE_ABSENT");
ofono_sim_inserted_notify(sim, FALSE);
if (sd->card_state == RIL_CARDSTATE_PRESENT)
sd->removed = TRUE;
sd->card_state = RIL_CARDSTATE_ABSENT;
if (current_passwd)
g_stpcpy(current_passwd, defaultpasswd);
sd->initialized = FALSE;
}
}
@@ -760,16 +781,81 @@ static void ril_query_pin_retries(struct ofono_sim *sim,
CALLBACK_WITH_SUCCESS(cb, sd->retries, data);
}
static void ril_query_passwd_state_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
struct ofono_sim *sim = cbd->user;
struct sim_data *sd = ofono_sim_get_data(sim);
ofono_sim_passwd_cb_t cb = cbd->cb;
void *data = cbd->data;
struct sim_app *apps[MAX_UICC_APPS];
struct sim_status status;
guint i = 0;
guint search_index = -1;
gint state = ofono_sim_get_state(sim);
if (ril_util_parse_sim_status(sd->ril, message, &status, apps) &&
status.num_apps) {
DBG("num_apps: %d gsm_umts_index: %d", status.num_apps,
status.gsm_umts_index);
/* TODO(CDMA): need some kind of logic to
* set the correct app_index,
*/
search_index = status.gsm_umts_index;
for (i = 0; i < status.num_apps; i++) {
if (i == search_index &&
apps[i]->app_type != RIL_APPTYPE_UNKNOWN) {
current_active_app = apps[i]->app_type;
configure_active_app(sd, apps[i], i);
set_pin_lock_state(sim, apps[i]);
break;
}
}
ril_util_free_sim_apps(apps, status.num_apps);
}
DBG("passwd_state %u", sd->passwd_state);
/* if pin code required cannot be initialized yet*/
if (sd->passwd_state == OFONO_SIM_PASSWORD_SIM_PIN)
sd->initialized = FALSE;
/*
* To prevent double call to sim_initialize_after_pin from
* sim_pin_query_cb we must prevent calling sim_pin_query_cb
* when !OFONO_SIM_STATE_READY && OFONO_SIM_PASSWORD_NONE
*/
if ((state == OFONO_SIM_STATE_READY) || (sd->initialized == FALSE) ||
(sd->passwd_state != OFONO_SIM_PASSWORD_NONE)){
if (sd->passwd_state == OFONO_SIM_PASSWORD_NONE)
sd->initialized = TRUE;
if (state == OFONO_SIM_STATE_LOCKED_OUT)
sd->initialized = FALSE;
if (sd->passwd_state == OFONO_SIM_PASSWORD_INVALID)
CALLBACK_WITH_FAILURE(cb, -1, data);
else
CALLBACK_WITH_SUCCESS(cb, sd->passwd_state, data);
}
}
static void ril_query_passwd_state(struct ofono_sim *sim,
ofono_sim_passwd_cb_t cb, void *data)
{
struct sim_data *sd = ofono_sim_get_data(sim);
DBG("passwd_state %u", sd->passwd_state);
struct cb_data *cbd = cb_data_new2(sim, cb, data);
int request = RIL_REQUEST_GET_SIM_STATUS;
guint ret;
ret = g_ril_send(sd->ril, request,
NULL, 0, ril_query_passwd_state_cb, cbd, g_free);
g_ril_print_request_no_args(sd->ril, ret, request);
if (sd->passwd_state == OFONO_SIM_PASSWORD_INVALID)
CALLBACK_WITH_FAILURE(cb, -1, data);
else
CALLBACK_WITH_SUCCESS(cb, sd->passwd_state, data);
}
static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
@@ -1093,13 +1179,6 @@ static int ril_sim_probe(struct ofono_sim *sim, unsigned int vendor,
sd = g_new0(struct sim_data, 1);
sd->ril = g_ril_clone(ril);
sd->aid_str = NULL;
sd->app_str = NULL;
sd->app_type = RIL_APPTYPE_UNKNOWN;
sd->passwd_state = OFONO_SIM_PASSWORD_NONE;
sd->passwd_type = OFONO_SIM_PASSWORD_NONE;
sd->sim_registered = FALSE;
sd->card_state = RIL_CARDSTATE_ABSENT;
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
sd->retries[i] = -1;

View File

@@ -38,10 +38,18 @@
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/sms.h>
#include <ofono/types.h>
#include <ofono/sim.h>
#include "smsutil.h"
#include "util.h"
#include "rilmodem.h"
#include "simutil.h"
#define SIM_EFSMS_FILEID 0x6F3C
#define EFSMS_LENGTH 176
unsigned char path[4] = {0x3F, 0x00, 0x7F, 0x10};
struct sms_data {
GRil *ril;
@@ -131,7 +139,7 @@ static void ril_csca_query_cb(struct ril_msg *message, gpointer user_data)
sca.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
DBG("csca_query_cb: %s, %d", sca.number, sca.type);
g_free(temp_buf); /*g_utf16_to_utf8 used by parcel_r_string*/
cb(&error, &sca, cbd->data);
} else {
ofono_error("return value invalid");
@@ -234,6 +242,8 @@ static void ril_cmgs(struct ofono_sms *sms, const unsigned char *pdu,
submit_sms_cb, cbd, g_free);
g_ril_append_print_buf(sd->ril, "(%s)", tpdu);
g_free(tpdu);
tpdu = NULL;
g_ril_print_request(sd->ril, ret, request);
parcel_free(&rilp);
@@ -291,6 +301,9 @@ static void ril_sms_notify(struct ril_msg *message, gpointer user_data)
long ril_buf_len;
guchar *ril_data;
ril_pdu = NULL;
ril_data = NULL;
DBG("req: %d; data_len: %d", message->req, message->buf_len);
switch (message->req) {
@@ -323,6 +336,8 @@ static void ril_sms_notify(struct ril_msg *message, gpointer user_data)
ofono_info("sms received, smsc_len is %d", smsc_len);
g_ril_append_print_buf(sd->ril, "(%s)", ril_pdu);
g_free(ril_pdu);
ril_pdu = NULL;
g_ril_print_unsol(sd->ril, message);
if (message->req == RIL_UNSOL_RESPONSE_NEW_SMS) {
@@ -335,16 +350,116 @@ static void ril_sms_notify(struct ril_msg *message, gpointer user_data)
ril_buf_len - smsc_len);
}
g_free(ril_data);
ril_data = NULL;
ril_ack_delivery(sms, TRUE);
return;
error:
g_free(ril_pdu);
ril_pdu = NULL;
g_free(ril_data);
ril_data = NULL;
ril_ack_delivery(sms, FALSE);
ofono_error("Unable to parse NEW_SMS notification");
}
static void ril_new_sms_on_sim_cb(struct ril_msg *message, gpointer user_data)
{
DBG("");
if (message->error == RIL_E_SUCCESS)
ofono_info("sms deleted from sim");
else
ofono_error("deleting sms from sim failed");
}
static void ril_request_delete_sms_om_sim(struct ofono_sms *sms,int record)
{
struct sms_data *data = ofono_sms_get_data(sms);
struct parcel rilp;
int request = RIL_REQUEST_DELETE_SMS_ON_SIM;
int ret;
DBG("Deleting record: %d", record);
parcel_init(&rilp);
parcel_w_int32(&rilp, 1); /* Number of int32 values in array */
parcel_w_int32(&rilp, record);
ret = g_ril_send(data->ril, request, rilp.data,
rilp.size, ril_new_sms_on_sim_cb, NULL, NULL);
parcel_free(&rilp);
if (ret <= 0)
ofono_error("cannot delete sms from sim");
}
static void ril_read_sms_on_sim_cb(const struct ofono_error *error,
const unsigned char *sdata,
int length, void *data)
{
struct cb_data *cbd = data;
struct ofono_sms *sms = cbd->user;
int record;
unsigned int smsc_len;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error("cannot read sms from sim");
goto exit;
}
/*
* It seems when reading EFsms RIL returns the whole record including
* the first status byte therefore we ignore that as we are only
* interested of the following pdu
*/
/* The first octect in the pdu contains the SMSC address length
* which is the X following octects it reads. We add 1 octet to
* the read length to take into account this read octet in order
* to calculate the proper tpdu length.
*/
smsc_len = sdata[1] + 1;
ofono_sms_deliver_notify(sms, sdata + 1, length - 1,
length - smsc_len - 1);
record = (int)cbd->data;
ril_request_delete_sms_om_sim(sms,record);
exit:
g_free(cbd);
}
static void ril_new_sms_on_sim(struct ril_msg *message, gpointer user_data)
{
struct ofono_sms *sms = user_data;
struct parcel rilp;
int record;
ofono_info("new sms on sim");
ril_util_init_parcel(message, &rilp);
/* data length of the response */
record = parcel_r_int32(&rilp);
if (record > 0) {
record = parcel_r_int32(&rilp);
struct cb_data *cbd = cb_data_new2(sms, NULL, (void*)record);
DBG(":%d", record);
get_sim_driver()->read_file_linear(get_sim(), SIM_EFSMS_FILEID,
record, EFSMS_LENGTH, path,
sizeof(path),
ril_read_sms_on_sim_cb, cbd);
}
}
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_sms *sms = user_data;
@@ -360,6 +475,8 @@ static gboolean ril_delayed_register(gpointer user_data)
ril_sms_notify, sms);
g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT,
ril_sms_notify, sms);
g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM,
ril_new_sms_on_sim, sms);
/* This makes the timeout a single-shot */
return FALSE;

View File

@@ -81,11 +81,12 @@ static void ril_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
hex_envelope = encode_hex(command, length, 0);
DBG("rilmodem envelope: %s", hex_envelope);
parcel_init(&rilp);
parcel_w_string(&rilp, hex_envelope);
g_free(hex_envelope);
hex_envelope = NULL;
ret = g_ril_send(sd->ril, request,
rilp.data, rilp.size, ril_envelope_cb,
@@ -132,11 +133,12 @@ static void ril_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
hex_tr = encode_hex(resp, length, 0);
DBG("rilmodem terminal response: %s", hex_tr);
parcel_init(&rilp);
parcel_w_string(&rilp, hex_tr);
g_free(hex_tr);
hex_tr = NULL;
ret = g_ril_send(sd->ril, request,
rilp.data, rilp.size, ril_tr_cb,
@@ -194,7 +196,9 @@ static void ril_stk_pcmd_notify(struct ril_msg *message, gpointer user_data)
strlen(pcmd),
&len, -1);
g_free(pcmd);
ofono_stk_proactive_command_notify(stk, len, (const guchar *)pdu);
g_free(pdu);
}
static void ril_stk_event_notify(struct ril_msg *message, gpointer user_data)
@@ -211,13 +215,14 @@ static void ril_stk_event_notify(struct ril_msg *message, gpointer user_data)
ril_util_init_parcel(message, &rilp);
pcmd = parcel_r_string(&rilp);
DBG("pcmd: %s", pcmd);
pdu = decode_hex((const char *) pcmd,
strlen(pcmd),
&len, -1);
g_free(pcmd);
pcmd = NULL;
ofono_stk_proactive_command_handled_notify(stk, len,
(const guchar *)pdu);
g_free(pdu);
}
static void ril_stk_session_end_notify(struct ril_msg *message,

View File

@@ -68,19 +68,37 @@ static void ril_ussd_request(struct ofono_ussd *ussd, int dcs,
enum sms_charset charset;
int ret = -1;
ofono_info("send ussd");
ofono_info("send ussd, len:%d", len);
if (cbs_dcs_decode(dcs, NULL, NULL, &charset,
NULL, NULL, NULL)) {
if (charset == SMS_CHARSET_7BIT) {
unsigned char unpacked_buf[182] = "";
long written;
int length;
unpack_7bit_own_buf(pdu, len, 0, TRUE,
sizeof(unpacked_buf), &written, 0,
unpacked_buf);
if (written >= 1) {
/*
* When USSD was packed, additional CR
might have been added (according to
23.038 6.1.2.3.1). So if the last
character is CR, it should be removed
here. And in addition written doesn't
contain correct length...
Over 2 characters long USSD string must
end with # (checked in
valid_ussd_string() ), so it should be
safe to remove extra CR.
*/
length = strlen((char *)unpacked_buf);
if (length > 2 &&
unpacked_buf[length-1] == '\r')
unpacked_buf[length-1] = 0;
struct parcel rilp;
parcel_init(&rilp);
parcel_w_string(&rilp, (char *)unpacked_buf);
@@ -149,9 +167,9 @@ static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
{
struct ofono_ussd *ussd = user_data;
struct parcel rilp;
gchar *ussd_from_network;
gchar *type;
gint ussdtype;
gchar *ussd_from_network = NULL;
gchar *type = NULL;
gint ussdtype = 0;
ofono_info("ussd_received");
@@ -159,13 +177,17 @@ static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
parcel_r_int32(&rilp);
type = parcel_r_string(&rilp);
ussdtype = g_ascii_xdigit_value(*type);
g_free(type);
type = NULL;
ussd_from_network = parcel_r_string(&rilp);
if (ussd_from_network)
/* ussd_from_network not freed because core does that if dcs is 0xFF */
if (ussd_from_network) {
DBG("ussd_received, length %d", strlen(ussd_from_network));
ofono_ussd_notify(ussd, ussdtype, 0xFF,
(const unsigned char *)ussd_from_network,
strlen(ussd_from_network));
else
} else
ofono_ussd_notify(ussd, ussdtype, 0, NULL, 0);
return;

View File

@@ -45,9 +45,7 @@
/* Amount of ms we wait between CLCC calls */
#define POLL_CLCC_INTERVAL 300
#define FLAG_NEED_CLIP 1
#define MAX_DTMF_BUFFER 32
struct voicecall_data {
@@ -278,6 +276,8 @@ static void generic_cb(struct ril_msg *message, gpointer user_data)
int request = RIL_REQUEST_GET_CURRENT_CALLS;
int ret;
ofono_info("request:%d",message->req);
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
@@ -382,15 +382,17 @@ static void ril_dial(struct ofono_voicecall *vc,
struct parcel rilp;
int request = RIL_REQUEST_DIAL;
int ret;
char *phstr = NULL;
ofono_info("dialing");
phstr = (char *) phone_number_to_string(ph);
ofono_info("dialing \"%s\"", phstr);
cbd->user = vc;
parcel_init(&rilp);
/* Number to dial */
parcel_w_string(&rilp, (char *) phone_number_to_string(ph));
parcel_w_string(&rilp, phstr);
/* CLIR mode */
parcel_w_int32(&rilp, clir);
/* USS, need it twice for absent */
@@ -523,6 +525,7 @@ static void ril_ss_notify(struct ril_msg *message, gpointer user_data)
strncpy(number.number, tmp_number,
OFONO_MAX_PHONE_NUMBER_LENGTH);
g_free(tmp_number);
DBG("RIL data: MT/MO: %i, code: %i, index: %i",
notification_type, code, index);
break;
@@ -676,6 +679,13 @@ static void ril_create_multiparty(struct ofono_voicecall *vc,
cb(&error, data);
}
static void ril_transfer(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
ril_template(RIL_REQUEST_EXPLICIT_CALL_TRANSFER, vc, generic_cb, 0,
NULL, 0, cb, data);
}
static void private_chat_cb(struct ril_msg *message, gpointer user_data)
{
struct ofono_error error;
@@ -881,12 +891,13 @@ static struct ofono_voicecall_driver driver = {
.release_specific = ril_hangup_specific,
.send_tones = ril_send_dtmf,
.create_multiparty = ril_create_multiparty,
.transfer = ril_transfer,
.private_chat = ril_private_chat,
.swap_without_accept = ril_swap_without_accept,
.hold_all_active = ril_hold_all_active,
.release_all_held = ril_release_all_held,
.set_udub = ril_set_udub,
.release_all_active = ril_release_all_active,
.release_all_active = ril_release_all_active,
};
void ril_voicecall_init(void)

View File

@@ -56,6 +56,8 @@ struct GDBusClient {
void *signal_data;
GDBusProxyFunction proxy_added;
GDBusProxyFunction proxy_removed;
GDBusClientFunction ready;
void *ready_data;
GDBusPropertyFunction property_changed;
void *user_data;
GList *proxy_list;
@@ -725,6 +727,93 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
return TRUE;
}
gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
const char *name, int type, const void *value,
size_t size, GDBusResultFunction function,
void *user_data, GDBusDestroyFunction destroy)
{
struct set_property_data *data;
GDBusClient *client;
DBusMessage *msg;
DBusMessageIter iter, variant, array;
DBusPendingCall *call;
char array_sig[3];
char type_sig[2];
if (!proxy || !name || !value)
return FALSE;
if (!dbus_type_is_basic(type))
return FALSE;
client = proxy->client;
if (!client)
return FALSE;
data = g_try_new0(struct set_property_data, 1);
if (!data)
return FALSE;
data->function = function;
data->user_data = user_data;
data->destroy = destroy;
msg = dbus_message_new_method_call(client->service_name,
proxy->obj_path,
DBUS_INTERFACE_PROPERTIES,
"Set");
if (!msg) {
g_free(data);
return FALSE;
}
array_sig[0] = DBUS_TYPE_ARRAY;
array_sig[1] = (char) type;
array_sig[2] = '\0';
type_sig[0] = (char) type;
type_sig[1] = '\0';
dbus_message_iter_init_append(msg, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
&proxy->interface);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &name);
dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
array_sig, &variant);
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
type_sig, &array);
if (dbus_type_is_fixed(type))
dbus_message_iter_append_fixed_array(&array, type, &value,
size);
else if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
const char **str = (const char **) value;
size_t i;
for (i = 0; i < size; i++)
dbus_message_iter_append_basic(&array, type, &str[i]);
}
dbus_message_iter_close_container(&variant, &array);
dbus_message_iter_close_container(&iter, &variant);
if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, -1) == FALSE) {
dbus_message_unref(msg);
g_free(data);
return FALSE;
}
dbus_pending_call_set_notify(call, set_property_reply, data, g_free);
dbus_pending_call_unref(call);
dbus_message_unref(msg);
return TRUE;
}
struct method_call_data {
GDBusReturnFunction function;
void *user_data;
@@ -982,6 +1071,9 @@ static void parse_managed_objects(GDBusClient *client, DBusMessage *msg)
dbus_message_iter_next(&dict);
}
if (client->ready)
client->ready(client, client->ready_data);
}
static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
@@ -1243,6 +1335,18 @@ gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
return TRUE;
}
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
GDBusClientFunction ready, void *user_data)
{
if (client == NULL)
return FALSE;
client->ready = ready;
client->ready_data = user_data;
return TRUE;
}
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,

View File

@@ -329,6 +329,11 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
GDBusResultFunction function, void *user_data,
GDBusDestroyFunction destroy);
gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
const char *name, int type, const void *value,
size_t size, GDBusResultFunction function,
void *user_data, GDBusDestroyFunction destroy);
typedef void (* GDBusSetupFunction) (DBusMessageIter *iter, void *user_data);
typedef void (* GDBusReturnFunction) (DBusMessage *message, void *user_data);
@@ -337,6 +342,7 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
GDBusReturnFunction function, void *user_data,
GDBusDestroyFunction destroy);
typedef void (* GDBusClientFunction) (GDBusClient *client, void *user_data);
typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data);
@@ -359,7 +365,8 @@ gboolean g_dbus_client_set_disconnect_watch(GDBusClient *client,
GDBusWatchFunction function, void *user_data);
gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
GDBusMessageFunction function, void *user_data);
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
GDBusClientFunction ready, void *user_data);
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,

View File

@@ -30,8 +30,6 @@
#include "gdbus.h"
#define DISPATCH_TIMEOUT 0
#define info(fmt...)
#define error(fmt...)
#define debug(fmt...)
@@ -70,8 +68,6 @@ static gboolean message_dispatch(void *data)
{
DBusConnection *conn = data;
dbus_connection_ref(conn);
/* Dispatch messages */
while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
@@ -84,7 +80,7 @@ static inline void queue_dispatch(DBusConnection *conn,
DBusDispatchStatus status)
{
if (status == DBUS_DISPATCH_DATA_REMAINS)
g_timeout_add(DISPATCH_TIMEOUT, message_dispatch, conn);
g_idle_add(message_dispatch, dbus_connection_ref(conn));
}
static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
@@ -92,9 +88,6 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
struct watch_info *info = data;
unsigned int flags = 0;
DBusDispatchStatus status;
DBusConnection *conn;
conn = dbus_connection_ref(info->conn);
if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
@@ -103,10 +96,8 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
dbus_watch_handle(info->watch, flags);
status = dbus_connection_get_dispatch_status(conn);
queue_dispatch(conn, status);
dbus_connection_unref(conn);
status = dbus_connection_get_dispatch_status(info->conn);
queue_dispatch(info->conn, status);
return TRUE;
}

View File

@@ -1253,6 +1253,8 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
if (!dbus_connection_register_object_path(connection, path,
&generic_table, data)) {
dbus_connection_unref(data->conn);
g_free(data->path);
g_free(data->introspect);
g_free(data);
return NULL;

View File

@@ -85,6 +85,7 @@ struct ril_s {
guint next_cmd_id; /* Next command id */
guint next_notify_id; /* Next notify id */
guint next_gid; /* Next group id */
int sk; /* Socket */
GRilIO *io; /* GRil IO */
GQueue *command_queue; /* Command queue */
GQueue *out_queue; /* Commands sent/been sent */
@@ -786,6 +787,7 @@ static void ril_unref(struct ril_s *ril)
g_ril_io_unref(ril->io);
ril->io = NULL;
ril_cleanup(ril);
close(ril->sk);
}
if (ril->in_read_handler)
@@ -810,7 +812,6 @@ static struct ril_s *create_ril()
{
struct ril_s *ril;
struct sockaddr_un addr;
int sk;
GIOChannel *io;
GKeyFile *keyfile;
char **subscriptions = NULL;
@@ -831,8 +832,8 @@ static struct ril_s *create_ril()
ril->trace = FALSE;
ril->connected = FALSE;
sk = socket(AF_UNIX, SOCK_STREAM, 0);
if (sk < 0) {
ril->sk = socket(AF_UNIX, SOCK_STREAM, 0);
if (ril->sk < 0) {
ofono_error("create_ril: can't create unix socket: %s (%d)\n",
strerror(errno), errno);
goto error;
@@ -842,13 +843,13 @@ static struct ril_s *create_ril()
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, RILD_CMD_SOCKET, sizeof(addr.sun_path) - 1);
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
if (connect(ril->sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
ofono_error("create_ril: can't connect to RILD: %s (%d)\n",
strerror(errno), errno);
goto error;
}
io = g_io_channel_unix_new(sk);
io = g_io_channel_unix_new(ril->sk);
if (io == NULL) {
ofono_error("create_ril: can't connect to RILD: %s (%d)\n",
strerror(errno), errno);

View File

@@ -73,6 +73,7 @@ static void read_watcher_destroy_notify(gpointer user_data)
io->read_handler = NULL;
io->read_data = NULL;
g_io_channel_unref(io->channel);
io->channel = NULL;
if (io->destroyed)

View File

@@ -159,19 +159,8 @@ struct reply_setup_data_call *g_ril_reply_parse_data_call(GRil *gril,
}
/* TODO:
* RILD can return multiple addresses; oFono only supports
* setting a single IPv4 address. At this time, we only
* use the first address. It's possible that a RIL may
* just specify the end-points of the point-to-point
* connection, in which case this code will need to
* changed to handle such a device.
*
* For now split into a maximum of three, and only use
* the first address for the remaining operations.
*/
if (raw_ip_addrs)
reply->ip_addrs = g_strsplit(raw_ip_addrs, " ", 3);
reply->ip_addrs = g_strsplit(raw_ip_addrs, " ", -1);
else
reply->ip_addrs = NULL;
@@ -191,7 +180,7 @@ struct reply_setup_data_call *g_ril_reply_parse_data_call(GRil *gril,
* setting a single IPv4 gateway.
*/
if (raw_gws)
reply->gateways = g_strsplit(raw_gws, " ", 3);
reply->gateways = g_strsplit(raw_gws, " ", -1);
else
reply->gateways = NULL;
@@ -203,7 +192,7 @@ struct reply_setup_data_call *g_ril_reply_parse_data_call(GRil *gril,
/* Split DNS addresses */
if (dnses)
reply->dns_addresses = g_strsplit(dnses, " ", 3);
reply->dns_addresses = g_strsplit(dnses, " ", -1);
else
reply->dns_addresses = NULL;

View File

@@ -78,6 +78,8 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
void ofono_gprs_add_context(struct ofono_gprs *gprs,
struct ofono_gprs_context *gc);
struct ofono_modem *ofono_gprs_get_modem(struct ofono_gprs *gprs);
#ifdef __cplusplus
}
#endif

View File

@@ -36,12 +36,18 @@ typedef void (*ofono_handsfree_cb_t)(const struct ofono_error *error,
typedef void (*ofono_handsfree_phone_cb_t)(const struct ofono_error *error,
const struct ofono_phone_number *number,
void *data);
typedef void (*ofono_handsfree_cnum_query_cb_t)(const struct ofono_error *error,
int total,
const struct ofono_phone_number *numbers,
void *data);
struct ofono_handsfree_driver {
const char *name;
int (*probe)(struct ofono_handsfree *hf, unsigned int vendor,
void *data);
void (*remove)(struct ofono_handsfree *hf);
void (*cnum_query)(struct ofono_handsfree *hf,
ofono_handsfree_cnum_query_cb_t cb, void *data);
void (*request_phone_number) (struct ofono_handsfree *hf,
ofono_handsfree_phone_cb_t cb,
void *data);
@@ -54,6 +60,8 @@ struct ofono_handsfree_driver {
void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
unsigned int ag_features);
void ofono_handsfree_set_ag_chld_features(struct ofono_handsfree *hf,
unsigned int ag_chld_features);
void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
ofono_bool_t enabled);
void ofono_handsfree_voice_recognition_notify(struct ofono_handsfree *hf,

View File

@@ -59,6 +59,7 @@
#include <drivers/atmodem/vendor.h>
static const char *none_prefix[] = { NULL };
static const char *qss_prefix[] = { "#QSS:", NULL };
struct he910_data {
GAtChat *chat; /* AT chat */
@@ -101,7 +102,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsmv1();
syntax = g_at_syntax_new_gsm_permissive();
chat = g_at_chat_new(channel, syntax);
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
@@ -167,6 +168,31 @@ static void he910_qss_notify(GAtResult *result, gpointer user_data)
switch_sim_state_status(modem, status);
}
static void qss_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
int status, mode;
GAtResultIter iter;
DBG("%p", modem);
if (!ok)
return;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "#QSS:"))
return;
if (!g_at_result_iter_next_number(&iter, &mode))
return;
if (!g_at_result_iter_next_number(&iter, &status))
return;
switch_sim_state_status(modem, status);
}
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -204,6 +230,15 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix,
NULL, NULL, NULL);
/* Follow sim state */
g_at_chat_register(data->chat, "#QSS:", he910_qss_notify,
FALSE, modem, NULL);
/* Enable sim state notification */
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
qss_query_cb, modem, NULL);
}
static int he910_enable(struct ofono_modem *modem)
@@ -232,13 +267,6 @@ static int he910_enable(struct ofono_modem *modem)
g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
NULL, NULL, NULL);
/* Follow sim state */
g_at_chat_register(data->chat, "#QSS:", he910_qss_notify,
FALSE, modem, NULL);
/* Enable sim state notification */
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
/* Set phone functionality */
g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
cfun_enable_cb, modem, NULL);

View File

@@ -1071,6 +1071,7 @@ done:
static int phonesim_init(void)
{
int err;
char *conf_override = getenv("OFONO_PHONESIM_CONFIG");
err = ofono_modem_driver_register(&phonesim_driver);
if (err < 0)
@@ -1081,7 +1082,10 @@ static int phonesim_init(void)
ofono_gprs_context_driver_register(&context_driver);
ofono_ctm_driver_register(&ctm_driver);
parse_config(CONFIGDIR "/phonesim.conf");
if (conf_override)
parse_config(conf_override);
else
parse_config(CONFIGDIR "/phonesim.conf");
return 0;
}

View File

@@ -113,13 +113,12 @@ static void ril_debug(const char *str, void *user_data)
static void sim_status_cb(struct ril_msg *message, gpointer user_data)
{
DBG("error=%d", message->error);
struct ofono_modem *modem = user_data;
struct ril_data *ril = ofono_modem_get_data(modem);
struct sim_status status;
struct sim_app *apps[MAX_UICC_APPS];
DBG("");
/*
* ril.h claims this should NEVER fail!
* However this isn't quite true. So,
@@ -189,6 +188,7 @@ static int send_get_sim_status(struct ofono_modem *modem)
static int ril_probe(struct ofono_modem *modem)
{
DBG("");
struct ril_data *ril = NULL;
ril = g_try_new0(struct ril_data, 1);
@@ -211,9 +211,9 @@ error:
static void ril_remove(struct ofono_modem *modem)
{
DBG("");
struct ril_data *ril = ofono_modem_get_data(modem);
ofono_modem_set_data(modem, NULL);
if (!ril)
@@ -229,7 +229,7 @@ static void ril_remove(struct ofono_modem *modem)
static void ril_pre_sim(struct ofono_modem *modem)
{
DBG("enter");
DBG("");
struct ril_data *ril = ofono_modem_get_data(modem);
struct ofono_sim *sim;
@@ -242,6 +242,7 @@ static void ril_pre_sim(struct ofono_modem *modem)
static void ril_post_sim(struct ofono_modem *modem)
{
DBG("");
struct ril_data *ril = ofono_modem_get_data(modem);
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
@@ -277,7 +278,7 @@ static void ril_post_sim(struct ofono_modem *modem)
static void ril_post_online(struct ofono_modem *modem)
{
DBG("enter");
DBG("");
struct ril_data *ril = ofono_modem_get_data(modem);
ofono_call_volume_create(modem, 0, "rilmodem", ril->modem);
@@ -290,7 +291,7 @@ static void ril_post_online(struct ofono_modem *modem)
static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
{
DBG("enter");
DBG("");
struct cb_data *cbd = user_data;
ofono_modem_online_cb_t cb = cbd->cb;
@@ -312,12 +313,13 @@ static void ril_set_online(struct ofono_modem *modem, ofono_bool_t online,
parcel_init(&rilp);
parcel_w_int32(&rilp, 1); /* Number of params */
parcel_w_int32(&rilp, online); /* Radio ON = 1, Radio OFF = 0 */
DBG("1");
ofono_info("RIL_REQUEST_RADIO_POWER %d", online);
ret = g_ril_send(ril->modem, RIL_REQUEST_RADIO_POWER, rilp.data,
rilp.size, ril_set_online_cb, cbd, g_free);
parcel_free(&rilp);
DBG("2");
DBG("RIL_REQUEST_RADIO_POWER done");
if (ret <= 0) {
g_free(cbd);
CALLBACK_WITH_FAILURE(callback, data);
@@ -355,6 +357,7 @@ static int ril_screen_state(struct ofono_modem *modem, ofono_bool_t state)
static gboolean display_changed(DBusConnection *conn,
DBusMessage *message, void *user_data)
{
DBG("");
struct ofono_modem *modem = user_data;
DBusMessageIter iter;
const char *value;
@@ -377,6 +380,7 @@ static gboolean display_changed(DBusConnection *conn,
static void mce_connect(DBusConnection *conn, void *user_data)
{
DBG("");
signal_watch = g_dbus_add_signal_watch(conn,
MCE_SERVICE, NULL,
MCE_SIGNAL_IF,
@@ -387,20 +391,25 @@ static void mce_connect(DBusConnection *conn, void *user_data)
static void mce_disconnect(DBusConnection *conn, void *user_data)
{
DBG("");
g_dbus_remove_watch(conn, signal_watch);
signal_watch = 0;
}
static void ril_connected(struct ril_msg *message, gpointer user_data)
{
DBG("");
struct ofono_modem *modem = (struct ofono_modem *) user_data;
struct ril_data *ril = ofono_modem_get_data(modem);
int ril_version = 0;
struct parcel rilp;
/* TODO: make conditional */
ofono_debug("[UNSOL]< %s", ril_unsol_request_to_string(message->req));
/* TODO: make conditional */
ril_util_init_parcel(message, &rilp);
ril_version = parcel_r_int32(&rilp);
ofono_debug("[UNSOL]< %s, RIL_VERSION %d",
ril_unsol_request_to_string(message->req), ril_version);
/* TODO: need a disconnect function to restart things! */
ril->connected = TRUE;
send_get_sim_status(modem);
@@ -412,6 +421,7 @@ static void ril_connected(struct ril_msg *message, gpointer user_data)
static gboolean ril_re_init(gpointer user_data)
{
DBG("");
if (reconnecting) {
ril_init();
return TRUE;
@@ -467,7 +477,7 @@ void ril_switchUser()
static int ril_enable(struct ofono_modem *modem)
{
DBG("enter");
DBG("%p", modem);
struct ril_data *ril = ofono_modem_get_data(modem);
ril->have_sim = FALSE;
@@ -510,17 +520,18 @@ static int ril_enable(struct ofono_modem *modem)
static int ril_disable(struct ofono_modem *modem)
{
DBG("%p", modem);
struct ril_data *ril = ofono_modem_get_data(modem);
struct parcel rilp;
int request = RIL_REQUEST_RADIO_POWER;
guint ret;
DBG("%p", modem);
parcel_init(&rilp);
parcel_w_int32(&rilp, 1); /* size of array */
parcel_w_int32(&rilp, 0); /* POWER=OFF */
ofono_info("RIL_REQUEST_RADIO_POWER OFF");
/* fire and forget i.e. not waiting for the callback*/
ret = g_ril_send(ril->modem, request, rilp.data,
rilp.size, NULL, NULL, NULL);
@@ -530,6 +541,10 @@ static int ril_disable(struct ofono_modem *modem)
parcel_free(&rilp);
/* this will trigger the cleanup of g_io_channel */
g_ril_unref(ril->modem);
ril->modem = NULL;
return 0;
}
@@ -564,7 +579,7 @@ static struct ofono_modem_driver ril_driver = {
*/
static int ril_init(void)
{
DBG("enter");
DBG("");
int retval = 0;
struct ofono_modem *modem;

View File

@@ -411,9 +411,12 @@ static void set_new_cond_list(struct ofono_call_forwarding *cf,
number = phone_number_to_string(
&lc->phone_number);
snprintf(attr, sizeof(attr), "%s%s",
bearer_class_to_string(lc->cls), cf_type_lut[i]);
ofono_dbus_signal_property_changed(conn, path,
OFONO_CALL_FORWARDING_INTERFACE,
cf_type_lut[i],
attr,
DBUS_TYPE_STRING, &number);
}

View File

@@ -58,6 +58,7 @@
#define MAX_CONTEXTS 256
#define SUSPEND_TIMEOUT 8
#define MAX_MMS_MTU 1280
#define MAX_GPRS_MTU 1280
/* 27.007 Section 7.29 */
enum packet_bearer {
@@ -909,6 +910,9 @@ static void pri_activate_callback(const struct ofono_error *error, void *data)
pri_context_signal_settings(ctx, gc->settings->ipv4 != NULL,
gc->settings->ipv6 != NULL);
if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET)
pri_limit_mtu(gc->settings->interface, MAX_GPRS_MTU);
}
value = ctx->active;
@@ -3134,3 +3138,8 @@ void *ofono_gprs_get_data(struct ofono_gprs *gprs)
{
return gprs->driver_data;
}
struct ofono_modem *ofono_gprs_get_modem(struct ofono_gprs *gprs)
{
return __ofono_atom_get_modem(gprs->atom);
}

View File

@@ -44,25 +44,34 @@
static GSList *g_drivers = NULL;
#define HANDSFREE_FLAG_CACHED 0x1
struct ofono_handsfree {
ofono_bool_t nrec;
ofono_bool_t inband_ringing;
ofono_bool_t voice_recognition;
ofono_bool_t voice_recognition_pending;
unsigned int ag_features;
unsigned int ag_chld_features;
unsigned char battchg;
GSList *subscriber_numbers;
const struct ofono_handsfree_driver *driver;
void *driver_data;
struct ofono_atom *atom;
DBusMessage *pending;
int flags;
};
static const char **ag_features_list(unsigned int features)
static const char **ag_features_list(unsigned int features,
unsigned int chld_features)
{
static const char *list[33];
static const char *list[10];
unsigned int i = 0;
if (features & HFP_AG_FEATURE_3WAY)
list[i++] = "three-way-calling";
if (features & HFP_AG_FEATURE_ECNR)
list[i++] = "echo-canceling-and-noise-reduction";
@@ -72,6 +81,21 @@ static const char **ag_features_list(unsigned int features)
if (features & HFP_AG_FEATURE_ATTACH_VOICE_TAG)
list[i++] = "attach-voice-tag";
if (chld_features & HFP_AG_CHLD_0)
list[i++] = "release-all-held";
if (chld_features & HFP_AG_CHLD_1x)
list[i++] = "release-specified-active-call";
if (chld_features & HFP_AG_CHLD_2x)
list[i++] = "private-chat";
if (chld_features & HFP_AG_CHLD_3)
list[i++] = "create-multiparty";
if (chld_features & HFP_AG_CHLD_4)
list[i++] = "transfer";
list[i] = NULL;
return list;
@@ -125,6 +149,15 @@ void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
hf->ag_features = ag_features;
}
void ofono_handsfree_set_ag_chld_features(struct ofono_handsfree *hf,
unsigned int ag_chld_features)
{
if (hf == NULL)
return;
hf->ag_chld_features = ag_chld_features;
}
void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
unsigned char level)
{
@@ -148,10 +181,44 @@ void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
&level);
}
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
static void append_subscriber_numbers(GSList *subscriber_numbers,
DBusMessageIter *iter)
{
DBusMessageIter entry;
DBusMessageIter variant, array;
GSList *l;
const char *subscriber_number_string;
char arraysig[3];
const char *key = "SubscriberNumbers";
arraysig[0] = DBUS_TYPE_ARRAY;
arraysig[1] = DBUS_TYPE_STRING;
arraysig[2] = '\0';
dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY,
NULL, &entry);
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
&key);
dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
arraysig, &variant);
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &array);
for (l = subscriber_numbers; l; l = l->next) {
subscriber_number_string = phone_number_to_string(l->data);
dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING,
&subscriber_number_string);
}
dbus_message_iter_close_container(&variant, &array);
dbus_message_iter_close_container(&entry, &variant);
dbus_message_iter_close_container(iter, &entry);
}
static DBusMessage *generate_get_properties_reply(struct ofono_handsfree *hf,
DBusMessage *msg)
{
struct ofono_handsfree *hf = data;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
@@ -181,18 +248,90 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
&voice_recognition);
features = ag_features_list(hf->ag_features);
features = ag_features_list(hf->ag_features, hf->ag_chld_features);
ofono_dbus_dict_append_array(&dict, "Features", DBUS_TYPE_STRING,
&features);
ofono_dbus_dict_append(&dict, "BatteryChargeLevel", DBUS_TYPE_BYTE,
&hf->battchg);
if (hf->subscriber_numbers)
append_subscriber_numbers(hf->subscriber_numbers, &dict);
dbus_message_iter_close_container(&iter, &dict);
return reply;
}
static void hf_cnum_callback(const struct ofono_error *error, int total,
const struct ofono_phone_number *numbers,
void *data)
{
struct ofono_handsfree *hf = data;
int num;
struct ofono_phone_number *subscriber_number;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
goto out;
for (num = 0; num < total; num++) {
subscriber_number = g_new0(struct ofono_phone_number, 1);
subscriber_number->type = numbers[num].type;
strncpy(subscriber_number->number, numbers[num].number,
OFONO_MAX_PHONE_NUMBER_LENGTH + 1);
hf->subscriber_numbers = g_slist_prepend(hf->subscriber_numbers,
subscriber_number);
}
hf->subscriber_numbers = g_slist_reverse(hf->subscriber_numbers);
out:
hf->flags |= HANDSFREE_FLAG_CACHED;
if (hf->pending) {
DBusMessage *reply =
generate_get_properties_reply(hf, hf->pending);
__ofono_dbus_pending_reply(&hf->pending, reply);
}
}
static void query_cnum(struct ofono_handsfree *hf)
{
DBusMessage *reply;
if (hf->driver->cnum_query != NULL) {
hf->driver->cnum_query(hf, hf_cnum_callback, hf);
return;
}
if (hf->pending == NULL)
return;
reply = generate_get_properties_reply(hf, hf->pending);
__ofono_dbus_pending_reply(&hf->pending, reply);
}
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_handsfree *hf = data;
if (hf->pending != NULL)
return __ofono_error_busy(msg);
if (hf->flags & HANDSFREE_FLAG_CACHED)
return generate_get_properties_reply(hf, msg);
/* Query the settings and report back */
hf->pending = dbus_message_ref(msg);
query_cnum(hf);
return NULL;
}
static void voicerec_set_cb(const struct ofono_error *error, void *data)
{
struct ofono_handsfree *hf = data;
@@ -424,6 +563,10 @@ static void handsfree_unregister(struct ofono_atom *atom)
__ofono_dbus_pending_reply(&hf->pending, reply);
}
g_slist_foreach(hf->subscriber_numbers, (GFunc) g_free, NULL);
g_slist_free(hf->subscriber_numbers);
hf->subscriber_numbers = NULL;
ofono_modem_remove_interface(modem, OFONO_HANDSFREE_INTERFACE);
g_dbus_unregister_interface(conn, path,
OFONO_HANDSFREE_INTERFACE);

View File

@@ -45,6 +45,17 @@ enum hfp_hf_feature {
HFP_HF_FEATURE_CODEC_NEGOTIATION = 0x80,
};
/* HFP AG supported call hold and multiparty services bitmap. Bluetooth HFP 1.6 spec page 76 */
enum hfp_ag_chld_feature {
HFP_AG_CHLD_0 = 0x1,
HFP_AG_CHLD_1 = 0x2,
HFP_AG_CHLD_1x = 0x4,
HFP_AG_CHLD_2 = 0x8,
HFP_AG_CHLD_2x = 0x10,
HFP_AG_CHLD_3 = 0x20,
HFP_AG_CHLD_4 = 0x40,
};
enum hfp_sdp_hf_features {
HFP_SDP_HF_FEATURE_ECNR = 0x1,
HFP_SDP_HF_FEATURE_3WAY = 0x2,

View File

@@ -135,7 +135,7 @@ void idmap_put(struct idmap *idmap, unsigned int id)
id %= BITS_PER_LONG;
idmap->bits[offset] &= ~(1 << id);
idmap->bits[offset] &= ~(1UL << id);
}
unsigned int idmap_alloc(struct idmap *idmap)
@@ -149,7 +149,7 @@ unsigned int idmap_alloc(struct idmap *idmap)
return idmap->max + 1;
offset = bit / BITS_PER_LONG;
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
return bit + idmap->min;
}
@@ -163,7 +163,7 @@ void idmap_take(struct idmap *idmap, unsigned int id)
return;
offset = bit / BITS_PER_LONG;
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
}
/*
@@ -186,7 +186,7 @@ unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
return idmap_alloc(idmap);
offset = bit / BITS_PER_LONG;
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
return bit + idmap->min;
}

View File

@@ -414,7 +414,9 @@ static void flush_atoms(struct ofono_modem *modem, enum modem_state new_state)
while (cur) {
struct ofono_atom *atom = cur->data;
if (atom->modem_state <= new_state) {
/* in case we are powering off the modem, flush everything */
if (atom->modem_state <= new_state &&
new_state > MODEM_STATE_POWER_OFF) {
prev = cur;
cur = cur->next;
continue;

View File

@@ -3561,7 +3561,7 @@ GSList *sms_text_prepare_with_alphabet(const char *to, const char *utf8,
if (gsm_encoded == NULL) {
gsize converted;
ucs2_encoded = g_convert(utf8, -1, "UCS-2BE//TRANSLIT", "UTF-8",
ucs2_encoded = g_convert(utf8, -1, "UTF-16BE//TRANSLIT", "UTF-8",
NULL, &converted, NULL);
written = converted;
}

View File

@@ -1502,6 +1502,19 @@ static void manager_dial_callback(const struct ofono_error *error, void *data)
if (is_emergency_number(vc, number) == TRUE)
__ofono_modem_dec_emergency_mode(modem);
if (vc->settings) {
/*Save the last dialled number for HFP AT+BLDN*/
if (number) {
g_key_file_set_string(vc->settings,
SETTINGS_GROUP,
"Number", number);
storage_sync(vc->imsi, SETTINGS_STORE,
vc->settings);
}
}
reply = __ofono_error_failed(vc->pending);
}
@@ -1545,12 +1558,6 @@ static int voicecall_dial(struct ofono_voicecall *vc, const char *number,
string_to_phone_number(number, &ph);
if (vc->settings) {
g_key_file_set_string(vc->settings, SETTINGS_GROUP,
"Number", number);
storage_sync(vc->imsi, SETTINGS_STORE, vc->settings);
}
vc->driver->dial(vc, &ph, clir, cb, vc);
return 0;
@@ -2317,6 +2324,19 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
voicecall_emit_disconnect_reason(call, reason);
number = phone_number_to_string(&call->call->phone_number);
if (vc->settings) {
/*Save the last dialled number for HFP AT+BLDN*/
if (call->call->direction == CALL_DIRECTION_MOBILE_ORIGINATED
&& number) {
g_key_file_set_string(vc->settings, SETTINGS_GROUP,
"Number", number);
storage_sync(vc->imsi, SETTINGS_STORE, vc->settings);
}
}
if (is_emergency_number(vc, number) == TRUE)
__ofono_modem_dec_emergency_mode(modem);
@@ -2428,6 +2448,21 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,
return;
error:
if (vc->settings) {
/*Save the last dialled number for HFP AT+BLDN*/
if (call->direction == CALL_DIRECTION_MOBILE_ORIGINATED
&& call->phone_number.number) {
const char *number =
phone_number_to_string(&call->phone_number);
g_key_file_set_string(vc->settings, SETTINGS_GROUP,
"Number", number);
storage_sync(vc->imsi, SETTINGS_STORE, vc->settings);
}
}
if (newcall)
g_free(newcall);

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
if (len(contexts) == 0):
print "No context available"
print("No context available")
sys.exit(1)
connman.SetProperty("Powered", dbus.Boolean(1))
@@ -35,6 +35,6 @@ for path, properties in modems:
try:
context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e))
except dbus.DBusException as e:
print("Error activating %s: %s" % (path, str(e)))
exit(2)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "incoming":
continue

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
@@ -12,23 +12,23 @@ def answer_call(path):
'org.ofono.VoiceCall')
time.sleep(2)
call.Answer()
print " Voice Call [ %s ] Answered" % (path)
print(" Voice Call [ %s ] Answered" % (path))
def voicecalls_call_added(path, properties):
print " Voice Call [ %s ] Added" % (path)
print(" Voice Call [ %s ] Added" % (path))
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print
print(" %s = %s" % (key, val))
print()
state = properties["State"]
if state == "incoming":
answer_call(path)
def voicecalls_call_removed(path):
print " Voice Call [ %s ] Removed" % (path)
print
print(" Voice Call [ %s ] Removed" % (path))
print()
if __name__ == "__main__":
global vcmanager
@@ -43,7 +43,7 @@ if __name__ == "__main__":
modems = manager.GetModems()
modem = modems[0][0]
print "Using modem %s" % modem
print("Using modem %s" % modem)
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager')
@@ -52,6 +52,6 @@ if __name__ == "__main__":
vcmanager.connect_to_signal("CallRemoved", voicecalls_call_removed)
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import re
@@ -6,7 +6,7 @@ import sys
import subprocess
if (len(sys.argv) < 3):
print "Usage: %s [binary] [log]" % (sys.argv[0])
print("Usage: %s [binary] [log]" % (sys.argv[0]))
sys.exit(1)
binary = sys.argv[1]
@@ -50,8 +50,8 @@ child_stdout.close()
frame_count = len(frames);
count = 0
print "-------- backtrace --------"
print("-------- backtrace --------")
while count < frame_count:
print "[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1])
print("[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1]))
count = count + 2
print "---------------------------"
print("---------------------------")

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -21,7 +21,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties()
state = properties["State"]
print "State: %s" % (state)
print("State: %s" % (state))
if state != "idle":
ussd.Cancel()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Disconnecting CDMA Packet Data Service on modem %s..." % path
print("Disconnecting CDMA Packet Data Service on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Connecting CDMA Packet Data Service on modem %s..." % path
print("Connecting CDMA Packet Data Service on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -16,7 +16,7 @@ else:
path, properties = modems[0]
number = sys.argv[1]
print "Using modem %s" % path
print("Using modem %s" % path)
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.VoiceCallManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,4 +22,4 @@ for path, properties in modems:
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,12 +17,12 @@ for path, properties in modems:
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.ConnectionManager')
print "Connecting CDMA Packet Data Service on modem %s..." % path
print("Connecting CDMA Packet Data Service on modem %s..." % path)
if len(sys.argv) > 1:
cm.SetProperty("Username", (sys.argv[1]))
print "Setting Username to %s" % (sys.argv[1])
print("Setting Username to %s" % (sys.argv[1]))
if len(sys.argv) > 2:
cm.SetProperty("Password", (sys.argv[2]))
print "Setting Password to %s" % (sys.argv[2])
print("Setting Password to %s" % (sys.argv[2]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -19,10 +19,10 @@ elif len(sys.argv) == 3:
old_pin = sys.argv[2]
new_pin = sys.argv[3]
else:
print "%s [PATH] pin_type old_pin new_pin" % (sys.argv[0])
print("%s [PATH] pin_type old_pin new_pin" % (sys.argv[0]))
sys.exit(0)
print "Change %s for modem %s..." % (pin_type, path)
print("Change %s for modem %s..." % (pin_type, path))
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -27,21 +27,21 @@ for path, properties in modems:
if path == "":
path = connman.AddContext("internet")
print "Created new context %s" % (path)
print("Created new context %s" % (path))
else:
print "Found context %s" % (path)
print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext')
if len(sys.argv) > 1:
context.SetProperty("AccessPointName", sys.argv[1])
print "Setting APN to %s" % (sys.argv[1])
print("Setting APN to %s" % (sys.argv[1]))
if len(sys.argv) > 2:
context.SetProperty("Username", sys.argv[2])
print "Setting username to %s" % (sys.argv[2])
print("Setting username to %s" % (sys.argv[2]))
if len(sys.argv) > 3:
context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3])
print("Setting password to %s" % (sys.argv[3]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -27,21 +27,21 @@ for path, properties in modems:
if path == "":
path = connman.AddContext("mms")
print "Created new context %s" % (path)
print("Created new context %s" % (path))
else:
print "Found context %s" % (path)
print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext')
if len(sys.argv) > 1:
context.SetProperty("AccessPointName", sys.argv[1])
print "Setting APN to %s" % (sys.argv[1])
print("Setting APN to %s" % (sys.argv[1]))
if len(sys.argv) > 2:
context.SetProperty("Username", sys.argv[2])
print "Setting username to %s" % (sys.argv[2])
print("Setting username to %s" % (sys.argv[2]))
if len(sys.argv) > 3:
context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3])
print("Setting password to %s" % (sys.argv[3]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -21,4 +21,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.CreateMultiparty()
for path in mpty:
print path
print(path)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
if (len(contexts) == 0):
print "No context available"
print("No context available")
sys.exit(1)
if len(sys.argv) > 1:
@@ -33,6 +33,6 @@ for path, properties in modems:
try:
context.SetProperty("Active", dbus.Boolean(0))
except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e))
except dbus.DBusException as e:
print("Error activating %s: %s" % (path, str(e)))
exit(2)

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if (len(sys.argv) < 2):
print "Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0])
print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -32,11 +32,11 @@ else:
number = sys.argv[2]
hide_callerid = sys.argv[3]
print "Using modem %s" % modem
print("Using modem %s" % modem)
vcm = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager')
path = vcm.Dial(number, hide_callerid)
print path
print(path)

View File

@@ -1,24 +1,24 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
if len(value.__str__()) > 0:
print "CF property %s changed to %s" % (property, value)
print("CF property %s changed to %s" % (property, value))
else:
print "CF property %s changed to disabled" % (property)
print("CF property %s changed to disabled" % (property))
if canexit:
mainloop.quit();
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Usage: %s <type>" % (sys.argv[0])
print "Type can be: all, conditional"
print("Usage: %s <type>" % (sys.argv[0]))
print("Type can be: all, conditional")
sys.exit(1)
canexit = False
@@ -41,13 +41,13 @@ if __name__ == "__main__":
try:
cf.DisableAll(type, timeout = 100)
except dbus.DBusException, e:
print "Unable to DisableAll", e
except dbus.DBusException as e:
print("Unable to DisableAll %s" % e)
sys.exit(1);
print "DisableAll successful"
print("DisableAll successful")
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Disconnecting GPRS on modem %s..." % path
print("Disconnecting GPRS on modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Disconnecting modem %s..." % path
print("Disconnecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if (len(sys.argv) < 2):
print "Usage: %s [modem] icon_id" % (sys.argv[0])
print("Usage: %s [modem] icon_id" % (sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -21,7 +21,7 @@ elif (len(sys.argv) == 3):
modem = sys.argv[1]
icon = sys.argv[2]
print "Using modem %s" % modem
print("Using modem %s" % modem)
sim = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
devices = manager.GetDevices()
path = devices[0][0]
print "Connect device %s..." % path
print("Connect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
devices = manager.GetDevices()
path = devices[0][0]
print "Disconnect device %s..." % path
print("Disconnect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Enabling cell broadcast on modem %s..." % path
print("Enabling cell broadcast on modem %s..." % path)
cbs = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CellBroadcast')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Connecting modem %s..." % path
print("Connecting modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Connecting modem %s..." % path
print("Connecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
print("%s [PATH] pin_type pin" % (sys.argv[0]))
sys.exit(0)
print "Enter Pin for modem %s..." % path
print("Enter Pin for modem %s..." % path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -8,7 +8,7 @@ bus = dbus.SystemBus()
if len(sys.argv) == 2:
id = sys.argv[1]
else:
print "%s <icon id>" % (sys.argv[0])
print("%s <icon id>" % (sys.argv[0]))
sys.exit(0)
manager = dbus.Interface(bus.get_object("org.ofono", "/"),
@@ -28,4 +28,4 @@ icon = sim.GetIcon(dbus.Byte(int(sys.argv[1])))
xpm = ""
for byte in icon:
xpm += str(byte)
print xpm
print(xpm)

View File

@@ -1,9 +1,9 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -66,4 +66,4 @@ net_time = dbus.Interface(bus.get_object('org.ofono', path),
time = net_time.GetNetworkTime()
print pretty(time)
print(pretty(time))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -22,7 +22,7 @@ for entry in operators:
path = entry[0]
properties = entry[1]
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -31,7 +31,7 @@ for entry in operators:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -17,4 +17,4 @@ radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
properties = radiosettings.GetProperties()
print "Technology preference: %s" % (properties["TechnologyPreference"])
print("Technology preference: %s" % (properties["TechnologyPreference"]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -18,7 +18,7 @@ calls = manager.GetCalls()
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "active":
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -6,7 +6,7 @@ import dbus
bus = dbus.SystemBus()
if (len(sys.argv) < 2):
print "Usage: %s [ Call Path ]" % (sys.argv[0])
print("Usage: %s [ Call Path ]" % (sys.argv[0]))
sys.exit(1)
call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if (len(sys.argv) < 2):
print "Usage: %s [modem] <ussd-string>" % (sys.argv[0])
print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -27,7 +27,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties()
state = properties["State"]
print "State: %s" % (state)
print("State: %s" % (state))
if state != "idle":
sys.exit(1);
@@ -37,22 +37,22 @@ result = ussd.Initiate(ussdstring, timeout=100)
properties = ussd.GetProperties()
state = properties["State"]
print result[0] + ": " + result[1]
print(result[0] + ": " + result[1])
if state == "idle":
sys.exit(0)
print "State: %s" % (state)
print("State: %s" % (state))
while state == "user-response":
response = raw_input("Enter response: ")
response = input("Enter response: ")
result = ussd.Respond(response, timeout=100)
properties = ussd.GetProperties()
state = properties["State"]
print result
print(result)
if state != "idle":
print "State: %s" % (state)
print("State: %s" % (state))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -21,11 +21,11 @@ for path, properties in modems:
calls = mgr.GetCalls()
for path, properties in calls:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key == 'Icon':
print " %s = %d" % (key, properties[key])
print(" %s = %d" % (key, properties[key]))
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
continue
@@ -21,7 +21,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
for path, properties in contexts:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key in ["Settings"] or key in ["IPv6.Settings"]:
@@ -39,6 +39,6 @@ for path, properties in modems:
val += " }"
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.MessageManager" not in properties["Interfaces"]:
continue
@@ -21,10 +21,10 @@ for path, properties in modems:
contexts = connman.GetMessages()
for path, properties in contexts:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Interfaces", "Features"]:
@@ -19,13 +19,13 @@ for path, properties in modems:
val += i + " "
else:
val = properties[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
for interface in properties["Interfaces"]:
object = dbus.Interface(bus.get_object('org.ofono', path),
interface)
print " [ %s ]" % (interface)
print(" [ %s ]" % (interface))
try:
properties = object.GetProperties()
@@ -77,6 +77,6 @@ for path, properties in modems:
val += " }"
else:
val = properties[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -11,7 +11,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
continue
@@ -25,7 +25,7 @@ for path, properties in modems:
operators = netreg.GetOperators()
for path, properties in operators:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -34,6 +34,6 @@ for path, properties in modems:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
print("%s [PATH] pin_type pin" % (sys.argv[0]))
sys.exit(0)
print "Lock %s %s for modem %s..." % (pin_type, pin, path)
print("Lock %s %s for modem %s..." % (pin_type, pin, path))
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,13 +13,13 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Locking and disconnecting modem %s..." % path
print("Locking and disconnecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')
modem.SetProperty("Lockdown", dbus.Boolean(1))
print "press ENTER to unlock the modem %s" % path
print("press ENTER to unlock the modem %s" % path)
sys.stdin.readline()
modem.SetProperty("Lockdown", dbus.Boolean(0))

View File

@@ -1,12 +1,12 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -52,32 +52,32 @@ def pretty(d):
def property_changed(name, value, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
def added(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
def removed(name, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, member, name)
print("{%s} [%s] %s" % (iface, member, name))
def event(member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, path, member)
print("{%s} [%s] %s" % (iface, path, member))
def message(msg, args, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
str(msg), pretty(args))
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
str(msg), pretty(args)))
def ussd(msg, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(msg))
print("{%s} [%s] %s %s" % (iface, path, member, str(msg)))
def value(value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(value))
print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -105,5 +105,5 @@ if __name__ == '__main__':
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,12 +1,12 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -55,32 +55,32 @@ def pretty(d):
def property_changed(name, value, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
def added(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
def removed(name, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, name, member)
print("{%s} [%s] %s" % (iface, name, member))
def event(member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, path, member)
print("{%s} [%s] %s" % (iface, path, member))
def message(msg, args, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
msg, pretty(args))
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
msg, pretty(args)))
def ussd(msg, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, msg)
print("{%s} [%s] %s %s" % (iface, path, member, msg))
def value(value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, path, member, str(value))
print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -150,5 +150,5 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -12,6 +12,6 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Setting modem %s offline..." % path
print("Setting modem %s offline..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
modem.SetProperty("Online", dbus.Boolean(0), timeout = 120)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -12,6 +12,6 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Setting modem %s online..." % path
print("Setting modem %s online..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -23,4 +23,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.PrivateChat(callid, timeout=100)
for path in mpty:
print path
print(path)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import dbus
@@ -23,7 +23,7 @@ for path, properties in modems:
if properties["Active"] == dbus.Boolean(0):
continue
print "Configuring %s" % (path)
print("Configuring %s" % (path))
settings = properties["Settings"]
@@ -35,20 +35,20 @@ for path, properties in modems:
gateway = "0.0.0.0";
if settings["Method"] == "dhcp":
print " Run DHCP on interface %s" % (interface)
print(" Run DHCP on interface %s" % (interface))
else:
print " Interface is %s" % (interface)
print " IP address is %s" % (address)
print " Gateway is %s" % (gateway)
print(" Interface is %s" % (interface))
print(" IP address is %s" % (address))
print(" Gateway is %s" % (gateway))
cmd = "ifconfig " + interface + " " + address
cmd += " netmask 255.255.255.255"
os.system(cmd);
for i in settings["DomainNameServers"]:
print " Nameserver is %s" % (i)
print(" Nameserver is %s" % (i))
cmd = "route add -host " + i
cmd +=" dev " + interface
os.system(cmd);
print
print('')

View File

@@ -1,16 +1,16 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def incoming_message(message, details, path, interface):
print "%s" % (message)
print("%s" % (message))
for key in details:
val = details[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -29,5 +29,5 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "incoming":
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -20,4 +20,4 @@ for path, properties in modems:
for path, properties in contexts:
connman.RemoveContext(path)
print"Removed: [ %s ]" % (path)
print("Removed: [ %s ]" % (path))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -14,9 +14,9 @@ elif len(sys.argv) == 4:
path = modems[0][0]
puk_type, puk, pin = sys.argv[1:]
else:
print "%s [PATH] puk_type puk pin" % (sys.argv[0])
print("%s [PATH] puk_type puk pin" % (sys.argv[0]))
print "Reset pin for modem %s..." % path
print("Reset pin for modem %s..." % path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Scanning operators on modem %s..." % path
print("Scanning operators on modem %s..." % path)
netreg = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.NetworkRegistration')
@@ -23,7 +23,7 @@ for entry in operators:
path = entry[0]
properties = entry[1]
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -32,7 +32,7 @@ for entry in operators:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,11 +1,11 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 4:
print "Usage: %s [modem] <to> <message> <delivery report>" %\
(sys.argv[0])
print("Usage: %s [modem] <to> <message> <delivery report>" %\
(sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -18,7 +18,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Send message using modem %s ..." % path
print("Send message using modem %s ..." % path)
mm = dbus.Interface(bus.get_object('org.ofono', path),
@@ -31,4 +31,4 @@ else:
mm.SetProperty("UseDeliveryReports", dbus.Boolean(int(sys.argv[3])))
path = mm.SendMessage(sys.argv[1], sys.argv[2])
print path
print(path)

Some files were not shown because too many files have changed in this diff Show More