Merge lp:~phablet-team/ofono/mvno-oem-py3-changes into lp:~phablet-team/ofono/ubuntu

Proposed by Tony Espy
Status: Merged
Merged at revision: 6855
Proposed branch: lp:~phablet-team/ofono/mvno-oem-py3-changes
Merge into: lp:~phablet-team/ofono/ubuntu
Prerequisite: lp:~phablet-team/ofono/ofono-mwi-and-bugs
Diff against target: 4891 lines (+1374/-894)
104 files modified
.gitignore (+1/-0)
Makefile.am (+5/-1)
debian/changelog (+21/-3)
debian/control (+3/-3)
gril/gril.c (+11/-28)
gril/gril.h (+2/-2)
gril/grilunsol.c (+13/-7)
plugins/ril.c (+3/-1)
src/gprs.c (+7/-0)
src/network.c (+32/-2)
src/simutil.c (+16/-7)
test/activate-context (+4/-4)
test/answer-calls (+3/-3)
test/backtrace (+5/-5)
test/cancel-ussd (+2/-2)
test/cdma-connman-disable (+2/-2)
test/cdma-connman-enable (+2/-2)
test/cdma-dial-number (+2/-2)
test/cdma-hangup (+1/-1)
test/cdma-list-call (+3/-3)
test/cdma-set-credentials (+4/-4)
test/change-pin (+3/-3)
test/create-internet-context (+6/-6)
test/create-mms-context (+6/-6)
test/create-multiparty (+2/-2)
test/deactivate-all (+1/-1)
test/deactivate-context (+4/-4)
test/dial-number (+4/-4)
test/disable-call-forwarding (+10/-10)
test/disable-gprs (+2/-2)
test/disable-modem (+2/-2)
test/dundee-connect (+2/-2)
test/dundee-disconnect (+2/-2)
test/enable-cbs (+2/-2)
test/enable-gprs (+2/-2)
test/enable-modem (+2/-2)
test/enter-pin (+3/-3)
test/get-icon (+3/-3)
test/get-operators (+4/-4)
test/get-tech-preference (+2/-2)
test/hangup-active (+2/-2)
test/hangup-all (+1/-1)
test/hangup-call (+2/-2)
test/hangup-multiparty (+1/-1)
test/hold-and-answer (+1/-1)
test/initiate-ussd (+8/-8)
test/list-calls (+5/-5)
test/list-contexts (+5/-5)
test/list-messages (+5/-5)
test/list-modems (+6/-6)
test/list-operators (+5/-5)
test/lock-pin (+3/-3)
test/lockdown-modem (+3/-3)
test/monitor-dundee (+12/-12)
test/monitor-ofono (+12/-12)
test/offline-modem (+2/-2)
test/online-modem (+2/-2)
test/private-chat (+2/-2)
test/process-context-settings (+8/-8)
test/receive-sms (+5/-5)
test/reject-calls (+3/-3)
test/release-and-answer (+2/-2)
test/release-and-swap (+2/-2)
test/remove-contexts (+2/-2)
test/reset-pin (+3/-3)
test/rilmodem/test-hangup (+97/-0)
test/rilmodem/test-modem-offline (+52/-0)
test/rilmodem/test-sim-online (+266/-0)
test/scan-for-operators (+4/-4)
test/send-sms (+4/-4)
test/send-ussd (+8/-8)
test/send-vcal (+3/-3)
test/send-vcard (+3/-3)
test/set-call-forwarding (+13/-13)
test/set-cbs-topics (+2/-2)
test/set-context-property (+5/-5)
test/set-fast-dormancy (+2/-2)
test/set-gsm-band (+2/-2)
test/set-mms-details (+4/-4)
test/set-roaming-allowed (+1/-1)
test/set-tech-preference (+2/-2)
test/set-tty (+2/-2)
test/set-umts-band (+2/-2)
test/set-use-sms-reports (+2/-2)
test/test-advice-of-charge (+20/-20)
test/test-call-barring (+18/-18)
test/test-call-forwarding (+39/-39)
test/test-call-settings (+27/-27)
test/test-cbs (+57/-56)
test/test-gnss (+27/-26)
test/test-message-waiting (+11/-11)
test/test-modem (+36/-36)
test/test-network-registration (+19/-19)
test/test-phonebook (+1/-1)
test/test-push-notification (+6/-6)
test/test-smart-messaging (+10/-10)
test/test-sms (+66/-65)
test/test-ss (+9/-9)
test/test-ss-control-cb (+58/-58)
test/test-ss-control-cf (+18/-18)
test/test-ss-control-cs (+83/-83)
test/test-stk-menu (+80/-80)
test/unlock-pin (+2/-2)
unit/test-simutil.c (+7/-5)
To merge this branch: bzr merge lp:~phablet-team/ofono/mvno-oem-py3-changes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+208864@code.launchpad.net

