Merge lp:~bluetooth/bluez/new-rel-5-37-plus-touch-xenial-sync into lp:~bluetooth/bluez/ubuntu
- new-rel-5-37-plus-touch-xenial-sync
- Merge into ubuntu
Status: | Merged |
---|---|
Approved by: | Simon Fels |
Approved revision: | 10 |
Merged at revision: | 10 |
Proposed branch: | lp:~bluetooth/bluez/new-rel-5-37-plus-touch-xenial-sync |
Merge into: | lp:~bluetooth/bluez/ubuntu |
Diff against target: |
1485 lines (+1366/-6) 12 files modified
debian/bluez-tests.install (+9/-0) debian/bluez.install (+5/-1) debian/changelog (+28/-0) debian/control (+8/-4) debian/patches/0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch (+730/-0) debian/patches/0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch (+292/-0) debian/patches/0002-hostname-handle-chassis-type-handset.patch (+55/-0) debian/patches/0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch (+65/-0) debian/patches/0004-obexd-enable-ebook-backend-conditionally.patch (+103/-0) debian/patches/0005-audio-media-return-empty-string-when-player-name-is-.patch (+55/-0) debian/patches/series (+11/-0) debian/rules (+5/-1) |
To merge this branch: | bzr merge lp:~bluetooth/bluez/new-rel-5-37-plus-touch-xenial-sync |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Fels | Approve | ||
Sebastien Bacher | Approve | ||
Review via email: mp+283734@code.launchpad.net |
Commit message
* New upstream version
* Add 0001-obexd-
- Pull in obexd ebook plugin from upstream git.
* Add 0001-obexd-
* Add 0002-hostname-
* Add 0003-tools-
- Allow use of an alternate DBus name by MPRIS if 'org.mpris' is not
available.
* Add 0004-obexd-
- Add a new configuration switch for EDS support.
* Add 0005-audio-
- If the name for the player is set as NULL we will crash later on
so taking a valid default is required.
* Update bluez.install to include new btattach binary and manpage.
* Update rules:
- enable obex phonebook-ebook by default
- add enable-experimental to build and install additional
* Update control:
- add libebook-dev (>= 3.12) to Build-Depends
- rename bluez-test-scripts to bluez-tests to reflect it does not only
contain scripts but more utilities which can be used for wider testing
of the BlueZ stack.
* Add new bluez-tests.install
* Update bluez.install to include extra tools
* Remove extra install logic from rules
Description of the change
This change includes:
- a new upstream release ( 5.37 )
- sync between touch version from overlay PPA and xenial
Note, as part of this change, the bluez-test-scripts binary package was re-named to bluez-tests ( see changelog for why ).
Also, the phonebook-ebook code is now enabled by default. This is basically a no-op on the desktop, as this code provides hooks to pull contact information from evolution-
Sebastien Bacher (seb128) wrote : | # |
Thanks for the work, if you rename a package you need to Replaces/
also it might be nice to use a .install to distribute the file rather than having makefile code in debian/rules
looks good otherwise!
Tony Espy (awe) wrote : | # |
Updated my branch based on comments. Should be all set now.
Sebastien Bacher (seb128) wrote : | # |
Thanks, looks good now!
Preview Diff
1 | === renamed file 'debian/bluez-test-scripts.docs' => 'debian/bluez-tests.doc' |
2 | === renamed file 'debian/bluez-test-scripts.examples' => 'debian/bluez-tests.examples' |
3 | === added file 'debian/bluez-tests.install' |
4 | --- debian/bluez-tests.install 1970-01-01 00:00:00 +0000 |
5 | +++ debian/bluez-tests.install 2016-02-02 17:17:35 +0000 |
6 | @@ -0,0 +1,9 @@ |
7 | +tools/bnep-tester usr/bin |
8 | +tools/gap-tester usr/bin |
9 | +tools/hci-tester usr/bin |
10 | +tools/l2cap-tester usr/bin |
11 | +tools/mgmt-tester usr/bin |
12 | +tools/rfcomm-tester usr/bin |
13 | +tools/sco-tester usr/bin |
14 | +tools/smp-tester usr/bin |
15 | +tools/userchan-tester usr/bin |
16 | |
17 | === modified file 'debian/bluez.install' |
18 | --- debian/bluez.install 2015-11-09 12:56:55 +0000 |
19 | +++ debian/bluez.install 2016-02-02 17:17:35 +0000 |
20 | @@ -7,6 +7,7 @@ |
21 | usr/bin/bluetoothctl |
22 | usr/bin/bccmd |
23 | usr/bin/bluemoon |
24 | +usr/bin/btattach |
25 | usr/bin/btmon |
26 | usr/bin/rctest |
27 | usr/bin/hciattach |
28 | @@ -18,7 +19,9 @@ |
29 | usr/bin/l2ping |
30 | usr/bin/l2test |
31 | usr/bin/rfcomm |
32 | -usr/bin/mpris-proxy |
33 | +tools/mpris-proxy usr/lib/bluetooth |
34 | +tools/btmgmt usr/bin |
35 | +tools/obexctl usr/bin |
36 | lib/udev/hid2hci |
37 | lib/udev/rules.d/97-hid2hci.rules |
38 | attrib/gatttool usr/bin |
39 | @@ -37,5 +40,6 @@ |
40 | usr/share/man/man1/rctest.1 |
41 | usr/share/man/man1/l2ping.1 |
42 | usr/share/man/man1/hid2hci.1 |
43 | +usr/share/man/man1/btattach.1 |
44 | usr/share/man/man8/bluetoothd.8 |
45 | debian/source_bluez.py usr/share/apport/package-hooks |
46 | |
47 | === modified file 'debian/changelog' |
48 | --- debian/changelog 2015-11-09 12:58:02 +0000 |
49 | +++ debian/changelog 2016-02-02 17:17:35 +0000 |
50 | @@ -1,3 +1,31 @@ |
51 | +bluez (5.37-0ubuntu1) UNRELEASED; urgency=medium |
52 | + |
53 | + * New upstream version |
54 | + * Add 0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch: |
55 | + - Pull in obexd ebook plugin from upstream git. |
56 | + * Add 0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch |
57 | + * Add 0002-hostname-handle-chassis-type-handset.patch |
58 | + * Add 0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch: |
59 | + - Allow use of an alternate DBus name by MPRIS if 'org.mpris' is not |
60 | + available. |
61 | + * Add 0004-obexd-enable-ebook-backend-conditionally.patch: |
62 | + - Add a new configuration switch for EDS support. |
63 | + * Add 0005-audio-media-return-empty-string-when-player-name-is-.patch: |
64 | + - If the name for the player is set as NULL we will crash later on |
65 | + so taking a valid default is required. |
66 | + * Update bluez.install to include new btattach binary and manpage. |
67 | + * Update rules: |
68 | + - enable obex phonebook-ebook by default |
69 | + - add enable-experimental to build and install additional |
70 | + tools/test scripts |
71 | + * Update control: |
72 | + - add libebook-dev (>= 3.12) to Build-Depends |
73 | + - rename bluez-test-scripts to bluez-tests to reflect it does not only |
74 | + contain scripts but more utilities which can be used for wider testing |
75 | + of the BlueZ stack. |
76 | + |
77 | + -- Tony Espy <espy@canonical.com> Sat, 23 Jan 2016 19:07:11 -0500 |
78 | + |
79 | bluez (5.36-0ubuntu1) xenial; urgency=medium |
80 | |
81 | * New upstream version |
82 | |
83 | === modified file 'debian/control' |
84 | --- debian/control 2015-11-09 12:56:55 +0000 |
85 | +++ debian/control 2016-02-02 17:17:35 +0000 |
86 | @@ -18,7 +18,8 @@ |
87 | libical-dev, |
88 | check (>= 0.9.8-1.1), |
89 | systemd, |
90 | - dh-systemd (>= 1.5) |
91 | + dh-systemd (>= 1.5), |
92 | + libebook1.2-dev (>= 3.12) |
93 | Vcs-Svn: svn://anonscm.debian.org/svn/pkg-bluetooth/packages/bluez/trunk |
94 | Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk |
95 | Homepage: http://www.bluez.org |
96 | @@ -140,11 +141,14 @@ |
97 | BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source |
98 | project distributed under GNU General Public License (GPL). |
99 | |
100 | -Package: bluez-test-scripts |
101 | +Package: bluez-tests |
102 | Architecture: all |
103 | Depends: ${misc:Depends} |
104 | -Description: BlueZ test scripts |
105 | - This package contains test scripts for using BlueZ. |
106 | +Replaces: bluez-test-scripts |
107 | +Conflicts: bluez-test-scripts |
108 | +Provides: bluez-test-scripts |
109 | +Description: BlueZ test tools and scripts |
110 | + This package contains test tools and scripts used for testing BlueZ. |
111 | . |
112 | BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source |
113 | project distributed under GNU General Public License (GPL). |
114 | |
115 | === added file 'debian/patches/0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch' |
116 | --- debian/patches/0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch 1970-01-01 00:00:00 +0000 |
117 | +++ debian/patches/0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch 2016-02-02 17:17:35 +0000 |
118 | @@ -0,0 +1,730 @@ |
119 | +From 3d4521c026b1bdfdbf3a022d26ed244c40f429e1 Mon Sep 17 00:00:00 2001 |
120 | +From: Simon Fels <simon.fels@canonical.com> |
121 | +Date: Wed, 2 Dec 2015 12:15:22 +0100 |
122 | +Subject: [PATCH] obexd: plugins: import PBAP ebook support from upstream git |
123 | + |
124 | +The PBAP ebook plugin is currently not included in the release tarballs |
125 | +so we have to bring this back from the corresponding git tree on our |
126 | +own. |
127 | +--- |
128 | + obexd/plugins/phonebook-ebook.c | 708 ++++++++++++++++++++++++++++++++++++++++ |
129 | + 1 file changed, 708 insertions(+) |
130 | + create mode 100644 obexd/plugins/phonebook-ebook.c |
131 | + |
132 | +diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c |
133 | +new file mode 100644 |
134 | +index 0000000..c422585 |
135 | +--- /dev/null |
136 | ++++ b/obexd/plugins/phonebook-ebook.c |
137 | +@@ -0,0 +1,708 @@ |
138 | ++/* |
139 | ++ * |
140 | ++ * OBEX Server |
141 | ++ * |
142 | ++ * Copyright (C) 2009-2010 Intel Corporation |
143 | ++ * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
144 | ++ * |
145 | ++ * |
146 | ++ * This program is free software; you can redistribute it and/or modify |
147 | ++ * it under the terms of the GNU General Public License as published by |
148 | ++ * the Free Software Foundation; either version 2 of the License, or |
149 | ++ * (at your option) any later version. |
150 | ++ * |
151 | ++ * This program is distributed in the hope that it will be useful, |
152 | ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
153 | ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
154 | ++ * GNU General Public License for more details. |
155 | ++ * |
156 | ++ * You should have received a copy of the GNU General Public License |
157 | ++ * along with this program; if not, write to the Free Software |
158 | ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
159 | ++ * |
160 | ++ */ |
161 | ++ |
162 | ++#ifdef HAVE_CONFIG_H |
163 | ++#include <config.h> |
164 | ++#endif |
165 | ++ |
166 | ++#include <string.h> |
167 | ++#include <errno.h> |
168 | ++ |
169 | ++#include <glib.h> |
170 | ++#include <libebook/e-book.h> |
171 | ++ |
172 | ++#include "lib/bluetooth.h" |
173 | ++ |
174 | ++#include "obexd/src/log.h" |
175 | ++#include "obexd/src/obex.h" |
176 | ++#include "obexd/src/service.h" |
177 | ++#include "phonebook.h" |
178 | ++ |
179 | ++#define QUERY_FN "(contains \"family_name\" \"%s\")" |
180 | ++#define QUERY_NAME "(contains \"given_name\" \"%s\")" |
181 | ++#define QUERY_PHONE "(contains \"phone\" \"%s\")" |
182 | ++ |
183 | ++struct query_context { |
184 | ++ const struct apparam_field *params; |
185 | ++ phonebook_cb contacts_cb; |
186 | ++ phonebook_entry_cb entry_cb; |
187 | ++ phonebook_cache_ready_cb ready_cb; |
188 | ++ EBookQuery *query; |
189 | ++ unsigned int count; |
190 | ++ GString *buf; |
191 | ++ char *id; |
192 | ++ unsigned queued_calls; |
193 | ++ void *user_data; |
194 | ++ GSList *ebooks; |
195 | ++ gboolean canceled; |
196 | ++}; |
197 | ++ |
198 | ++static char *attribute_mask[] = { |
199 | ++/* 0 */ "VERSION", |
200 | ++ "FN", |
201 | ++ "N", |
202 | ++ "PHOTO", |
203 | ++ "BDAY", |
204 | ++ "ADR", |
205 | ++ "LABEL", |
206 | ++ "TEL", |
207 | ++/* 8 */ "EMAIL", |
208 | ++ "MAILER", |
209 | ++ "TZ", |
210 | ++ "GEO", |
211 | ++ "TITLE", |
212 | ++ "ROLE", |
213 | ++ "LOGO", |
214 | ++ "AGENT", |
215 | ++/* 16 */ "ORG", |
216 | ++ "NOTE", |
217 | ++ "REV", |
218 | ++ "SOUND", |
219 | ++ "URL", |
220 | ++ "UID", |
221 | ++ "KEY", |
222 | ++ "NICKNAME", |
223 | ++/* 24 */ "CATEGORIES", |
224 | ++ "PROID", |
225 | ++ "CLASS", |
226 | ++ "SORT-STRING", |
227 | ++/* 28 */ "X-IRMC-CALL-DATETIME", |
228 | ++ NULL |
229 | ++ |
230 | ++}; |
231 | ++ |
232 | ++static void close_ebooks(GSList *ebooks) |
233 | ++{ |
234 | ++ g_slist_free_full(ebooks, g_object_unref); |
235 | ++} |
236 | ++ |
237 | ++static void free_query_context(struct query_context *data) |
238 | ++{ |
239 | ++ g_free(data->id); |
240 | ++ |
241 | ++ if (data->buf != NULL) |
242 | ++ g_string_free(data->buf, TRUE); |
243 | ++ |
244 | ++ if (data->query != NULL) |
245 | ++ e_book_query_unref(data->query); |
246 | ++ |
247 | ++ close_ebooks(data->ebooks); |
248 | ++ |
249 | ++ g_free(data); |
250 | ++} |
251 | ++ |
252 | ++static char *evcard_to_string(EVCard *evcard, unsigned int format, |
253 | ++ uint64_t filter) |
254 | ++{ |
255 | ++ EVCard *evcard2; |
256 | ++ GList *l; |
257 | ++ char *vcard; |
258 | ++ |
259 | ++ if (!filter) |
260 | ++ return e_vcard_to_string(evcard, EVC_FORMAT_VCARD_30); |
261 | ++ /* XXX There is no support for VCARD 2.1 at this time */ |
262 | ++ |
263 | ++ /* |
264 | ++ * Mandatory attributes for vCard 2.1 are VERSION ,N and TEL. |
265 | ++ * Mandatory attributes for vCard 3.0 are VERSION, N, FN and TEL |
266 | ++ */ |
267 | ++ filter = format == EVC_FORMAT_VCARD_30 ? filter | 0x87: filter | 0x85; |
268 | ++ |
269 | ++ l = e_vcard_get_attributes(evcard); |
270 | ++ evcard2 = e_vcard_new(); |
271 | ++ for (; l; l = g_list_next(l)) { |
272 | ++ EVCardAttribute *attrib = l->data; |
273 | ++ const char *name; |
274 | ++ int i; |
275 | ++ |
276 | ++ if (!attrib) |
277 | ++ continue; |
278 | ++ |
279 | ++ name = e_vcard_attribute_get_name(attrib); |
280 | ++ |
281 | ++ for (i = 0; attribute_mask[i] != NULL; i++) { |
282 | ++ if (!(filter & (1 << i))) |
283 | ++ continue; |
284 | ++ if (g_strcmp0(name, attribute_mask[i]) != 0) |
285 | ++ continue; |
286 | ++ |
287 | ++ e_vcard_add_attribute(evcard2, |
288 | ++ e_vcard_attribute_copy(attrib)); |
289 | ++ } |
290 | ++ } |
291 | ++ |
292 | ++ vcard = e_vcard_to_string(evcard2, format); |
293 | ++ g_object_unref(evcard2); |
294 | ++ |
295 | ++ return vcard; |
296 | ++} |
297 | ++ |
298 | ++static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, |
299 | ++ void *user_data) |
300 | ++{ |
301 | ++ struct query_context *data = user_data; |
302 | ++ GList *l; |
303 | ++ unsigned int count, maxcount; |
304 | ++ |
305 | ++ data->queued_calls--; |
306 | ++ |
307 | ++ if (data->canceled) |
308 | ++ goto canceled; |
309 | ++ |
310 | ++ if (gerr != NULL) { |
311 | ++ error("E-Book query failed: %s", gerr->message); |
312 | ++ goto done; |
313 | ++ } |
314 | ++ |
315 | ++ DBG(""); |
316 | ++ |
317 | ++ /* |
318 | ++ * When MaxListCount is zero, PCE wants to know the number of used |
319 | ++ * indexes in the phonebook of interest. All other parameters that |
320 | ++ * may be present in the request shall be ignored. |
321 | ++ */ |
322 | ++ maxcount = data->params->maxlistcount; |
323 | ++ if (maxcount == 0) { |
324 | ++ data->count += g_list_length(contacts); |
325 | ++ goto done; |
326 | ++ } |
327 | ++ |
328 | ++ l = g_list_nth(contacts, data->params->liststartoffset); |
329 | ++ |
330 | ++ for (count = 0; l && count + data->count < maxcount; l = g_list_next(l), |
331 | ++ count++) { |
332 | ++ EContact *contact = E_CONTACT(l->data); |
333 | ++ EVCard *evcard = E_VCARD(contact); |
334 | ++ char *vcard; |
335 | ++ |
336 | ++ vcard = evcard_to_string(evcard, EVC_FORMAT_VCARD_30, |
337 | ++ data->params->filter); |
338 | ++ |
339 | ++ data->buf = g_string_append(data->buf, vcard); |
340 | ++ data->buf = g_string_append(data->buf, "\r\n"); |
341 | ++ g_free(vcard); |
342 | ++ } |
343 | ++ |
344 | ++ DBG("collected %d vcards", count); |
345 | ++ |
346 | ++ data->count += count; |
347 | ++ |
348 | ++ g_list_free_full(contacts, g_object_unref); |
349 | ++ |
350 | ++done: |
351 | ++ if (data->queued_calls == 0) { |
352 | ++ GString *buf = data->buf; |
353 | ++ data->buf = NULL; |
354 | ++ |
355 | ++ data->contacts_cb(buf->str, buf->len, data->count, |
356 | ++ 0, TRUE, data->user_data); |
357 | ++ |
358 | ++ g_string_free(buf, TRUE); |
359 | ++ |
360 | ++ } |
361 | ++ |
362 | ++ return; |
363 | ++ |
364 | ++canceled: |
365 | ++ if (data->queued_calls == 0) |
366 | ++ free_query_context(data); |
367 | ++} |
368 | ++ |
369 | ++static void ebook_entry_cb(EBook *book, const GError *gerr, |
370 | ++ EContact *contact, void *user_data) |
371 | ++{ |
372 | ++ struct query_context *data = user_data; |
373 | ++ EVCard *evcard; |
374 | ++ char *vcard; |
375 | ++ size_t len; |
376 | ++ |
377 | ++ data->queued_calls--; |
378 | ++ |
379 | ++ if (data->canceled) |
380 | ++ goto done; |
381 | ++ |
382 | ++ if (gerr != NULL) { |
383 | ++ error("E-Book query failed: %s", gerr->message); |
384 | ++ goto done; |
385 | ++ } |
386 | ++ |
387 | ++ DBG(""); |
388 | ++ |
389 | ++ evcard = E_VCARD(contact); |
390 | ++ |
391 | ++ vcard = evcard_to_string(evcard, EVC_FORMAT_VCARD_30, |
392 | ++ data->params->filter); |
393 | ++ |
394 | ++ len = vcard ? strlen(vcard) : 0; |
395 | ++ |
396 | ++ data->count++; |
397 | ++ data->contacts_cb(vcard, len, 1, 0, TRUE, data->user_data); |
398 | ++ |
399 | ++ g_free(vcard); |
400 | ++ g_object_unref(contact); |
401 | ++ |
402 | ++ return; |
403 | ++ |
404 | ++done: |
405 | ++ if (data->queued_calls == 0) { |
406 | ++ if (data->count == 0) |
407 | ++ data->contacts_cb(NULL, 0, 1, 0, TRUE, |
408 | ++ data->user_data); |
409 | ++ else if (data->canceled) |
410 | ++ free_query_context(data); |
411 | ++ } |
412 | ++} |
413 | ++ |
414 | ++static char *evcard_name_attribute_to_string(EVCard *evcard) |
415 | ++{ |
416 | ++ EVCardAttribute *attrib; |
417 | ++ GList *l; |
418 | ++ GString *name = NULL; |
419 | ++ |
420 | ++ attrib = e_vcard_get_attribute(evcard, EVC_N); |
421 | ++ if (!attrib) |
422 | ++ return NULL; |
423 | ++ |
424 | ++ for (l = e_vcard_attribute_get_values(attrib); l; l = l->next) { |
425 | ++ const char *value = l->data; |
426 | ++ |
427 | ++ if (!strlen(value)) |
428 | ++ continue; |
429 | ++ |
430 | ++ if (!name) |
431 | ++ name = g_string_new(value); |
432 | ++ else { |
433 | ++ name = g_string_append(name, ";"); |
434 | ++ name = g_string_append(name, l->data); |
435 | ++ } |
436 | ++ } |
437 | ++ |
438 | ++ if (!name) |
439 | ++ return NULL; |
440 | ++ |
441 | ++ return g_string_free(name, FALSE); |
442 | ++} |
443 | ++ |
444 | ++static void cache_cb(EBook *book, const GError *gerr, GList *contacts, |
445 | ++ void *user_data) |
446 | ++{ |
447 | ++ struct query_context *data = user_data; |
448 | ++ GList *l; |
449 | ++ |
450 | ++ data->queued_calls--; |
451 | ++ |
452 | ++ if (data->canceled) |
453 | ++ goto canceled; |
454 | ++ |
455 | ++ if (gerr != NULL) { |
456 | ++ error("E-Book operation failed: %s", gerr->message); |
457 | ++ goto done; |
458 | ++ } |
459 | ++ |
460 | ++ DBG(""); |
461 | ++ |
462 | ++ for (l = contacts; l; l = g_list_next(l)) { |
463 | ++ EContact *contact = E_CONTACT(l->data); |
464 | ++ EVCard *evcard = E_VCARD(contact); |
465 | ++ EVCardAttribute *attrib; |
466 | ++ char *uid, *tel, *name; |
467 | ++ |
468 | ++ name = evcard_name_attribute_to_string(evcard); |
469 | ++ if (!name) |
470 | ++ continue; |
471 | ++ |
472 | ++ attrib = e_vcard_get_attribute(evcard, EVC_UID); |
473 | ++ if (!attrib) |
474 | ++ continue; |
475 | ++ |
476 | ++ uid = e_vcard_attribute_get_value(attrib); |
477 | ++ if (!uid) |
478 | ++ continue; |
479 | ++ |
480 | ++ attrib = e_vcard_get_attribute(evcard, EVC_TEL); |
481 | ++ if (attrib) |
482 | ++ tel = e_vcard_attribute_get_value(attrib); |
483 | ++ else |
484 | ++ tel = g_strdup(""); |
485 | ++ |
486 | ++ data->entry_cb(uid, PHONEBOOK_INVALID_HANDLE, name, NULL, |
487 | ++ tel, data->user_data); |
488 | ++ |
489 | ++ g_free(name); |
490 | ++ g_free(uid); |
491 | ++ g_free(tel); |
492 | ++ } |
493 | ++ |
494 | ++ g_list_free_full(contacts, g_object_unref); |
495 | ++ |
496 | ++done: |
497 | ++ if (data->queued_calls == 0) |
498 | ++ data->ready_cb(data->user_data); |
499 | ++ |
500 | ++ return; |
501 | ++ |
502 | ++canceled: |
503 | ++ if (data->queued_calls == 0) |
504 | ++ free_query_context(data); |
505 | ++} |
506 | ++ |
507 | ++static GSList *traverse_sources(GSList *ebooks, GSList *sources, |
508 | ++ char **default_src) { |
509 | ++ GError *gerr = NULL; |
510 | ++ |
511 | ++ for (; sources != NULL; sources = g_slist_next(sources)) { |
512 | ++ char *uri; |
513 | ++ ESource *source = E_SOURCE(sources->data); |
514 | ++ EBook *ebook = e_book_new(source, &gerr); |
515 | ++ |
516 | ++ if (ebook == NULL) { |
517 | ++ error("Can't create user's address book: %s", |
518 | ++ gerr->message); |
519 | ++ g_clear_error(&gerr); |
520 | ++ continue; |
521 | ++ } |
522 | ++ |
523 | ++ uri = e_source_get_uri(source); |
524 | ++ if (g_strcmp0(*default_src, uri) == 0) { |
525 | ++ g_free(uri); |
526 | ++ continue; |
527 | ++ } |
528 | ++ g_free(uri); |
529 | ++ |
530 | ++ if (e_book_open(ebook, FALSE, &gerr) == FALSE) { |
531 | ++ error("Can't open e-book address book: %s", |
532 | ++ gerr->message); |
533 | ++ g_object_unref(ebook); |
534 | ++ g_clear_error(&gerr); |
535 | ++ continue; |
536 | ++ } |
537 | ++ |
538 | ++ if (*default_src == NULL) |
539 | ++ *default_src = e_source_get_uri(source); |
540 | ++ |
541 | ++ DBG("%s address book opened", e_source_peek_name(source)); |
542 | ++ |
543 | ++ ebooks = g_slist_append(ebooks, ebook); |
544 | ++ } |
545 | ++ |
546 | ++ return ebooks; |
547 | ++} |
548 | ++ |
549 | ++int phonebook_init(void) |
550 | ++{ |
551 | ++ g_type_init(); |
552 | ++ |
553 | ++ return 0; |
554 | ++} |
555 | ++ |
556 | ++static GSList *open_ebooks(void) |
557 | ++{ |
558 | ++ GError *gerr = NULL; |
559 | ++ ESourceList *src_list; |
560 | ++ GSList *list; |
561 | ++ char *default_src = NULL; |
562 | ++ GSList *ebooks = NULL; |
563 | ++ |
564 | ++ if (e_book_get_addressbooks(&src_list, &gerr) == FALSE) { |
565 | ++ error("Can't list user's address books: %s", gerr->message); |
566 | ++ g_error_free(gerr); |
567 | ++ return NULL; |
568 | ++ } |
569 | ++ |
570 | ++ list = e_source_list_peek_groups(src_list); |
571 | ++ while (list != NULL) { |
572 | ++ ESourceGroup *group = E_SOURCE_GROUP(list->data); |
573 | ++ GSList *sources = e_source_group_peek_sources(group); |
574 | ++ |
575 | ++ ebooks = traverse_sources(ebooks, sources, &default_src); |
576 | ++ |
577 | ++ list = list->next; |
578 | ++ } |
579 | ++ |
580 | ++ g_free(default_src); |
581 | ++ g_object_unref(src_list); |
582 | ++ |
583 | ++ return ebooks; |
584 | ++} |
585 | ++ |
586 | ++void phonebook_exit(void) |
587 | ++{ |
588 | ++} |
589 | ++ |
590 | ++char *phonebook_set_folder(const char *current_folder, |
591 | ++ const char *new_folder, uint8_t flags, int *err) |
592 | ++{ |
593 | ++ gboolean root, child; |
594 | ++ char *fullname = NULL, *tmp1, *tmp2, *base; |
595 | ++ int ret = 0, len; |
596 | ++ |
597 | ++ root = (g_strcmp0("/", current_folder) == 0); |
598 | ++ child = (new_folder && strlen(new_folder) != 0); |
599 | ++ |
600 | ++ /* Evolution back-end will support /telecom/pb folder only */ |
601 | ++ |
602 | ++ switch (flags) { |
603 | ++ case 0x02: |
604 | ++ /* Go back to root */ |
605 | ++ if (!child) { |
606 | ++ fullname = g_strdup("/"); |
607 | ++ goto done; |
608 | ++ } |
609 | ++ |
610 | ++ /* Go down 1 level */ |
611 | ++ fullname = g_build_filename(current_folder, new_folder, NULL); |
612 | ++ if (strcmp(PB_TELECOM_FOLDER, fullname) != 0 && |
613 | ++ strcmp(PB_CONTACTS_FOLDER, fullname) != 0) { |
614 | ++ g_free(fullname); |
615 | ++ fullname = NULL; |
616 | ++ ret = -ENOENT; |
617 | ++ } |
618 | ++ |
619 | ++ break; |
620 | ++ case 0x03: |
621 | ++ /* Go up 1 level */ |
622 | ++ if (root) { |
623 | ++ /* Already root */ |
624 | ++ ret = -EBADR; |
625 | ++ goto done; |
626 | ++ } |
627 | ++ |
628 | ++ /* |
629 | ++ * Removing one level of the current folder. Current folder |
630 | ++ * contains AT LEAST one level since it is not at root folder. |
631 | ++ * Use glib utility functions to handle invalid chars in the |
632 | ++ * folder path properly. |
633 | ++ */ |
634 | ++ tmp1 = g_path_get_basename(current_folder); |
635 | ++ tmp2 = g_strrstr(current_folder, tmp1); |
636 | ++ len = tmp2 - (current_folder + 1); |
637 | ++ |
638 | ++ g_free(tmp1); |
639 | ++ |
640 | ++ if (len == 0) |
641 | ++ base = g_strdup("/"); |
642 | ++ else |
643 | ++ base = g_strndup(current_folder, len); |
644 | ++ |
645 | ++ /* Return one level only */ |
646 | ++ if (!child) { |
647 | ++ fullname = base; |
648 | ++ goto done; |
649 | ++ } |
650 | ++ |
651 | ++ fullname = g_build_filename(base, new_folder, NULL); |
652 | ++ if (strcmp(fullname, PB_TELECOM_FOLDER) != 0 && |
653 | ++ strcmp(fullname, PB_CONTACTS_FOLDER) != 0) { |
654 | ++ g_free(fullname); |
655 | ++ fullname = NULL; |
656 | ++ ret = -ENOENT; |
657 | ++ } |
658 | ++ |
659 | ++ g_free(base); |
660 | ++ |
661 | ++ break; |
662 | ++ default: |
663 | ++ ret = -EBADR; |
664 | ++ break; |
665 | ++ } |
666 | ++ |
667 | ++done: |
668 | ++ if (err) |
669 | ++ *err = ret; |
670 | ++ |
671 | ++ return fullname; |
672 | ++} |
673 | ++ |
674 | ++void phonebook_req_finalize(void *request) |
675 | ++{ |
676 | ++ struct query_context *data = request; |
677 | ++ |
678 | ++ if (data->queued_calls == 0) |
679 | ++ free_query_context(data); |
680 | ++ else |
681 | ++ data->canceled = TRUE; |
682 | ++} |
683 | ++ |
684 | ++void *phonebook_pull(const char *name, const struct apparam_field *params, |
685 | ++ phonebook_cb cb, void *user_data, int *err) |
686 | ++{ |
687 | ++ struct query_context *data; |
688 | ++ |
689 | ++ if (g_strcmp0(PB_CONTACTS, name) != 0) { |
690 | ++ if (err) |
691 | ++ *err = -ENOENT; |
692 | ++ |
693 | ++ return NULL; |
694 | ++ } |
695 | ++ |
696 | ++ data = g_new0(struct query_context, 1); |
697 | ++ data->contacts_cb = cb; |
698 | ++ data->params = params; |
699 | ++ data->user_data = user_data; |
700 | ++ data->buf = g_string_new(""); |
701 | ++ data->query = e_book_query_any_field_contains(""); |
702 | ++ data->ebooks = open_ebooks(); |
703 | ++ |
704 | ++ if (err) |
705 | ++ *err = data->ebooks == NULL ? -EIO : 0; |
706 | ++ |
707 | ++ return data; |
708 | ++} |
709 | ++ |
710 | ++int phonebook_pull_read(void *request) |
711 | ++{ |
712 | ++ struct query_context *data = request; |
713 | ++ GSList *l; |
714 | ++ |
715 | ++ if (!data) |
716 | ++ return -ENOENT; |
717 | ++ |
718 | ++ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
719 | ++ EBook *ebook = l->data; |
720 | ++ |
721 | ++ if (e_book_is_opened(ebook) == FALSE) |
722 | ++ continue; |
723 | ++ |
724 | ++ if (e_book_get_contacts_async(ebook, data->query, |
725 | ++ ebookpull_cb, data) == TRUE) |
726 | ++ data->queued_calls++; |
727 | ++ } |
728 | ++ |
729 | ++ if (data->queued_calls == 0) |
730 | ++ return -ENOENT; |
731 | ++ |
732 | ++ return 0; |
733 | ++} |
734 | ++ |
735 | ++void *phonebook_get_entry(const char *folder, const char *id, |
736 | ++ const struct apparam_field *params, |
737 | ++ phonebook_cb cb, void *user_data, int *err) |
738 | ++{ |
739 | ++ struct query_context *data; |
740 | ++ GSList *l; |
741 | ++ |
742 | ++ data = g_new0(struct query_context, 1); |
743 | ++ data->contacts_cb = cb; |
744 | ++ data->params = params; |
745 | ++ data->user_data = user_data; |
746 | ++ data->id = g_strdup(id); |
747 | ++ data->ebooks = open_ebooks(); |
748 | ++ |
749 | ++ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
750 | ++ EBook *ebook = l->data; |
751 | ++ |
752 | ++ if (e_book_is_opened(ebook) == FALSE) |
753 | ++ continue; |
754 | ++ |
755 | ++ if (e_book_get_contact_async(ebook, data->id, |
756 | ++ ebook_entry_cb, data) == TRUE) |
757 | ++ data->queued_calls++; |
758 | ++ } |
759 | ++ |
760 | ++ if (err) |
761 | ++ *err = (data->queued_calls == 0 ? -ENOENT : 0); |
762 | ++ |
763 | ++ return data; |
764 | ++} |
765 | ++ |
766 | ++void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, |
767 | ++ phonebook_cache_ready_cb ready_cb, void *user_data, int *err) |
768 | ++{ |
769 | ++ struct query_context *data; |
770 | ++ EBookQuery *query; |
771 | ++ GSList *l; |
772 | ++ EContact *me; |
773 | ++ EVCard *evcard; |
774 | ++ GError *gerr = NULL; |
775 | ++ EBook *eb; |
776 | ++ EVCardAttribute *attrib; |
777 | ++ char *uid, *tel, *cname; |
778 | ++ |
779 | ++ if (g_strcmp0(PB_CONTACTS_FOLDER, name) != 0) { |
780 | ++ if (err) |
781 | ++ *err = -ENOENT; |
782 | ++ |
783 | ++ return NULL; |
784 | ++ } |
785 | ++ |
786 | ++ DBG(""); |
787 | ++ |
788 | ++ query = e_book_query_any_field_contains(""); |
789 | ++ |
790 | ++ data = g_new0(struct query_context, 1); |
791 | ++ data->entry_cb = entry_cb; |
792 | ++ data->ready_cb = ready_cb; |
793 | ++ data->user_data = user_data; |
794 | ++ data->query = query; |
795 | ++ data->ebooks = open_ebooks(); |
796 | ++ |
797 | ++ /* Add 0.vcf */ |
798 | ++ if (e_book_get_self(&me, &eb, &gerr) == FALSE) { |
799 | ++ g_error_free(gerr); |
800 | ++ goto next; |
801 | ++ } |
802 | ++ |
803 | ++ evcard = E_VCARD(me); |
804 | ++ |
805 | ++ cname = evcard_name_attribute_to_string(evcard); |
806 | ++ if (!cname) |
807 | ++ cname = g_strdup(""); |
808 | ++ |
809 | ++ attrib = e_vcard_get_attribute(evcard, EVC_UID); |
810 | ++ uid = e_vcard_attribute_get_value(attrib); |
811 | ++ if (!uid) |
812 | ++ uid = g_strdup(""); |
813 | ++ |
814 | ++ attrib = e_vcard_get_attribute(evcard, EVC_TEL); |
815 | ++ if (attrib) |
816 | ++ tel = e_vcard_attribute_get_value(attrib); |
817 | ++ else |
818 | ++ tel = g_strdup(""); |
819 | ++ |
820 | ++ data->entry_cb(uid, 0, cname, NULL, tel, data->user_data); |
821 | ++ |
822 | ++ data->count++; |
823 | ++ |
824 | ++ g_free(cname); |
825 | ++ g_free(uid); |
826 | ++ g_free(tel); |
827 | ++ g_object_unref(eb); |
828 | ++ |
829 | ++next: |
830 | ++ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
831 | ++ EBook *ebook = l->data; |
832 | ++ |
833 | ++ if (e_book_is_opened(ebook) == FALSE) |
834 | ++ continue; |
835 | ++ |
836 | ++ if (e_book_get_contacts_async(ebook, query, |
837 | ++ cache_cb, data) == TRUE) |
838 | ++ data->queued_calls++; |
839 | ++ } |
840 | ++ |
841 | ++ if (err) |
842 | ++ *err = (data->queued_calls == 0 ? -ENOENT : 0); |
843 | ++ |
844 | ++ return data; |
845 | ++} |
846 | +-- |
847 | +2.5.0 |
848 | + |
849 | |
850 | === added file 'debian/patches/0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch' |
851 | --- debian/patches/0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch 1970-01-01 00:00:00 +0000 |
852 | +++ debian/patches/0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch 2016-02-02 17:17:35 +0000 |
853 | @@ -0,0 +1,292 @@ |
854 | +From 7c7d01ec54cdde2e6d782e398c7b2a9600867e80 Mon Sep 17 00:00:00 2001 |
855 | +From: Simon Fels <simon.fels@canonical.com> |
856 | +Date: Fri, 11 Sep 2015 18:46:26 +0200 |
857 | +Subject: [PATCH 1/4] obexd: plugins: port ebook support to the latest EDS |
858 | + |
859 | +Signed-off-by: Simon Fels <simon.fels@canonical.com> |
860 | +--- |
861 | + obexd/plugins/phonebook-ebook.c | 132 ++++++++++++++++++---------------------- |
862 | + 1 file changed, 60 insertions(+), 72 deletions(-) |
863 | + |
864 | +diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c |
865 | +index c422585..d1e6159 100644 |
866 | +--- a/obexd/plugins/phonebook-ebook.c |
867 | ++++ b/obexd/plugins/phonebook-ebook.c |
868 | +@@ -28,9 +28,9 @@ |
869 | + |
870 | + #include <string.h> |
871 | + #include <errno.h> |
872 | +- |
873 | + #include <glib.h> |
874 | +-#include <libebook/e-book.h> |
875 | ++ |
876 | ++#include <libebook/libebook.h> |
877 | + |
878 | + #include "lib/bluetooth.h" |
879 | + |
880 | +@@ -158,13 +158,17 @@ static char *evcard_to_string(EVCard *evcard, unsigned int format, |
881 | + return vcard; |
882 | + } |
883 | + |
884 | +-static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, |
885 | +- void *user_data) |
886 | ++static void ebookpull_cb(EBookClient *client, GAsyncResult *res, |
887 | ++ gpointer user_data) |
888 | + { |
889 | + struct query_context *data = user_data; |
890 | +- GList *l; |
891 | ++ GSList *l; |
892 | ++ GSList *contacts = NULL; |
893 | ++ GError *gerr = NULL; |
894 | + unsigned int count, maxcount; |
895 | + |
896 | ++ e_book_client_get_contacts_finish(client, res, &contacts, &gerr); |
897 | ++ |
898 | + data->queued_calls--; |
899 | + |
900 | + if (data->canceled) |
901 | +@@ -184,13 +188,13 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, |
902 | + */ |
903 | + maxcount = data->params->maxlistcount; |
904 | + if (maxcount == 0) { |
905 | +- data->count += g_list_length(contacts); |
906 | ++ data->count += g_slist_length(contacts); |
907 | + goto done; |
908 | + } |
909 | + |
910 | +- l = g_list_nth(contacts, data->params->liststartoffset); |
911 | ++ l = g_slist_nth(contacts, data->params->liststartoffset); |
912 | + |
913 | +- for (count = 0; l && count + data->count < maxcount; l = g_list_next(l), |
914 | ++ for (count = 0; l && count + data->count < maxcount; l = g_slist_next(l), |
915 | + count++) { |
916 | + EContact *contact = E_CONTACT(l->data); |
917 | + EVCard *evcard = E_VCARD(contact); |
918 | +@@ -208,7 +212,7 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts, |
919 | + |
920 | + data->count += count; |
921 | + |
922 | +- g_list_free_full(contacts, g_object_unref); |
923 | ++ g_slist_free_full(contacts, g_object_unref); |
924 | + |
925 | + done: |
926 | + if (data->queued_calls == 0) { |
927 | +@@ -229,14 +233,18 @@ canceled: |
928 | + free_query_context(data); |
929 | + } |
930 | + |
931 | +-static void ebook_entry_cb(EBook *book, const GError *gerr, |
932 | +- EContact *contact, void *user_data) |
933 | ++static void ebook_entry_cb(EBookClient *client, GAsyncResult *res, |
934 | ++ gpointer user_data) |
935 | + { |
936 | + struct query_context *data = user_data; |
937 | ++ EContact *contact; |
938 | ++ GError *gerr = NULL; |
939 | + EVCard *evcard; |
940 | + char *vcard; |
941 | + size_t len; |
942 | + |
943 | ++ e_book_client_get_contact_finish(client, res, &contact, &gerr); |
944 | ++ |
945 | + data->queued_calls--; |
946 | + |
947 | + if (data->canceled) |
948 | +@@ -244,6 +252,7 @@ static void ebook_entry_cb(EBook *book, const GError *gerr, |
949 | + |
950 | + if (gerr != NULL) { |
951 | + error("E-Book query failed: %s", gerr->message); |
952 | ++ g_error_free(gerr); |
953 | + goto done; |
954 | + } |
955 | + |
956 | +@@ -367,81 +376,55 @@ canceled: |
957 | + free_query_context(data); |
958 | + } |
959 | + |
960 | +-static GSList *traverse_sources(GSList *ebooks, GSList *sources, |
961 | +- char **default_src) { |
962 | ++static GSList *traverse_sources(GSList *ebooks, ESource *source) |
963 | ++{ |
964 | + GError *gerr = NULL; |
965 | + |
966 | +- for (; sources != NULL; sources = g_slist_next(sources)) { |
967 | +- char *uri; |
968 | +- ESource *source = E_SOURCE(sources->data); |
969 | +- EBook *ebook = e_book_new(source, &gerr); |
970 | +- |
971 | +- if (ebook == NULL) { |
972 | +- error("Can't create user's address book: %s", |
973 | +- gerr->message); |
974 | +- g_clear_error(&gerr); |
975 | +- continue; |
976 | +- } |
977 | +- |
978 | +- uri = e_source_get_uri(source); |
979 | +- if (g_strcmp0(*default_src, uri) == 0) { |
980 | +- g_free(uri); |
981 | +- continue; |
982 | +- } |
983 | +- g_free(uri); |
984 | +- |
985 | +- if (e_book_open(ebook, FALSE, &gerr) == FALSE) { |
986 | +- error("Can't open e-book address book: %s", |
987 | ++ EClient *client = e_book_client_connect_sync(source, -1, NULL, &gerr); |
988 | ++ if (client == NULL) { |
989 | ++ error("Can't create user's address book: %s", |
990 | + gerr->message); |
991 | +- g_object_unref(ebook); |
992 | +- g_clear_error(&gerr); |
993 | +- continue; |
994 | +- } |
995 | +- |
996 | +- if (*default_src == NULL) |
997 | +- *default_src = e_source_get_uri(source); |
998 | ++ g_clear_error(&gerr); |
999 | ++ return NULL; |
1000 | ++ } |
1001 | + |
1002 | +- DBG("%s address book opened", e_source_peek_name(source)); |
1003 | ++ DBG("%s address book opened", e_source_get_display_name(source)); |
1004 | + |
1005 | +- ebooks = g_slist_append(ebooks, ebook); |
1006 | +- } |
1007 | ++ ebooks = g_slist_append(ebooks, client); |
1008 | + |
1009 | + return ebooks; |
1010 | + } |
1011 | + |
1012 | + int phonebook_init(void) |
1013 | + { |
1014 | +- g_type_init(); |
1015 | +- |
1016 | + return 0; |
1017 | + } |
1018 | + |
1019 | + static GSList *open_ebooks(void) |
1020 | + { |
1021 | + GError *gerr = NULL; |
1022 | +- ESourceList *src_list; |
1023 | +- GSList *list; |
1024 | +- char *default_src = NULL; |
1025 | ++ GList *list; |
1026 | + GSList *ebooks = NULL; |
1027 | ++ ESourceRegistry *registry; |
1028 | + |
1029 | +- if (e_book_get_addressbooks(&src_list, &gerr) == FALSE) { |
1030 | ++ registry = e_source_registry_new_sync(NULL, &gerr); |
1031 | ++ if (gerr) { |
1032 | + error("Can't list user's address books: %s", gerr->message); |
1033 | + g_error_free(gerr); |
1034 | + return NULL; |
1035 | + } |
1036 | + |
1037 | +- list = e_source_list_peek_groups(src_list); |
1038 | ++ list = e_source_registry_list_sources(registry, E_SOURCE_EXTENSION_ADDRESS_BOOK); |
1039 | + while (list != NULL) { |
1040 | +- ESourceGroup *group = E_SOURCE_GROUP(list->data); |
1041 | +- GSList *sources = e_source_group_peek_sources(group); |
1042 | ++ ESource *source = E_SOURCE(list->data); |
1043 | + |
1044 | +- ebooks = traverse_sources(ebooks, sources, &default_src); |
1045 | ++ ebooks = traverse_sources(ebooks, source); |
1046 | + |
1047 | + list = list->next; |
1048 | + } |
1049 | + |
1050 | +- g_free(default_src); |
1051 | +- g_object_unref(src_list); |
1052 | ++ g_list_free_full(list, g_object_unref); |
1053 | ++ g_object_unref(registry); |
1054 | + |
1055 | + return ebooks; |
1056 | + } |
1057 | +@@ -579,14 +562,13 @@ int phonebook_pull_read(void *request) |
1058 | + return -ENOENT; |
1059 | + |
1060 | + for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
1061 | +- EBook *ebook = l->data; |
1062 | +- |
1063 | +- if (e_book_is_opened(ebook) == FALSE) |
1064 | +- continue; |
1065 | ++ EClient *client = l->data; |
1066 | ++ gchar *query = e_book_query_to_string(data->query); |
1067 | + |
1068 | +- if (e_book_get_contacts_async(ebook, data->query, |
1069 | +- ebookpull_cb, data) == TRUE) |
1070 | +- data->queued_calls++; |
1071 | ++ e_book_client_get_contacts(E_BOOK_CLIENT(client), query, |
1072 | ++ NULL, (GAsyncReadyCallback) ebookpull_cb, data); |
1073 | ++ data->queued_calls++; |
1074 | ++ g_free(query); |
1075 | + } |
1076 | + |
1077 | + if (data->queued_calls == 0) |
1078 | +@@ -610,14 +592,11 @@ void *phonebook_get_entry(const char *folder, const char *id, |
1079 | + data->ebooks = open_ebooks(); |
1080 | + |
1081 | + for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
1082 | +- EBook *ebook = l->data; |
1083 | +- |
1084 | +- if (e_book_is_opened(ebook) == FALSE) |
1085 | +- continue; |
1086 | ++ EClient *client = l->data; |
1087 | + |
1088 | +- if (e_book_get_contact_async(ebook, data->id, |
1089 | +- ebook_entry_cb, data) == TRUE) |
1090 | +- data->queued_calls++; |
1091 | ++ e_book_client_get_contact(E_BOOK_CLIENT(client), data->id, |
1092 | ++ NULL, (GAsyncReadyCallback) ebook_entry_cb, data); |
1093 | ++ data->queued_calls++; |
1094 | + } |
1095 | + |
1096 | + if (err) |
1097 | +@@ -630,12 +609,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, |
1098 | + phonebook_cache_ready_cb ready_cb, void *user_data, int *err) |
1099 | + { |
1100 | + struct query_context *data; |
1101 | ++ ESourceRegistry *registry; |
1102 | + EBookQuery *query; |
1103 | + GSList *l; |
1104 | + EContact *me; |
1105 | + EVCard *evcard; |
1106 | + GError *gerr = NULL; |
1107 | +- EBook *eb; |
1108 | ++ EBookClient *eb; |
1109 | + EVCardAttribute *attrib; |
1110 | + char *uid, *tel, *cname; |
1111 | + |
1112 | +@@ -648,6 +628,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, |
1113 | + |
1114 | + DBG(""); |
1115 | + |
1116 | ++ registry = e_source_registry_new_sync(NULL, &gerr); |
1117 | ++ if (gerr) { |
1118 | ++ error("Can't access user's address books: %s", gerr->message); |
1119 | ++ g_error_free(gerr); |
1120 | ++ return NULL; |
1121 | ++ } |
1122 | ++ |
1123 | + query = e_book_query_any_field_contains(""); |
1124 | + |
1125 | + data = g_new0(struct query_context, 1); |
1126 | +@@ -658,7 +645,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, |
1127 | + data->ebooks = open_ebooks(); |
1128 | + |
1129 | + /* Add 0.vcf */ |
1130 | +- if (e_book_get_self(&me, &eb, &gerr) == FALSE) { |
1131 | ++ if (e_book_client_get_self(registry, &me, &eb, &gerr) == FALSE) { |
1132 | + g_error_free(gerr); |
1133 | + goto next; |
1134 | + } |
1135 | +@@ -688,6 +675,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, |
1136 | + g_free(uid); |
1137 | + g_free(tel); |
1138 | + g_object_unref(eb); |
1139 | ++ g_object_unref(registry); |
1140 | + |
1141 | + next: |
1142 | + for (l = data->ebooks; l != NULL; l = g_slist_next(l)) { |
1143 | +-- |
1144 | +2.5.0 |
1145 | + |
1146 | |
1147 | === added file 'debian/patches/0002-hostname-handle-chassis-type-handset.patch' |
1148 | --- debian/patches/0002-hostname-handle-chassis-type-handset.patch 1970-01-01 00:00:00 +0000 |
1149 | +++ debian/patches/0002-hostname-handle-chassis-type-handset.patch 2016-02-02 17:17:35 +0000 |
1150 | @@ -0,0 +1,55 @@ |
1151 | +From c4d9e1636ca711bad18ec7b884c383bea3d301c4 Mon Sep 17 00:00:00 2001 |
1152 | +From: Simon Fels <simon.fels@canonical.com> |
1153 | +Date: Mon, 12 Oct 2015 07:32:36 +0200 |
1154 | +Subject: [PATCH 2/4] hostname: handle chassis type handset |
1155 | + |
1156 | +This also corrects the link to the definition of the base class of |
1157 | +device field. |
1158 | +--- |
1159 | + plugins/hostname.c | 11 ++++++++++- |
1160 | + 1 file changed, 10 insertions(+), 1 deletion(-) |
1161 | + |
1162 | +diff --git a/plugins/hostname.c b/plugins/hostname.c |
1163 | +index 4f9dfe6..09c01db 100644 |
1164 | +--- a/plugins/hostname.c |
1165 | ++++ b/plugins/hostname.c |
1166 | +@@ -40,10 +40,11 @@ |
1167 | + #include "src/adapter.h" |
1168 | + #include "src/log.h" |
1169 | + |
1170 | +-/* http://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm */ |
1171 | ++/* https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband */ |
1172 | + |
1173 | + #define MAJOR_CLASS_MISCELLANEOUS 0x00 |
1174 | + #define MAJOR_CLASS_COMPUTER 0x01 |
1175 | ++#define MAJOR_CLASS_PHONE 0x02 |
1176 | + |
1177 | + #define MINOR_CLASS_UNCATEGORIZED 0x00 |
1178 | + #define MINOR_CLASS_DESKTOP 0x01 |
1179 | +@@ -54,6 +55,8 @@ |
1180 | + #define MINOR_CLASS_WEARABLE 0x06 |
1181 | + #define MINOR_CLASS_TABLET 0x07 |
1182 | + |
1183 | ++#define MINOR_CLASS_SMARTPHONE 0x3 |
1184 | ++ |
1185 | + static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS; |
1186 | + static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED; |
1187 | + |
1188 | +@@ -122,8 +125,14 @@ static const struct { |
1189 | + { "desktop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP }, |
1190 | + { "server", MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER }, |
1191 | + { "laptop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP }, |
1192 | ++#if 0 |
1193 | ++ // NOTE: Until we have support for more chassis types in |
1194 | ++ // hostnamed like 'phone' we keep handset separated and |
1195 | ++ // take it for the phone role. |
1196 | + { "handset", MAJOR_CLASS_COMPUTER, MINOR_CLASS_HANDHELD }, |
1197 | ++#endif |
1198 | + { "tablet", MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET }, |
1199 | ++ { "handset", MAJOR_CLASS_PHONE, MINOR_CLASS_SMARTPHONE }, |
1200 | + { } |
1201 | + }; |
1202 | + |
1203 | +-- |
1204 | +2.5.0 |
1205 | + |
1206 | |
1207 | === added file 'debian/patches/0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch' |
1208 | --- debian/patches/0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch 1970-01-01 00:00:00 +0000 |
1209 | +++ debian/patches/0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch 2016-02-02 17:17:35 +0000 |
1210 | @@ -0,0 +1,65 @@ |
1211 | +From 7abc94204c2dd72fd6a731a0240123e344dd2ac9 Mon Sep 17 00:00:00 2001 |
1212 | +From: Simon Fels <simon.fels@canonical.com> |
1213 | +Date: Mon, 19 Oct 2015 22:13:02 +0200 |
1214 | +Subject: [PATCH 3/4] tools: mpris-proxy: allow user to specify different mpris |
1215 | + service name |
1216 | + |
1217 | +In some environments the MPRIS service isn't available on the bus name |
1218 | +org.mpris and for those situations we should allow the user to use |
1219 | +a different bus name on startup. |
1220 | +--- |
1221 | + tools/mpris-proxy.c | 10 ++++++++-- |
1222 | + 1 file changed, 8 insertions(+), 2 deletions(-) |
1223 | + |
1224 | +diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c |
1225 | +index bf8148f..613ffa7 100644 |
1226 | +--- a/tools/mpris-proxy.c |
1227 | ++++ b/tools/mpris-proxy.c |
1228 | +@@ -65,6 +65,7 @@ static GSList *transports = NULL; |
1229 | + |
1230 | + static gboolean option_version = FALSE; |
1231 | + static gboolean option_export = FALSE; |
1232 | ++static char *option_service = NULL; |
1233 | + |
1234 | + struct tracklist { |
1235 | + GDBusProxy *proxy; |
1236 | +@@ -595,7 +596,7 @@ static gboolean name_owner_changed(DBusConnection *conn, |
1237 | + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
1238 | + } |
1239 | + |
1240 | +- if (!g_str_has_prefix(name, "org.mpris")) |
1241 | ++ if (!g_str_has_prefix(name, option_service)) |
1242 | + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
1243 | + |
1244 | + if (*new == '\0') { |
1245 | +@@ -677,7 +678,7 @@ static void parse_list_names(DBusConnection *conn, DBusMessageIter *args) |
1246 | + |
1247 | + dbus_message_iter_get_basic(&array, &name); |
1248 | + |
1249 | +- if (!g_str_has_prefix(name, "org.mpris")) |
1250 | ++ if (!g_str_has_prefix(name, option_service)) |
1251 | + goto next; |
1252 | + |
1253 | + owner = get_name_owner(conn, name); |
1254 | +@@ -740,6 +741,8 @@ static void usage(void) |
1255 | + } |
1256 | + |
1257 | + static GOptionEntry options[] = { |
1258 | ++ { "service", 's', 0, G_OPTION_ARG_STRING, &option_service, |
1259 | ++ "Specifiy the mpris service name. Defaults to 'org.mpris'" }, |
1260 | + { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version, |
1261 | + "Show version information and exit" }, |
1262 | + { "export", 'e', 0, G_OPTION_ARG_NONE, &option_export, |
1263 | +@@ -2533,6 +2536,9 @@ int main(int argc, char *argv[]) |
1264 | + exit(0); |
1265 | + } |
1266 | + |
1267 | ++ if (!option_service) |
1268 | ++ option_service = "org.mpris"; |
1269 | ++ |
1270 | + main_loop = g_main_loop_new(NULL, FALSE); |
1271 | + |
1272 | + sys = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL); |
1273 | +-- |
1274 | +2.5.0 |
1275 | + |
1276 | |
1277 | === added file 'debian/patches/0004-obexd-enable-ebook-backend-conditionally.patch' |
1278 | --- debian/patches/0004-obexd-enable-ebook-backend-conditionally.patch 1970-01-01 00:00:00 +0000 |
1279 | +++ debian/patches/0004-obexd-enable-ebook-backend-conditionally.patch 2016-02-02 17:17:35 +0000 |
1280 | @@ -0,0 +1,103 @@ |
1281 | +From 5acde5532f16e1bb8b354baee00f8fe71fc38e52 Mon Sep 17 00:00:00 2001 |
1282 | +From: Simon Fels <simon.fels@canonical.com> |
1283 | +Date: Fri, 11 Sep 2015 19:01:52 +0200 |
1284 | +Subject: [PATCH 4/4] obexd: enable ebook backend conditionally |
1285 | + |
1286 | +EDS support was sitting around but wasn't usable cause it was not included |
1287 | +in the build configuration. It is now put behind an additional configure |
1288 | +switch. By default still the dummy backend is used. |
1289 | +--- |
1290 | + Makefile.obexd | 12 ++++++++---- |
1291 | + configure.ac | 12 ++++++++++++ |
1292 | + 2 files changed, 20 insertions(+), 4 deletions(-) |
1293 | + |
1294 | +Index: bluez-5.37/Makefile.obexd |
1295 | +=================================================================== |
1296 | +--- bluez-5.37.orig/Makefile.obexd |
1297 | ++++ bluez-5.37/Makefile.obexd |
1298 | +@@ -39,8 +39,12 @@ obexd_builtin_sources += obexd/plugins/i |
1299 | + obexd_builtin_modules += pbap |
1300 | + obexd_builtin_sources += obexd/plugins/pbap.c \ |
1301 | + obexd/plugins/vcard.h obexd/plugins/vcard.c \ |
1302 | +- obexd/plugins/phonebook.h \ |
1303 | +- obexd/plugins/phonebook-dummy.c |
1304 | ++ obexd/plugins/phonebook.h |
1305 | ++if PHONEBOOK_EBOOK |
1306 | ++obexd_builtin_sources += obexd/plugins/phonebook-ebook.c |
1307 | ++else |
1308 | ++obexd_builtin_sources += obexd/plugins/phonebook-dummy.c |
1309 | ++endif |
1310 | + endif |
1311 | + |
1312 | + obexd_builtin_modules += mas |
1313 | +@@ -81,14 +85,15 @@ obexd_src_obexd_SOURCES = $(btio_sources |
1314 | + obexd/src/map_ap.h |
1315 | + obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \ |
1316 | + gdbus/libgdbus-internal.la \ |
1317 | +- @ICAL_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl |
1318 | ++ @ICAL_LIBS@ @EBOOK_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl |
1319 | + |
1320 | + obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic |
1321 | + |
1322 | + obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ |
1323 | +- @ICAL_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \ |
1324 | ++ @ICAL_CFLAGS@ @EBOOK_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \ |
1325 | + -DPLUGINDIR=\""$(obex_plugindir)"\" \ |
1326 | +- -fPIC -D_FILE_OFFSET_BITS=64 |
1327 | ++ -fPIC -D_FILE_OFFSET_BITS=64 \ |
1328 | ++ -DEBOOK_API=@EBOOK_API@ |
1329 | + |
1330 | + obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src |
1331 | + |
1332 | +Index: bluez-5.37/configure.ac |
1333 | +=================================================================== |
1334 | +--- bluez-5.37.orig/configure.ac |
1335 | ++++ bluez-5.37/configure.ac |
1336 | +@@ -180,6 +180,11 @@ AC_ARG_ENABLE(cups, AC_HELP_STRING([--di |
1337 | + [disable CUPS printer support]), [enable_cups=${enableval}]) |
1338 | + AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no") |
1339 | + |
1340 | ++AC_ARG_ENABLE(phonebook-ebook, AC_HELP_STRING([--enable-phonebook-ebook], |
1341 | ++ [disable Phonebook support through EDS]), |
1342 | ++ [enable_phonebook_ebook=${enableval}]) |
1343 | ++AM_CONDITIONAL(PHONEBOOK_EBOOK, test "${enable_phonebook_ebook}" = "yes") |
1344 | ++ |
1345 | + AC_ARG_ENABLE(obex, AC_HELP_STRING([--disable-obex], |
1346 | + [disable OBEX profile support]), [enable_obex=${enableval}]) |
1347 | + if (test "${enable_obex}" != "no"); then |
1348 | +@@ -187,6 +192,19 @@ if (test "${enable_obex}" != "no"); then |
1349 | + AC_MSG_ERROR(libical is required)) |
1350 | + AC_SUBST(ICAL_CFLAGS) |
1351 | + AC_SUBST(ICAL_LIBS) |
1352 | ++ |
1353 | ++ if (test "${enable_phonebook_ebook}" = "yes"); then |
1354 | ++ |
1355 | ++ AC_SUBST(EBOOK_API, "12") |
1356 | ++ |
1357 | ++ PKG_CHECK_MODULES(EBOOK, libebook-1.2 >= 3.12, dummy=yes, |
1358 | ++ AC_MSG_ERROR(libebook is required)) |
1359 | ++ AC_SUBST(EBOOK_CFLAGS) |
1360 | ++ AC_SUBST(EBOOK_LIBS) |
1361 | ++ |
1362 | ++ PKG_CHECK_MODULES(EBOOK, libebook-1.2 >= 3.16, |
1363 | ++ AC_SUBST(EBOOK_API, "16"), dummy=yes) |
1364 | ++ fi |
1365 | + fi |
1366 | + AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no") |
1367 | + |
1368 | +Index: bluez-5.37/obexd/plugins/phonebook-ebook.c |
1369 | +=================================================================== |
1370 | +--- bluez-5.37.orig/obexd/plugins/phonebook-ebook.c |
1371 | ++++ bluez-5.37/obexd/plugins/phonebook-ebook.c |
1372 | +@@ -380,7 +380,11 @@ static GSList *traverse_sources(GSList * |
1373 | + { |
1374 | + GError *gerr = NULL; |
1375 | + |
1376 | ++#if EBOOK_API >= 16 |
1377 | + EClient *client = e_book_client_connect_sync(source, -1, NULL, &gerr); |
1378 | ++#else |
1379 | ++ EClient *client = e_book_client_connect_sync(source, NULL, &gerr); |
1380 | ++#endif |
1381 | + if (client == NULL) { |
1382 | + error("Can't create user's address book: %s", |
1383 | + gerr->message); |
1384 | |
1385 | === added file 'debian/patches/0005-audio-media-return-empty-string-when-player-name-is-.patch' |
1386 | --- debian/patches/0005-audio-media-return-empty-string-when-player-name-is-.patch 1970-01-01 00:00:00 +0000 |
1387 | +++ debian/patches/0005-audio-media-return-empty-string-when-player-name-is-.patch 2016-02-02 17:17:35 +0000 |
1388 | @@ -0,0 +1,55 @@ |
1389 | +From c9055958af1dec734b66bf4c941ee7392034c958 Mon Sep 17 00:00:00 2001 |
1390 | +From: Simon Fels <simon.fels@canonical.com> |
1391 | +Date: Wed, 2 Dec 2015 11:58:54 +0100 |
1392 | +Subject: [PATCH 5/5] audio/media: return empty string when player name is not |
1393 | + available |
1394 | + |
1395 | +If the name for the player is set as NULL we will crash later on |
1396 | +so taking a valid default is required. |
1397 | + |
1398 | +Crash observed without this: |
1399 | + |
1400 | +Program terminated with signal SIGSEGV, Segmentation fault. |
1401 | +0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:85 |
1402 | +85 ../sysdeps/arm/armv6t2/strlen.S: No such file or directory. |
1403 | +(gdb) bt |
1404 | +0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:85 |
1405 | +1 0xb6f13ebc in avrcp_handle_media_player_list (session=0xb8f339c0, |
1406 | + session=0xb8f339c0, end_item=<optimized out>, start_item=<optimized out>, |
1407 | + pdu=0xb8f43283) at profiles/audio/avrcp.c:1917 |
1408 | +2 avrcp_handle_get_folder_items (session=0xb8f339c0, pdu=0xb8f43283, |
1409 | + transaction=<optimized out>) at profiles/audio/avrcp.c:1968 |
1410 | +3 0xb6f13fb8 in handle_browsing_pdu (conn=<optimized out>, |
1411 | + transaction=<optimized out>, operands=0xb8f43283 "q\b", |
1412 | + operand_count=<optimized out>, user_data=0xb8f339c0) |
1413 | + at profiles/audio/avrcp.c:2028 |
1414 | +4 0xb6f0f088 in session_browsing_cb (chan=<optimized out>, |
1415 | + cond=<optimized out>, data=0xb8f3ba28) at profiles/audio/avctp.c:930 |
1416 | +5 0xb6e19e90 in g_main_dispatch (context=0xb8f28100) |
1417 | + at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3122 |
1418 | +6 g_main_context_dispatch (context=context@entry=0xb8f28100) |
1419 | + at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3737 |
1420 | +7 0xb6e1a114 in g_main_context_iterate (context=0xb8f28100, |
1421 | + block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) |
1422 | + at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3808 |
1423 | +8 0xb6e1a3b0 in g_main_loop_run (loop=0xb8f28030) |
1424 | + at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:4002 |
1425 | +9 0xb6efef3e in main (argc=1, argv=0xbebdde04) at src/main.c:661 |
1426 | +--- |
1427 | + profiles/audio/media.c | 3 +++ |
1428 | + 1 file changed, 3 insertions(+) |
1429 | + |
1430 | +Index: bluez-5.37/profiles/audio/media.c |
1431 | +=================================================================== |
1432 | +--- bluez-5.37.orig/profiles/audio/media.c |
1433 | ++++ bluez-5.37/profiles/audio/media.c |
1434 | +@@ -1018,6 +1018,9 @@ static const char *get_player_name(void |
1435 | + { |
1436 | + struct media_player *mp = user_data; |
1437 | + |
1438 | ++ if (!mp->name) |
1439 | ++ return ""; |
1440 | ++ |
1441 | + return mp->name; |
1442 | + } |
1443 | + |
1444 | |
1445 | === modified file 'debian/patches/series' |
1446 | --- debian/patches/series 2015-11-09 12:57:41 +0000 |
1447 | +++ debian/patches/series 2016-02-02 17:17:35 +0000 |
1448 | @@ -4,3 +4,14 @@ |
1449 | 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch |
1450 | change_path_of_hogsuspend.patch |
1451 | migrate_scripts_python3.patch |
1452 | + |
1453 | +# This currently stays specific for Ubuntu |
1454 | +0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch |
1455 | +0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch |
1456 | +0002-hostname-handle-chassis-type-handset.patch |
1457 | + |
1458 | +# The following patches are submitted upstream and can be |
1459 | +# dropped with one of the next releases |
1460 | +0003-tools-mpris-proxy-allow-user-to-specify-different-mp.patch |
1461 | +0004-obexd-enable-ebook-backend-conditionally.patch |
1462 | +0005-audio-media-return-empty-string-when-player-name-is-.patch |
1463 | |
1464 | === modified file 'debian/rules' |
1465 | --- debian/rules 2015-08-14 10:04:55 +0000 |
1466 | +++ debian/rules 2016-02-02 17:17:35 +0000 |
1467 | @@ -21,7 +21,8 @@ |
1468 | --enable-systemd \ |
1469 | --enable-threads \ |
1470 | --enable-sixaxis \ |
1471 | - --enable-experimental |
1472 | + --enable-experimental \ |
1473 | + --enable-phonebook-ebook |
1474 | |
1475 | %: |
1476 | dh $@ --with systemd,autoreconf |
1477 | @@ -32,6 +33,9 @@ |
1478 | override_dh_installinit: |
1479 | dh_installinit -pbluez --name=bluetooth --restart-after-upgrade |
1480 | |
1481 | +override_dh_install: |
1482 | + dh_install --list-missing |
1483 | + |
1484 | override_dh_strip: |
1485 | dh_strip -a --dbg-package=bluez-dbg libbluetooth3-dbg |
1486 |
LGTM