Commit message

  * debian/control: adjust ofono-scripts dependencies for Python 3
  * plugins/ril, src/gprs.c,network.c,simutil.c: fix MVNO roaming
    Many MVNOs store their home networks in EF_SPDI. This
    was used correctly for displaying operator name, however
    some modems failed to handle roaming correctly for MVNOs.
    This fix is transparent to modems that do the right thing.
  * gril/gril.c, plugins/ril.c: API changes for OEMS
    This change introduces a socket-path to the g_ril_new()
    function, and also adds a new disconnect function.
  * gril/grilunsol.c: add support for v5 signal strength message
  * test: convert tests scripts to Python 3 (LP: #1283571)

Description of the change

This merge includes the following changes from our github auto-import tree:

1. MVNO Roaming Fix - some modems don't properly handle roaming when a MVNO SIM is used. This change should be transparent for modems that work correctly. AFAIK, the only way to test is to use a very specific MVNO SIM and a device with a semi-broken rild implementation. So, my best advice to you is to test normal scenarios and make sure there's been no regressions.

2. OEM preparation - minor change to gril API so that a socket path can be passed in when creating a new gril impl. Again, should be transparent. If this doesn't work, nothing else will...

3. Python3 changes - all of the ofono test scripts have been ported to Python3. They are not longer Python 2 compatible.

This merge has been tested on a mako running image #194.

To post a comment you must log in.
Revision history for this message
Tony Espy (awe) wrote :

One annoying thing I noticed is that I get the following error for the python scripts during build:

python-script-but-no-python-dep

however the control file does have python deps for ofono-scripts.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
6855. By Tony Espy

debian/control: adjust ofono-scripts dependencies for Python 3

6856. By Tony Espy

test/rilmodem: add copyright/license headers

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.gitignore'
2--- .gitignore 2013-11-19 11:18:44 +0000
3+++ .gitignore 2014-02-28 20:44:46 +0000
4@@ -46,6 +46,7 @@
5 unit/test-grilreply
6 unit/test-grilrequest
7 unit/test-grilunsol
8+unit/test-mnclength
9
10 tools/huawei-audio
11 tools/auto-enable
12
13=== modified file 'Makefile.am'
14--- Makefile.am 2014-01-08 20:15:24 +0000
15+++ Makefile.am 2014-02-28 20:44:46 +0000
16@@ -681,7 +681,11 @@
17 test/release-and-swap \
18 test/hold-and-answer \
19 test/hangup-multiparty \
20- test/hangup-call
21+ test/hangup-call \
22+ test/rilmodem/test-hangup \
23+ test/rilmodem/test-modem-offline \
24+ test/rilmodem/test-sim-online
25+
26
27 if TEST
28 testdir = $(pkglibdir)/test
29
30=== modified file 'debian/changelog'
31--- debian/changelog 2014-02-28 20:44:46 +0000
32+++ debian/changelog 2014-02-28 20:44:46 +0000
33@@ -9,20 +9,38 @@
34 systems via an ifdef, which leaves unused functions
35 and data. This change exends the ifdef to cover
36 the unused functions and test data.
37- * gril, rilmodem/sim, unit: fix SIM IO crash (LP: #1268743)
38+ * gril, rilmodem/sim, unit: fix SIM IO crash (LP: #1268743)
39 - cleanup gril_reply_parse_sim_io() to add malformed parcel
40 check and fix memory leak.
41 - add check for null hex_response in ril_file_io_cb(), as
42 the emulator can return such responses.
43 - add additional unit tests to cover crash scenarios.
44- * ril, src: enable message-waiting-interface
45+ * ril, src: enable message-waiting-interface
46 - register message_waiting atom in ril plugin
47 - fix sms_mwi_dcs_decode bug which prevented incoming message
48 waiting indications from being set.
49- * rilmodem/voicecall: fix call-decline bug (LP: #1260988)
50+ * rilmodem/voicecall: fix call-decline bug (LP: #1260988)
51 Send a RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND instead of
52 RIL_REQUEST_HANGUP for incoming calls.
53
54+ [ Alfonso Sanchez-Beato ]
55+ * plugins/ril, src/gprs.c,network.c,simutil.c: fix MVNO roaming
56+ Many MVNOs store their home networks in EF_SPDI. This
57+ was used correctly for displaying operator name, however
58+ some modems failed to handle roaming correctly for MVNOs.
59+ This fix is transparent to modems that do the right thing.
60+ * gril/gril.c, plugins/ril.c: API changes for OEMS
61+ This change introduces a socket-path to the g_ril_new()
62+ function, and also adds a new disconnect function.
63+ * gril/grilunsol.c: add support for v5 signal strength message
64+
65+ [ Martin Pitt ]
66+ * test: convert tests scripts to Python 3 (LP: #1283571)
67+
68+ [ Tony Espy ]
69+ * debian/control: adjust ofono-scripts dependencies for Python 3
70+ * test/rilmodem: add copyright/license headers
71+
72 -- Tony Espy <espy@canonical.com> Tue, 21 Jan 2014 13:54:46 -0500
73
74 ofono (1.12+bzr6851-0ubuntu1) trusty; urgency=low
75
76=== modified file 'debian/control'
77--- debian/control 2013-10-02 15:34:41 +0000
78+++ debian/control 2014-02-28 20:44:46 +0000
79@@ -77,9 +77,9 @@
80 Depends: ${shlibs:Depends},
81 ${misc:Depends},
82 ofono (>= ${source:Version}),
83- python,
84- python-dbus,
85- python-gobject-2,
86+ python3,
87+ python-dbus,
88+ python3-gi
89 Description: Mobile telephony stack (test and maintenance script files)
90 oFono is a stack for mobile telephony devices on Linux. oFono supports
91 speaking to telephony devices through specific drivers, or with generic
92
93=== modified file 'gril/gril.c'
94--- gril/gril.c 2013-12-18 20:02:51 +0000
95+++ gril/gril.c 2014-02-28 20:44:46 +0000
96@@ -51,9 +51,6 @@
97 #define COMMAND_FLAG_EXPECT_PDU 0x1
98 #define COMMAND_FLAG_EXPECT_SHORT_PROMPT 0x2
99
100-#define RILD_CMD_SOCKET "/dev/socket/rild"
101-#define RILD_DBG_SOCKET "/dev/socket/rild-debug"
102-
103 struct ril_request {
104 gchar *data;
105 guint data_len;
106@@ -93,7 +90,6 @@
107 GRilDisconnectFunc user_disconnect; /* user disconnect func */
108 gpointer user_disconnect_data; /* user disconnect data */
109 guint read_so_far; /* Number of bytes processed */
110- gboolean connected; /* RIL_UNSOL_CONNECTED rvcd */
111 gboolean suspended; /* Are we suspended? */
112 GRilDebugFunc debugf; /* debugging output function */
113 gpointer debug_data; /* Data to pass to debug func */
114@@ -294,8 +290,6 @@
115 g_queue_free(p->out_queue);
116 p->out_queue = NULL;
117
118- p->connected = FALSE;
119-
120 /* Cleanup registered notifications */
121 if (p->notify_list)
122 g_hash_table_destroy(p->notify_list);
123@@ -308,6 +302,13 @@
124 }
125 }
126
127+void g_ril_set_disconnect_function(GRil *ril, GRilDisconnectFunc disconnect,
128+ gpointer user_data)
129+{
130+ ril->parent->user_disconnect = disconnect;
131+ ril->parent->user_disconnect_data = user_data;
132+}
133+
134 static void io_disconnect(gpointer user_data)
135 {
136 struct ril_s *ril = user_data;
137@@ -396,9 +397,6 @@
138
139 g_hash_table_iter_init(&iter, p->notify_list);
140
141- if (message->req == RIL_UNSOL_RIL_CONNECTED)
142- p->connected = TRUE;
143-
144 while (g_hash_table_iter_next(&iter, &key, &value)) {
145 req_key = *((int *)key);
146 notify = value;
147@@ -767,7 +765,7 @@
148 return FALSE;
149 }
150
151-static struct ril_s *create_ril()
152+static struct ril_s *create_ril(const char *sock_path)
153
154 {
155 struct ril_s *ril;
156@@ -786,7 +784,6 @@
157 ril->debugf = NULL;
158 ril->req_bytes_written = 0;
159 ril->trace = FALSE;
160- ril->connected = FALSE;
161
162 sk = socket(AF_UNIX, SOCK_STREAM, 0);
163 if (sk < 0) {
164@@ -797,7 +794,7 @@
165
166 memset(&addr, 0, sizeof(addr));
167 addr.sun_family = AF_UNIX;
168- strncpy(addr.sun_path, RILD_CMD_SOCKET, sizeof(addr.sun_path) - 1);
169+ strncpy(addr.sun_path, sock_path, sizeof(addr.sun_path) - 1);
170
171 if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
172 ofono_error("create_ril: can't connect to RILD: %s (%d)\n",
173@@ -913,7 +910,6 @@
174 {
175 struct ril_notify *notify;
176 struct ril_notify_node *node;
177- struct ril_msg message;
178
179 if (ril->notify_list == NULL)
180 return 0;
181@@ -940,19 +936,6 @@
182
183 notify->nodes = g_slist_prepend(notify->nodes, node);
184
185- if ((req == RIL_UNSOL_RIL_CONNECTED) && (ril->connected == TRUE)) {
186- /* fire the callback in a timer, as it won't ever fire */
187- DBG("CONNECTED already received... ");
188-
189- message.req = RIL_UNSOL_RIL_CONNECTED;
190- message.unsolicited = TRUE;
191- message.buf_len = 0;
192- message.buf = NULL;
193-
194- func(&message, user_data);
195- }
196-
197-
198 return node->id;
199 }
200
201@@ -1011,7 +994,7 @@
202 rilp->malformed = 0;
203 }
204
205-GRil *g_ril_new()
206+GRil *g_ril_new(const char *sock_path)
207 {
208 GRil *ril;
209
210@@ -1019,7 +1002,7 @@
211 if (ril == NULL)
212 return NULL;
213
214- ril->parent = create_ril();
215+ ril->parent = create_ril(sock_path);
216 if (ril->parent == NULL) {
217 g_free(ril);
218 return NULL;
219
220=== modified file 'gril/gril.h'
221--- gril/gril.h 2013-12-09 17:09:20 +0000
222+++ gril/gril.h 2014-02-28 20:44:46 +0000
223@@ -93,7 +93,7 @@
224
225 void g_ril_init_parcel(const struct ril_msg *message, struct parcel *rilp);
226
227-GRil *g_ril_new();
228+GRil *g_ril_new(const char *sock_path);
229
230 GIOChannel *g_ril_get_channel(GRil *ril);
231 GRilIO *g_ril_get_io(GRil *ril);
232@@ -103,7 +103,7 @@
233
234 GRil *g_ril_clone(GRil *ril);
235
236-gboolean g_ril_set_disconnect_function(GRil *ril, GRilDisconnectFunc disconnect,
237+void g_ril_set_disconnect_function(GRil *ril, GRilDisconnectFunc disconnect,
238 gpointer user_data);
239
240 gboolean g_ril_get_trace(GRil *ril);
241
242=== modified file 'gril/grilunsol.c'
243--- gril/grilunsol.c 2014-01-08 08:32:56 +0000
244+++ gril/grilunsol.c 2014-02-28 20:44:46 +0000
245@@ -264,6 +264,7 @@
246
247 return radio_state;
248 }
249+
250 int g_ril_unsol_parse_signal_strength(GRil *gril, const struct ril_msg *message)
251 {
252 struct parcel rilp;
253@@ -271,7 +272,7 @@
254
255 g_ril_init_parcel(message, &rilp);
256
257- /* RIL_SignalStrength_v6 */
258+ /* RIL_SignalStrength_v5 */
259 /* GW_SignalStrength */
260 gw_signal = parcel_r_int32(&rilp);
261 parcel_r_int32(&rilp); /* bitErrorRate */
262@@ -285,12 +286,17 @@
263 parcel_r_int32(&rilp); /* ecio */
264 parcel_r_int32(&rilp); /* signalNoiseRatio */
265
266- /* LTE_SignalStrength */
267- lte_signal = parcel_r_int32(&rilp);
268- parcel_r_int32(&rilp); /* rsrp */
269- parcel_r_int32(&rilp); /* rsrq */
270- parcel_r_int32(&rilp); /* rssnr */
271- parcel_r_int32(&rilp); /* cqi */
272+ /* Present only for RIL_SignalStrength_v6 or newer */
273+ if (parcel_data_avail(&rilp) > 0) {
274+ /* LTE_SignalStrength */
275+ lte_signal = parcel_r_int32(&rilp);
276+ parcel_r_int32(&rilp); /* rsrp */
277+ parcel_r_int32(&rilp); /* rsrq */
278+ parcel_r_int32(&rilp); /* rssnr */
279+ parcel_r_int32(&rilp); /* cqi */
280+ } else {
281+ lte_signal = -1;
282+ }
283
284 g_ril_append_print_buf(gril, "(gw: %d, cdma: %d, evdo: %d, lte: %d)",
285 gw_signal, cdma_dbm, evdo_dbm, lte_signal);
286
287=== modified file 'plugins/ril.c'
288--- plugins/ril.c 2014-02-28 20:44:46 +0000
289+++ plugins/ril.c 2014-02-28 20:44:46 +0000
290@@ -65,6 +65,8 @@
291
292 #define MAX_SIM_STATUS_RETRIES 15
293
294+#define RILD_CMD_SOCKET "/dev/socket/rild"
295+
296 struct ril_data {
297 GRil *modem;
298 int sim_status_retries;
299@@ -366,7 +368,7 @@
300
301 DBG("");
302
303- ril->modem = g_ril_new();
304+ ril->modem = g_ril_new(RILD_CMD_SOCKET);
305
306 /* NOTE: Since AT modems open a tty, and then call
307 * g_at_chat_new(), they're able to return -EIO if
308
309=== modified file 'src/gprs.c'
310--- src/gprs.c 2013-11-15 23:15:52 +0000
311+++ src/gprs.c 2014-02-28 20:44:46 +0000
312@@ -2112,6 +2112,13 @@
313 {
314 DBG("%s status %d", __ofono_atom_get_path(gprs->atom), status);
315
316+ if (status == NETWORK_REGISTRATION_STATUS_ROAMING &&
317+ ofono_netreg_get_status(gprs->netreg) ==
318+ NETWORK_REGISTRATION_STATUS_REGISTERED) {
319+ DBG("MVNO: roaming -> registered");
320+ status = NETWORK_REGISTRATION_STATUS_REGISTERED;
321+ }
322+
323 gprs->status = status;
324
325 if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
326
327=== modified file 'src/network.c'
328--- src/network.c 2013-11-15 23:15:52 +0000
329+++ src/network.c 2014-02-28 20:44:46 +0000
330@@ -117,6 +117,20 @@
331 return "unknown";
332 }
333
334+static int get_display_status(struct ofono_netreg *netreg, int status)
335+{
336+ struct network_operator_data *opd = netreg->current_operator;
337+
338+ /* Networks in EF_SPDI are equivalent to a home network */
339+ if (status == NETWORK_REGISTRATION_STATUS_ROAMING && opd != NULL &&
340+ sim_spdi_lookup(netreg->spdi, opd->mcc, opd->mnc)) {
341+ DBG("mcc+mnc found in SPDI, roaming -> registered");
342+ status = NETWORK_REGISTRATION_STATUS_REGISTERED;
343+ }
344+
345+ return status;
346+}
347+
348 static char **network_operator_technologies(struct network_operator_data *opd)
349 {
350 unsigned int ntechs = 0;
351@@ -1038,11 +1052,14 @@
352
353 static void set_registration_status(struct ofono_netreg *netreg, int status)
354 {
355- const char *str_status = registration_status_to_string(status);
356+ const char *str_status;
357 const char *path = __ofono_atom_get_path(netreg->atom);
358 DBusConnection *conn = ofono_dbus_get_connection();
359
360- netreg->status = status;
361+ /* Status depends also on SIM files */
362+ netreg->status = get_display_status(netreg, status);
363+
364+ str_status = registration_status_to_string(netreg->status);
365
366 ofono_dbus_signal_property_changed(conn, path,
367 OFONO_NETWORK_REGISTRATION_INTERFACE,
368@@ -1296,6 +1313,9 @@
369 }
370 }
371
372+ /* Registration status might be affected for MVNOs */
373+ set_registration_status(netreg, netreg->status);
374+
375 notify_status_watches(netreg);
376 }
377
378@@ -1643,7 +1663,17 @@
379 netreg->current_operator->mnc))
380 return;
381
382+ /*
383+ * SPDI contents affect the displayed operator AND whether we consider
384+ * that we are roaming or not.
385+ */
386+
387 netreg_emit_operator_display_name(netreg);
388+
389+ /* Registration status might be affected for MVNOs */
390+ set_registration_status(netreg, netreg->status);
391+
392+ notify_status_watches(netreg);
393 }
394
395 static void sim_spn_display_condition_parse(struct ofono_netreg *netreg,
396
397=== modified file 'src/simutil.c'
398--- src/simutil.c 2012-11-25 14:34:41 +0000
399+++ src/simutil.c 2014-02-28 20:44:46 +0000
400@@ -767,12 +767,14 @@
401 gboolean *add_ci)
402 {
403 char *ret = NULL;
404- unsigned char *endp;
405 unsigned char dcs;
406 int i;
407 gboolean ci = FALSE;
408+ unsigned char *unpacked_buf;
409+ long num_char, written;
410+ int spare_bits;
411
412- if (length < 1)
413+ if (length < 2)
414 return NULL;
415
416 dcs = *buffer++;
417@@ -787,11 +789,18 @@
418
419 switch (dcs & (7 << 4)) {
420 case 0x00:
421- endp = memchr(buffer, 0xff, length);
422- if (endp)
423- length = endp - buffer;
424- ret = convert_gsm_to_utf8(buffer, length,
425- NULL, NULL, 0xff);
426+ spare_bits = dcs & 0x07;
427+ num_char = (length * 8 - spare_bits) / 7;
428+
429+ unpacked_buf = unpack_7bit(buffer, length, 0, FALSE,
430+ num_char, &written, 0);
431+ if (unpacked_buf == NULL)
432+ break;
433+
434+ ret = convert_gsm_to_utf8(unpacked_buf, written, NULL, NULL, 0);
435+
436+ g_free(unpacked_buf);
437+
438 break;
439 case 0x10:
440 if ((length % 2) == 1) {
441
442=== modified file 'test/activate-context'
443--- test/activate-context 2011-07-24 23:49:06 +0000
444+++ test/activate-context 2014-02-28 20:44:46 +0000
445@@ -1,4 +1,4 @@
446-#!/usr/bin/python
447+#!/usr/bin/python3
448
449 import sys
450 import dbus
451@@ -20,7 +20,7 @@
452 contexts = connman.GetContexts()
453
454 if (len(contexts) == 0):
455- print "No context available"
456+ print("No context available")
457 sys.exit(1)
458
459 connman.SetProperty("Powered", dbus.Boolean(1))
460@@ -35,6 +35,6 @@
461
462 try:
463 context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
464- except dbus.DBusException, e:
465- print "Error activating %s: %s" % (path, str(e))
466+ except dbus.DBusException as e:
467+ print("Error activating %s: %s" % (path, str(e)))
468 exit(2)
469
470=== modified file 'test/answer-calls'
471--- test/answer-calls 2010-09-26 14:25:20 +0000
472+++ test/answer-calls 2014-02-28 20:44:46 +0000
473@@ -1,4 +1,4 @@
474-#!/usr/bin/python
475+#!/usr/bin/python3
476
477 import dbus
478
479@@ -10,7 +10,7 @@
480 modems = manager.GetModems()
481
482 for path, properties in modems:
483- print "[ %s ]" % (path)
484+ print("[ %s ]" % (path))
485
486 if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
487 continue
488@@ -22,7 +22,7 @@
489
490 for path, properties in calls:
491 state = properties["State"]
492- print "[ %s ] %s" % (path, state)
493+ print("[ %s ] %s" % (path, state))
494
495 if state != "incoming":
496 continue
497
498=== modified file 'test/backtrace'
499--- test/backtrace 2010-08-20 12:44:54 +0000
500+++ test/backtrace 2014-02-28 20:44:46 +0000
501@@ -1,4 +1,4 @@
502-#!/usr/bin/python
503+#!/usr/bin/python3
504
505 import os
506 import re
507@@ -6,7 +6,7 @@
508 import subprocess
509
510 if (len(sys.argv) < 3):
511- print "Usage: %s [binary] [log]" % (sys.argv[0])
512+ print("Usage: %s [binary] [log]" % (sys.argv[0]))
513 sys.exit(1)
514
515 binary = sys.argv[1]
516@@ -50,8 +50,8 @@
517 frame_count = len(frames);
518
519 count = 0
520-print "-------- backtrace --------"
521+print("-------- backtrace --------")
522 while count < frame_count:
523- print "[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1])
524+ print("[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1]))
525 count = count + 2
526-print "---------------------------"
527+print("---------------------------")
528
529=== modified file 'test/cancel-ussd'
530--- test/cancel-ussd 2011-06-06 20:09:08 +0000
531+++ test/cancel-ussd 2014-02-28 20:44:46 +0000
532@@ -1,4 +1,4 @@
533-#!/usr/bin/python
534+#!/usr/bin/python3
535
536 import sys
537 import dbus
538@@ -21,7 +21,7 @@
539 properties = ussd.GetProperties()
540 state = properties["State"]
541
542-print "State: %s" % (state)
543+print("State: %s" % (state))
544
545 if state != "idle":
546 ussd.Cancel()
547
548=== modified file 'test/cdma-connman-disable'
549--- test/cdma-connman-disable 2011-03-17 19:18:56 +0000
550+++ test/cdma-connman-disable 2014-02-28 20:44:46 +0000
551@@ -1,4 +1,4 @@
552-#!/usr/bin/python
553+#!/usr/bin/python3
554
555 import dbus
556 import sys
557@@ -13,7 +13,7 @@
558 modems = manager.GetModems()
559 path = modems[0][0]
560
561-print "Disconnecting CDMA Packet Data Service on modem %s..." % path
562+print("Disconnecting CDMA Packet Data Service on modem %s..." % path)
563 cm = dbus.Interface(bus.get_object('org.ofono', path),
564 'org.ofono.cdma.ConnectionManager')
565
566
567=== modified file 'test/cdma-connman-enable'
568--- test/cdma-connman-enable 2011-03-17 19:18:56 +0000
569+++ test/cdma-connman-enable 2014-02-28 20:44:46 +0000
570@@ -1,4 +1,4 @@
571-#!/usr/bin/python
572+#!/usr/bin/python3
573
574 import dbus
575 import sys
576@@ -13,7 +13,7 @@
577 modems = manager.GetModems()
578 path = modems[0][0]
579
580-print "Connecting CDMA Packet Data Service on modem %s..." % path
581+print("Connecting CDMA Packet Data Service on modem %s..." % path)
582 cm = dbus.Interface(bus.get_object('org.ofono', path),
583 'org.ofono.cdma.ConnectionManager')
584
585
586=== modified file 'test/cdma-dial-number'
587--- test/cdma-dial-number 2011-01-13 22:07:12 +0000
588+++ test/cdma-dial-number 2014-02-28 20:44:46 +0000
589@@ -1,4 +1,4 @@
590-#!/usr/bin/python
591+#!/usr/bin/python3
592
593 import sys
594 import dbus
595@@ -16,7 +16,7 @@
596 path, properties = modems[0]
597 number = sys.argv[1]
598
599-print "Using modem %s" % path
600+print("Using modem %s" % path)
601
602 manager = dbus.Interface(bus.get_object('org.ofono', path),
603 'org.ofono.cdma.VoiceCallManager')
604
605=== modified file 'test/cdma-hangup'
606--- test/cdma-hangup 2011-01-13 22:07:12 +0000
607+++ test/cdma-hangup 2014-02-28 20:44:46 +0000
608@@ -1,4 +1,4 @@
609-#!/usr/bin/python
610+#!/usr/bin/python3
611
612 import sys
613 import dbus
614
615=== modified file 'test/cdma-list-call'
616--- test/cdma-list-call 2011-01-13 22:07:12 +0000
617+++ test/cdma-list-call 2014-02-28 20:44:46 +0000
618@@ -1,4 +1,4 @@
619-#!/usr/bin/python
620+#!/usr/bin/python3
621
622 import dbus
623
624@@ -10,7 +10,7 @@
625 modems = manager.GetModems()
626
627 for path, properties in modems:
628- print "[ %s ]" % (path)
629+ print("[ %s ]" % (path))
630
631 if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
632 continue
633@@ -22,4 +22,4 @@
634
635 for key in properties.keys():
636 val = str(properties[key])
637- print " %s = %s" % (key, val)
638+ print(" %s = %s" % (key, val))
639
640=== modified file 'test/cdma-set-credentials'
641--- test/cdma-set-credentials 2011-07-27 14:32:55 +0000
642+++ test/cdma-set-credentials 2014-02-28 20:44:46 +0000
643@@ -1,4 +1,4 @@
644-#!/usr/bin/python
645+#!/usr/bin/python3
646
647 import dbus
648 import sys
649@@ -17,12 +17,12 @@
650 cm = dbus.Interface(bus.get_object('org.ofono', path),
651 'org.ofono.cdma.ConnectionManager')
652
653- print "Connecting CDMA Packet Data Service on modem %s..." % path
654+ print("Connecting CDMA Packet Data Service on modem %s..." % path)
655
656 if len(sys.argv) > 1:
657 cm.SetProperty("Username", (sys.argv[1]))
658- print "Setting Username to %s" % (sys.argv[1])
659+ print("Setting Username to %s" % (sys.argv[1]))
660
661 if len(sys.argv) > 2:
662 cm.SetProperty("Password", (sys.argv[2]))
663- print "Setting Password to %s" % (sys.argv[2])
664+ print("Setting Password to %s" % (sys.argv[2]))
665
666=== modified file 'test/change-pin'
667--- test/change-pin 2012-06-19 17:19:23 +0000
668+++ test/change-pin 2014-02-28 20:44:46 +0000
669@@ -1,4 +1,4 @@
670-#!/usr/bin/python
671+#!/usr/bin/python3
672
673 import dbus
674 import sys
675@@ -19,10 +19,10 @@
676 old_pin = sys.argv[2]
677 new_pin = sys.argv[3]
678 else:
679- print "%s [PATH] pin_type old_pin new_pin" % (sys.argv[0])
680+ print("%s [PATH] pin_type old_pin new_pin" % (sys.argv[0]))
681 sys.exit(0)
682
683-print "Change %s for modem %s..." % (pin_type, path)
684+print("Change %s for modem %s..." % (pin_type, path))
685
686 simmanager = dbus.Interface(bus.get_object('org.ofono', path),
687 'org.ofono.SimManager')
688
689=== modified file 'test/create-internet-context'
690--- test/create-internet-context 2010-10-26 20:25:09 +0000
691+++ test/create-internet-context 2014-02-28 20:44:46 +0000
692@@ -1,4 +1,4 @@
693-#!/usr/bin/python
694+#!/usr/bin/python3
695
696 import sys
697 import dbus
698@@ -27,21 +27,21 @@
699
700 if path == "":
701 path = connman.AddContext("internet")
702- print "Created new context %s" % (path)
703+ print("Created new context %s" % (path))
704 else:
705- print "Found context %s" % (path)
706+ print("Found context %s" % (path))
707
708 context = dbus.Interface(bus.get_object('org.ofono', path),
709 'org.ofono.ConnectionContext')
710
711 if len(sys.argv) > 1:
712 context.SetProperty("AccessPointName", sys.argv[1])
713- print "Setting APN to %s" % (sys.argv[1])
714+ print("Setting APN to %s" % (sys.argv[1]))
715
716 if len(sys.argv) > 2:
717 context.SetProperty("Username", sys.argv[2])
718- print "Setting username to %s" % (sys.argv[2])
719+ print("Setting username to %s" % (sys.argv[2]))
720
721 if len(sys.argv) > 3:
722 context.SetProperty("Password", sys.argv[3])
723- print "Setting password to %s" % (sys.argv[3])
724+ print("Setting password to %s" % (sys.argv[3]))
725
726=== modified file 'test/create-mms-context'
727--- test/create-mms-context 2010-10-26 20:25:09 +0000
728+++ test/create-mms-context 2014-02-28 20:44:46 +0000
729@@ -1,4 +1,4 @@
730-#!/usr/bin/python
731+#!/usr/bin/python3
732
733 import sys
734 import dbus
735@@ -27,21 +27,21 @@
736
737 if path == "":
738 path = connman.AddContext("mms")
739- print "Created new context %s" % (path)
740+ print("Created new context %s" % (path))
741 else:
742- print "Found context %s" % (path)
743+ print("Found context %s" % (path))
744
745 context = dbus.Interface(bus.get_object('org.ofono', path),
746 'org.ofono.ConnectionContext')
747
748 if len(sys.argv) > 1:
749 context.SetProperty("AccessPointName", sys.argv[1])
750- print "Setting APN to %s" % (sys.argv[1])
751+ print("Setting APN to %s" % (sys.argv[1]))
752
753 if len(sys.argv) > 2:
754 context.SetProperty("Username", sys.argv[2])
755- print "Setting username to %s" % (sys.argv[2])
756+ print("Setting username to %s" % (sys.argv[2]))
757
758 if len(sys.argv) > 3:
759 context.SetProperty("Password", sys.argv[3])
760- print "Setting password to %s" % (sys.argv[3])
761+ print("Setting password to %s" % (sys.argv[3]))
762
763=== modified file 'test/create-multiparty'
764--- test/create-multiparty 2010-09-09 19:38:14 +0000
765+++ test/create-multiparty 2014-02-28 20:44:46 +0000
766@@ -1,4 +1,4 @@
767-#!/usr/bin/python
768+#!/usr/bin/python3
769
770 import sys
771 import dbus
772@@ -18,4 +18,4 @@
773 mpty = manager.CreateMultiparty()
774
775 for path in mpty:
776- print path
777+ print(path)
778
779=== modified file 'test/deactivate-all'
780--- test/deactivate-all 2010-10-25 21:32:49 +0000
781+++ test/deactivate-all 2014-02-28 20:44:46 +0000
782@@ -1,4 +1,4 @@
783-#!/usr/bin/python
784+#!/usr/bin/python3
785
786 import sys
787 import dbus
788
789=== modified file 'test/deactivate-context'
790--- test/deactivate-context 2010-10-21 19:46:32 +0000
791+++ test/deactivate-context 2014-02-28 20:44:46 +0000
792@@ -1,4 +1,4 @@
793-#!/usr/bin/python
794+#!/usr/bin/python3
795
796 import sys
797 import dbus
798@@ -20,7 +20,7 @@
799 contexts = connman.GetContexts()
800
801 if (len(contexts) == 0):
802- print "No context available"
803+ print("No context available")
804 sys.exit(1)
805
806 if len(sys.argv) > 1:
807@@ -33,6 +33,6 @@
808
809 try:
810 context.SetProperty("Active", dbus.Boolean(0))
811- except dbus.DBusException, e:
812- print "Error activating %s: %s" % (path, str(e))
813+ except dbus.DBusException as e:
814+ print("Error activating %s: %s" % (path, str(e)))
815 exit(2)
816
817=== modified file 'test/dial-number'
818--- test/dial-number 2011-03-14 14:24:59 +0000
819+++ test/dial-number 2014-02-28 20:44:46 +0000
820@@ -1,10 +1,10 @@
821-#!/usr/bin/python
822+#!/usr/bin/python3
823
824 import sys
825 import dbus
826
827 if (len(sys.argv) < 2):
828- print "Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0])
829+ print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
830 sys.exit(1)
831
832 bus = dbus.SystemBus()
833@@ -32,11 +32,11 @@
834 number = sys.argv[2]
835 hide_callerid = sys.argv[3]
836
837-print "Using modem %s" % modem
838+print("Using modem %s" % modem)
839
840 vcm = dbus.Interface(bus.get_object('org.ofono', modem),
841 'org.ofono.VoiceCallManager')
842
843 path = vcm.Dial(number, hide_callerid)
844
845-print path
846+print(path)
847
848=== modified file 'test/disable-call-forwarding'
849--- test/disable-call-forwarding 2011-01-14 10:30:37 +0000
850+++ test/disable-call-forwarding 2014-02-28 20:44:46 +0000
851@@ -1,24 +1,24 @@
852-#!/usr/bin/python
853+#!/usr/bin/python3
854
855 import sys
856-import gobject
857+from gi.repository import GLib
858
859 import dbus
860 import dbus.mainloop.glib
861
862 def property_changed(property, value):
863 if len(value.__str__()) > 0:
864- print "CF property %s changed to %s" % (property, value)
865+ print("CF property %s changed to %s" % (property, value))
866 else:
867- print "CF property %s changed to disabled" % (property)
868+ print("CF property %s changed to disabled" % (property))
869
870 if canexit:
871 mainloop.quit();
872
873 if __name__ == "__main__":
874 if len(sys.argv) < 2:
875- print "Usage: %s <type>" % (sys.argv[0])
876- print "Type can be: all, conditional"
877+ print("Usage: %s <type>" % (sys.argv[0]))
878+ print("Type can be: all, conditional")
879 sys.exit(1)
880
881 canexit = False
882@@ -41,13 +41,13 @@
883
884 try:
885 cf.DisableAll(type, timeout = 100)
886- except dbus.DBusException, e:
887- print "Unable to DisableAll", e
888+ except dbus.DBusException as e:
889+ print("Unable to DisableAll %s" % e)
890 sys.exit(1);
891
892- print "DisableAll successful"
893+ print("DisableAll successful")
894
895 canexit = True
896
897- mainloop = gobject.MainLoop()
898+ mainloop = GLib.MainLoop()
899 mainloop.run()
900
901=== modified file 'test/disable-gprs'
902--- test/disable-gprs 2010-09-10 15:52:50 +0000
903+++ test/disable-gprs 2014-02-28 20:44:46 +0000
904@@ -1,4 +1,4 @@
905-#!/usr/bin/python
906+#!/usr/bin/python3
907
908 import dbus
909 import sys
910@@ -13,7 +13,7 @@
911 modems = manager.GetModems()
912 path = modems[0][0]
913
914-print "Disconnecting GPRS on modem %s..." % path
915+print("Disconnecting GPRS on modem %s..." % path)
916 cm = dbus.Interface(bus.get_object('org.ofono', path),
917 'org.ofono.ConnectionManager')
918
919
920=== modified file 'test/disable-modem'
921--- test/disable-modem 2011-08-07 14:36:34 +0000
922+++ test/disable-modem 2014-02-28 20:44:46 +0000
923@@ -1,4 +1,4 @@
924-#!/usr/bin/python
925+#!/usr/bin/python3
926
927 import dbus
928 import sys
929@@ -13,7 +13,7 @@
930 modems = manager.GetModems()
931 path = modems[0][0]
932
933-print "Disconnecting modem %s..." % path
934+print("Disconnecting modem %s..." % path)
935 modem = dbus.Interface(bus.get_object('org.ofono', path),
936 'org.ofono.Modem')
937
938
939=== modified file 'test/dundee-connect'
940--- test/dundee-connect 2012-05-22 16:44:46 +0000
941+++ test/dundee-connect 2014-02-28 20:44:46 +0000
942@@ -1,4 +1,4 @@
943-#!/usr/bin/python
944+#!/usr/bin/python3
945
946 import dbus
947 import sys
948@@ -13,7 +13,7 @@
949 devices = manager.GetDevices()
950 path = devices[0][0]
951
952-print "Connect device %s..." % path
953+print("Connect device %s..." % path)
954 device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
955 'org.ofono.dundee.Device')
956
957
958=== modified file 'test/dundee-disconnect'
959--- test/dundee-disconnect 2012-05-22 16:44:46 +0000
960+++ test/dundee-disconnect 2014-02-28 20:44:46 +0000
961@@ -1,4 +1,4 @@
962-#!/usr/bin/python
963+#!/usr/bin/python3
964
965 import dbus
966 import sys
967@@ -13,7 +13,7 @@
968 devices = manager.GetDevices()
969 path = devices[0][0]
970
971-print "Disonnect device %s..." % path
972+print("Disonnect device %s..." % path)
973 device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
974 'org.ofono.dundee.Device')
975
976
977=== modified file 'test/enable-cbs'
978--- test/enable-cbs 2010-09-09 19:38:14 +0000
979+++ test/enable-cbs 2014-02-28 20:44:46 +0000
980@@ -1,4 +1,4 @@
981-#!/usr/bin/python
982+#!/usr/bin/python3
983
984 import dbus
985 import sys
986@@ -13,7 +13,7 @@
987 modems = manager.GetModems()
988 path = modems[0][0]
989
990-print "Enabling cell broadcast on modem %s..." % path
991+print("Enabling cell broadcast on modem %s..." % path)
992 cbs = dbus.Interface(bus.get_object('org.ofono', path),
993 'org.ofono.CellBroadcast')
994
995
996=== modified file 'test/enable-gprs'
997--- test/enable-gprs 2010-09-10 15:52:50 +0000
998+++ test/enable-gprs 2014-02-28 20:44:46 +0000
999@@ -1,4 +1,4 @@
1000-#!/usr/bin/python
1001+#!/usr/bin/python3
1002
1003 import dbus
1004 import sys
1005@@ -13,7 +13,7 @@
1006 modems = manager.GetModems()
1007 path = modems[0][0]
1008
1009-print "Connecting modem %s..." % path
1010+print("Connecting modem %s..." % path)
1011 cm = dbus.Interface(bus.get_object('org.ofono', path),
1012 'org.ofono.ConnectionManager')
1013
1014
1015=== modified file 'test/enable-modem'
1016--- test/enable-modem 2011-08-07 14:36:34 +0000
1017+++ test/enable-modem 2014-02-28 20:44:46 +0000
1018@@ -1,4 +1,4 @@
1019-#!/usr/bin/python
1020+#!/usr/bin/python3
1021
1022 import dbus
1023 import sys
1024@@ -13,7 +13,7 @@
1025 modems = manager.GetModems()
1026 path = modems[0][0]
1027
1028-print "Connecting modem %s..." % path
1029+print("Connecting modem %s..." % path)
1030 modem = dbus.Interface(bus.get_object('org.ofono', path),
1031 'org.ofono.Modem')
1032
1033
1034=== modified file 'test/enter-pin'
1035--- test/enter-pin 2010-12-08 13:03:01 +0000
1036+++ test/enter-pin 2014-02-28 20:44:46 +0000
1037@@ -1,4 +1,4 @@
1038-#!/usr/bin/python
1039+#!/usr/bin/python3
1040
1041 import dbus
1042 import sys
1043@@ -17,10 +17,10 @@
1044 pin_type = sys.argv[1]
1045 pin = sys.argv[2]
1046 else:
1047- print "%s [PATH] pin_type pin" % (sys.argv[0])
1048+ print("%s [PATH] pin_type pin" % (sys.argv[0]))
1049 sys.exit(0)
1050
1051-print "Enter Pin for modem %s..." % path
1052+print("Enter Pin for modem %s..." % path)
1053 simmanager = dbus.Interface(bus.get_object('org.ofono', path),
1054 'org.ofono.SimManager')
1055
1056
1057=== modified file 'test/get-icon'
1058--- test/get-icon 2012-11-25 14:02:23 +0000
1059+++ test/get-icon 2014-02-28 20:44:46 +0000
1060@@ -1,4 +1,4 @@
1061-#!/usr/bin/python
1062+#!/usr/bin/python3
1063
1064 import dbus
1065 import sys
1066@@ -8,7 +8,7 @@
1067 if len(sys.argv) == 2:
1068 id = sys.argv[1]
1069 else:
1070- print "%s <icon id>" % (sys.argv[0])
1071+ print("%s <icon id>" % (sys.argv[0]))
1072 sys.exit(0)
1073
1074 manager = dbus.Interface(bus.get_object("org.ofono", "/"),
1075@@ -28,4 +28,4 @@
1076 xpm = ""
1077 for byte in icon:
1078 xpm += str(byte)
1079-print xpm
1080+print(xpm)
1081
1082=== modified file 'test/get-operators'
1083--- test/get-operators 2010-09-09 19:38:14 +0000
1084+++ test/get-operators 2014-02-28 20:44:46 +0000
1085@@ -1,4 +1,4 @@
1086-#!/usr/bin/python
1087+#!/usr/bin/python3
1088
1089 import dbus
1090 import sys
1091@@ -22,7 +22,7 @@
1092 path = entry[0]
1093 properties = entry[1]
1094
1095- print "[ %s ]" % (path)
1096+ print("[ %s ]" % (path))
1097
1098 for key in properties.keys():
1099 if key in ["Technologies"]:
1100@@ -31,7 +31,7 @@
1101 val += i + " "
1102 else:
1103 val = str(properties[key])
1104- print " %s = %s" % (key, val)
1105+ print(" %s = %s" % (key, val))
1106
1107- print
1108+ print()
1109
1110
1111=== modified file 'test/get-tech-preference'
1112--- test/get-tech-preference 2010-09-09 19:38:14 +0000
1113+++ test/get-tech-preference 2014-02-28 20:44:46 +0000
1114@@ -1,4 +1,4 @@
1115-#!/usr/bin/python
1116+#!/usr/bin/python3
1117
1118 import dbus, sys
1119
1120@@ -17,4 +17,4 @@
1121
1122 properties = radiosettings.GetProperties()
1123
1124-print "Technology preference: %s" % (properties["TechnologyPreference"])
1125+print("Technology preference: %s" % (properties["TechnologyPreference"]))
1126
1127=== modified file 'test/hangup-active'
1128--- test/hangup-active 2011-02-03 16:20:23 +0000
1129+++ test/hangup-active 2014-02-28 20:44:46 +0000
1130@@ -1,4 +1,4 @@
1131-#!/usr/bin/python
1132+#!/usr/bin/python3
1133
1134 import sys
1135 import dbus
1136@@ -18,7 +18,7 @@
1137
1138 for path, properties in calls:
1139 state = properties["State"]
1140- print "[ %s ] %s" % (path, state)
1141+ print("[ %s ] %s" % (path, state))
1142
1143 if state != "active":
1144 continue
1145
1146=== modified file 'test/hangup-all'
1147--- test/hangup-all 2011-03-14 14:25:52 +0000
1148+++ test/hangup-all 2014-02-28 20:44:46 +0000
1149@@ -1,4 +1,4 @@
1150-#!/usr/bin/python
1151+#!/usr/bin/python3
1152
1153 import sys
1154 import dbus
1155
1156=== modified file 'test/hangup-call'
1157--- test/hangup-call 2012-08-06 15:52:23 +0000
1158+++ test/hangup-call 2014-02-28 20:44:46 +0000
1159@@ -1,4 +1,4 @@
1160-#!/usr/bin/python
1161+#!/usr/bin/python3
1162
1163 import sys
1164 import dbus
1165@@ -6,7 +6,7 @@
1166 bus = dbus.SystemBus()
1167
1168 if (len(sys.argv) < 2):
1169- print "Usage: %s [ Call Path ]" % (sys.argv[0])
1170+ print("Usage: %s [ Call Path ]" % (sys.argv[0]))
1171 sys.exit(1)
1172
1173 call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),
1174
1175=== modified file 'test/hangup-multiparty'
1176--- test/hangup-multiparty 2012-08-03 16:56:34 +0000
1177+++ test/hangup-multiparty 2014-02-28 20:44:46 +0000
1178@@ -1,4 +1,4 @@
1179-#!/usr/bin/python
1180+#!/usr/bin/python3
1181
1182 import sys
1183 import dbus
1184
1185=== modified file 'test/hold-and-answer'
1186--- test/hold-and-answer 2012-08-02 19:23:34 +0000
1187+++ test/hold-and-answer 2014-02-28 20:44:46 +0000
1188@@ -1,4 +1,4 @@
1189-#!/usr/bin/python
1190+#!/usr/bin/python3
1191
1192 import sys
1193 import dbus
1194
1195=== modified file 'test/initiate-ussd'
1196--- test/initiate-ussd 2011-06-06 20:09:39 +0000
1197+++ test/initiate-ussd 2014-02-28 20:44:46 +0000
1198@@ -1,10 +1,10 @@
1199-#!/usr/bin/python
1200+#!/usr/bin/python3
1201
1202 import sys
1203 import dbus
1204
1205 if (len(sys.argv) < 2):
1206- print "Usage: %s [modem] <ussd-string>" % (sys.argv[0])
1207+ print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
1208 sys.exit(1)
1209
1210 bus = dbus.SystemBus()
1211@@ -27,7 +27,7 @@
1212 properties = ussd.GetProperties()
1213 state = properties["State"]
1214
1215-print "State: %s" % (state)
1216+print("State: %s" % (state))
1217
1218 if state != "idle":
1219 sys.exit(1);
1220@@ -37,22 +37,22 @@
1221 properties = ussd.GetProperties()
1222 state = properties["State"]
1223
1224-print result[0] + ": " + result[1]
1225+print(result[0] + ": " + result[1])
1226
1227 if state == "idle":
1228 sys.exit(0)
1229
1230-print "State: %s" % (state)
1231+print("State: %s" % (state))
1232
1233 while state == "user-response":
1234- response = raw_input("Enter response: ")
1235+ response = input("Enter response: ")
1236
1237 result = ussd.Respond(response, timeout=100)
1238
1239 properties = ussd.GetProperties()
1240 state = properties["State"]
1241
1242- print result
1243+ print(result)
1244
1245 if state != "idle":
1246- print "State: %s" % (state)
1247+ print("State: %s" % (state))
1248
1249=== modified file 'test/list-calls'
1250--- test/list-calls 2012-09-12 04:27:14 +0000
1251+++ test/list-calls 2014-02-28 20:44:46 +0000
1252@@ -1,4 +1,4 @@
1253-#!/usr/bin/python
1254+#!/usr/bin/python3
1255
1256 import dbus
1257
1258@@ -10,7 +10,7 @@
1259 modems = manager.GetModems()
1260
1261 for path, properties in modems:
1262- print "[ %s ]" % (path)
1263+ print("[ %s ]" % (path))
1264
1265 if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
1266 continue
1267@@ -21,11 +21,11 @@
1268 calls = mgr.GetCalls()
1269
1270 for path, properties in calls:
1271- print " [ %s ]" % (path)
1272+ print(" [ %s ]" % (path))
1273
1274 for key in properties.keys():
1275 if key == 'Icon':
1276- print " %s = %d" % (key, properties[key])
1277+ print(" %s = %d" % (key, properties[key]))
1278 else:
1279 val = str(properties[key])
1280- print " %s = %s" % (key, val)
1281+ print(" %s = %s" % (key, val))
1282
1283=== modified file 'test/list-contexts'
1284--- test/list-contexts 2011-03-15 22:11:59 +0000
1285+++ test/list-contexts 2014-02-28 20:44:46 +0000
1286@@ -1,4 +1,4 @@
1287-#!/usr/bin/python
1288+#!/usr/bin/python3
1289
1290 import dbus
1291
1292@@ -10,7 +10,7 @@
1293 modems = manager.GetModems()
1294
1295 for path, properties in modems:
1296- print "[ %s ]" % (path)
1297+ print("[ %s ]" % (path))
1298
1299 if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
1300 continue
1301@@ -21,7 +21,7 @@
1302 contexts = connman.GetContexts()
1303
1304 for path, properties in contexts:
1305- print " [ %s ]" % (path)
1306+ print(" [ %s ]" % (path))
1307
1308 for key in properties.keys():
1309 if key in ["Settings"] or key in ["IPv6.Settings"]:
1310@@ -39,6 +39,6 @@
1311 val += " }"
1312 else:
1313 val = str(properties[key])
1314- print " %s = %s" % (key, val)
1315+ print(" %s = %s" % (key, val))
1316
1317- print
1318+ print()
1319
1320=== modified file 'test/list-messages'
1321--- test/list-messages 2011-01-29 02:29:15 +0000
1322+++ test/list-messages 2014-02-28 20:44:46 +0000
1323@@ -1,4 +1,4 @@
1324-#!/usr/bin/python
1325+#!/usr/bin/python3
1326
1327 import dbus
1328
1329@@ -10,7 +10,7 @@
1330 modems = manager.GetModems()
1331
1332 for path, properties in modems:
1333- print "[ %s ]" % (path)
1334+ print("[ %s ]" % (path))
1335
1336 if "org.ofono.MessageManager" not in properties["Interfaces"]:
1337 continue
1338@@ -21,10 +21,10 @@
1339 contexts = connman.GetMessages()
1340
1341 for path, properties in contexts:
1342- print " [ %s ]" % (path)
1343+ print(" [ %s ]" % (path))
1344
1345 for key in properties.keys():
1346 val = str(properties[key])
1347- print " %s = %s" % (key, val)
1348+ print(" %s = %s" % (key, val))
1349
1350- print
1351+ print()
1352
1353=== modified file 'test/list-modems'
1354--- test/list-modems 2012-12-17 15:50:22 +0000
1355+++ test/list-modems 2014-02-28 20:44:46 +0000
1356@@ -1,4 +1,4 @@
1357-#!/usr/bin/python
1358+#!/usr/bin/python3
1359
1360 import dbus
1361
1362@@ -10,7 +10,7 @@
1363 modems = manager.GetModems()
1364
1365 for path, properties in modems:
1366- print "[ %s ]" % (path)
1367+ print("[ %s ]" % (path))
1368
1369 for key in properties.keys():
1370 if key in ["Interfaces", "Features"]:
1371@@ -19,13 +19,13 @@
1372 val += i + " "
1373 else:
1374 val = properties[key]
1375- print " %s = %s" % (key, val)
1376+ print(" %s = %s" % (key, val))
1377
1378 for interface in properties["Interfaces"]:
1379 object = dbus.Interface(bus.get_object('org.ofono', path),
1380 interface)
1381
1382- print " [ %s ]" % (interface)
1383+ print(" [ %s ]" % (interface))
1384
1385 try:
1386 properties = object.GetProperties()
1387@@ -77,6 +77,6 @@
1388 val += " }"
1389 else:
1390 val = properties[key]
1391- print " %s = %s" % (key, val)
1392+ print(" %s = %s" % (key, val))
1393
1394- print
1395+ print()
1396
1397=== modified file 'test/list-operators'
1398--- test/list-operators 2010-09-09 19:38:14 +0000
1399+++ test/list-operators 2014-02-28 20:44:46 +0000
1400@@ -1,4 +1,4 @@
1401-#!/usr/bin/python
1402+#!/usr/bin/python3
1403
1404 import dbus
1405 import sys
1406@@ -11,7 +11,7 @@
1407 modems = manager.GetModems()
1408
1409 for path, properties in modems:
1410- print "[ %s ]" % (path)
1411+ print("[ %s ]" % (path))
1412
1413 if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
1414 continue
1415@@ -25,7 +25,7 @@
1416 operators = netreg.GetOperators()
1417
1418 for path, properties in operators:
1419- print " [ %s ]" % (path)
1420+ print(" [ %s ]" % (path))
1421
1422 for key in properties.keys():
1423 if key in ["Technologies"]:
1424@@ -34,6 +34,6 @@
1425 val += i + " "
1426 else:
1427 val = str(properties[key])
1428- print " %s = %s" % (key, val)
1429+ print(" %s = %s" % (key, val))
1430
1431- print
1432+ print()
1433
1434=== modified file 'test/lock-pin'
1435--- test/lock-pin 2010-09-09 19:38:14 +0000
1436+++ test/lock-pin 2014-02-28 20:44:46 +0000
1437@@ -1,4 +1,4 @@
1438-#!/usr/bin/python
1439+#!/usr/bin/python3
1440
1441 import dbus
1442 import sys
1443@@ -17,10 +17,10 @@
1444 pin_type = sys.argv[1]
1445 pin = sys.argv[2]
1446 else:
1447- print "%s [PATH] pin_type pin" % (sys.argv[0])
1448+ print("%s [PATH] pin_type pin" % (sys.argv[0]))
1449 sys.exit(0)
1450
1451-print "Lock %s %s for modem %s..." % (pin_type, pin, path)
1452+print("Lock %s %s for modem %s..." % (pin_type, pin, path))
1453
1454 simmanager = dbus.Interface(bus.get_object('org.ofono', path),
1455 'org.ofono.SimManager')
1456
1457=== modified file 'test/lockdown-modem'
1458--- test/lockdown-modem 2010-12-22 19:37:38 +0000
1459+++ test/lockdown-modem 2014-02-28 20:44:46 +0000
1460@@ -1,4 +1,4 @@
1461-#!/usr/bin/python
1462+#!/usr/bin/python3
1463
1464 import dbus
1465 import sys
1466@@ -13,13 +13,13 @@
1467 modems = manager.GetModems()
1468 path = modems[0][0]
1469
1470-print "Locking and disconnecting modem %s..." % path
1471+print("Locking and disconnecting modem %s..." % path)
1472 modem = dbus.Interface(bus.get_object('org.ofono', path),
1473 'org.ofono.Modem')
1474
1475 modem.SetProperty("Lockdown", dbus.Boolean(1))
1476
1477-print "press ENTER to unlock the modem %s" % path
1478+print("press ENTER to unlock the modem %s" % path)
1479 sys.stdin.readline()
1480
1481 modem.SetProperty("Lockdown", dbus.Boolean(0))
1482
1483=== modified file 'test/monitor-dundee'
1484--- test/monitor-dundee 2012-05-22 16:44:46 +0000
1485+++ test/monitor-dundee 2014-02-28 20:44:46 +0000
1486@@ -1,12 +1,12 @@
1487-#!/usr/bin/python
1488+#!/usr/bin/python3
1489
1490-import gobject
1491+from gi.repository import GLib
1492
1493 import dbus
1494 import dbus.mainloop.glib
1495
1496 _dbus2py = {
1497- dbus.String : unicode,
1498+ dbus.String : str,
1499 dbus.UInt32 : int,
1500 dbus.Int32 : int,
1501 dbus.Int16 : int,
1502@@ -52,32 +52,32 @@
1503
1504 def property_changed(name, value, path, interface):
1505 iface = interface[interface.rfind(".") + 1:]
1506- print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
1507+ print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
1508
1509 def added(name, value, member, path, interface):
1510 iface = interface[interface.rfind(".") + 1:]
1511- print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
1512+ print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
1513
1514 def removed(name, member, path, interface):
1515 iface = interface[interface.rfind(".") + 1:]
1516- print "{%s} [%s] %s" % (iface, member, name)
1517+ print("{%s} [%s] %s" % (iface, member, name))
1518
1519 def event(member, path, interface):
1520 iface = interface[interface.rfind(".") + 1:]
1521- print "{%s} [%s] %s" % (iface, path, member)
1522+ print("{%s} [%s] %s" % (iface, path, member))
1523
1524 def message(msg, args, member, path, interface):
1525 iface = interface[interface.rfind(".") + 1:]
1526- print "{%s} [%s] %s %s (%s)" % (iface, path, member,
1527- str(msg), pretty(args))
1528+ print("{%s} [%s] %s %s (%s)" % (iface, path, member,
1529+ str(msg), pretty(args)))
1530
1531 def ussd(msg, member, path, interface):
1532 iface = interface[interface.rfind(".") + 1:]
1533- print "{%s} [%s] %s %s" % (iface, path, member, str(msg))
1534+ print("{%s} [%s] %s %s" % (iface, path, member, str(msg)))
1535
1536 def value(value, member, path, interface):
1537 iface = interface[interface.rfind(".") + 1:]
1538- print "{%s} [%s] %s %s" % (iface, path, member, str(value))
1539+ print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
1540
1541 if __name__ == '__main__':
1542 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1543@@ -105,5 +105,5 @@
1544 interface_keyword="interface")
1545
1546
1547- mainloop = gobject.MainLoop()
1548+ mainloop = GLib.MainLoop()
1549 mainloop.run()
1550
1551=== modified file 'test/monitor-ofono'
1552--- test/monitor-ofono 2013-12-04 20:19:31 +0000
1553+++ test/monitor-ofono 2014-02-28 20:44:46 +0000
1554@@ -1,12 +1,12 @@
1555-#!/usr/bin/python
1556+#!/usr/bin/python3
1557
1558-import gobject
1559+from gi.repository import GLib
1560
1561 import dbus
1562 import dbus.mainloop.glib
1563
1564 _dbus2py = {
1565- dbus.String : unicode,
1566+ dbus.String : str,
1567 dbus.UInt32 : int,
1568 dbus.Int32 : int,
1569 dbus.Int16 : int,
1570@@ -55,24 +55,24 @@
1571
1572 def property_changed(name, value, path, interface):
1573 iface = interface[interface.rfind(".") + 1:]
1574- print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
1575+ print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
1576
1577 def added(name, value, member, path, interface):
1578 iface = interface[interface.rfind(".") + 1:]
1579- print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
1580+ print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
1581
1582 def removed(name, member, path, interface):
1583 iface = interface[interface.rfind(".") + 1:]
1584- print "{%s} [%s] %s" % (iface, name, member)
1585+ print("{%s} [%s] %s" % (iface, name, member))
1586
1587 def event(member, path, interface):
1588 iface = interface[interface.rfind(".") + 1:]
1589- print "{%s} [%s] %s" % (iface, path, member)
1590+ print("{%s} [%s] %s" % (iface, path, member))
1591
1592 def message(msg, args, member, path, interface):
1593 iface = interface[interface.rfind(".") + 1:]
1594- print "{%s} [%s] %s %s (%s)" % (iface, path, member,
1595- msg, pretty(args))
1596+ print("{%s} [%s] %s %s (%s)" % (iface, path, member,
1597+ msg, pretty(args)))
1598
1599 def network_time_changed(time, member, path, interface):
1600 iface = interface[interface.rfind(".") + 1:]
1601@@ -80,11 +80,11 @@
1602
1603 def ussd(msg, member, path, interface):
1604 iface = interface[interface.rfind(".") + 1:]
1605- print "{%s} [%s] %s %s" % (iface, path, member, msg)
1606+ print("{%s} [%s] %s %s" % (iface, path, member, msg))
1607
1608 def value(value, member, path, interface):
1609 iface = interface[interface.rfind(".") + 1:]
1610- print "{%s} [%s] %s %s" % (iface, path, member, str(value))
1611+ print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
1612
1613 if __name__ == '__main__':
1614 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1615@@ -162,5 +162,5 @@
1616 path_keyword="path",
1617 interface_keyword="interface")
1618
1619- mainloop = gobject.MainLoop()
1620+ mainloop = GLib.MainLoop()
1621 mainloop.run()
1622
1623=== modified file 'test/offline-modem'
1624--- test/offline-modem 2011-08-07 14:36:34 +0000
1625+++ test/offline-modem 2014-02-28 20:44:46 +0000
1626@@ -1,4 +1,4 @@
1627-#!/usr/bin/python
1628+#!/usr/bin/python3
1629
1630 import dbus, sys
1631
1632@@ -12,6 +12,6 @@
1633 modems = manager.GetModems()
1634 path = modems[0][0]
1635
1636-print "Setting modem %s offline..." % path
1637+print("Setting modem %s offline..." % path)
1638 modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
1639 modem.SetProperty("Online", dbus.Boolean(0), timeout = 120)
1640
1641=== modified file 'test/online-modem'
1642--- test/online-modem 2011-08-07 14:36:34 +0000
1643+++ test/online-modem 2014-02-28 20:44:46 +0000
1644@@ -1,4 +1,4 @@
1645-#!/usr/bin/python
1646+#!/usr/bin/python3
1647
1648 import dbus, sys
1649
1650@@ -12,6 +12,6 @@
1651 modems = manager.GetModems()
1652 path = modems[0][0]
1653
1654-print "Setting modem %s online..." % path
1655+print("Setting modem %s online..." % path)
1656 modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
1657 modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)
1658
1659=== modified file 'test/private-chat'
1660--- test/private-chat 2012-05-22 01:53:18 +0000
1661+++ test/private-chat 2014-02-28 20:44:46 +0000
1662@@ -1,4 +1,4 @@
1663-#!/usr/bin/python
1664+#!/usr/bin/python3
1665
1666 import sys
1667 import dbus
1668@@ -17,4 +17,4 @@
1669 mpty = manager.PrivateChat(sys.argv[1], timeout=100)
1670
1671 for path in mpty:
1672- print path
1673+ print(path)
1674
1675=== modified file 'test/process-context-settings'
1676--- test/process-context-settings 2010-10-26 15:20:47 +0000
1677+++ test/process-context-settings 2014-02-28 20:44:46 +0000
1678@@ -1,4 +1,4 @@
1679-#!/usr/bin/python
1680+#!/usr/bin/python3
1681
1682 import os
1683 import dbus
1684@@ -23,7 +23,7 @@
1685 if properties["Active"] == dbus.Boolean(0):
1686 continue
1687
1688- print "Configuring %s" % (path)
1689+ print("Configuring %s" % (path))
1690
1691 settings = properties["Settings"]
1692
1693@@ -35,20 +35,20 @@
1694 gateway = "0.0.0.0";
1695
1696 if settings["Method"] == "dhcp":
1697- print " Run DHCP on interface %s" % (interface)
1698+ print(" Run DHCP on interface %s" % (interface))
1699 else:
1700- print " Interface is %s" % (interface)
1701- print " IP address is %s" % (address)
1702- print " Gateway is %s" % (gateway)
1703+ print(" Interface is %s" % (interface))
1704+ print(" IP address is %s" % (address))
1705+ print(" Gateway is %s" % (gateway))
1706
1707 cmd = "ifconfig " + interface + " " + address
1708 cmd += " netmask 255.255.255.255"
1709 os.system(cmd);
1710
1711 for i in settings["DomainNameServers"]:
1712- print " Nameserver is %s" % (i)
1713+ print(" Nameserver is %s" % (i))
1714
1715 cmd = "route add -host " + i
1716 cmd +=" dev " + interface
1717 os.system(cmd);
1718- print
1719+ print()
1720
1721=== modified file 'test/receive-sms'
1722--- test/receive-sms 2009-09-25 21:04:43 +0000
1723+++ test/receive-sms 2014-02-28 20:44:46 +0000
1724@@ -1,16 +1,16 @@
1725-#!/usr/bin/python
1726+#!/usr/bin/python3
1727
1728-import gobject
1729+from gi.repository import GLib
1730
1731 import dbus
1732 import dbus.mainloop.glib
1733
1734 def incoming_message(message, details, path, interface):
1735- print "%s" % (message)
1736+ print("%s" % (message))
1737
1738 for key in details:
1739 val = details[key]
1740- print " %s = %s" % (key, val)
1741+ print(" %s = %s" % (key, val))
1742
1743 if __name__ == '__main__':
1744 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1745@@ -29,5 +29,5 @@
1746 path_keyword="path",
1747 interface_keyword="interface")
1748
1749- mainloop = gobject.MainLoop()
1750+ mainloop = GLib.MainLoop()
1751 mainloop.run()
1752
1753=== modified file 'test/reject-calls'
1754--- test/reject-calls 2012-01-02 02:25:00 +0000
1755+++ test/reject-calls 2014-02-28 20:44:46 +0000
1756@@ -1,4 +1,4 @@
1757-#!/usr/bin/python
1758+#!/usr/bin/python3
1759
1760 import dbus
1761
1762@@ -10,7 +10,7 @@
1763 modems = manager.GetModems()
1764
1765 for path, properties in modems:
1766- print "[ %s ]" % (path)
1767+ print("[ %s ]" % (path))
1768
1769 if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
1770 continue
1771@@ -22,7 +22,7 @@
1772
1773 for path, properties in calls:
1774 state = properties["State"]
1775- print "[ %s ] %s" % (path, state)
1776+ print("[ %s ] %s" % (path, state))
1777
1778 if state != "incoming":
1779 continue
1780
1781=== modified file 'test/release-and-answer'
1782--- test/release-and-answer 2012-04-23 20:18:41 +0000
1783+++ test/release-and-answer 2014-02-28 20:44:46 +0000
1784@@ -1,4 +1,4 @@
1785-#!/usr/bin/python
1786+#!/usr/bin/python3
1787
1788 import dbus
1789
1790@@ -10,7 +10,7 @@
1791 modems = manager.GetModems()
1792
1793 for path, properties in modems:
1794- print "[ %s ]" % (path)
1795+ print("[ %s ]" % (path))
1796
1797 if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
1798 continue
1799
1800=== modified file 'test/release-and-swap'
1801--- test/release-and-swap 2012-08-06 04:34:52 +0000
1802+++ test/release-and-swap 2014-02-28 20:44:46 +0000
1803@@ -1,4 +1,4 @@
1804-#!/usr/bin/python
1805+#!/usr/bin/python3
1806
1807 import dbus
1808
1809@@ -10,7 +10,7 @@
1810 modems = manager.GetModems()
1811
1812 for path, properties in modems:
1813- print "[ %s ]" % (path)
1814+ print("[ %s ]" % (path))
1815
1816 if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
1817 continue
1818
1819=== modified file 'test/remove-contexts'
1820--- test/remove-contexts 2010-09-09 19:38:14 +0000
1821+++ test/remove-contexts 2014-02-28 20:44:46 +0000
1822@@ -1,4 +1,4 @@
1823-#!/usr/bin/python
1824+#!/usr/bin/python3
1825
1826 import dbus
1827
1828@@ -20,4 +20,4 @@
1829
1830 for path, properties in contexts:
1831 connman.RemoveContext(path)
1832- print"Removed: [ %s ]" % (path)
1833+ print("Removed: [ %s ]" % (path))
1834
1835=== modified file 'test/reset-pin'
1836--- test/reset-pin 2010-11-09 15:30:06 +0000
1837+++ test/reset-pin 2014-02-28 20:44:46 +0000
1838@@ -1,4 +1,4 @@
1839-#!/usr/bin/python
1840+#!/usr/bin/python3
1841
1842 import dbus
1843 import sys
1844@@ -14,9 +14,9 @@
1845 path = modems[0][0]
1846 puk_type, puk, pin = sys.argv[1:]
1847 else:
1848- print "%s [PATH] puk_type puk pin" % (sys.argv[0])
1849+ print("%s [PATH] puk_type puk pin" % (sys.argv[0]))
1850
1851-print "Reset pin for modem %s..." % path
1852+print("Reset pin for modem %s..." % path)
1853 simmanager = dbus.Interface(bus.get_object('org.ofono', path),
1854 'org.ofono.SimManager')
1855
1856
1857=== added directory 'test/rilmodem'
1858=== added file 'test/rilmodem/test-hangup'
1859--- test/rilmodem/test-hangup 1970-01-01 00:00:00 +0000
1860+++ test/rilmodem/test-hangup 2014-02-28 20:44:46 +0000
1861@@ -0,0 +1,97 @@
1862+#!/usr/bin/python3
1863+#
1864+# oFono - Open Source Telephony - RIL Modem test
1865+#
1866+# Copyright (C) 2014 Canonical Ltd.
1867+#
1868+# This program is free software; you can redistribute it and/or modify
1869+# it under the terms of the GNU General Public License version 2 as
1870+# published by the Free Software Foundation.
1871+#
1872+# This program is distributed in the hope that it will be useful,
1873+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1874+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1875+# GNU General Public License for more details.
1876+#
1877+# You should have received a copy of the GNU General Public License
1878+# along with this program; if not, write to the Free Software
1879+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1880+#
1881+# This test ensures that basic modem information is available
1882+# when the modem is online and has a valid, unlocked SIM present.
1883+#
1884+# *** REQUIRED SETUP ***
1885+#
1886+# 1. /etc/host:
1887+# This script uses telnetlib to access the emulator console. In
1888+# order for this to work, the emulator needs to be configured so
1889+# that it can access 'localhost' on the host machine. This is
1890+# done by modifying /etc/hosts in the emulator to define 'localhost'
1891+# as 10.0.2.2, which is a special alias to the host loopback interface.
1892+# Without this change, it's impossible for this script to access the
1893+# emulator console.
1894+#
1895+# 2. Modem online
1896+# This script must be run *after* the modem has been brought online,
1897+# otherwise it will fail. This is currently done by telepathy-ofono,
1898+# which isn't being started in the current touch emulator, however it
1899+# will soon be the responsibility of urfkill.
1900+#
1901+# *** TODO ***
1902+#
1903+# 1. This test calls HangupAll() which is an asynchronous operation.
1904+# There's no getting around that fact that a timer needs to be used
1905+# to delay querying the calls after the hangup. The code currently
1906+# uses a time.sleep(5), however it could be changed to listen for a
1907+# CallRemoved signal. A timer would still be required to catch the
1908+# scenario where the signal was never received.
1909+
1910+import dbus
1911+import sys
1912+import time
1913+import telnetlib
1914+
1915+def create_incoming_call(number, port):
1916+
1917+ tn = telnetlib.Telnet("localhost", 5554)
1918+ tn.read_until("OK")
1919+
1920+ tn.write("gsm call " + number + "\n")
1921+ print("incoming call created")
1922+
1923+ tn.read_until("OK")
1924+ tn.write("exit")
1925+
1926+if __name__ == "__main__":
1927+
1928+ if len(sys.argv) == 2:
1929+ port = sys.argv[1]
1930+ else:
1931+ port = 5554
1932+
1933+ create_incoming_call("6663334444", port)
1934+
1935+ bus = dbus.SystemBus()
1936+
1937+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
1938+ 'org.ofono.Manager')
1939+ modems = manager.GetModems()
1940+
1941+ for path, properties in modems:
1942+ print("[ %s ]" % (path))
1943+
1944+ assert "org.ofono.VoiceCallManager" in properties["Interfaces"]
1945+
1946+ mgr = dbus.Interface(bus.get_object('org.ofono', path),
1947+ 'org.ofono.VoiceCallManager')
1948+ calls = mgr.GetCalls()
1949+
1950+ assert len(calls) > 0, "No incoming call present!"
1951+
1952+ mgr.HangupAll()
1953+
1954+ time.sleep(5)
1955+
1956+ calls = mgr.GetCalls()
1957+
1958+ assert len(calls) == 0, "HangupAll() failed, calls still exist!"
1959
1960=== added file 'test/rilmodem/test-modem-offline'
1961--- test/rilmodem/test-modem-offline 1970-01-01 00:00:00 +0000
1962+++ test/rilmodem/test-modem-offline 2014-02-28 20:44:46 +0000
1963@@ -0,0 +1,52 @@
1964+#!/usr/bin/python3
1965+#
1966+# oFono - Open Source Telephony - RIL Modem test
1967+#
1968+# Copyright (C) 2014 Canonical Ltd.
1969+#
1970+# This program is free software; you can redistribute it and/or modify
1971+# it under the terms of the GNU General Public License version 2 as
1972+# published by the Free Software Foundation.
1973+#
1974+# This program is distributed in the hope that it will be useful,
1975+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1976+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1977+# GNU General Public License for more details.
1978+#
1979+# You should have received a copy of the GNU General Public License
1980+# along with this program; if not, write to the Free Software
1981+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1982+#
1983+# This test ensures that basic modem information is available
1984+# when the modem is offline.
1985+
1986+import dbus
1987+
1988+bus = dbus.SystemBus()
1989+
1990+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
1991+ 'org.ofono.Manager')
1992+
1993+modems = manager.GetModems()
1994+
1995+for path, properties in modems:
1996+ print("[ %s ]" % (path))
1997+
1998+ keys = list(properties.keys())
1999+
2000+ assert keys.index('Online') != "ValueError"
2001+ assert keys.index("Powered") != "ValueError"
2002+ assert keys.index("Emergency") != "ValueError"
2003+ assert keys.index("Lockdown") != "ValueError"
2004+ assert keys.index("Serial") != "ValueError"
2005+ assert keys.index("Revision") != "ValueError"
2006+ assert keys.index("Interfaces") != "ValueError"
2007+
2008+ assert properties['Online'] == 0
2009+ assert properties['Powered'] == 1
2010+ assert properties['Emergency'] == 0
2011+ assert properties["Lockdown"] == 0
2012+ assert properties["Serial"].isalnum()
2013+ assert properties["Revision"].isalnum()
2014+
2015+ print("OK\n")
2016
2017=== added file 'test/rilmodem/test-sim-online'
2018--- test/rilmodem/test-sim-online 1970-01-01 00:00:00 +0000
2019+++ test/rilmodem/test-sim-online 2014-02-28 20:44:46 +0000
2020@@ -0,0 +1,266 @@
2021+#!/usr/bin/python3
2022+#
2023+# oFono - Open Source Telephony - RIL Modem test
2024+#
2025+# Copyright (C) 2014 Canonical Ltd.
2026+#
2027+# This program is free software; you can redistribute it and/or modify
2028+# it under the terms of the GNU General Public License version 2 as
2029+# published by the Free Software Foundation.
2030+#
2031+# This program is distributed in the hope that it will be useful,
2032+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2033+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2034+# GNU General Public License for more details.
2035+#
2036+# You should have received a copy of the GNU General Public License
2037+# along with this program; if not, write to the Free Software
2038+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2039+#
2040+# This test ensures that basic modem information is available
2041+# when the modem is online and has a valid, unlocked SIM present.
2042+
2043+import argparse
2044+import dbus
2045+import time
2046+
2047+def is_modem_online(properties):
2048+ """Returns the modem 'Online' property.
2049+ """
2050+ return properties['Online']
2051+
2052+def set_modem_online(modem, path):
2053+ """Sets the modem 'Online' property.
2054+ """
2055+
2056+ print("Setting modem %s online..." % path)
2057+
2058+ modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)
2059+
2060+def validate_emergency_numbers():
2061+ # valid VoiceCallManager properties
2062+ voice = dbus.Interface(bus.get_object('org.ofono', path),
2063+ 'org.ofono.VoiceCallManager')
2064+
2065+ properties = voice.GetProperties()
2066+ keys = list(properties.keys())
2067+
2068+ assert keys.index("EmergencyNumbers") != "ValueError"
2069+
2070+ numbers = properties["EmergencyNumbers"]
2071+
2072+ print("%s" % numbers)
2073+
2074+ for number in numbers:
2075+ assert number in ["08", "000", "999", "110", "112", "911", "118", "119"]
2076+
2077+ print("OK\n")
2078+
2079+def validate_netreg(args, path):
2080+ """Validates NetworkRegistration properties.
2081+ """
2082+
2083+ # valid NetworkRegistration properties
2084+ netreg = dbus.Interface(bus.get_object('org.ofono', path),
2085+ 'org.ofono.NetworkRegistration')
2086+
2087+ properties = netreg.GetProperties()
2088+ keys = list(properties.keys())
2089+
2090+ assert keys.index("Status") != "ValueError"
2091+
2092+ # TODO: no Strength reported by emulator!
2093+ # assert keys.index("Strength") != "ValueError"
2094+
2095+ assert keys.index("Name") != "ValueError"
2096+ assert keys.index("LocationAreaCode") != "ValueError"
2097+ assert keys.index("Mode") != "ValueError"
2098+ assert keys.index("MobileCountryCode") != "ValueError"
2099+
2100+ # TODO: no Technology reported by emulator
2101+ # assert keys.index("Technology") != "ValueError"
2102+
2103+ assert keys.index("CellId") != "ValueError"
2104+ assert keys.index("MobileNetworkCode") != "ValueError"
2105+
2106+ assert properties["Status"] == "registered"
2107+ assert properties["Name"] == "Android (Android)"
2108+ assert properties["LocationAreaCode"] == 65535
2109+
2110+ # TODO: emulator reports "Mode" as "auto" ! "auto-only"
2111+ # assert properties["Mode"] == "auto-only"
2112+
2113+ assert properties["MobileCountryCode"] == "310"
2114+
2115+ # TODO: no Technology reported by emulator
2116+ # assert properties["Technology"] == "umts"
2117+
2118+ assert properties["MobileNetworkCode"] == "260"
2119+
2120+
2121+def parse_arguments():
2122+ """Parses command-line arguments.
2123+ """
2124+
2125+ parser = argparse.ArgumentParser(description="test-sim-online script")
2126+
2127+ parser.add_argument("-e",
2128+ "--emulator",
2129+ dest="emulator",
2130+ action="store_true",
2131+ help="""Indicates that this script is to
2132+ run in the Touch emulator""",
2133+ default=False
2134+ )
2135+ parser.add_argument("-o",
2136+ "--online",
2137+ dest="online",
2138+ action="store_true",
2139+ help="""Set the modem online if required""",
2140+ default=False,
2141+ )
2142+ parser.add_argument("--mnc",
2143+ dest="mnc",
2144+ help="""Specify a MNC (mobile-network-code) to
2145+ match against""",
2146+ default="",
2147+ )
2148+ parser.add_argument("--mcc",
2149+ dest="mcc",
2150+ help="""Specify a MCC (mobile-country-code) to
2151+ match against""",
2152+ default="",
2153+ )
2154+ parser.add_argument("--subscriber",
2155+ dest="subscriber",
2156+ help="""Specify a SubscriberIdentity to
2157+ match against""",
2158+ default="",
2159+ )
2160+ parser.add_argument("--netreg",
2161+ dest="netreg",
2162+ action="store_true",
2163+ help="""Validate Netreg interface""",
2164+ default=False,
2165+ )
2166+
2167+ return parser.parse_args()
2168+
2169+def main(args):
2170+
2171+ bus = dbus.SystemBus()
2172+
2173+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
2174+ 'org.ofono.Manager')
2175+ modems = manager.GetModems()
2176+ path = modems[0][0]
2177+ modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
2178+ properties = modem.GetProperties()
2179+
2180+ print("[ %s ]" % path)
2181+
2182+ if is_modem_online(properties) == 0 and args.online == True:
2183+ set_modem_online(modem, path)
2184+ time.sleep(5)
2185+
2186+ keys = list(properties.keys())
2187+
2188+ assert keys.index("Features") != "ValueError"
2189+ assert keys.index("Emergency") != "ValueError"
2190+ assert keys.index("Powered") != "ValueError"
2191+ assert keys.index("Lockdown") != "ValueError"
2192+ assert keys.index("Interfaces") != "ValueError"
2193+ assert keys.index("Online") != "ValueError"
2194+ assert keys.index("Model") != "ValueError"
2195+
2196+ # TODO: not properly set by emulator
2197+ if args.emulator == False:
2198+ assert keys.index("Revision") != "ValueError"
2199+
2200+ assert keys.index("Type") != "ValueError"
2201+
2202+ # TODO: not properly set by emulator
2203+ if args.emulator == False:
2204+ assert keys.index("Serial") != "ValueError"
2205+
2206+ assert keys.index("Manufacturer") != "ValueError"
2207+
2208+ # validate Features = net sms gprs sim
2209+
2210+ assert properties["Emergency"] == 0
2211+ assert properties["Powered"] == 1
2212+ assert properties["Lockdown"] == 0
2213+
2214+ # TODO: validate Interfaces: NetworkReg, CallVolume, MessageManager,
2215+ # ConnectionManager, NetworkTime, SimManager, VoiceCallManager
2216+
2217+ assert properties["Online"] == 1
2218+ assert properties["Model"] == "Fake Modem Model"
2219+ assert properties["Type"] == "hardware"
2220+
2221+ # TODO: not properly set by emulator
2222+ # assert properties["Serial"] == "000000000000000"
2223+
2224+ assert properties["Manufacturer"] == "Fake Manufacturer"
2225+
2226+ # valid SimManager properties
2227+ simmanager = dbus.Interface(bus.get_object('org.ofono', path),
2228+ 'org.ofono.SimManager')
2229+
2230+ properties = simmanager.GetProperties()
2231+ keys = list(properties.keys())
2232+
2233+ assert keys.index("Retries") != "ValueError"
2234+ assert keys.index("FixedDialing") != "ValueError"
2235+ assert keys.index("MobileCountryCode") != "ValueError"
2236+ assert keys.index("SubscriberNumbers") != "ValueError"
2237+ assert keys.index("BarredDialing") != "ValueError"
2238+ assert keys.index("CardIdentifier") != "ValueError"
2239+ assert keys.index("LockedPins") != "ValueError"
2240+ assert keys.index("MobileNetworkCode") != "ValueError"
2241+ assert keys.index("SubscriberIdentity") != "ValueError"
2242+ assert keys.index("Present") != "ValueError"
2243+ assert keys.index("PinRequired") != "ValueError"
2244+
2245+ # TODO: Retries isn't currently populated ( lp: )
2246+ # assert properties["Retries"] ==
2247+
2248+ assert properties["FixedDialing"] == 0
2249+
2250+ # TODO: make these optional arguments
2251+ if args.emulator:
2252+ assert properties["MobileCountryCode"] == "310"
2253+ elif args.mcc != "":
2254+ assert properties["MobileCountryCode"] == args.mcc
2255+
2256+ if args.emulator:
2257+ assert properties["SubscriberNumbers"][0] == "15555215554"
2258+
2259+ assert properties["BarredDialing"] == 0
2260+
2261+ if args.emulator:
2262+ assert properties["CardIdentifier"] == "89014103211118510720"
2263+
2264+ assert len(properties["LockedPins"]) == 0
2265+
2266+ if args.emulator:
2267+ assert properties["MobileNetworkCode"] == "260"
2268+ elif args.mnc != "":
2269+ assert properties["MobileNetworkCode"] == args.mnc
2270+
2271+ if args.emulator:
2272+ assert properties["SubscriberIdentity"] == "310260000000000"
2273+ elif args.subscriber != "":
2274+ assert properties["SubscriberIdentity"] == args.subscriber
2275+
2276+ assert properties["Present"] == 1
2277+ assert properties["PinRequired"] == "none"
2278+
2279+ if args.netreg:
2280+ validate_netreg(args, path)
2281+
2282+ # TODO: add support for emergency numbers
2283+
2284+if __name__ == "__main__":
2285+ args = parse_arguments()
2286+ main(args)
2287
2288=== modified file 'test/scan-for-operators'
2289--- test/scan-for-operators 2010-12-03 12:46:51 +0000
2290+++ test/scan-for-operators 2014-02-28 20:44:46 +0000
2291@@ -13,7 +13,7 @@
2292 modems = manager.GetModems()
2293 path = modems[0][0]
2294
2295-print "Scanning operators on modem %s..." % path
2296+print("Scanning operators on modem %s..." % path)
2297 netreg = dbus.Interface(bus.get_object('org.ofono', path),
2298 'org.ofono.NetworkRegistration')
2299
2300@@ -23,7 +23,7 @@
2301 path = entry[0]
2302 properties = entry[1]
2303
2304- print "[ %s ]" % (path)
2305+ print("[ %s ]" % (path))
2306
2307 for key in properties.keys():
2308 if key in ["Technologies"]:
2309@@ -32,7 +32,7 @@
2310 val += i + " "
2311 else:
2312 val = str(properties[key])
2313- print " %s = %s" % (key, val)
2314+ print(" %s = %s" % (key, val))
2315
2316- print
2317+ print()
2318
2319
2320=== modified file 'test/send-sms'
2321--- test/send-sms 2012-06-25 07:04:38 +0000
2322+++ test/send-sms 2014-02-28 20:44:46 +0000
2323@@ -4,8 +4,8 @@
2324 import dbus
2325
2326 if len(sys.argv) < 4:
2327- print "Usage: %s [modem] <to> <message> <delivery report>" %\
2328- (sys.argv[0])
2329+ print("Usage: %s [modem] <to> <message> <delivery report>" %\
2330+ (sys.argv[0]))
2331 sys.exit(1)
2332
2333 bus = dbus.SystemBus()
2334@@ -18,7 +18,7 @@
2335 modems = manager.GetModems()
2336 path = modems[0][0]
2337
2338-print "Send message using modem %s ..." % path
2339+print("Send message using modem %s ..." % path)
2340
2341
2342 mm = dbus.Interface(bus.get_object('org.ofono', path),
2343@@ -31,4 +31,4 @@
2344 mm.SetProperty("UseDeliveryReports", dbus.Boolean(int(sys.argv[3])))
2345 path = mm.SendMessage(sys.argv[1], sys.argv[2])
2346
2347-print path
2348+print(path)
2349
2350=== modified file 'test/send-ussd'
2351--- test/send-ussd 2012-07-27 05:30:57 +0000
2352+++ test/send-ussd 2014-02-28 20:44:46 +0000
2353@@ -4,7 +4,7 @@
2354 import dbus
2355
2356 if (len(sys.argv) < 2):
2357- print "Usage: %s [modem] <ussd-string>" % (sys.argv[0])
2358+ print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
2359 sys.exit(1)
2360
2361 bus = dbus.SystemBus()
2362@@ -27,13 +27,13 @@
2363 properties = ussd.GetProperties()
2364 state = properties["State"]
2365
2366-print "State: %s" % (state)
2367+print("State: %s" % (state))
2368
2369 if state == "idle":
2370 result = ussd.Initiate(ussdstring, timeout=100)
2371- print result[0] + ": " + result[1]
2372+ print(result[0] + ": " + result[1])
2373 elif state == "user-response":
2374- print ussd.Respond(ussdstring, timeout=100)
2375+ print(ussd.Respond(ussdstring, timeout=100))
2376 else:
2377 sys.exit(1);
2378
2379@@ -43,15 +43,15 @@
2380 if state == "idle":
2381 sys.exit(0)
2382
2383-print "State: %s" % (state)
2384+print("State: %s" % (state))
2385
2386 while state == "user-response":
2387- response = raw_input("Enter response: ")
2388+ response = input("Enter response: ")
2389
2390- print ussd.Respond(response, timeout=100)
2391+ print(ussd.Respond(response, timeout=100))
2392
2393 properties = ussd.GetProperties()
2394 state = properties["State"]
2395
2396 if state != "idle":
2397- print "State: %s" % (state)
2398+ print("State: %s" % (state))
2399
2400=== modified file 'test/send-vcal'
2401--- test/send-vcal 2011-04-28 14:20:11 +0000
2402+++ test/send-vcal 2014-02-28 20:44:46 +0000
2403@@ -4,7 +4,7 @@
2404 import dbus
2405
2406 if len(sys.argv) < 3:
2407- print "Usage: %s [modem] <to> <vcal file>" % (sys.argv[0])
2408+ print("Usage: %s [modem] <to> <vcal file>" % (sys.argv[0]))
2409 sys.exit(1)
2410
2411 bus = dbus.SystemBus()
2412@@ -17,7 +17,7 @@
2413 modems = manager.GetModems()
2414 path = modems[0][0]
2415
2416-print "Send vcal using modem %s ..." % path
2417+print("Send vcal using modem %s ..." % path)
2418
2419 sm = dbus.Interface(bus.get_object('org.ofono', path),
2420 'org.ofono.SmartMessaging')
2421@@ -29,4 +29,4 @@
2422 vcal = file(sys.argv[2]).read()
2423 path = sm.SendAppointment(sys.argv[1], vcal)
2424
2425-print path
2426+print(path)
2427
2428=== modified file 'test/send-vcard'
2429--- test/send-vcard 2011-04-28 14:20:11 +0000
2430+++ test/send-vcard 2014-02-28 20:44:46 +0000
2431@@ -4,7 +4,7 @@
2432 import dbus
2433
2434 if len(sys.argv) < 3:
2435- print "Usage: %s [modem] <to> <vcard file>" % (sys.argv[0])
2436+ print("Usage: %s [modem] <to> <vcard file>" % (sys.argv[0]))
2437 sys.exit(1)
2438
2439 bus = dbus.SystemBus()
2440@@ -17,7 +17,7 @@
2441 modems = manager.GetModems()
2442 path = modems[0][0]
2443
2444-print "Send vcard using modem %s ..." % path
2445+print("Send vcard using modem %s ..." % path)
2446
2447 sm = dbus.Interface(bus.get_object('org.ofono', path),
2448 'org.ofono.SmartMessaging')
2449@@ -29,4 +29,4 @@
2450 vcard = file(sys.argv[2]).read()
2451 path = sm.SendBusinessCard(sys.argv[1], vcard)
2452
2453-print path
2454+print(path)
2455
2456=== modified file 'test/set-call-forwarding'
2457--- test/set-call-forwarding 2011-02-01 17:36:01 +0000
2458+++ test/set-call-forwarding 2014-02-28 20:44:46 +0000
2459@@ -1,26 +1,26 @@
2460 #!/usr/bin/python
2461
2462 import sys
2463-import gobject
2464+from gi.repository import GLib
2465
2466 import dbus
2467 import dbus.mainloop.glib
2468
2469 def property_changed(property, value):
2470 if len(value.__str__()) > 0:
2471- print "CF property %s changed to %s" % (property, value)
2472+ print("CF property %s changed to %s" % (property, value))
2473 else:
2474- print "CF property %s changed to disabled" % (property)
2475+ print("CF property %s changed to disabled" % (property))
2476
2477 if canexit:
2478 mainloop.quit();
2479
2480 if __name__ == "__main__":
2481 if len(sys.argv) < 3:
2482- print "Usage: %s <property> <value>" % (sys.argv[0])
2483- print "Properties can be: VoiceUnconditional, VoiceBusy,"
2484- print " VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable"
2485- print "Value: number to or the timeout"
2486+ print("Usage: %s <property> <value>" % (sys.argv[0]))
2487+ print("Properties can be: VoiceUnconditional, VoiceBusy,")
2488+ print(" VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable")
2489+ print("Value: number to or the timeout")
2490 sys.exit(1)
2491
2492 property = sys.argv[1]
2493@@ -46,19 +46,19 @@
2494 try:
2495 cf.SetProperty(property, dbus.UInt16(value),
2496 timeout = 100)
2497- except dbus.DBusException, e:
2498- print "Unable SetProperty", e
2499+ except dbus.DBusException as e:
2500+ print("Unable SetProperty %s" % e)
2501 sys.exit(1);
2502 else:
2503 try:
2504 cf.SetProperty(property, value, timeout = 100)
2505- except dbus.DBusException, e:
2506- print "Unable SetProperty", e
2507+ except dbus.DBusException as e:
2508+ print("Unable SetProperty %s" % e)
2509 sys.exit(1);
2510
2511- print "Set Property successful"
2512+ print("Set Property successful")
2513
2514 canexit = True
2515
2516- mainloop = gobject.MainLoop()
2517+ mainloop = GLib.MainLoop()
2518 mainloop.run()
2519
2520=== modified file 'test/set-cbs-topics'
2521--- test/set-cbs-topics 2010-09-09 19:38:14 +0000
2522+++ test/set-cbs-topics 2014-02-28 20:44:46 +0000
2523@@ -15,9 +15,9 @@
2524 path = modems[0][0]
2525 topics = sys.argv[1]
2526 else:
2527- print "%s [PATH] topics" % (sys.argv[0])
2528+ print("%s [PATH] topics" % (sys.argv[0]))
2529
2530-print "Setting cell broadcast topics for modem %s..." % path
2531+print("Setting cell broadcast topics for modem %s..." % path)
2532 cbs = dbus.Interface(bus.get_object('org.ofono', path),
2533 'org.ofono.CellBroadcast')
2534
2535
2536=== modified file 'test/set-context-property'
2537--- test/set-context-property 2011-03-24 18:24:38 +0000
2538+++ test/set-context-property 2014-02-28 20:44:46 +0000
2539@@ -4,7 +4,7 @@
2540 import dbus
2541
2542 if len(sys.argv) < 4:
2543- print "Usage: set-context-property <context> <name> <value>"
2544+ print("Usage: set-context-property <context> <name> <value>")
2545 sys.exit(1)
2546
2547 bus = dbus.SystemBus()
2548@@ -24,7 +24,7 @@
2549 contexts = connman.GetContexts()
2550
2551 if (len(contexts) == 0):
2552- print "No context available"
2553+ print("No context available")
2554 sys.exit(1)
2555
2556 path = contexts[int(sys.argv[1])][0]
2557@@ -33,7 +33,7 @@
2558
2559 try:
2560 context.SetProperty(sys.argv[2], sys.argv[3])
2561- except dbus.DBusException, e:
2562- print "Error setting context %s property %s: %s" %\
2563- (path, sys.argv[2], str(e))
2564+ except dbus.DBusException as e:
2565+ print("Error setting context %s property %s: %s" %\
2566+ (path, sys.argv[2], str(e)))
2567 exit(2)
2568
2569=== modified file 'test/set-fast-dormancy'
2570--- test/set-fast-dormancy 2010-10-28 03:26:15 +0000
2571+++ test/set-fast-dormancy 2014-02-28 20:44:46 +0000
2572@@ -15,10 +15,10 @@
2573 path = modems[0][0]
2574 enable = int(sys.argv[1])
2575 else:
2576- print "%s [PATH] {0|1}" % (sys.argv[0])
2577+ print("%s [PATH] {0|1}" % (sys.argv[0]))
2578 exit(1)
2579
2580-print "Setting fast dormancy for modem %s..." % path
2581+print("Setting fast dormancy for modem %s..." % path)
2582 radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
2583 'org.ofono.RadioSettings')
2584
2585
2586=== modified file 'test/set-gsm-band'
2587--- test/set-gsm-band 2010-12-21 22:02:49 +0000
2588+++ test/set-gsm-band 2014-02-28 20:44:46 +0000
2589@@ -15,10 +15,10 @@
2590 path = modems[0][0]
2591 band = sys.argv[1]
2592 else:
2593- print "%s [PATH] band" % (sys.argv[0])
2594+ print("%s [PATH] band" % (sys.argv[0]))
2595 exit(1)
2596
2597-print "Setting gsm band for modem %s..." % path
2598+print("Setting gsm band for modem %s..." % path)
2599 radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
2600 'org.ofono.RadioSettings')
2601
2602
2603=== modified file 'test/set-mms-details'
2604--- test/set-mms-details 2010-10-26 20:35:43 +0000
2605+++ test/set-mms-details 2014-02-28 20:44:46 +0000
2606@@ -26,18 +26,18 @@
2607 break
2608
2609 if path == "":
2610- print "No MMS context"
2611+ print("No MMS context")
2612 exit(1)
2613
2614 context = dbus.Interface(bus.get_object('org.ofono', path),
2615 'org.ofono.ConnectionContext')
2616
2617 if len(sys.argv) < 3:
2618- print "Usage: %s <proxy> <center>" % (sys.argv[0])
2619+ print("Usage: %s <proxy> <center>" % (sys.argv[0]))
2620 exit(1)
2621
2622 context.SetProperty("MessageProxy", sys.argv[1])
2623- print "Setting MMS Proxy to %s" % (sys.argv[1])
2624+ print("Setting MMS Proxy to %s" % (sys.argv[1]))
2625
2626 context.SetProperty("MessageCenter", sys.argv[2])
2627- print "Setting MMSC to %s" % (sys.argv[2])
2628+ print("Setting MMSC to %s" % (sys.argv[2]))
2629
2630=== modified file 'test/set-roaming-allowed'
2631--- test/set-roaming-allowed 2010-10-05 14:11:09 +0000
2632+++ test/set-roaming-allowed 2014-02-28 20:44:46 +0000
2633@@ -24,4 +24,4 @@
2634
2635 connman.SetProperty("RoamingAllowed", allowed)
2636
2637- print "Setting %s to RoamingAllowed=%d" % (path, allowed)
2638+ print("Setting %s to RoamingAllowed=%d" % (path, allowed))
2639
2640=== modified file 'test/set-tech-preference'
2641--- test/set-tech-preference 2010-09-09 19:38:14 +0000
2642+++ test/set-tech-preference 2014-02-28 20:44:46 +0000
2643@@ -15,9 +15,9 @@
2644 path = modems[0][0]
2645 tech = sys.argv[1]
2646 else:
2647- print "%s [PATH] technology" % (sys.argv[0])
2648+ print("%s [PATH] technology" % (sys.argv[0]))
2649
2650-print "Setting technology preference for modem %s..." % path
2651+print("Setting technology preference for modem %s..." % path)
2652 radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
2653 'org.ofono.RadioSettings')
2654
2655
2656=== modified file 'test/set-tty'
2657--- test/set-tty 2010-11-26 19:21:50 +0000
2658+++ test/set-tty 2014-02-28 20:44:46 +0000
2659@@ -15,10 +15,10 @@
2660 path = modems[0][0]
2661 enable = int(sys.argv[1])
2662 else:
2663- print "%s [PATH] {0|1}" % (sys.argv[0])
2664+ print("%s [PATH] {0|1}" % (sys.argv[0]))
2665 exit(1)
2666
2667-print "Setting TTY for modem %s..." % path
2668+print("Setting TTY for modem %s..." % path)
2669 texttelephony = dbus.Interface(bus.get_object('org.ofono', path),
2670 'org.ofono.TextTelephony')
2671
2672
2673=== modified file 'test/set-umts-band'
2674--- test/set-umts-band 2010-12-21 22:02:49 +0000
2675+++ test/set-umts-band 2014-02-28 20:44:46 +0000
2676@@ -15,10 +15,10 @@
2677 path = modems[0][0]
2678 band = sys.argv[1]
2679 else:
2680- print "%s [PATH] band" % (sys.argv[0])
2681+ print("%s [PATH] band" % (sys.argv[0]))
2682 exit(1)
2683
2684-print "Setting umts band for modem %s..." % path
2685+print("Setting umts band for modem %s..." % path)
2686 radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
2687 'org.ofono.RadioSettings')
2688
2689
2690=== modified file 'test/set-use-sms-reports'
2691--- test/set-use-sms-reports 2011-01-29 17:51:24 +0000
2692+++ test/set-use-sms-reports 2014-02-28 20:44:46 +0000
2693@@ -19,10 +19,10 @@
2694 if sys.argv[1] == "off":
2695 enabled = 0
2696 else:
2697- print "%s [PATH] on/off" % (sys.argv[0])
2698+ print("%s [PATH] on/off" % (sys.argv[0]))
2699 sys.exit(1)
2700
2701-print "Setting delivery report use for modem %s..." % path
2702+print("Setting delivery report use for modem %s..." % path)
2703 sms = dbus.Interface(bus.get_object('org.ofono', path),
2704 'org.ofono.MessageManager')
2705
2706
2707=== modified file 'test/test-advice-of-charge'
2708--- test/test-advice-of-charge 2011-02-16 15:09:46 +0000
2709+++ test/test-advice-of-charge 2014-02-28 20:44:46 +0000
2710@@ -1,22 +1,22 @@
2711 #!/usr/bin/python
2712
2713-import gobject
2714+from gi.repository import GLib
2715 import sys
2716 import dbus
2717 import dbus.mainloop.glib
2718
2719
2720 def cm_property_changed(name, value):
2721- print "CallMeter property: '%s' changed to '%s'" % (name, str(value))
2722+ print("CallMeter property: '%s' changed to '%s'" % (name, str(value)))
2723 if canexit:
2724 mainloop.quit()
2725
2726 def cm_maximum_reached():
2727- print "Only 30 seconds call time remains, recharge."
2728+ print("Only 30 seconds call time remains, recharge.")
2729
2730 def print_useage(s):
2731- print "Usage: %s <property> <newvalue> <password>" % (s)
2732- print "Usage: %s reset <password>" % (s)
2733+ print("Usage: %s <property> <newvalue> <password>" % (s))
2734+ print("Usage: %s reset <password>" % (s))
2735 sys.exit(1);
2736
2737 if __name__ == "__main__":
2738@@ -51,24 +51,24 @@
2739
2740 properties = cm.GetProperties()
2741
2742- print "Currency: %s" % (properties['Currency'])
2743- print "PricePerUnit %s" % (properties['PricePerUnit'])
2744- print "Call meter for the current call: %s" % (properties['CallMeter'])
2745- print "Call meter for current and previous calls: %s" %\
2746- properties['AccumulatedCallMeter']
2747- print "Call meter maximum, once reached calls are not possible: %s" %\
2748- properties['AccumulatedCallMeterMaximum']
2749+ print("Currency: %s" % (properties['Currency']))
2750+ print("PricePerUnit %s" % (properties['PricePerUnit']))
2751+ print("Call meter for the current call: %s" % (properties['CallMeter']))
2752+ print("Call meter for current and previous calls: %s" %\
2753+ properties['AccumulatedCallMeter'])
2754+ print("Call meter maximum, once reached calls are not possible: %s" %\
2755+ properties['AccumulatedCallMeterMaximum'])
2756
2757 total = properties['PricePerUnit'] * properties['AccumulatedCallMeter']
2758- print "Accumulated Meter in Currency: %s %s" %\
2759- (total, properties['Currency'])
2760+ print("Accumulated Meter in Currency: %s %s" %\
2761+ (total, properties['Currency']))
2762
2763 if (sys.argv[1] == 'reset'):
2764- print "Resetting Accumulated Call Meter"
2765+ print("Resetting Accumulated Call Meter")
2766 try:
2767 cm.Reset(pin)
2768- except dbus.DBusException, e:
2769- print "Unable to reset ACM: ", e
2770+ except dbus.DBusException as e:
2771+ print("Unable to reset ACM: %s" % e)
2772 sys.exit(1)
2773 else:
2774 try:
2775@@ -77,11 +77,11 @@
2776 elif property == 'PricePerUnit':
2777 newvalue = float(newvalue)
2778 cm.SetProperty(property, newvalue, pin)
2779- except dbus.DBusException, e:
2780- print "Unable to set property: ", e
2781+ except dbus.DBusException as e:
2782+ print("Unable to set property: %s" % e)
2783 sys.exit(1)
2784
2785 canexit = True
2786
2787- mainloop = gobject.MainLoop()
2788+ mainloop = GLib.MainLoop()
2789 mainloop.run()
2790
2791=== modified file 'test/test-call-barring'
2792--- test/test-call-barring 2010-12-17 00:57:48 +0000
2793+++ test/test-call-barring 2014-02-28 20:44:46 +0000
2794@@ -1,20 +1,20 @@
2795 #!/usr/bin/python
2796
2797-import gobject
2798+from gi.repository import GLib
2799 import sys
2800 import dbus
2801 import dbus.mainloop.glib
2802
2803
2804 def property_changed(name, value):
2805- print "CallBarring property: '%s' changed to '%s'" % (name, str(value))
2806+ print("CallBarring property: '%s' changed to '%s'" % (name, str(value)))
2807 if canexit:
2808 mainloop.quit()
2809
2810 def print_useage(s):
2811- print "Usage: %s <property> <newvalue> <password>" % (s)
2812- print "Usage: %s disableall <password>" % (s)
2813- print "Usage: %s passwd <old_password> <new_password>" % (s)
2814+ print("Usage: %s <property> <newvalue> <password>" % (s))
2815+ print("Usage: %s disableall <password>" % (s))
2816+ print("Usage: %s passwd <old_password> <new_password>" % (s))
2817 sys.exit(1);
2818
2819 if __name__ == "__main__":
2820@@ -51,34 +51,34 @@
2821
2822 properties = cb.GetProperties()
2823
2824- print "Barring settings for Incoming Voice calls: %s" %\
2825- (properties['VoiceIncoming'])
2826- print "Barring settings for Outgoing Calls: %s" %\
2827- (properties['VoiceOutgoing'])
2828+ print("Barring settings for Incoming Voice calls: %s" %\
2829+ (properties['VoiceIncoming']))
2830+ print("Barring settings for Outgoing Calls: %s" %\
2831+ (properties['VoiceOutgoing']))
2832
2833 if (sys.argv[1] == 'disableall'):
2834- print "Disabling all barrings"
2835+ print("Disabling all barrings")
2836 try:
2837 cb.DisableAll(pin)
2838- except dbus.DBusException, e:
2839- print "Unable to Disable All barrings: ", e
2840+ except dbus.DBusException as e:
2841+ print("Unable to Disable All barrings: ", e)
2842 sys.exit(1)
2843 elif (sys.argv[1] == 'passwd'):
2844 try:
2845 cb.ChangePassword(old_password, new_password)
2846- except dbus.DBusException, e:
2847- print "Unable to change password: ", e
2848+ except dbus.DBusException as e:
2849+ print("Unable to change password: ", e)
2850 sys.exit(1)
2851- print "Password changed"
2852+ print("Password changed")
2853 sys.exit(0)
2854 else:
2855 try:
2856 cb.SetProperty(property, newvalue, pin)
2857- except dbus.DBusException, e:
2858- print "Unable to set property: ", e
2859+ except dbus.DBusException as e:
2860+ print("Unable to set property: ", e)
2861 sys.exit(1)
2862
2863 canexit = True
2864
2865- mainloop = gobject.MainLoop()
2866+ mainloop = GLib.MainLoop()
2867 mainloop.run()
2868
2869=== modified file 'test/test-call-forwarding'
2870--- test/test-call-forwarding 2010-09-09 19:38:14 +0000
2871+++ test/test-call-forwarding 2014-02-28 20:44:46 +0000
2872@@ -1,21 +1,21 @@
2873 #!/usr/bin/python
2874
2875-import gobject
2876+from gi.repository import GLib
2877
2878 import dbus
2879 import dbus.mainloop.glib
2880
2881 def property_changed(property, value):
2882- print "CallForwarding property %s changed to %s" % (property, value)
2883+ print("CallForwarding property %s changed to %s" % (property, value))
2884
2885 def print_properties(cf):
2886 properties = cf.GetProperties()
2887
2888 for p in properties:
2889 if len(properties[p].__str__()) > 0:
2890- print "%s call forwarding rule is: %s" % (p, properties[p])
2891+ print("%s call forwarding rule is: %s" % (p, properties[p]))
2892 else:
2893- print "%s call forwarding rule disabled" % (p)
2894+ print("%s call forwarding rule disabled" % (p))
2895
2896 if __name__ == "__main__":
2897 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
2898@@ -36,84 +36,84 @@
2899
2900 try:
2901 cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
2902- except dbus.DBusException, e:
2903- print "Unable to set timeout - Good"
2904+ except dbus.DBusException as e:
2905+ print("Unable to set timeout - Good")
2906
2907 try:
2908 cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
2909- except dbus.DBusException, e:
2910- print "Unable to set timeout - Good"
2911+ except dbus.DBusException as e:
2912+ print("Unable to set timeout - Good")
2913
2914 try:
2915 cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
2916- except dbus.DBusException, e:
2917- print "Unable to set timeout - Good"
2918+ except dbus.DBusException as e:
2919+ print("Unable to set timeout - Good")
2920
2921 try:
2922 cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
2923- except dbus.DBusException, e:
2924- print "Unable to set timeout - Good"
2925+ except dbus.DBusException as e:
2926+ print("Unable to set timeout - Good")
2927
2928 try:
2929 cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
2930- except dbus.DBusException, e:
2931- print "Unable to set timeout - Good"
2932+ except dbus.DBusException as e:
2933+ print("Unable to set timeout - Good")
2934
2935 try:
2936 cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
2937- except dbus.DBusException, e:
2938- print "Unable to set timeout - Good"
2939+ except dbus.DBusException as e:
2940+ print("Unable to set timeout - Good")
2941
2942 try:
2943 cf.SetProperty("VoiceNoReply", "")
2944- except dbus.DBusException, e:
2945- print "Unable to erase voice no reply rule - Bad"
2946+ except dbus.DBusException as e:
2947+ print("Unable to erase voice no reply rule - Bad")
2948
2949 try:
2950 cf.SetProperty("VoiceNoReply", "+134444")
2951- except dbus.DBusException, e:
2952- print "Unable to register voice no reply rule - Bad"
2953+ except dbus.DBusException as e:
2954+ print("Unable to register voice no reply rule - Bad")
2955
2956 try:
2957 cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
2958- except dbus.DBusException, e:
2959- print "Unable to set voice no reply timeout - Bad"
2960+ except dbus.DBusException as e:
2961+ print("Unable to set voice no reply timeout - Bad")
2962
2963 properties = cf.GetProperties()
2964
2965- print properties["VoiceNoReply"]
2966- print properties["VoiceNoReplyTimeout"]
2967+ print(properties["VoiceNoReply"])
2968+ print(properties["VoiceNoReplyTimeout"])
2969
2970 try:
2971 cf.SetProperty("VoiceUnconditional", "+155555")
2972- except dbus.DBusException, e:
2973- print "Unable to set Voice Unconditional - Bad"
2974+ except dbus.DBusException as e:
2975+ print("Unable to set Voice Unconditional - Bad")
2976
2977 properties = cf.GetProperties()
2978
2979- print properties["VoiceUnconditional"]
2980+ print(properties["VoiceUnconditional"])
2981
2982 try:
2983 cf.DisableAll("foobar")
2984- except dbus.DBusException, e:
2985- print "Unable to delete invalids - Good"
2986+ except dbus.DBusException as e:
2987+ print("Unable to delete invalids - Good")
2988
2989 try:
2990 cf.DisableAll("conditional")
2991- except dbus.DBusException, e:
2992- print "Unable to delete all conditional - Bad"
2993+ except dbus.DBusException as e:
2994+ print("Unable to delete all conditional - Bad")
2995
2996 properties = cf.GetProperties()
2997
2998- print properties["VoiceNoReply"]
2999- print properties["VoiceNoReplyTimeout"]
3000+ print(properties["VoiceNoReply"])
3001+ print(properties["VoiceNoReplyTimeout"])
3002
3003 try:
3004 cf.DisableAll("all")
3005- except dbus.DBusException, e:
3006- print "Unable to delete all conditional - Bad"
3007-
3008- print properties["VoiceUnconditional"]
3009-
3010- mainloop = gobject.MainLoop()
3011+ except dbus.DBusException as e:
3012+ print("Unable to delete all conditional - Bad")
3013+
3014+ print(properties["VoiceUnconditional"])
3015+
3016+ mainloop = GLib.MainLoop()
3017 mainloop.run()
3018
3019=== modified file 'test/test-call-settings'
3020--- test/test-call-settings 2011-03-08 19:21:52 +0000
3021+++ test/test-call-settings 2014-02-28 20:44:46 +0000
3022@@ -1,24 +1,24 @@
3023 #!/usr/bin/python
3024
3025-import gobject
3026+from gi.repository import GLib
3027
3028 import dbus
3029 import dbus.mainloop.glib
3030 import sys
3031
3032 def property_changed(name, value):
3033- print "CallSettings property: '%s' changed to '%s'" % (name, value)
3034+ print("CallSettings property: '%s' changed to '%s'" % (name, value))
3035
3036 if canexit:
3037 mainloop.quit();
3038
3039 if __name__ == "__main__":
3040 if len(sys.argv) < 3:
3041- print "Usage: %s [modem] <property> <newvalue>" % (sys.argv[0])
3042- print "Properties can be: VoiceCallWaiting,"
3043- print " ConnectedLineRestriction, CallingLineRestriction,"
3044- print " CallingLinePresentation, CalledLinePresentation,"
3045- print " ConnectedLinePresentation, HideCallerId"
3046+ print("Usage: %s [modem] <property> <newvalue>" % (sys.argv[0]))
3047+ print("Properties can be: VoiceCallWaiting,")
3048+ print(" ConnectedLineRestriction, CallingLineRestriction,")
3049+ print(" CallingLinePresentation, CalledLinePresentation,")
3050+ print(" ConnectedLinePresentation, HideCallerId")
3051 sys.exit(1)
3052
3053 canexit = False
3054@@ -41,7 +41,7 @@
3055 property = sys.argv[1]
3056 newvalue = sys.argv[2]
3057
3058- print "Using modem %s" % modem
3059+ print("Using modem %s" % modem)
3060
3061 cs = dbus.Interface(bus.get_object('org.ofono', modem),
3062 'org.ofono.CallSettings')
3063@@ -50,34 +50,34 @@
3064
3065 properties = cs.GetProperties()
3066
3067- print "Current Property values:"
3068- print "Network Status of Call Waiting - Voice: %s" %\
3069- (properties['VoiceCallWaiting'])
3070- print "Network Status of Connected Line Restriction: %s" %\
3071- (properties['ConnectedLineRestriction'])
3072- print "Network Status of Calling Line Restriction: %s" %\
3073- (properties['CallingLineRestriction'])
3074- print "Network Status of Calling Line Presentation: %s" %\
3075- (properties['CallingLinePresentation'])
3076- print "Network Status of Called Line Presentation: %s" %\
3077- (properties['CalledLinePresentation'])
3078- print "Network Status of Connected Line Presentation: %s" %\
3079- (properties['ConnectedLinePresentation'])
3080- print "Hide my Caller Id: %s" % (properties['HideCallerId'])
3081+ print("Current Property values:")
3082+ print("Network Status of Call Waiting - Voice: %s" %\
3083+ (properties['VoiceCallWaiting']))
3084+ print("Network Status of Connected Line Restriction: %s" %\
3085+ (properties['ConnectedLineRestriction']))
3086+ print("Network Status of Calling Line Restriction: %s" %\
3087+ (properties['CallingLineRestriction']))
3088+ print("Network Status of Calling Line Presentation: %s" %\
3089+ (properties['CallingLinePresentation']))
3090+ print("Network Status of Called Line Presentation: %s" %\
3091+ (properties['CalledLinePresentation']))
3092+ print("Network Status of Connected Line Presentation: %s" %\
3093+ (properties['ConnectedLinePresentation']))
3094+ print("Hide my Caller Id: %s" % (properties['HideCallerId']))
3095
3096 try:
3097 cs.SetProperty(property, newvalue)
3098- except dbus.DBusException, e:
3099- print "Unable to set property: ", e
3100+ except dbus.DBusException as e:
3101+ print("Unable to set property: %s" % e)
3102 sys.exit(1);
3103
3104- print "Setting successful"
3105+ print("Setting successful")
3106
3107 if (properties[property] == newvalue):
3108- print "Setting was already set to this value"
3109+ print("Setting was already set to this value")
3110 sys.exit(1);
3111
3112 canexit = True
3113
3114- mainloop = gobject.MainLoop()
3115+ mainloop = GLib.MainLoop()
3116 mainloop.run()
3117
3118=== modified file 'test/test-cbs'
3119--- test/test-cbs 2011-03-14 14:32:29 +0000
3120+++ test/test-cbs 2014-02-28 20:44:46 +0000
3121@@ -3,73 +3,73 @@
3122 import dbus
3123 import dbus.mainloop.glib
3124 import sys
3125-import gobject
3126+from gi.repository import GLib
3127 import os
3128
3129 def print_menu():
3130- print "Select test case"
3131- print "----------------------------------------------------------------"
3132- print "[0] Activate cbs"
3133- print "[1] Deactivate cbs"
3134- print "[2] Get cbs properties"
3135- print "[3] Set/Register topics"
3136- print " If several - give topics separated with comma. \
3137- \n E.g. 20,50-51,60"
3138- print "[4] Clear/Unregister topics"
3139- print "[5] NetReg Base Station - Get current serving cell"
3140- print "[x] Exit"
3141- print "----------------------------------------------------------------"
3142+ print("Select test case")
3143+ print("----------------------------------------------------------------")
3144+ print("[0] Activate cbs")
3145+ print("[1] Deactivate cbs")
3146+ print("[2] Get cbs properties")
3147+ print("[3] Set/Register topics")
3148+ print(" If several - give topics separated with comma. \
3149+ \n E.g. 20,50-51,60")
3150+ print("[4] Clear/Unregister topics")
3151+ print("[5] NetReg Base Station - Get current serving cell")
3152+ print("[x] Exit")
3153+ print("----------------------------------------------------------------")
3154
3155 def property_changed(property, value):
3156 if value == "" and property == "Topics":
3157- print "User selected Topics have been cleared. \
3158- \nRegistered for emergency topics only."
3159+ print("User selected Topics have been cleared. \
3160+ \nRegistered for emergency topics only.")
3161 else:
3162- print "Cell Broadcast property %s is changed to %s" % (property, value)
3163- print "\nPress ENTER to continue"
3164+ print("Cell Broadcast property %s is changed to %s" % (property, value))
3165+ print("\nPress ENTER to continue")
3166
3167 def incoming_broadcast(text, topic):
3168- print "Broadcast msg: %s \n Topic channel: %s" % (text, topic)
3169- print "\nPress ENTER to continue"
3170+ print("Broadcast msg: %s \n Topic channel: %s" % (text, topic))
3171+ print("\nPress ENTER to continue")
3172
3173 def emergency_broadcast(text, properties):
3174 emergType = properties["EmergencyType"]
3175 emergAlert = properties["EmergencyAlert"]
3176
3177- print "Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \
3178- % (text, emergType, emergAlert, popup)
3179+ print("Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \
3180+ % (text, emergType, emergAlert, popup))
3181
3182 if properties["Popup"] == True:
3183- print "Popup required."
3184+ print("Popup required.")
3185
3186- print "\nPress ENTER to continue"
3187+ print("\nPress ENTER to continue")
3188
3189 def set_cbs_state(cbs, state):
3190 if state == True:
3191- print "Activating cell broadcast..."
3192+ print("Activating cell broadcast...")
3193 cbs.SetProperty("Powered", dbus.Boolean(1))
3194 else:
3195- print "Deactivating cell broadcast..."
3196+ print("Deactivating cell broadcast...")
3197 cbs.SetProperty("Powered", dbus.Boolean(0))
3198- print "-----------------------------------------------------------"
3199+ print("-----------------------------------------------------------")
3200
3201 def print_cbs_properties(cbs):
3202 properties = cbs.GetProperties()
3203- print "---------------------PROPERTIES----------------------------"
3204+ print("---------------------PROPERTIES----------------------------")
3205 for p in properties:
3206 if len(properties[p].__str__()) > 0:
3207 if p == "Powered":
3208 if properties[p] == True:
3209- print "Cell Broadcast is Activated."
3210+ print("Cell Broadcast is Activated.")
3211 else:
3212- print "Cell Broadcast is Deactivated."
3213+ print("Cell Broadcast is Deactivated.")
3214 elif p == "Topics":
3215- print "Currently set CBS %s are: %s" \
3216- % (p, properties[p])
3217+ print("Currently set CBS %s are: %s" \
3218+ % (p, properties[p]))
3219 topics_available = True
3220 else:
3221- print "Cell Broadcast %s value empty" % (p)
3222- print "-----------------------------------------------------------"
3223+ print("Cell Broadcast %s value empty" % (p))
3224+ print("-----------------------------------------------------------")
3225
3226 def set_topics(cbs):
3227 print_cbs_properties(cbs)
3228@@ -78,7 +78,7 @@
3229 invalidData = False;
3230 index = 0
3231
3232- topics = raw_input('Enter the topic ID(s) you want to register to: ')
3233+ topics = input('Enter the topic ID(s) you want to register to: ')
3234
3235 while index < len(topics):
3236 if topics[index] == ',' or topics[index] == '-':
3237@@ -86,27 +86,27 @@
3238 elif topics[index] >= '0' and topics[index] <= '9':
3239 topicTemp = topicTemp + topics[index]
3240 else:
3241- print "Invalid char. \"%s\" entered. Topic not set." \
3242- % (topics[index])
3243+ print("Invalid char. \"%s\" entered. Topic not set." \
3244+ % (topics[index]))
3245 invalidData = True
3246 break
3247
3248 if topicTemp:
3249 if int(topicTemp) > 999:
3250 invalidData = True
3251- print "Invalid Topic ID %s (range 0-999). \
3252- \nCould not register." % topicTemp
3253+ print("Invalid Topic ID %s (range 0-999). \
3254+ \nCould not register." % topicTemp)
3255
3256 index = index + 1
3257
3258 if invalidData == False:
3259 try:
3260- print "Setting Cell Broadcast topics..."
3261+ print("Setting Cell Broadcast topics...")
3262 cbs.SetProperty("Topics", topics);
3263- except dbus.DBusException, e:
3264- print "Unable to set topic: ", e
3265+ except dbus.DBusException as e:
3266+ print("Unable to set topic: %s" % e)
3267
3268- print "-----------------------------------------------------------"
3269+ print("-----------------------------------------------------------")
3270
3271 def get_serving_cell_name(netReg):
3272 wasFound = False;
3273@@ -115,20 +115,20 @@
3274 for p in properties:
3275 if p == "BaseStation":
3276 if len(properties[p].__str__()) > 0:
3277- print "Current serving cell name: %s" \
3278- % (properties["BaseStation"])
3279+ print("Current serving cell name: %s" \
3280+ % (properties["BaseStation"]))
3281 wasFound = True;
3282 else:
3283- print "Current Serving cell name empty. \
3284- Base Station CBS not available."
3285+ print("Current Serving cell name empty. \
3286+ Base Station CBS not available.")
3287
3288 if wasFound == False:
3289- print "Base Station parameter not found. \
3290- \nBase Station CBS not available."
3291- print "-----------------------------------------------------------"
3292+ print("Base Station parameter not found. \
3293+ \nBase Station CBS not available.")
3294+ print("-----------------------------------------------------------")
3295
3296-def stdin_handler(fd, condition, cbs, netReg):
3297- in_key = os.read(fd.fileno(), 160).rstrip()
3298+def stdin_handler(channel, condition, cbs, netReg):
3299+ in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
3300
3301 if in_key == '0':
3302 set_cbs_state(cbs, True)
3303@@ -151,7 +151,7 @@
3304 elif in_key == 'x':
3305 sys.exit(1)
3306
3307- print '\n' * 2
3308+ print('\n' * 2)
3309 print_menu()
3310
3311 return True
3312@@ -177,12 +177,13 @@
3313 cbs.connect_to_signal("IncomingBroadcast", incoming_broadcast)
3314 cbs.connect_to_signal("EmergencyBroadcast", emergency_broadcast)
3315
3316- print '\n' * 2
3317+ print('\n' * 2)
3318
3319 print_menu()
3320
3321- gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler, cbs, \
3322- netReg)
3323+ GLib.io_add_watch(GLib.IOChannel(filedes=sys.stdin.fileno()),
3324+ GLib.PRIORITY_DEFAULT, GLib.IO_IN, stdin_handler, cbs, \
3325+ netReg)
3326
3327- mainloop = gobject.MainLoop()
3328+ mainloop = GLib.MainLoop()
3329 mainloop.run()
3330
3331=== modified file 'test/test-gnss'
3332--- test/test-gnss 2011-03-28 23:06:59 +0000
3333+++ test/test-gnss 2014-02-28 20:44:46 +0000
3334@@ -1,6 +1,6 @@
3335 #!/usr/bin/python
3336
3337-import gobject
3338+from gi.repository import GLib
3339 import sys
3340 import os
3341
3342@@ -15,51 +15,51 @@
3343 @dbus.service.method(AGENT_INTERFACE,
3344 in_signature="", out_signature="")
3345 def Release(self):
3346- print "Release"
3347+ print("Release")
3348 mainloop.quit()
3349
3350 @dbus.service.method(AGENT_INTERFACE,
3351 in_signature="s", out_signature="")
3352 def Request(self, xml):
3353- print "positioning data: %s" % (xml)
3354+ print("positioning data: %s" % (xml))
3355
3356 @dbus.service.method(AGENT_INTERFACE,
3357 in_signature="", out_signature="")
3358 def ResetAssistanceData(self):
3359- print "Reset Assistance Data request received"
3360+ print("Reset Assistance Data request received")
3361
3362 def print_menu():
3363- print "Select test case"
3364- print "-----------------------------------------------------------"
3365- print "[0] SendPositioningElement"
3366- print "[1] RegisterPositioningRequestAgent"
3367- print "[2] UnregisterPositioningRequestAgent"
3368- print "[x] Exit"
3369- print "-----------------------------------------------------------"
3370+ print("Select test case")
3371+ print("-----------------------------------------------------------")
3372+ print("[0] SendPositioningElement")
3373+ print("[1] RegisterPositioningRequestAgent")
3374+ print("[2] UnregisterPositioningRequestAgent")
3375+ print("[x] Exit")
3376+ print("-----------------------------------------------------------")
3377
3378-def stdin_handler(fd, condition, gnss, path):
3379- in_key = os.read(fd.fileno(), 8).rstrip()
3380+def stdin_handler(channel, condition, gnss, path):
3381+ in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
3382 if in_key == '0':
3383- xml = raw_input('type the element and press enter: ')
3384+ xml = input('type the element and press enter: ')
3385 try:
3386 gnss.SendPositioningElement(dbus.String(xml))
3387- print "ok"
3388- except dbus.DBusException, e:
3389- print "Unable to send positioning element"
3390+ print("ok")
3391+ except dbus.DBusException as e:
3392+ print("Unable to send positioning element")
3393
3394 elif in_key == '1':
3395 try:
3396 gnss.RegisterPositioningRequestAgent("/test/posagent")
3397- print "ok"
3398- except dbus.DBusException, e:
3399- print "Unable to register positioning agent"
3400+ print("ok")
3401+ except dbus.DBusException as e:
3402+ print("Unable to register positioning agent")
3403
3404 elif in_key == '2':
3405 try:
3406 gnss.UnregisterPositioningRequestAgent(path)
3407- print "ok"
3408- except dbus.DBusException, e:
3409- print "Unable to unregister positioning agent"
3410+ print("ok")
3411+ except dbus.DBusException as e:
3412+ print("Unable to unregister positioning agent")
3413 elif in_key == 'x':
3414 sys.exit(1)
3415
3416@@ -87,7 +87,8 @@
3417
3418 print_menu()
3419
3420- gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler,
3421- gnss, path)
3422- mainloop = gobject.MainLoop()
3423+ GLib.io_add_watch(GLib.IOChannel(filedes=sys.stdin.fileno()),
3424+ GLib.PRIORITY_DEFAULT, GLib.IO_IN, stdin_handler,
3425+ gnss, path)
3426+ mainloop = GLib.MainLoop()
3427 mainloop.run()
3428
3429=== modified file 'test/test-message-waiting'
3430--- test/test-message-waiting 2011-03-11 20:00:36 +0000
3431+++ test/test-message-waiting 2014-02-28 20:44:46 +0000
3432@@ -1,17 +1,17 @@
3433 #!/usr/bin/python
3434
3435-import gobject
3436+from gi.repository import GLib
3437 import sys
3438 import dbus
3439 import dbus.mainloop.glib
3440
3441 def mw_property_changed(name, value):
3442 if name == 'VoicemailMessageCount':
3443- print "MessageWaiting property: '%s' changed to '%d'" %\
3444- (name,value)
3445+ print("MessageWaiting property: '%s' changed to '%d'" %\
3446+ (name,value))
3447 else:
3448- print "MessageWaiting property: '%s' changed to '%s'" %\
3449- (name,value)
3450+ print("MessageWaiting property: '%s' changed to '%s'" %\
3451+ (name,value))
3452
3453 if __name__ == "__main__":
3454 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3455@@ -30,11 +30,11 @@
3456
3457 properties = mw.GetProperties()
3458
3459- print "Voicemail waiting: %s" % (properties['VoicemailWaiting'])
3460- print "Voicemail message count: %d" %\
3461- (properties['VoicemailMessageCount'])
3462- print "Voicemail mailbox number: %s" %\
3463- (properties['VoicemailMailboxNumber'])
3464+ print("Voicemail waiting: %s" % (properties['VoicemailWaiting']))
3465+ print("Voicemail message count: %d" %\
3466+ (properties['VoicemailMessageCount']))
3467+ print("Voicemail mailbox number: %s" %\
3468+ (properties['VoicemailMailboxNumber']))
3469
3470- mainloop = gobject.MainLoop()
3471+ mainloop = GLib.MainLoop()
3472 mainloop.run()
3473
3474=== modified file 'test/test-modem'
3475--- test/test-modem 2011-03-08 19:34:24 +0000
3476+++ test/test-modem 2014-02-28 20:44:46 +0000
3477@@ -1,12 +1,12 @@
3478 #!/usr/bin/python
3479
3480-import gobject
3481+from gi.repository import GLib
3482
3483 import dbus
3484 import dbus.mainloop.glib
3485
3486 def property_changed(name, value):
3487- print "Modem property %s changed to %s" % (name, value)
3488+ print("Modem property %s changed to %s" % (name, value))
3489
3490 if __name__ == "__main__":
3491 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3492@@ -24,42 +24,42 @@
3493
3494 properties = modem.GetProperties()
3495
3496- if properties.has_key('Name'):
3497- print "Name: %s" % (properties['Name'])
3498-
3499- if properties.has_key('Manufacturer'):
3500- print "Manufacturer: %s" % (properties['Manufacturer'])
3501-
3502- if properties.has_key('Model'):
3503- print "Model: %s" % (properties['Model'])
3504-
3505- if properties.has_key('Revision'):
3506- print "Revision: %s" % (properties['Revision'])
3507-
3508- if properties.has_key('Serial'):
3509- print "Serial: %s" % (properties['Serial'])
3510-
3511- if properties.has_key('Powered'):
3512- print "Powered: %s" % (properties['Powered'])
3513-
3514- if properties.has_key('Online'):
3515- print "Online: %s" % (properties['Online'])
3516-
3517- if properties.has_key('Lockdown'):
3518- print "Lockdown: %s" % (properties['Lockdown'])
3519-
3520- if properties.has_key('Emergency'):
3521- print "Emergency: %s" % (properties['Emergency'])
3522-
3523- if properties.has_key('Features'):
3524- print "Features:"
3525+ if 'Name' in properties:
3526+ print("Name: %s" % (properties['Name']))
3527+
3528+ if 'Manufacturer' in properties:
3529+ print("Manufacturer: %s" % (properties['Manufacturer']))
3530+
3531+ if 'Model' in properties:
3532+ print("Model: %s" % (properties['Model']))
3533+
3534+ if 'Revision' in properties:
3535+ print("Revision: %s" % (properties['Revision']))
3536+
3537+ if 'Serial' in properties:
3538+ print("Serial: %s" % (properties['Serial']))
3539+
3540+ if 'Powered' in properties:
3541+ print("Powered: %s" % (properties['Powered']))
3542+
3543+ if 'Online' in properties:
3544+ print("Online: %s" % (properties['Online']))
3545+
3546+ if 'Lockdown' in properties:
3547+ print("Lockdown: %s" % (properties['Lockdown']))
3548+
3549+ if 'Emergency' in properties:
3550+ print("Emergency: %s" % (properties['Emergency']))
3551+
3552+ if 'Features' in properties:
3553+ print("Features:")
3554 for feature in properties["Features"]:
3555- print " [ %s ]" % (feature)
3556+ print(" [ %s ]" % (feature))
3557
3558- if properties.has_key('Interfaces'):
3559- print "Interfaces:"
3560+ if 'Interfaces' in properties:
3561+ print("Interfaces:")
3562 for interface in properties["Interfaces"]:
3563- print " [ %s ]" % (interface)
3564+ print(" [ %s ]" % (interface))
3565
3566- mainloop = gobject.MainLoop()
3567+ mainloop = GLib.MainLoop()
3568 mainloop.run()
3569
3570=== modified file 'test/test-network-registration'
3571--- test/test-network-registration 2011-09-29 19:03:45 +0000
3572+++ test/test-network-registration 2014-02-28 20:44:46 +0000
3573@@ -1,23 +1,23 @@
3574 #!/usr/bin/python
3575
3576-import gobject
3577+from gi.repository import GLib
3578 import sys
3579 import dbus
3580 import dbus.mainloop.glib
3581
3582 def network_property_changed(name, value):
3583- print "Network Registration property '%s' changed to '%s'" %\
3584- (name, value)
3585+ print("Network Registration property '%s' changed to '%s'" %\
3586+ (name, value))
3587
3588 if name == 'Name' and canexit:
3589 mainloop.quit()
3590
3591 if __name__ == "__main__":
3592 if len(sys.argv) < 2:
3593- print "Usage: %s [modem] <path> - Register to PLMN on <path>" %\
3594- (sys.argv[0])
3595- print "Usage: %s [modem] default - Register to default PLMN" %\
3596- (sys.argv[0])
3597+ print("Usage: %s [modem] <path> - Register to PLMN on <path>" %\
3598+ (sys.argv[0]))
3599+ print("Usage: %s [modem] default - Register to default PLMN" %\
3600+ (sys.argv[0]))
3601 sys.exit(1)
3602
3603 canexit = False
3604@@ -44,15 +44,15 @@
3605
3606 props = netreg.GetProperties()
3607
3608- print "Status is: '%s', Operator Name is: '%s'" %\
3609- (props['Status'], props['Name'])
3610-
3611- if props.has_key('LocationAreaCode') and props.has_key('CellId'):
3612- print "Location: '%d', Cell: '%d'" %\
3613- (props['LocationAreaCode'], props['CellId'])
3614-
3615- if props.has_key('Technology'):
3616- print "Technology: '%s'" % (props['Technology'])
3617+ print("Status is: '%s', Operator Name is: '%s'" %\
3618+ (props['Status'], props['Name']))
3619+
3620+ if 'LocationAreaCode' in props and 'CellId' in props:
3621+ print("Location: '%d', Cell: '%d'" %\
3622+ (props['LocationAreaCode'], props['CellId']))
3623+
3624+ if 'Technology' in props:
3625+ print("Technology: '%s'" % (props['Technology']))
3626
3627 try:
3628 if plmn == 'default':
3629@@ -61,11 +61,11 @@
3630 obj = bus.get_object('org.ofono', plmn);
3631 op = dbus.Interface(obj, 'org.ofono.NetworkOperator')
3632 op.Register()
3633- except dbus.DBusException, e:
3634- print "Unable to register: ", e
3635+ except dbus.DBusException as e:
3636+ print("Unable to register: %s" % e)
3637 sys.exit(1)
3638
3639 canexit = True
3640
3641- mainloop = gobject.MainLoop()
3642+ mainloop = GLib.MainLoop()
3643 mainloop.run()
3644
3645=== modified file 'test/test-phonebook'
3646--- test/test-phonebook 2011-09-29 19:03:45 +0000
3647+++ test/test-phonebook 2014-02-28 20:44:46 +0000
3648@@ -20,4 +20,4 @@
3649 phonebook = dbus.Interface(bus.get_object('org.ofono', path),
3650 'org.ofono.Phonebook')
3651
3652- print phonebook.Import(timeout=100)
3653+ print(phonebook.Import(timeout=100))
3654
3655=== modified file 'test/test-push-notification'
3656--- test/test-push-notification 2010-12-03 12:47:40 +0000
3657+++ test/test-push-notification 2014-02-28 20:44:46 +0000
3658@@ -1,6 +1,6 @@
3659 #!/usr/bin/python
3660
3661-import gobject
3662+from gi.repository import GLib
3663
3664 import sys
3665 import dbus
3666@@ -11,16 +11,16 @@
3667 @dbus.service.method("org.ofono.PushNotificationAgent",
3668 in_signature="", out_signature="")
3669 def Release(self):
3670- print "Release"
3671+ print("Release")
3672 mainloop.quit()
3673
3674 @dbus.service.method("org.ofono.PushNotificationAgent",
3675 in_signature="aya{sv}", out_signature="")
3676 def ReceiveNotification(self, data, props):
3677 for key in props.keys():
3678- print "Key: %s, Value: %s" % (key, props[key])
3679+ print("Key: %s, Value: %s" % (key, props[key]))
3680
3681- print "Received notification of size: %d" % len(data)
3682+ print("Received notification of size: %d" % len(data))
3683
3684 if __name__ == '__main__':
3685 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3686@@ -41,9 +41,9 @@
3687 path = "/test/agent"
3688 agent = PushNotificationAgent(bus, path)
3689 pn.RegisterAgent(path)
3690- print "Agent registered"
3691+ print("Agent registered")
3692
3693- mainloop = gobject.MainLoop()
3694+ mainloop = GLib.MainLoop()
3695
3696 try:
3697 mainloop.run()
3698
3699=== modified file 'test/test-smart-messaging'
3700--- test/test-smart-messaging 2010-12-03 12:47:40 +0000
3701+++ test/test-smart-messaging 2014-02-28 20:44:46 +0000
3702@@ -1,6 +1,6 @@
3703 #!/usr/bin/python
3704
3705-import gobject
3706+from gi.repository import GLib
3707
3708 import sys
3709 import dbus
3710@@ -11,34 +11,34 @@
3711 @dbus.service.method("org.ofono.SmartMessagingAgent",
3712 in_signature="", out_signature="")
3713 def Release(self):
3714- print "Release"
3715+ print("Release")
3716 mainloop.quit()
3717
3718 @dbus.service.method("org.ofono.SmartMessagingAgent",
3719 in_signature="aya{sv}", out_signature="")
3720 def ReceiveBusinessCard(self, data, props):
3721 for key in props.keys():
3722- print "Key: %s, Value: %s" % (key, props[key])
3723+ print("Key: %s, Value: %s" % (key, props[key]))
3724
3725 string = ""
3726 for byte in data:
3727 string += str(byte)
3728
3729- print "Received Business Card:"
3730- print string
3731+ print("Received Business Card:")
3732+ print(string)
3733
3734 @dbus.service.method("org.ofono.SmartMessagingAgent",
3735 in_signature="aya{sv}", out_signature="")
3736 def ReceiveAppointment(self, data, props):
3737 for key in props.keys():
3738- print "Key: %s, Value: %s" % (key, props[key])
3739+ print("Key: %s, Value: %s" % (key, props[key]))
3740
3741 string = ""
3742 for byte in data:
3743 string += str(byte)
3744
3745- print "Received Appointment:"
3746- print string
3747+ print("Received Appointment:")
3748+ print(string)
3749
3750 if __name__ == '__main__':
3751 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
3752@@ -59,9 +59,9 @@
3753 path = "/test/agent"
3754 agent = SmartMessagingAgent(bus, path)
3755 pn.RegisterAgent(path)
3756- print "Agent registered"
3757+ print("Agent registered")
3758
3759- mainloop = gobject.MainLoop()
3760+ mainloop = GLib.MainLoop()
3761
3762 try:
3763 mainloop.run()
3764
3765=== modified file 'test/test-sms'
3766--- test/test-sms 2011-09-29 19:03:45 +0000
3767+++ test/test-sms 2014-02-28 20:44:46 +0000
3768@@ -1,7 +1,7 @@
3769 #!/usr/bin/python
3770 # -*- coding: utf-8 -*-
3771
3772-import gobject
3773+from gi.repository import GLib
3774 import sys
3775 import os
3776
3777@@ -20,119 +20,119 @@
3778 os.system('CLS')
3779
3780 else:
3781- print '\n' * numlines
3782+ print('\n' * numlines)
3783
3784 def print_menu():
3785- print "Select test case"
3786- print "-----------------------------------------------------------"
3787- print "[0] Send SMS"
3788- print "[1] Enable delivery reports"
3789- print "[2] Disable delivery reports"
3790- print "[3] Set Service Center Address"
3791- print "[4] Set PS-only Bearer"
3792- print "[5] Set CS-only Bearer"
3793- print "[6] Set PS-preferred Bearer"
3794- print "[7] Set CS-preferred Bearer"
3795- print "[x] Exit"
3796- print "-----------------------------------------------------------"
3797+ print("Select test case")
3798+ print("-----------------------------------------------------------")
3799+ print("[0] Send SMS")
3800+ print("[1] Enable delivery reports")
3801+ print("[2] Disable delivery reports")
3802+ print("[3] Set Service Center Address")
3803+ print("[4] Set PS-only Bearer")
3804+ print("[5] Set CS-only Bearer")
3805+ print("[6] Set PS-preferred Bearer")
3806+ print("[7] Set CS-preferred Bearer")
3807+ print("[x] Exit")
3808+ print("-----------------------------------------------------------")
3809
3810 def print_send_sms_menu():
3811- print "Select SMS type"
3812- print "-----------------------------------------------------------"
3813- print "[1] Default SMS"
3814- print "[2] Long SMS > 160 characters"
3815- print "[3] SMS with national characters"
3816- print "-----------------------------------------------------------"
3817+ print("Select SMS type")
3818+ print("-----------------------------------------------------------")
3819+ print("[1] Default SMS")
3820+ print("[2] Long SMS > 160 characters")
3821+ print("[3] SMS with national characters")
3822+ print("-----------------------------------------------------------")
3823
3824 def message_delivery_report(sms, value):
3825 try:
3826 sms.SetProperty("UseDeliveryReports", dbus.Boolean(value))
3827
3828- except dbus.DBusException, e:
3829+ except dbus.DBusException as e:
3830 if value == 1:
3831- print "Unable to activate Delivery Reports - FAIL"
3832+ print("Unable to activate Delivery Reports - FAIL")
3833
3834 if value == 0:
3835- print "Unable to deactivate Delivery Reports - FAIL"
3836+ print("Unable to deactivate Delivery Reports - FAIL")
3837
3838 def message_service_center_address(sms, value):
3839 try:
3840 sms.SetProperty("ServiceCenterAddress",dbus.String(value))
3841- except dbus.DBusException, e:
3842- print "Unable to set correct Service Center Address - FAIL"
3843+ except dbus.DBusException as e:
3844+ print("Unable to set correct Service Center Address - FAIL")
3845
3846 def message_bearer(sms, value):
3847 try:
3848 sms.SetProperty("Bearer", dbus.String(value))
3849- except dbus.DBusException, e:
3850- print "Unable to set Bearer[%s] - FAIL" % (value)
3851+ except dbus.DBusException as e:
3852+ print("Unable to set Bearer[%s] - FAIL" % (value))
3853
3854
3855 def message_send(sms, number, value):
3856 sms.SendMessage(dbus.String(number), value)
3857
3858 def property_changed(property, value):
3859- print "[1]:Message Manager property %s changed to %s" %\
3860- (property, value)
3861- print "[1]:press ENTER"
3862+ print("[1]:Message Manager property %s changed to %s" %\
3863+ (property, value))
3864+ print("[1]:press ENTER")
3865
3866 def immediate_message(property, value):
3867- print "[2]:Message Manager immediate message"
3868- print "[2]:Text::%s" % (property)
3869+ print("[2]:Message Manager immediate message")
3870+ print("[2]:Text::%s" % (property))
3871 for key in value.keys():
3872 val = str(value[key])
3873- print "[2]:%s = %s" % (key, val)
3874+ print("[2]:%s = %s" % (key, val))
3875
3876- print "[2]:press ENTER"
3877+ print("[2]:press ENTER")
3878
3879 def incoming_message(property, value):
3880- print "[3]:Message Manager incoming message"
3881- print "[3]:Text::%s" % (property)
3882+ print("[3]:Message Manager incoming message")
3883+ print("[3]:Text::%s" % (property))
3884 for key in value.keys():
3885 val = str(value[key])
3886- print "[3]:%s = %s" % (key, val)
3887+ print("[3]:%s = %s" % (key, val))
3888
3889- print "[3]:press ENTER"
3890+ print("[3]:press ENTER")
3891
3892 def message_added(property, value):
3893- print "[4]:Message Manager[Added]"
3894- print "[4]:%s"% (property)
3895+ print("[4]:Message Manager[Added]")
3896+ print("[4]:%s"% (property))
3897
3898 for key in value.keys():
3899 val = str(value[key])
3900- print "[4]:%s = %s" % (key, val)
3901+ print("[4]:%s = %s" % (key, val))
3902
3903- print "[4]:press ENTER"
3904+ print("[4]:press ENTER")
3905
3906 def message_removed(property):
3907- print "[5]:Message Manager [removed]"
3908- print "[5]: %s" % (property)
3909- print "[5]:press ENTER"
3910+ print("[5]:Message Manager [removed]")
3911+ print("[5]: %s" % (property))
3912+ print("[5]:press ENTER")
3913
3914 def print_sms_properties(sms):
3915 global SCA
3916 properties = sms.GetProperties()
3917- print "---------------------PROPERTIES----------------------------"
3918+ print("---------------------PROPERTIES----------------------------")
3919 for p in properties:
3920 if len(properties[p].__str__()) > 0:
3921- print "%s Message Manager rule is: %s" %\
3922- (p, properties[p])
3923- print "------------------------------------------" \
3924- "-----------------"
3925+ print("%s Message Manager rule is: %s" %\
3926+ (p, properties[p]))
3927+ print("------------------------------------------" \
3928+ "-----------------")
3929 if p == "ServiceCenterAddress":
3930 SCA = properties[p]
3931 else:
3932- print "%s Message Manager rule disabled" % (p)
3933+ print("%s Message Manager rule disabled" % (p))
3934
3935-def stdin_handler(fd, condition, sms, value, number):
3936+def stdin_handler(channel, condition, sms, value, number):
3937 global lock
3938- in_key = os.read(fd.fileno(), 160).rstrip()
3939+ in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
3940
3941 if lock == "off":
3942 lock = "on"
3943 if in_key == '0':
3944 print_send_sms_menu()
3945- sms_type = raw_input('Select SMS type: ')
3946+ sms_type = input('Select SMS type: ')
3947
3948 if sms_type == '1':
3949 message_send(sms, number, value)
3950@@ -150,49 +150,49 @@
3951
3952 elif in_key == '1':
3953 message_delivery_report(sms, 1)
3954- send_msg = raw_input('Send test message[y/n]?: ')
3955+ send_msg = input('Send test message[y/n]?: ')
3956 if send_msg == 'y':
3957 message_send(sms, number, ("(1)" + value +
3958 ": UseDeliveryReports[TRUE]"))
3959
3960 elif in_key == '2':
3961 message_delivery_report(sms, 0)
3962- send_msg = raw_input('Send test message[y/n]?: ')
3963+ send_msg = input('Send test message[y/n]?: ')
3964 if send_msg == 'y':
3965 message_send(sms, number, ("(2) " + value +
3966 ": UseDeliveryReports[FALSE]"))
3967
3968 elif in_key == '3':
3969 message_service_center_address(sms, SCA)
3970- send_msg = raw_input('Send test message[y/n]?: ')
3971+ send_msg = input('Send test message[y/n]?: ')
3972 if send_msg == 'y':
3973 message_send(sms, number, ("(3) " + value +
3974 ": ServiceCenterAddress"))
3975
3976 elif in_key == '4':
3977 message_bearer(sms, "ps-only")
3978- send_msg = raw_input('Send test message[y/n]?: ')
3979+ send_msg = input('Send test message[y/n]?: ')
3980 if send_msg == 'y':
3981 message_send(sms, number, ("(4) " + value +
3982 ": Bearer[ps-only]"))
3983
3984 elif in_key == '5':
3985 message_bearer(sms, "cs-only")
3986- send_msg = raw_input('Send test message[y/n]?: ')
3987+ send_msg = input('Send test message[y/n]?: ')
3988 if send_msg == 'y':
3989 message_send(sms, number, ("(5) " + value +
3990 ": Bearer[cs-only]"))
3991
3992 elif in_key == '6':
3993 message_bearer(sms, "ps-preferred")
3994- send_msg = raw_input('Send test message[y/n]?: ')
3995+ send_msg = input('Send test message[y/n]?: ')
3996 if send_msg == 'y':
3997 message_send(sms, number, ("(6) " + value +
3998 ": Bearer[ps-preferred]"))
3999
4000 elif in_key == '7':
4001 message_bearer(sms, "cs-preferred")
4002- send_msg = raw_input('Send test message[y/n]?: ')
4003+ send_msg = input('Send test message[y/n]?: ')
4004 if send_msg == 'y':
4005 message_send(sms,number, ("(7) " + value +
4006 ": Bearer[cs-preferred]"))
4007@@ -210,7 +210,7 @@
4008 if __name__ == "__main__":
4009
4010 if (len(sys.argv) < 3):
4011- print "Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0])
4012+ print("Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0]))
4013 sys.exit(1)
4014
4015 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4016@@ -241,7 +241,8 @@
4017 print_sms_properties(sms)
4018 print_menu()
4019
4020- gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler,
4021- sms, value, number)
4022- mainloop = gobject.MainLoop()
4023+ GLib.io_add_watch(GLib.IOChannel(filedes=sys.stdin.fileno()),
4024+ GLib.PRIORITY_DEFAULT, GLib.IOCondition.IN, stdin_handler,
4025+ sms, value, number)
4026+ mainloop = GLib.MainLoop()
4027 mainloop.run()
4028
4029=== modified file 'test/test-ss'
4030--- test/test-ss 2012-05-30 13:50:21 +0000
4031+++ test/test-ss 2014-02-28 20:44:46 +0000
4032@@ -22,21 +22,21 @@
4033
4034 try:
4035 ss_type, properties = ss.Initiate(ss_code, timeout=100)
4036-except dbus.DBusException, e:
4037- print "Unable to perform operation: ", e
4038+except dbus.DBusException as e:
4039+ print("Unable to perform operation: %s" % e)
4040 sys.exit(1);
4041
4042 if (ss_type == "CallBarring"):
4043- print "%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1])
4044+ print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
4045 for key in properties[2]:
4046- print "%s : %s" % (key, properties[2][key])
4047+ print("%s : %s" % (key, properties[2][key]))
4048 elif (ss_type == "CallForwarding"):
4049- print "%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1])
4050+ print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
4051 for key in properties[2]:
4052- print "%s : %s" % (key, properties[2][key])
4053+ print("%s : %s" % (key, properties[2][key]))
4054 elif (ss_type == "CallWaiting"):
4055- print "%s : Operation [ %s ]" % (ss_type, properties[0])
4056+ print("%s : Operation [ %s ]" % (ss_type, properties[0]))
4057 for key in properties[1]:
4058- print "%s : %s" % (key, properties[1][key])
4059+ print("%s : %s" % (key, properties[1][key]))
4060 else:
4061- print "%s : Operation [ %s ] Status [ %s ]" % (ss_type, properties[0], properties[1])
4062+ print("%s : Operation [ %s ] Status [ %s ]" % (ss_type, properties[0], properties[1]))
4063
4064=== modified file 'test/test-ss-control-cb'
4065--- test/test-ss-control-cb 2010-09-09 19:38:14 +0000
4066+++ test/test-ss-control-cb 2014-02-28 20:44:46 +0000
4067@@ -1,18 +1,18 @@
4068 #!/usr/bin/python
4069
4070-import gobject
4071+from gi.repository import GLib
4072
4073 import dbus
4074 import dbus.mainloop.glib
4075
4076 def property_changed(property, value):
4077- print "CallBarring property %s changed to %s" % (property, value)
4078+ print("CallBarring property %s changed to %s" % (property, value))
4079
4080 def print_properties(cb):
4081- properties = cb.GetProperties()
4082+ properties = cb.GetProperties()
4083
4084 for p in properties:
4085- print "property %s, value: %s" % (p, properties[p])
4086+ print("property %s, value: %s" % (p, properties[p]))
4087
4088 if __name__ == "__main__":
4089 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4090@@ -27,69 +27,69 @@
4091 cb = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
4092 'org.ofono.CallBarring')
4093
4094- cb.connect_to_signal("PropertyChanged", property_changed)
4095+ cb.connect_to_signal("PropertyChanged", property_changed)
4096
4097 ss = dbus.Interface(bus.get_object('org.ofono', modems[0]),
4098 'org.ofono.SupplementaryServices')
4099
4100 print_properties(cb)
4101
4102- print "Trying invalid SS request for CB"
4103- try:
4104- print ss.Initiate("*33#456666")
4105- except dbus.DBusException, e:
4106- print "Failed with %s - Good" % e
4107-
4108- print "Trying invalid SS request for CB"
4109- try:
4110- print ss.Initiate("*33*ABC#")
4111- except dbus.DBusException, e:
4112- print "Failed with %s - Good" % e
4113-
4114- print "Trying invalid SS request for CB"
4115- try:
4116- print ss.Initiate("*33**ABC#")
4117- except dbus.DBusException, e:
4118- print "Failed with %s - Good" % e
4119-
4120- print "Trying invalid SS request for CB"
4121- try:
4122- print ss.Initiate("*33***12#")
4123- except dbus.DBusException, e:
4124- print "Failed with %s - Good" % e
4125-
4126- print "Query Outgoing All"
4127- print ss.Initiate("*#33#")
4128-
4129- print "Query Outgoing International"
4130- print ss.Initiate("*#331#")
4131-
4132- print "Query Outgoing except home country"
4133- print ss.Initiate("*#332#")
4134-
4135- print "Query Incoming All"
4136- print ss.Initiate("*#35#")
4137-
4138- print "Query Incoming while Roaming"
4139- print ss.Initiate("*#351#")
4140-
4141- print "Query All Outgoing"
4142- print ss.Initiate("*#333#")
4143-
4144- print "Query All Incoming"
4145- print ss.Initiate("*#353#")
4146-
4147- print "Query All"
4148- print ss.Initiate("*#330#")
4149-
4150- print "Enable Barring for Outgoing International calls for Voice"
4151- print ss.Initiate("*33*3579*11#")
4152+ print("Trying invalid SS request for CB")
4153+ try:
4154+ print(ss.Initiate("*33#456666"))
4155+ except dbus.DBusException as e:
4156+ print("Failed with %s - Good" % e)
4157+
4158+ print("Trying invalid SS request for CB")
4159+ try:
4160+ print(ss.Initiate("*33*ABC#"))
4161+ except dbus.DBusException as e:
4162+ print("Failed with %s - Good" % e)
4163+
4164+ print("Trying invalid SS request for CB")
4165+ try:
4166+ print(ss.Initiate("*33**ABC#"))
4167+ except dbus.DBusException as e:
4168+ print("Failed with %s - Good" % e)
4169+
4170+ print("Trying invalid SS request for CB")
4171+ try:
4172+ print(ss.Initiate("*33***12#"))
4173+ except dbus.DBusException as e:
4174+ print("Failed with %s - Good" % e)
4175+
4176+ print("Query Outgoing All")
4177+ print(ss.Initiate("*#33#"))
4178+
4179+ print("Query Outgoing International")
4180+ print(ss.Initiate("*#331#"))
4181+
4182+ print("Query Outgoing except home country")
4183+ print(ss.Initiate("*#332#"))
4184+
4185+ print("Query Incoming All")
4186+ print(ss.Initiate("*#35#"))
4187+
4188+ print("Query Incoming while Roaming")
4189+ print(ss.Initiate("*#351#"))
4190+
4191+ print("Query All Outgoing")
4192+ print(ss.Initiate("*#333#"))
4193+
4194+ print("Query All Incoming")
4195+ print(ss.Initiate("*#353#"))
4196+
4197+ print("Query All")
4198+ print(ss.Initiate("*#330#"))
4199+
4200+ print("Enable Barring for Outgoing International calls for Voice")
4201+ print(ss.Initiate("*33*3579*11#"))
4202
4203 print_properties(cb)
4204
4205- print "Disable All Barrings"
4206- print ss.Initiate("#330*3579#")
4207+ print("Disable All Barrings")
4208+ print(ss.Initiate("#330*3579#"))
4209
4210- mainloop = gobject.MainLoop()
4211+ mainloop = GLib.MainLoop()
4212 mainloop.run()
4213
4214
4215=== modified file 'test/test-ss-control-cf'
4216--- test/test-ss-control-cf 2010-09-09 19:38:14 +0000
4217+++ test/test-ss-control-cf 2014-02-28 20:44:46 +0000
4218@@ -1,12 +1,12 @@
4219 #!/usr/bin/python
4220
4221-import gobject
4222+from gi.repository import GLib
4223
4224 import dbus
4225 import dbus.mainloop.glib
4226
4227 def property_changed(property, value):
4228- print "CallForwarding property %s changed to %s" % (property, value)
4229+ print("CallForwarding property %s changed to %s" % (property, value))
4230
4231 def print_properties(cf):
4232 properties = cf.GetProperties()
4233@@ -17,7 +17,7 @@
4234 else:
4235 value = "disabled"
4236
4237- print "%s call forwarding rule: %s" % (p, value)
4238+ print("%s call forwarding rule: %s" % (p, value))
4239
4240 if __name__ == "__main__":
4241 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4242@@ -42,34 +42,34 @@
4243 print_properties(cf)
4244
4245 # Busy To +155542, for Voice
4246- print "Setting Busy Voice rule to +155542"
4247- print ss.Initiate("*67*+155542*11#")
4248+ print("Setting Busy Voice rule to +155542")
4249+ print(ss.Initiate("*67*+155542*11#"))
4250 print_properties(cf)
4251
4252 # Not Reachable to +155543, Voice
4253- print "Setting Voice Not Reachable rule to +155543"
4254- print ss.Initiate("**62*+155543*11#")
4255+ print("Setting Voice Not Reachable rule to +155543")
4256+ print(ss.Initiate("**62*+155543*11#"))
4257
4258 # Not Reachable to +155544, Voice service
4259- print "Setting Voice No Reply rule to +155544, timeout=30"
4260- print ss.Initiate("**61*+155544*11*30#")
4261+ print("Setting Voice No Reply rule to +155544, timeout=30")
4262+ print(ss.Initiate("**61*+155544*11*30#"))
4263
4264 # Unconditional to +155547, Voice
4265- print "Setting Unconditional for Voice to +155545"
4266- print ss.Initiate("*21*+155545*10#")
4267+ print("Setting Unconditional for Voice to +155545")
4268+ print(ss.Initiate("*21*+155545*10#"))
4269
4270 print_properties(cf)
4271
4272- print "Query all voice forwardings"
4273- print ss.Initiate("*#002**11#")
4274+ print("Query all voice forwardings")
4275+ print(ss.Initiate("*#002**11#"))
4276
4277- print "Query no reply voice forwardings"
4278- print ss.Initiate("*#61**11#")
4279+ print("Query no reply voice forwardings")
4280+ print(ss.Initiate("*#61**11#"))
4281
4282 # Deactivate everything
4283- print "Deactivating everything"
4284- print ss.Initiate("##002#")
4285+ print("Deactivating everything")
4286+ print(ss.Initiate("##002#"))
4287 print_properties(cf)
4288
4289- mainloop = gobject.MainLoop()
4290+ mainloop = GLib.MainLoop()
4291 mainloop.run()
4292
4293=== modified file 'test/test-ss-control-cs'
4294--- test/test-ss-control-cs 2010-12-17 00:40:19 +0000
4295+++ test/test-ss-control-cs 2014-02-28 20:44:46 +0000
4296@@ -1,18 +1,18 @@
4297 #!/usr/bin/python
4298
4299-import gobject
4300+from gi.repository import GLib
4301
4302 import dbus
4303 import dbus.mainloop.glib
4304
4305 def property_changed(property, value):
4306- print "CallSettings property %s changed to %s" % (property, value)
4307+ print("CallSettings property %s changed to %s" % (property, value))
4308
4309 def print_properties(cs):
4310- properties = cs.GetProperties()
4311+ properties = cs.GetProperties()
4312
4313 for p in properties:
4314- print "property %s, value: %s" % (p, properties[p])
4315+ print("property %s, value: %s" % (p, properties[p]))
4316
4317 if __name__ == "__main__":
4318 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4319@@ -27,90 +27,90 @@
4320 cs = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
4321 'org.ofono.CallSettings')
4322
4323- cs.connect_to_signal("PropertyChanged", property_changed)
4324+ cs.connect_to_signal("PropertyChanged", property_changed)
4325
4326 ss = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
4327 'org.ofono.SupplementaryServices')
4328
4329 print_properties(cs)
4330
4331- print "Trying invalid SS request for CLIR"
4332- try:
4333- print ss.Initiate("*31#456666")
4334- except dbus.DBusException, e:
4335- print "Failed with %s - Good" % e
4336-
4337- print "Trying invalid SS request for CLIR"
4338- try:
4339- print ss.Initiate("*31*455*4#")
4340- except dbus.DBusException, e:
4341- print "Failed with %s - Good" % e
4342-
4343- print "Trying invalid SS request for CLIR"
4344- try:
4345- print ss.Initiate("*31**44435#")
4346- except dbus.DBusException, e:
4347- print "Failed with %s - Good" % e
4348-
4349- print "Query CLIP"
4350- print ss.Initiate("*#30#")
4351-
4352- print "Query CNAP"
4353- print ss.Initiate("*#300#")
4354-
4355- print "Query COLP"
4356- print ss.Initiate("*#76#")
4357-
4358- print "Query CLIR"
4359- print ss.Initiate("*#31#")
4360-
4361- print "Activate CLIR"
4362- print ss.Initiate("*31#")
4363-
4364- print_properties(cs)
4365-
4366- print "Deactivate CLIR"
4367- print ss.Initiate("#31#")
4368-
4369- print_properties(cs)
4370-
4371- print "Trying invalid SS request for CW"
4372- try:
4373- print ss.Initiate("*43#456666")
4374- except dbus.DBusException, e:
4375- print "Failed with %s - Good" % e
4376-
4377- print "Trying invalid SS request for CW"
4378- try:
4379- print ss.Initiate("*43*455*4#")
4380- except dbus.DBusException, e:
4381- print "Failed with %s - Good" % e
4382-
4383- print "Trying invalid SS request for CW"
4384- try:
4385- print ss.Initiate("*43**44435#")
4386- except dbus.DBusException, e:
4387- print "Failed with %s - Good" % e
4388-
4389- print "Query CW"
4390- print ss.Initiate("*#43#")
4391-
4392- print "Query CW, only Voice"
4393- print ss.Initiate("*#43*11#")
4394-
4395- print "Query CW, only Fax"
4396- print ss.Initiate("*#43*13#")
4397-
4398- print "Disable CW for everything"
4399- print ss.Initiate("#43#");
4400-
4401- print_properties(cs)
4402-
4403- print "Enable CW for Voice"
4404- print ss.Initiate("*43*11#")
4405-
4406- print_properties(cs)
4407-
4408- mainloop = gobject.MainLoop()
4409+ print("Trying invalid SS request for CLIR")
4410+ try:
4411+ print(ss.Initiate("*31#456666"))
4412+ except dbus.DBusException as e:
4413+ print("Failed with %s - Good" % e)
4414+
4415+ print("Trying invalid SS request for CLIR")
4416+ try:
4417+ print(ss.Initiate("*31*455*4#"))
4418+ except dbus.DBusException as e:
4419+ print("Failed with %s - Good" % e)
4420+
4421+ print("Trying invalid SS request for CLIR")
4422+ try:
4423+ print(ss.Initiate("*31**44435#"))
4424+ except dbus.DBusException as e:
4425+ print("Failed with %s - Good" % e)
4426+
4427+ print("Query CLIP")
4428+ print(ss.Initiate("*#30#"))
4429+
4430+ print("Query CNAP")
4431+ print(ss.Initiate("*#300#"))
4432+
4433+ print("Query COLP")
4434+ print(ss.Initiate("*#76#"))
4435+
4436+ print("Query CLIR")
4437+ print(ss.Initiate("*#31#"))
4438+
4439+ print("Activate CLIR")
4440+ print(ss.Initiate("*31#"))
4441+
4442+ print_properties(cs)
4443+
4444+ print("Deactivate CLIR")
4445+ print(ss.Initiate("#31#"))
4446+
4447+ print_properties(cs)
4448+
4449+ print("Trying invalid SS request for CW")
4450+ try:
4451+ print(ss.Initiate("*43#456666"))
4452+ except dbus.DBusException as e:
4453+ print("Failed with %s - Good" % e)
4454+
4455+ print("Trying invalid SS request for CW")
4456+ try:
4457+ print(ss.Initiate("*43*455*4#"))
4458+ except dbus.DBusException as e:
4459+ print("Failed with %s - Good" % e)
4460+
4461+ print("Trying invalid SS request for CW")
4462+ try:
4463+ print(ss.Initiate("*43**44435#"))
4464+ except dbus.DBusException as e:
4465+ print("Failed with %s - Good" % e)
4466+
4467+ print("Query CW")
4468+ print(ss.Initiate("*#43#"))
4469+
4470+ print("Query CW, only Voice")
4471+ print(ss.Initiate("*#43*11#"))
4472+
4473+ print("Query CW, only Fax")
4474+ print(ss.Initiate("*#43*13#"))
4475+
4476+ print("Disable CW for everything")
4477+ print(ss.Initiate("#43#"));
4478+
4479+ print_properties(cs)
4480+
4481+ print("Enable CW for Voice")
4482+ print(ss.Initiate("*43*11#"))
4483+
4484+ print_properties(cs)
4485+
4486+ mainloop = GLib.MainLoop()
4487 mainloop.run()
4488
4489
4490=== modified file 'test/test-stk-menu'
4491--- test/test-stk-menu 2012-11-28 16:31:14 +0000
4492+++ test/test-stk-menu 2014-02-28 20:44:46 +0000
4493@@ -1,6 +1,6 @@
4494 #!/usr/bin/python
4495
4496-import gobject
4497+from gi.repository import GLib
4498
4499 import sys
4500 import dbus
4501@@ -34,30 +34,30 @@
4502 return False
4503
4504 def call_added(self, path, properties):
4505- print "call added %s" % (path)
4506+ print("call added %s" % (path))
4507 if (self.timeout_id > 0):
4508- gobject.source_remove(self.timeout_id)
4509+ GLib.source_remove(self.timeout_id)
4510 self.timeout_callback()
4511
4512 @dbus.service.method("org.ofono.SimToolkitAgent",
4513 in_signature="", out_signature="")
4514 def Release(self):
4515- print "Release"
4516+ print("Release")
4517 if self.exit_on_release:
4518 mainloop.quit()
4519
4520 @dbus.service.method("org.ofono.SimToolkitAgent",
4521 in_signature="sya(sy)n", out_signature="y")
4522 def RequestSelection(self, title, icon, items, default):
4523- print "Title: (%s)" % (title)
4524- print "Icon: (%d)" % (icon)
4525+ print("Title: (%s)" % (title))
4526+ print("Icon: (%d)" % (icon))
4527 index = 0
4528 for item in items:
4529- print "%d. %s (icon: %d)" % (index, item[0], item[1])
4530+ print("%d. %s (icon: %d)" % (index, item[0], item[1]))
4531 index += 1
4532
4533- print "\nDefault: %d" % (default)
4534- select = raw_input("Enter Selection (t, b):")
4535+ print("\nDefault: %d" % (default))
4536+ select = input("Enter Selection (t, b):")
4537
4538 if select == 'b':
4539 raise GoBack("User wishes to go back")
4540@@ -71,10 +71,10 @@
4541 async_callbacks=("reply_func",
4542 "error_func"))
4543 def DisplayText(self, title, icon, urgent, reply_func, error_func):
4544- print "DisplayText (%s)" % (title)
4545- print "Icon: (%d)" % (icon)
4546- print "Urgent: (%d)" % (urgent)
4547- key = raw_input("Press return to clear ('t' terminates, "
4548+ print("DisplayText (%s)" % (title))
4549+ print("Icon: (%d)" % (icon))
4550+ print("Urgent: (%d)" % (urgent))
4551+ key = input("Press return to clear ('t' terminates, "
4552 "'b' goes back, 'n' busy, "
4553 "'w' return and wait):")
4554
4555@@ -91,23 +91,23 @@
4556 raise Busy("User wishes to simulate busy screen")
4557
4558 if (seconds > 0):
4559- print "Waiting for %d seconds" % (seconds)
4560+ print("Waiting for %d seconds" % (seconds))
4561
4562 self.timeout_reply_handler = reply_func
4563- self.timeout_id = gobject.timeout_add_seconds(seconds,
4564+ self.timeout_id = GLib.timeout_add_seconds(seconds,
4565 self.timeout_callback)
4566
4567 @dbus.service.method("org.ofono.SimToolkitAgent",
4568 in_signature="sysyyb", out_signature="s")
4569 def RequestInput(self, title, icon, default, min_chars, max_chars,
4570 hide_typing):
4571- print "Title: (%s)" % (title)
4572- print "Icon: (%d)" % (icon)
4573- print "Default: (%s)" % (default)
4574- print "Hide typing: (%s)" % (hide_typing)
4575- print "Enter characters, min: %d, max: %d:" % (min_chars,
4576- max_chars)
4577- userin = raw_input("")
4578+ print("Title: (%s)" % (title))
4579+ print("Icon: (%d)" % (icon))
4580+ print("Default: (%s)" % (default))
4581+ print("Hide typing: (%s)" % (hide_typing))
4582+ print("Enter characters, min: %d, max: %d:" % (min_chars,
4583+ max_chars))
4584+ userin = input("")
4585
4586 return userin
4587
4588@@ -115,13 +115,13 @@
4589 in_signature="sysyyb", out_signature="s")
4590 def RequestDigits(self, title, icon, default, min_chars, max_chars,
4591 hide_typing):
4592- print "Title: (%s)" % (title)
4593- print "Icon: (%d)" % (icon)
4594- print "Default: (%s)" % (default)
4595- print "Hide typing: (%s)" % (hide_typing)
4596- print "Enter digits, min: %d, max: %d:" % (min_chars,
4597- max_chars)
4598- userin = raw_input("'t' terminates, 'b' goes back:")
4599+ print("Title: (%s)" % (title))
4600+ print("Icon: (%d)" % (icon))
4601+ print("Default: (%s)" % (default))
4602+ print("Hide typing: (%s)" % (hide_typing))
4603+ print("Enter digits, min: %d, max: %d:" % (min_chars,
4604+ max_chars))
4605+ userin = input("'t' terminates, 'b' goes back:")
4606
4607 if userin == 'b':
4608 raise GoBack("User wishes to go back")
4609@@ -133,9 +133,9 @@
4610 @dbus.service.method("org.ofono.SimToolkitAgent",
4611 in_signature="sy", out_signature="s")
4612 def RequestKey(self, title, icon):
4613- print "Title: (%s)" % (title)
4614- print "Icon: (%d)" % (icon)
4615- key = raw_input("Enter Key (t, b):")
4616+ print("Title: (%s)" % (title))
4617+ print("Icon: (%d)" % (icon))
4618+ key = input("Enter Key (t, b):")
4619
4620 if key == 'b':
4621 raise GoBack("User wishes to go back")
4622@@ -147,9 +147,9 @@
4623 @dbus.service.method("org.ofono.SimToolkitAgent",
4624 in_signature="sy", out_signature="s")
4625 def RequestDigit(self, title, icon):
4626- print "Title: (%s)" % (title)
4627- print "Icon: (%d)" % (icon)
4628- key = raw_input("Enter Digit (t, b):")
4629+ print("Title: (%s)" % (title))
4630+ print("Icon: (%d)" % (icon))
4631+ key = input("Enter Digit (t, b):")
4632
4633 if key == 'b':
4634 raise GoBack("User wishes to go back")
4635@@ -161,9 +161,9 @@
4636 @dbus.service.method("org.ofono.SimToolkitAgent",
4637 in_signature="sy", out_signature="s")
4638 def RequestQuickDigit(self, title, icon):
4639- print "Title: (%s)" % (title)
4640- print "Icon: (%d)" % (icon)
4641- key = raw_input("Quick digit (0-9, *, #, t, b):")
4642+ print("Title: (%s)" % (title))
4643+ print("Icon: (%d)" % (icon))
4644+ key = input("Quick digit (0-9, *, #, t, b):")
4645
4646 if key == 'b':
4647 raise GoBack("User wishes to go back")
4648@@ -175,9 +175,9 @@
4649 @dbus.service.method("org.ofono.SimToolkitAgent",
4650 in_signature="sy", out_signature="b")
4651 def RequestConfirmation(self, title, icon):
4652- print "Title: (%s)" % (title)
4653- print "Icon: (%d)" % (icon)
4654- key = raw_input("Enter Confirmation (t, b, y, n):")
4655+ print("Title: (%s)" % (title))
4656+ print("Icon: (%d)" % (icon))
4657+ key = input("Enter Confirmation (t, b, y, n):")
4658
4659 if key == 'b':
4660 raise GoBack("User wishes to go back")
4661@@ -191,9 +191,9 @@
4662 @dbus.service.method("org.ofono.SimToolkitAgent",
4663 in_signature="sy", out_signature="b")
4664 def ConfirmCallSetup(self, info, icon):
4665- print "Information: (%s)" % (info)
4666- print "Icon: (%d)" % (icon)
4667- key = raw_input("Enter Confirmation (t, y, n):")
4668+ print("Information: (%s)" % (info))
4669+ print("Icon: (%d)" % (icon))
4670+ key = input("Enter Confirmation (t, y, n):")
4671
4672 if key == 't':
4673 raise EndSession("User wishes to terminate session")
4674@@ -205,10 +205,10 @@
4675 @dbus.service.method("org.ofono.SimToolkitAgent",
4676 in_signature="sys", out_signature="b")
4677 def ConfirmLaunchBrowser(self, info, icon, url):
4678- print "Information: (%s)" % (info)
4679- print "Icon: (%d)" % (icon)
4680- print "URL (%s)" % (url)
4681- key = raw_input("Enter Confirmation (y, n):")
4682+ print("Information: (%s)" % (info))
4683+ print("Icon: (%d)" % (icon))
4684+ print("URL (%s)" % (url))
4685+ key = input("Enter Confirmation (y, n):")
4686
4687 if key == 'y':
4688 return True
4689@@ -218,38 +218,38 @@
4690 @dbus.service.method("org.ofono.SimToolkitAgent",
4691 in_signature="", out_signature="")
4692 def Cancel(self):
4693- print "Cancel"
4694+ print("Cancel")
4695
4696 @dbus.service.method("org.ofono.SimToolkitAgent",
4697 in_signature="ssy", out_signature="")
4698 def PlayTone(self, tone, text, icon):
4699- print "PlayTone: %s" % (tone)
4700- print "Text: %s" % (text)
4701- print "Icon: %d" % (icon)
4702+ print("PlayTone: %s" % (tone))
4703+ print("Text: %s" % (text))
4704+ print("Icon: %d" % (icon))
4705
4706 signal.signal(signal.SIGALRM, handler)
4707 signal.alarm(5)
4708
4709 try:
4710- key = raw_input("Press return to end before end of"
4711+ key = input("Press return to end before end of"
4712 " single tone (t):")
4713 signal.alarm(0)
4714
4715 if key == 't':
4716 raise EndSession("User wishes to terminate"
4717 " session")
4718- except Exception, exc:
4719- print exc
4720+ except Exception as exc:
4721+ print(exc)
4722
4723 @dbus.service.method("org.ofono.SimToolkitAgent",
4724 in_signature="ssy", out_signature="",
4725 async_callbacks=("reply_func",
4726 "error_func"))
4727 def LoopTone(self, tone, text, icon, reply_func, error_func):
4728- print "LoopTone: %s" % (tone)
4729- print "Text: %s" % (text)
4730- print "Icon: %d" % (icon)
4731- key = raw_input("Press return to end before timeout "
4732+ print("LoopTone: %s" % (tone))
4733+ print("Text: %s" % (text))
4734+ print("Icon: %d" % (icon))
4735+ key = input("Press return to end before timeout "
4736 "('t' terminates, 'w' return and wait):")
4737
4738 if key == 'w':
4739@@ -261,24 +261,24 @@
4740 raise EndSession("User wishes to terminate session")
4741
4742 if (seconds > 0):
4743- print "Waiting for %d seconds" % (seconds)
4744+ print("Waiting for %d seconds" % (seconds))
4745
4746 self.timeout_reply_handler = reply_func
4747- self.timeout_id = gobject.timeout_add_seconds(seconds,
4748+ self.timeout_id = GLib.timeout_add_seconds(seconds,
4749 self.timeout_callback)
4750
4751 @dbus.service.method("org.ofono.SimToolkitAgent",
4752 in_signature="sy", out_signature="")
4753 def DisplayActionInformation(self, text, icon):
4754- print "Text: %s" % (text)
4755- print "Icon: %d" % (icon)
4756+ print("Text: %s" % (text))
4757+ print("Icon: %d" % (icon))
4758
4759 @dbus.service.method("org.ofono.SimToolkitAgent",
4760 in_signature="sy", out_signature="")
4761 def DisplayAction(self, text, icon):
4762- print "Text: (%s)" % (text)
4763- print "Icon: (%d)" % (icon)
4764- key = raw_input("Press 't' to terminate the session ")
4765+ print("Text: (%s)" % (text))
4766+ print("Icon: (%d)" % (icon))
4767+ key = input("Press 't' to terminate the session ")
4768
4769 if key == 't':
4770 raise EndSession("User wishes to terminate session")
4771@@ -286,9 +286,9 @@
4772 @dbus.service.method("org.ofono.SimToolkitAgent",
4773 in_signature="sy", out_signature="b")
4774 def ConfirmOpenChannel(self, info, icon):
4775- print "Open channel confirmation: (%s)" % (info)
4776- print "Icon: (%d)" % (icon)
4777- key = raw_input("Enter Confirmation (t, y, n):")
4778+ print("Open channel confirmation: (%s)" % (info))
4779+ print("Icon: (%d)" % (icon))
4780+ key = input("Enter Confirmation (t, y, n):")
4781
4782 if key == 't':
4783 raise EndSession("User wishes to terminate session")
4784@@ -298,7 +298,7 @@
4785 return False
4786
4787 _dbus2py = {
4788- dbus.String : unicode,
4789+ dbus.String : str,
4790 dbus.UInt32 : int,
4791 dbus.Int32 : int,
4792 dbus.Int16 : int,
4793@@ -346,7 +346,7 @@
4794 return str(d)
4795
4796 def property_changed(name, value):
4797- print "SimToolKit property: %s changed to '%s'" % (name, pretty(value))
4798+ print("SimToolKit property: %s changed to '%s'" % (name, pretty(value)))
4799
4800 if __name__ == '__main__':
4801 if len(sys.argv) == 2:
4802@@ -376,15 +376,15 @@
4803
4804 if mode == 'menu':
4805 if "MainMenuTitle" in properties:
4806- print "Main Menu:"
4807- print "%s" % (properties["MainMenuTitle"])
4808- print "\n"
4809+ print("Main Menu:")
4810+ print("%s" % (properties["MainMenuTitle"]))
4811+ print("\n")
4812
4813 if "MainMenu" in properties:
4814- print "Items:"
4815+ print("Items:")
4816 index = 0
4817 for item in properties["MainMenu"]:
4818- print "%d. %s" % (index, item[0])
4819+ print("%d. %s" % (index, item[0]))
4820 index += 1
4821
4822 path = "/test/agent"
4823@@ -395,7 +395,7 @@
4824 except:
4825 pass
4826
4827- select = int(raw_input("Enter Selection: "))
4828+ select = int(input("Enter Selection: "))
4829 stk.SelectItem(select, path)
4830 elif mode == 'agent':
4831 path = "/test/agent"
4832@@ -408,10 +408,10 @@
4833
4834 stk.RegisterAgent(path)
4835
4836- print "Default Agent registered - Waiting for STK command..."
4837+ print("Default Agent registered - Waiting for STK command...")
4838 else:
4839- print "%s [menu|agent]" % (sys.argv[0])
4840+ print("%s [menu|agent]" % (sys.argv[0]))
4841 exit(0)
4842
4843- mainloop = gobject.MainLoop()
4844+ mainloop = GLib.MainLoop()
4845 mainloop.run()
4846
4847=== modified file 'test/unlock-pin'
4848--- test/unlock-pin 2010-09-09 19:38:14 +0000
4849+++ test/unlock-pin 2014-02-28 20:44:46 +0000
4850@@ -17,10 +17,10 @@
4851 pin_type = sys.argv[1]
4852 pin = sys.argv[2]
4853 else:
4854- print "%s [PATH] pin_type pin" % (sys.argv[0])
4855+ print("%s [PATH] pin_type pin" % (sys.argv[0]))
4856 sys.exit(0)
4857
4858-print "Unlock %s %s for modem %s..." % (pin_type, pin, path)
4859+print("Unlock %s %s for modem %s..." % (pin_type, pin, path))
4860
4861 simmanager = dbus.Interface(bus.get_object('org.ofono', path),
4862 'org.ofono.SimManager')
4863
4864=== modified file 'unit/test-simutil.c'
4865--- unit/test-simutil.c 2012-11-22 16:26:34 +0000
4866+++ unit/test-simutil.c 2014-02-28 20:44:46 +0000
4867@@ -345,10 +345,12 @@
4868 };
4869
4870 const unsigned char valid_efpnn[][28] = {
4871- { 0x43, 0x0a, 0x00, 0x54, 0x75, 0x78, 0x20, 0x43, 0x6f, 0x6d,
4872- 0x6d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, },
4873- { 0x43, 0x05, 0x00, 0x4C, 0x6F, 0x6E, 0x67, 0x45, 0x06, 0x00,
4874- 0x53, 0x68, 0x6F, 0x72, 0x74, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }
4875+ /* Solavei */
4876+ { 0x43, 0x08, 0x87, 0xD3, 0x37, 0x3B, 0x6C, 0x2F, 0xA7, 0x01 },
4877+ /* T-Mobile / T-Mobile */
4878+ { 0x43, 0x08, 0x80, 0xD4, 0x56, 0xF3, 0x2D, 0x4E, 0xB3, 0xCB,
4879+ 0x45, 0x08, 0x80, 0xD4, 0x56, 0xF3, 0x2D, 0x4E, 0xB3, 0xCB,
4880+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
4881 };
4882
4883 static void test_eons(void)
4884@@ -376,7 +378,7 @@
4885 op_info = sim_eons_lookup(eons_info, "246", "81");
4886 g_assert(op_info);
4887
4888- g_assert(!strcmp(op_info->longname, "Tux Comm"));
4889+ g_assert(!strcmp(op_info->longname, "Solavei"));
4890 g_assert(!op_info->shortname);
4891 g_assert(!op_info->info);
4892

Subscribers

People subscribed via source and target branches

to all changes: