Hello community,

here is the log from the commit of package bluez for openSUSE:Factory checked 
in at 2016-04-14 13:01:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bluez (Old)
 and      /work/SRC/openSUSE:Factory/.bluez.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bluez"

Changes:
--------
--- /work/SRC/openSUSE:Factory/bluez/bluez.changes      2016-04-03 
23:05:04.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.bluez.new/bluez.changes 2016-04-14 
13:01:32.000000000 +0200
@@ -1,0 +2,8 @@
+Sun Apr 10 09:37:14 UTC 2016 - seife+...@b1-systems.com
+
+- update to version 5.39:
+  This is almost entirely a bug fix release with important fixes to
+  GATT, HoG, AVRCP & A2DP.
+- install gatttool, needed for bluetooth 4.0 devices (boo#970628)
+
+-------------------------------------------------------------------

Old:
----
  bluez-5.38.tar.xz

New:
----
  bluez-5.39.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bluez.spec ++++++
--- /var/tmp/diff_new_pack.fgz1Nd/_old  2016-04-14 13:01:33.000000000 +0200
+++ /var/tmp/diff_new_pack.fgz1Nd/_new  2016-04-14 13:01:33.000000000 +0200
@@ -24,7 +24,7 @@
 BuildRequires:  systemd-devel
 BuildRequires:  pkgconfig(dbus-1) >= 1.6
 %{?systemd_requires}
-Version:        5.38
+Version:        5.39
 Release:        0
 Summary:        Bluetooth Stack for Linux
 License:        GPL-2.0+
@@ -151,6 +151,10 @@
 rm %{buildroot}%{_prefix}/lib/systemd/user/obex.service
 # end FIXME
 
+## same as in fedora...
+# "make install" fails to install gatttool, used with Bluetooth Low Energy
+install -m0755 attrib/gatttool %{buildroot}%{_bindir}
+
 # rpmlint warnings...
 cd %{buildroot}%{_libdir}/bluez/test
 chmod 0644 *.py *.xml *.dtd
@@ -189,6 +193,7 @@
 %doc AUTHORS COPYING ChangeLog README dbus-apis
 %{_bindir}/bluemoon
 %{_bindir}/btattach
+%{_bindir}/gatttool
 %{_bindir}/hcitool
 %{_bindir}/l2ping
 %{_bindir}/rfcomm

++++++ bluez-5.38.tar.xz -> bluez-5.39.tar.xz ++++++
++++ 1663 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/ChangeLog new/bluez-5.39/ChangeLog
--- old/bluez-5.38/ChangeLog    2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/ChangeLog    2016-04-05 00:21:51.000000000 +0200
@@ -1,3 +1,13 @@
+ver 5.39:
+       Fix issue with missing uHID kernel support.
+       Fix issue with GATT reliable write handling.
+       Fix issue with GATT service changed handling.
+       Fix issue with GATT execute write handling.
+       Fix issue with AVRCP player event handling.
+       Fix issue with AVRCP controller handling.
+       Fix issue with AVDTP connection handling.
+       Fix issue with AVDTP error handling.
+
 ver 5.38:
        Fix issue with stack overflow and UUID handling.
        Fix issue with ObjectManager interface and GATT.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/Makefile.plugins new/bluez-5.39/Makefile.plugins
--- old/bluez-5.38/Makefile.plugins     2015-12-28 03:13:20.000000000 +0100
+++ new/bluez-5.39/Makefile.plugins     2016-04-05 00:21:51.000000000 +0200
@@ -87,7 +87,7 @@
 builtin_modules += deviceinfo
 builtin_sources += profiles/deviceinfo/deviceinfo.c
 
-if EXPERIMENTAL
+if DEPRECATED
 builtin_modules += alert
 builtin_sources += profiles/alert/server.c
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/client/main.c new/bluez-5.39/client/main.c
--- old/bluez-5.38/client/main.c        2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/client/main.c        2016-04-05 00:21:51.000000000 +0200
@@ -964,17 +964,16 @@
        GSList *uuids;
 };
 
-static void set_discovery_filter_setup(DBusMessageIter *iter,
-                                          void *user_data)
+static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
 {
        struct set_discovery_filter_args *args = user_data;
        DBusMessageIter dict;
 
        dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
-                           DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-                           DBUS_TYPE_STRING_AS_STRING
-                           DBUS_TYPE_VARIANT_AS_STRING
-                           DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+                               DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+                               DBUS_TYPE_STRING_AS_STRING
+                               DBUS_TYPE_VARIANT_AS_STRING
+                               DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
 
        if (args->uuids != NULL) {
                DBusMessageIter entry, value, arrayIter;
@@ -982,22 +981,22 @@
                GSList *l;
 
                dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY,
-                                                NULL, &entry);
+                                                       NULL, &entry);
                /* dict key */
                dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
-                                              &uuids);
+                                                       &uuids);
 
                dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
-                                                "as", &value);
+                                                       "as", &value);
 
                dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY, "s",
-                                                &arrayIter);
+                                                       &arrayIter);
 
                for (l = args->uuids; l != NULL; l = g_slist_next(l))
                        /* list->data contains string representation of uuid */
                        dbus_message_iter_append_basic(&arrayIter,
-                                                      DBUS_TYPE_STRING,
-                                                      &l->data);
+                                                       DBUS_TYPE_STRING,
+                                                       &l->data);
 
                dbus_message_iter_close_container(&value, &arrayIter);
 
@@ -1010,21 +1009,20 @@
 
        if (args->pathloss != DISTANCE_VAL_INVALID)
                dict_append_entry(&dict, "Pathloss", DBUS_TYPE_UINT16,
-                                 &args->pathloss);
+                                               &args->pathloss);
 
        if (args->rssi != DISTANCE_VAL_INVALID)
                dict_append_entry(&dict, "RSSI", DBUS_TYPE_INT16, &args->rssi);
 
        if (args->transport != NULL)
                dict_append_entry(&dict, "Transport", DBUS_TYPE_STRING,
-                                 &args->transport);
+                                               &args->transport);
 
        dbus_message_iter_close_container(iter, &dict);
 }
 
 
-static void set_discovery_filter_reply(DBusMessage *message,
-                                      void *user_data)
+static void set_discovery_filter_reply(DBusMessage *message, void *user_data)
 {
        DBusError error;
 
@@ -1079,7 +1077,7 @@
                uuid_str = strtok_r(uuidstmp, " \t", &saveptr);
                if (uuid_str == NULL)
                        break;
-           filtered_scan_uuids = g_slist_append(filtered_scan_uuids,
+               filtered_scan_uuids = g_slist_append(filtered_scan_uuids,
                                                        strdup(uuid_str));
        }
 
@@ -2077,6 +2075,7 @@
        main_loop = g_main_loop_new(NULL, FALSE);
        dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
 
+       setlinebuf(stdout);
        rl_attempted_completion_function = cmd_completion;
 
        rl_erase_empty_line = 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/configure.ac new/bluez-5.39/configure.ac
--- old/bluez-5.38/configure.ac 2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/configure.ac 2016-04-05 00:21:51.000000000 +0200
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(bluez, 5.38)
+AC_INIT(bluez, 5.39)
 
 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
                                        tar-pax no-dist-gzip dist-xz])
@@ -247,6 +247,11 @@
                                        [enable_experimental=${enableval}])
 AM_CONDITIONAL(EXPERIMENTAL, test "${enable_experimental}" = "yes")
 
+AC_ARG_ENABLE(deprecated, AC_HELP_STRING([--enable-deprecated],
+                       [enable deprecated plugins (BLE services, ...)]),
+                                       [enable_deprecated=${enableval}])
+AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes")
+
 AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis],
                [enable sixaxis plugin]), [enable_sixaxis=${enableval}])
 AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" &&
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/lib/bluetooth.c new/bluez-5.39/lib/bluetooth.c
--- old/bluez-5.38/lib/bluetooth.c      2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/lib/bluetooth.c      2016-04-05 00:21:51.000000000 +0200
@@ -1903,6 +1903,56 @@
                return "Mul-T-Lock";
        case 820:
                return "Corentium AS";
+       case 821:
+               return "Enlighted Inc";
+       case 822:
+               return "GISTIC";
+       case 823:
+               return "AJP2 Holdings, LLC";
+       case 824:
+               return "COBI GmbH";
+       case 825:
+               return "Blue Sky Scientific, LLC";
+       case 826:
+               return "Appception, Inc.";
+       case 827:
+               return "Courtney Thorne Limited";
+       case 828:
+               return "Virtuosys";
+       case 829:
+               return "TPV Technology Limited";
+       case 830:
+               return "Monitra SA";
+       case 831:
+               return "Automation Components, Inc.";
+       case 832:
+               return "Letsense s.r.l.";
+       case 833:
+               return "Etesian Technologies LLC";
+       case 834:
+               return "GERTEC BRASIL LTDA.";
+       case 835:
+               return "Drekker Development Pty. Ltd.";
+       case 836:
+               return "Whirl Inc";
+       case 837:
+               return "Locus Positioning";
+       case 838:
+               return "Acuity Brands Lighting, Inc";
+       case 839:
+               return "Prevent Biometrics";
+       case 840:
+               return "Arioneo";
+       case 841:
+               return "VersaMe";
+       case 842:
+               return "Vaddio";
+       case 843:
+               return "Libratone A/S";
+       case 844:
+               return "HM Electronics, Inc.";
+       case 845:
+               return "TASER International, Inc.";
        case 65535:
                return "internal use";
        default:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/a2dp.c new/bluez-5.39/profiles/audio/a2dp.c
--- old/bluez-5.38/profiles/audio/a2dp.c        2015-10-30 04:30:13.000000000 
+0100
+++ new/bluez-5.39/profiles/audio/a2dp.c        2016-04-05 00:21:51.000000000 
+0200
@@ -225,6 +225,29 @@
        va_end(args);
 }
 
+static int error_to_errno(struct avdtp_error *err)
+{
+       int perr;
+
+       if (!err)
+               return 0;
+
+       if (avdtp_error_category(err) != AVDTP_ERRNO)
+               return -EIO;
+
+       perr = -avdtp_error_posix_errno(err);
+       switch (-perr) {
+       case -EHOSTDOWN:
+       case -ECONNABORTED:
+               return perr;
+       default:
+               /*
+                * An unexpect error has occurred setup may be attempted again.
+                */
+               return -EAGAIN;
+       }
+}
+
 static gboolean finalize_config(gpointer data)
 {
        struct a2dp_setup *s = data;
@@ -239,8 +262,8 @@
                if (!cb->config_cb)
                        continue;
 
-               cb->config_cb(s->session, s->sep, stream, s->err,
-                                                       cb->user_data);
+               cb->config_cb(s->session, s->sep, stream,
+                               error_to_errno(s->err), cb->user_data);
                setup_cb_free(cb);
        }
 
@@ -260,7 +283,8 @@
                if (!cb->resume_cb)
                        continue;
 
-               cb->resume_cb(s->session, s->err, cb->user_data);
+               cb->resume_cb(s->session, error_to_errno(s->err),
+                                                       cb->user_data);
                setup_cb_free(cb);
        }
 
@@ -280,7 +304,8 @@
                if (!cb->suspend_cb)
                        continue;
 
-               cb->suspend_cb(s->session, s->err, cb->user_data);
+               cb->suspend_cb(s->session, error_to_errno(s->err),
+                                                       cb->user_data);
                setup_cb_free(cb);
        }
 
@@ -316,7 +341,8 @@
                if (!cb->discover_cb)
                        continue;
 
-               cb->discover_cb(s->session, s->seps, s->err, cb->user_data);
+               cb->discover_cb(s->session, s->seps, error_to_errno(s->err),
+                                                               cb->user_data);
                setup_cb_free(cb);
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/a2dp.h new/bluez-5.39/profiles/audio/a2dp.h
--- old/bluez-5.38/profiles/audio/a2dp.h        2015-07-30 21:17:18.000000000 
+0200
+++ new/bluez-5.39/profiles/audio/a2dp.h        2016-04-05 00:21:51.000000000 
+0200
@@ -53,17 +53,14 @@
 };
 
 typedef void (*a2dp_discover_cb_t) (struct avdtp *session, GSList *seps,
-                                       struct avdtp_error *err,
-                                       void *user_data);
+                                               int err, void *user_data);
 typedef void (*a2dp_select_cb_t) (struct avdtp *session,
                                        struct a2dp_sep *sep, GSList *caps,
                                        void *user_data);
 typedef void (*a2dp_config_cb_t) (struct avdtp *session, struct a2dp_sep *sep,
-                                       struct avdtp_stream *stream,
-                                       struct avdtp_error *err,
+                                       struct avdtp_stream *stream, int err,
                                        void *user_data);
-typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
-                                       struct avdtp_error *err,
+typedef void (*a2dp_stream_cb_t) (struct avdtp *session, int err,
                                        void *user_data);
 
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/avdtp.c new/bluez-5.39/profiles/audio/avdtp.c
--- old/bluez-5.38/profiles/audio/avdtp.c       2015-09-04 03:19:36.000000000 
+0200
+++ new/bluez-5.39/profiles/audio/avdtp.c       2016-04-05 00:21:51.000000000 
+0200
@@ -1105,6 +1105,8 @@
 {
        char address[18];
 
+       session = avdtp_ref(session);
+
        ba2str(device_get_address(session->device), address);
        DBG("Disconnected from %s", address);
 
@@ -1115,10 +1117,7 @@
 
        avdtp_set_state(session, AVDTP_SESSION_STATE_DISCONNECTED);
 
-       if (session->ref > 0)
-               return;
-
-       avdtp_free(session);
+       avdtp_unref(session);
 }
 
 static gboolean disconnect_timeout(gpointer user_data)
@@ -1171,7 +1170,18 @@
        if (session->ref > 0)
                return;
 
-       set_disconnect_timer(session);
+       switch (session->state) {
+       case AVDTP_SESSION_STATE_CONNECTED:
+               set_disconnect_timer(session);
+               break;
+       case AVDTP_SESSION_STATE_CONNECTING:
+               connection_lost(session, ECONNABORTED);
+               break;
+       case AVDTP_SESSION_STATE_DISCONNECTED:
+       default:
+               avdtp_free(session);
+               break;
+       }
 }
 
 struct avdtp *avdtp_ref(struct avdtp *session)
@@ -3476,7 +3486,7 @@
        if (!stream && session->discover) {
                /* Don't call cb since it being aborted */
                session->discover->cb = NULL;
-               finalize_discovery(session, -ECANCELED);
+               finalize_discovery(session, ECANCELED);
                return -EALREADY;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/avrcp.c new/bluez-5.39/profiles/audio/avrcp.c
--- old/bluez-5.38/profiles/audio/avrcp.c       2016-03-18 03:18:03.000000000 
+0100
+++ new/bluez-5.39/profiles/audio/avrcp.c       2016-04-05 00:21:51.000000000 
+0200
@@ -3647,8 +3647,9 @@
                case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
                case AVRCP_EVENT_UIDS_CHANGED:
                case AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED:
-                       /* These events above are controller specific */
-                       if (!session->controller)
+                       /* These events above requires a player */
+                       if (!session->controller ||
+                                               !session->controller->player)
                                break;
                case AVRCP_EVENT_VOLUME_CHANGED:
                        avrcp_register_notification(session, event);
@@ -3656,7 +3657,7 @@
                }
        }
 
-       if (!session->controller)
+       if (!session->controller || !session->controller->player)
                return FALSE;
 
        if (!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/sink.c new/bluez-5.39/profiles/audio/sink.c
--- old/bluez-5.38/profiles/audio/sink.c        2015-09-04 03:19:36.000000000 
+0200
+++ new/bluez-5.39/profiles/audio/sink.c        2016-04-05 00:21:51.000000000 
+0200
@@ -180,8 +180,8 @@
 }
 
 static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
-                                       struct avdtp_stream *stream,
-                                       struct avdtp_error *err, void 
*user_data)
+                                       struct avdtp_stream *stream, int err,
+                                       void *user_data)
 {
        struct sink *sink = user_data;
 
@@ -192,11 +192,7 @@
 
        avdtp_unref(sink->session);
        sink->session = NULL;
-       if (avdtp_error_category(err) == AVDTP_ERRNO
-                               && avdtp_error_posix_errno(err) != EHOSTDOWN)
-               btd_service_connecting_complete(sink->service, -EAGAIN);
-       else
-               btd_service_connecting_complete(sink->service, -EIO);
+       btd_service_connecting_complete(sink->service, err);
 }
 
 static void select_complete(struct avdtp *session, struct a2dp_sep *sep,
@@ -221,25 +217,17 @@
        sink->session = NULL;
 }
 
-static void discovery_complete(struct avdtp *session, GSList *seps, struct 
avdtp_error *err,
-                               void *user_data)
+static void discovery_complete(struct avdtp *session, GSList *seps, int err,
+                                                       void *user_data)
 {
        struct sink *sink = user_data;
-       int id, perr;
+       int id;
 
        sink->connect_id = 0;
 
        if (err) {
                avdtp_unref(sink->session);
                sink->session = NULL;
-
-               perr = -avdtp_error_posix_errno(err);
-               if (perr != -EHOSTDOWN) {
-                       if (avdtp_error_category(err) == AVDTP_ERRNO)
-                               perr = -EAGAIN;
-                       else
-                               perr = -EIO;
-               }
                goto failed;
        }
 
@@ -248,7 +236,7 @@
        id = a2dp_select_capabilities(sink->session, AVDTP_SEP_TYPE_SINK, NULL,
                                                select_complete, sink);
        if (id == 0) {
-               perr = -EIO;
+               err = -EIO;
                goto failed;
        }
 
@@ -256,7 +244,7 @@
        return;
 
 failed:
-       btd_service_connecting_complete(sink->service, perr);
+       btd_service_connecting_complete(sink->service, err);
        avdtp_unref(sink->session);
        sink->session = NULL;
 }
@@ -408,13 +396,13 @@
 
        /* cancel pending connect */
        if (sink->connect_id > 0) {
+               avdtp_unref(sink->session);
+               sink->session = NULL;
+
                a2dp_cancel(sink->connect_id);
                sink->connect_id = 0;
                btd_service_disconnecting_complete(sink->service, 0);
 
-               avdtp_unref(sink->session);
-               sink->session = NULL;
-
                return 0;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/source.c new/bluez-5.39/profiles/audio/source.c
--- old/bluez-5.38/profiles/audio/source.c      2015-09-04 03:19:36.000000000 
+0200
+++ new/bluez-5.39/profiles/audio/source.c      2016-04-05 00:21:51.000000000 
+0200
@@ -177,8 +177,8 @@
 }
 
 static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
-                                       struct avdtp_stream *stream,
-                                       struct avdtp_error *err, void 
*user_data)
+                                       struct avdtp_stream *stream, int err,
+                                       void *user_data)
 {
        struct source *source = user_data;
 
@@ -189,11 +189,7 @@
 
        avdtp_unref(source->session);
        source->session = NULL;
-       if (avdtp_error_category(err) == AVDTP_ERRNO
-                               && avdtp_error_posix_errno(err) != EHOSTDOWN)
-               btd_service_connecting_complete(source->service, -EAGAIN);
-       else
-               btd_service_connecting_complete(source->service, -EIO);
+       btd_service_connecting_complete(source->service, err);
 }
 
 static void select_complete(struct avdtp *session, struct a2dp_sep *sep,
@@ -221,34 +217,26 @@
        source->session = NULL;
 }
 
-static void discovery_complete(struct avdtp *session, GSList *seps, struct 
avdtp_error *err,
-                               void *user_data)
+static void discovery_complete(struct avdtp *session, GSList *seps, int err,
+                                                       void *user_data)
 {
        struct source *source = user_data;
-       int id, perr;
+       int id;
 
        source->connect_id = 0;
 
        if (err) {
                avdtp_unref(source->session);
                source->session = NULL;
-
-               perr = -avdtp_error_posix_errno(err);
-               if (perr != -EHOSTDOWN) {
-                       if (avdtp_error_category(err) == AVDTP_ERRNO)
-                               perr = -EAGAIN;
-                       else
-                               perr = -EIO;
-               }
                goto failed;
        }
 
        DBG("Discovery complete");
 
-       id = a2dp_select_capabilities(source->session, AVDTP_SEP_TYPE_SOURCE, 
NULL,
-                                               select_complete, source);
+       id = a2dp_select_capabilities(source->session, AVDTP_SEP_TYPE_SOURCE,
+                                       NULL, select_complete, source);
        if (id == 0) {
-               perr = -EIO;
+               err = -EIO;
                goto failed;
        }
 
@@ -256,7 +244,7 @@
        return;
 
 failed:
-       btd_service_connecting_complete(source->service, perr);
+       btd_service_connecting_complete(source->service, err);
        avdtp_unref(source->session);
        source->session = NULL;
 }
@@ -400,13 +388,13 @@
 
        /* cancel pending connect */
        if (source->connect_id > 0) {
+               avdtp_unref(source->session);
+               source->session = NULL;
+
                a2dp_cancel(source->connect_id);
                source->connect_id = 0;
                btd_service_disconnecting_complete(source->service, 0);
 
-               avdtp_unref(source->session);
-               source->session = NULL;
-
                return 0;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/audio/transport.c 
new/bluez-5.39/profiles/audio/transport.c
--- old/bluez-5.38/profiles/audio/transport.c   2015-09-28 14:16:53.000000000 
+0200
+++ new/bluez-5.39/profiles/audio/transport.c   2016-04-05 00:21:51.000000000 
+0200
@@ -283,8 +283,8 @@
        return TRUE;
 }
 
-static void a2dp_resume_complete(struct avdtp *session,
-                               struct avdtp_error *err, void *user_data)
+static void a2dp_resume_complete(struct avdtp *session, int err,
+                                                       void *user_data)
 {
        struct media_owner *owner = user_data;
        struct media_request *req = owner->pending;
@@ -362,8 +362,8 @@
        return id;
 }
 
-static void a2dp_suspend_complete(struct avdtp *session,
-                               struct avdtp_error *err, void *user_data)
+static void a2dp_suspend_complete(struct avdtp *session, int err,
+                                                       void *user_data)
 {
        struct media_owner *owner = user_data;
        struct media_transport *transport = owner->transport;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/profiles/input/hog.c new/bluez-5.39/profiles/input/hog.c
--- old/bluez-5.38/profiles/input/hog.c 2015-12-28 03:13:20.000000000 +0100
+++ new/bluez-5.39/profiles/input/hog.c 2016-04-05 00:21:51.000000000 +0200
@@ -107,8 +107,13 @@
                                                        product, version);
 
        dev = new0(struct hog_device, 1);
-       dev->device = btd_device_ref(device);
        dev->hog = bt_hog_new_default(name, vendor, product, version, prim);
+       if (!dev->hog) {
+               free(dev);
+               return NULL;
+       }
+
+       dev->device = btd_device_ref(device);
 
        /*
         * TODO: Remove attio callback and use .accept once using
@@ -189,6 +194,9 @@
                        continue;
 
                dev = hog_device_new(device, prim);
+               if (!dev)
+                       break;
+
                btd_service_set_user_data(service, dev);
                return 0;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/src/gatt-client.c new/bluez-5.39/src/gatt-client.c
--- old/bluez-5.38/src/gatt-client.c    2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/src/gatt-client.c    2016-04-05 00:21:51.000000000 +0200
@@ -1663,8 +1663,8 @@
 
        DBG("Failed to re-register notification client");
 
-       queue_remove(notify_client->chrc->notify_clients, client);
-       queue_remove(client->all_notify_clients, client);
+       queue_remove(notify_client->chrc->notify_clients, notify_client);
+       queue_remove(client->all_notify_clients, notify_client);
 
        notify_client_free(notify_client);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/src/shared/gatt-client.c new/bluez-5.39/src/shared/gatt-client.c
--- old/bluez-5.38/src/shared/gatt-client.c     2016-03-18 03:18:03.000000000 
+0100
+++ new/bluez-5.39/src/shared/gatt-client.c     2016-04-05 00:21:51.000000000 
+0200
@@ -55,6 +55,9 @@
        struct bt_att *att;
        int ref_count;
 
+       struct bt_gatt_client *parent;
+       struct queue *clones;
+
        bt_gatt_client_callback_t ready_callback;
        bt_gatt_client_destroy_func_t ready_destroy;
        void *ready_data;
@@ -1013,12 +1016,23 @@
 static void notify_client_ready(struct bt_gatt_client *client, bool success,
                                                        uint8_t att_ecode)
 {
+       const struct queue_entry *entry;
+
        if (!client->ready_callback || client->ready)
                return;
 
        bt_gatt_client_ref(client);
        client->ready = success;
        client->ready_callback(success, att_ecode, client->ready_data);
+
+       /* Notify clones */
+       for (entry = queue_get_entries(client->clones); entry;
+                                                       entry = entry->next) {
+               struct bt_gatt_client *clone = entry->data;
+
+               notify_client_ready(clone, success, att_ecode);
+       }
+
        bt_gatt_client_unref(client);
 }
 
@@ -1332,6 +1346,7 @@
        struct service_changed_op *next_sc_op;
        uint16_t start_handle = op->start;
        uint16_t end_handle = op->end;
+       const struct queue_entry *entry;
 
        client->in_svc_chngd = false;
 
@@ -1348,6 +1363,16 @@
                client->svc_chngd_callback(start_handle, end_handle,
                                                        client->svc_chngd_data);
 
+       /* Notify clones */
+       for (entry = queue_get_entries(client->clones); entry;
+                                                       entry = entry->next) {
+               struct bt_gatt_client *clone = entry->data;
+
+               if (clone->svc_chngd_callback)
+                       clone->svc_chngd_callback(start_handle, end_handle,
+                                                       clone->svc_chngd_data);
+       }
+
        /* Process any queued events */
        next_sc_op = queue_pop_head(client->svc_chngd_queue);
        if (next_sc_op) {
@@ -1634,11 +1659,17 @@
 
        gatt_db_unref(client->db);
 
+       queue_destroy(client->clones, NULL);
        queue_destroy(client->svc_chngd_queue, free);
        queue_destroy(client->long_write_queue, request_unref);
        queue_destroy(client->notify_chrcs, notify_chrc_free);
        queue_destroy(client->pending_requests, request_unref);
 
+       if (client->parent) {
+               queue_remove(client->parent->clones, client);
+               bt_gatt_client_unref(client->parent);
+       }
+
        free(client);
 }
 
@@ -1670,6 +1701,7 @@
        if (!client->disc_id)
                goto fail;
 
+       client->clones = queue_new();
        client->long_write_queue = queue_new();
        client->svc_chngd_queue = queue_new();
        client->notify_list = queue_new();
@@ -1722,13 +1754,20 @@
 {
        struct bt_gatt_client *clone;
 
-       if (!client || !client->ready)
+       if (!client)
                return NULL;
 
        clone = gatt_client_new(client->db, client->att);
        if (!clone)
                return NULL;
 
+       queue_push_tail(client->clones, clone);
+
+       /*
+        * Reference the parent since the clones depend on it to propagate
+        * service changed and ready callbacks.
+        */
+       clone->parent = bt_gatt_client_ref(client);
        clone->ready = client->ready;
 
        return bt_gatt_client_ref(clone);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/src/shared/gatt-server.c new/bluez-5.39/src/shared/gatt-server.c
--- old/bluez-5.38/src/shared/gatt-server.c     2015-12-28 03:13:20.000000000 
+0100
+++ new/bluez-5.39/src/shared/gatt-server.c     2016-04-05 00:21:51.000000000 
+0200
@@ -1088,11 +1088,73 @@
        bt_att_send_error_rsp(server->att, opcode, 0, ecode);
 }
 
+static bool append_prep_data(struct prep_write_data *prep_data, uint16_t 
handle,
+                                       uint16_t length, uint8_t *value)
+{
+       uint8_t *val;
+       uint16_t len;
+
+       if (!length)
+               return true;
+
+       len = prep_data->length + length;
+
+       val = realloc(prep_data->value, len);
+       if (!val)
+               return false;
+
+       memcpy(val + prep_data->length, value, length);
+
+       prep_data->value = val;
+       prep_data->length = len;
+
+       return true;
+}
+
+static bool prep_data_new(struct bt_gatt_server *server,
+                                       uint16_t handle, uint16_t offset,
+                                       uint16_t length, uint8_t *value)
+{
+       struct prep_write_data *prep_data;
+
+       prep_data = new0(struct prep_write_data, 1);
+
+       if (!append_prep_data(prep_data, handle, length, value)) {
+               prep_write_data_destroy(prep_data);
+               return false;
+       }
+
+       prep_data->server = server;
+       prep_data->handle = handle;
+       prep_data->offset = offset;
+
+       queue_push_tail(server->prep_queue, prep_data);
+
+       return true;
+}
+
+static bool store_prep_data(struct bt_gatt_server *server,
+                                       uint16_t handle, uint16_t offset,
+                                       uint16_t length, uint8_t *value)
+{
+       struct prep_write_data *prep_data = NULL;
+
+       /*
+        * Now lets check if prep write is a continuation of long write
+        * If so do aggregation of data
+        */
+       prep_data = queue_peek_tail(server->prep_queue);
+       if (prep_data && (prep_data->handle == handle) &&
+                       (offset == (prep_data->length + prep_data->offset)))
+               return append_prep_data(prep_data, handle, length, value);
+
+       return prep_data_new(server, handle, offset, length, value);
+}
+
 static void prep_write_cb(uint8_t opcode, const void *pdu,
                                        uint16_t length, void *user_data)
 {
        struct bt_gatt_server *server = user_data;
-       struct prep_write_data *prep_data = NULL;
        uint16_t handle = 0;
        uint16_t offset;
        struct gatt_db_attribute *attr;
@@ -1126,33 +1188,18 @@
        if (ecode)
                goto error;
 
-       prep_data = new0(struct prep_write_data, 1);
-       prep_data->length = length - 4;
-       if (prep_data->length) {
-               prep_data->value = malloc(prep_data->length);
-               if (!prep_data->value) {
-                       ecode = BT_ATT_ERROR_INSUFFICIENT_RESOURCES;
-                       goto error;
-               }
+       if (!store_prep_data(server, handle, offset, length - 4,
+                                               &((uint8_t *) pdu)[4])) {
+               ecode = BT_ATT_ERROR_INSUFFICIENT_RESOURCES;
+               goto error;
        }
 
-       prep_data->server = server;
-       prep_data->handle = handle;
-       prep_data->offset = offset;
-       memcpy(prep_data->value, pdu + 4, prep_data->length);
-
-       queue_push_tail(server->prep_queue, prep_data);
-
        bt_att_send(server->att, BT_ATT_OP_PREP_WRITE_RSP, pdu, length, NULL,
                                                                NULL, NULL);
        return;
 
 error:
-       if (prep_data)
-               prep_write_data_destroy(prep_data);
-
        bt_att_send_error_rsp(server->att, opcode, handle, ecode);
-
 }
 
 static void exec_next_prep_write(struct bt_gatt_server *server,
@@ -1204,6 +1251,9 @@
        err = BT_ATT_ERROR_UNLIKELY;
 
 error:
+       queue_remove_all(server->prep_queue, NULL, NULL,
+                                               prep_write_data_destroy);
+
        bt_att_send_error_rsp(server->att, BT_ATT_OP_EXEC_WRITE_REQ,
                                                                ehandle, err);
 }
@@ -1248,6 +1298,8 @@
        return;
 
 error:
+       queue_remove_all(server->prep_queue, NULL, NULL,
+                                               prep_write_data_destroy);
        bt_att_send_error_rsp(server->att, opcode, 0, ecode);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/test/example-gatt-client new/bluez-5.39/test/example-gatt-client
--- old/bluez-5.38/test/example-gatt-client     2016-03-18 03:18:03.000000000 
+0100
+++ new/bluez-5.39/test/example-gatt-client     2016-04-05 00:21:51.000000000 
+0200
@@ -1,6 +1,5 @@
 #!/usr/bin/env python3
 
-import argparse
 import dbus
 try:
   from gi.repository import GObject
@@ -152,7 +151,7 @@
     return True
 
 
-def process_hr_service(service_path):
+def process_hr_service(service_path, chrc_paths):
     service = bus.get_object(BLUEZ_SERVICE_NAME, service_path)
     service_props = service.GetAll(GATT_SERVICE_IFACE,
                                    dbus_interface=DBUS_PROP_IFACE)
@@ -160,11 +159,11 @@
     uuid = service_props['UUID']
 
     if uuid != HR_SVC_UUID:
-        print('Service is not a Heart Rate Service: ' + uuid)
         return False
 
+    print('Heart Rate Service found: ' + service_path)
+
     # Process the characteristics.
-    chrc_paths = service_props['Characteristics']
     for chrc_path in chrc_paths:
         process_chrc(chrc_path)
 
@@ -184,15 +183,6 @@
 
 
 def main():
-    # Prase the service path from the arguments.
-    parser = argparse.ArgumentParser(
-            description='D-Bus Heart Rate Service client example')
-    parser.add_argument('service_path', metavar='<service-path>',
-                        type=dbus.ObjectPath, nargs=1,
-                        help='GATT service object path')
-    args = parser.parse_args()
-    service_path = args.service_path[0]
-
     # Set up the main loop.
     DBusGMainLoop(set_as_default=True)
     global bus
@@ -203,14 +193,26 @@
     om = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, '/'), DBUS_OM_IFACE)
     om.connect_to_signal('InterfacesRemoved', interfaces_removed_cb)
 
-    try:
-        if not process_hr_service(service_path):
-            sys.exit(1)
-    except dbus.DBusException as e:
-        print(e)
-        sys.exit(1)
+    objects = om.GetManagedObjects()
+    chrcs = []
+
+    for path, interfaces in objects.items():
+        if GATT_CHRC_IFACE not in interfaces.keys():
+            continue
+        chrcs.append(path)
+
+    for path, interfaces in objects.items():
+        if GATT_SERVICE_IFACE not in interfaces.keys():
+            continue
 
-    print('Heart Rate Service ready')
+        chrc_paths = [d for d in chrcs if d.startswith(path + "/")]
+
+        if process_hr_service(path, chrc_paths):
+            break
+
+    if not hr_service:
+        print('No Heart Rate Service found')
+        sys.exit(1)
 
     start_client()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/tools/btattach.c new/bluez-5.39/tools/btattach.c
--- old/bluez-5.38/tools/btattach.c     2015-09-28 14:16:53.000000000 +0200
+++ new/bluez-5.39/tools/btattach.c     2016-04-05 00:21:51.000000000 +0200
@@ -48,7 +48,7 @@
 #include "src/shared/util.h"
 #include "src/shared/hci.h"
 
-static int open_serial(const char *path)
+static int open_serial(const char *path, unsigned int speed)
 {
        struct termios ti;
        int fd, saved_ldisc, ldisc = N_HCI;
@@ -75,7 +75,7 @@
        memset(&ti, 0, sizeof(ti));
        cfmakeraw(&ti);
 
-       ti.c_cflag |= (B115200 | CLOCAL | CREAD);
+       ti.c_cflag |= (speed | CLOCAL | CREAD);
 
        /* Set flow control */
        ti.c_cflag |= CRTSCTS;
@@ -106,11 +106,11 @@
 }
 
 static int attach_proto(const char *path, unsigned int proto,
-                                               unsigned int flags)
+                               unsigned int speed, unsigned int flags)
 {
        int fd, dev_id;
 
-       fd = open_serial(path);
+       fd = open_serial(path, speed);
        if (fd < 0)
                return -1;
 
@@ -189,6 +189,7 @@
                "\t-B, --bredr <device>   Attach BR/EDR controller\n"
                "\t-A, --amp <device>     Attach AMP controller\n"
                "\t-P, --protocol <proto> Specify protocol type\n"
+               "\t-S, --speed <baudrate> Specify which baudrate to use\n"
                "\t-h, --help             Show help options\n");
 }
 
@@ -196,6 +197,7 @@
        { "bredr",    required_argument, NULL, 'B' },
        { "amp",      required_argument, NULL, 'A' },
        { "protocol", required_argument, NULL, 'P' },
+       { "speed",    required_argument, NULL, 'S' },
        { "version",  no_argument,       NULL, 'v' },
        { "help",     no_argument,       NULL, 'h' },
        { }
@@ -217,17 +219,68 @@
        { }
 };
 
+static unsigned int get_speed(const char *str)
+{
+       switch (atoi(str)) {
+       case 57600:
+               return B57600;
+       case 115200:
+               return B115200;
+       case 230400:
+               return B230400;
+       case 460800:
+               return B460800;
+       case 500000:
+               return B500000;
+       case 576000:
+               return B576000;
+       case 921600:
+               return B921600;
+       case 1000000:
+               return B1000000;
+       case 1152000:
+               return B1152000;
+       case 1500000:
+               return B1500000;
+       case 2000000:
+               return B2000000;
+#ifdef B2500000
+       case 2500000:
+               return B2500000;
+#endif
+#ifdef B3000000
+       case 3000000:
+               return B3000000;
+#endif
+#ifdef B3500000
+       case 3500000:
+               return B3500000;
+#endif
+#ifdef B3710000
+       case 3710000:
+               return B3710000;
+#endif
+#ifdef B4000000
+       case 4000000:
+               return B4000000;
+#endif
+       }
+
+       return 0;
+}
+
 int main(int argc, char *argv[])
 {
        const char *bredr_path = NULL, *amp_path = NULL, *proto = NULL;
        bool raw_device = false;
        sigset_t mask;
        int exit_status, count = 0, proto_id = HCI_UART_H4;
+       unsigned int speed = B115200;
 
        for (;;) {
                int opt;
 
-               opt = getopt_long(argc, argv, "B:A:P:Rvh",
+               opt = getopt_long(argc, argv, "B:A:P:S:Rvh",
                                                main_options, NULL);
                if (opt < 0)
                        break;
@@ -242,6 +295,13 @@
                case 'P':
                        proto = optarg;
                        break;
+               case 'S':
+                       speed = get_speed(optarg);
+                       if (!speed) {
+                               fprintf(stderr, "Invalid speed: %s\n", optarg);
+                               return EXIT_FAILURE;
+                       }
+                       break;
                case 'R':
                        raw_device = true;
                        break;
@@ -296,7 +356,7 @@
                if (raw_device)
                        flags = (1 << HCI_UART_RAW_DEVICE);
 
-               fd = attach_proto(bredr_path, proto_id, flags);
+               fd = attach_proto(bredr_path, proto_id, speed, flags);
                if (fd >= 0) {
                        mainloop_add_fd(fd, 0, uart_callback, NULL, NULL);
                        count++;
@@ -315,7 +375,7 @@
                if (raw_device)
                        flags = (1 << HCI_UART_RAW_DEVICE);
 
-               fd = attach_proto(amp_path, proto_id, flags);
+               fd = attach_proto(amp_path, proto_id, speed, flags);
                if (fd >= 0) {
                        mainloop_add_fd(fd, 0, uart_callback, NULL, NULL);
                        count++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/unit/test-crypto.c new/bluez-5.39/unit/test-crypto.c
--- old/bluez-5.38/unit/test-crypto.c   2015-06-15 11:33:25.000000000 +0200
+++ new/bluez-5.39/unit/test-crypto.c   2016-04-05 00:21:51.000000000 +0200
@@ -38,6 +38,8 @@
        const uint8_t *msg;
        uint16_t msg_len;
        const uint8_t *t;
+       const uint8_t *key;
+       uint32_t cnt;
 };
 
 static const uint8_t key[] = {
@@ -54,7 +56,8 @@
 static const struct test_data test_data_1 = {
        .msg = msg_1,
        .msg_len = 0,
-       .t = t_msg_1
+       .t = t_msg_1,
+       .key = key,
 };
 
 static const uint8_t msg_2[] = {
@@ -70,7 +73,8 @@
 static const struct test_data test_data_2 = {
        .msg = msg_2,
        .msg_len = 16,
-       .t = t_msg_2
+       .t = t_msg_2,
+       .key = key,
 };
 
 static const uint8_t msg_3[] = {
@@ -87,7 +91,8 @@
 static const struct test_data test_data_3 = {
        .msg = msg_3,
        .msg_len = 40,
-       .t = t_msg_3
+       .t = t_msg_3,
+       .key = key,
 };
 
 static const uint8_t msg_4[] = {
@@ -106,7 +111,30 @@
 static const struct test_data test_data_4 = {
        .msg = msg_4,
        .msg_len = 64,
-       .t = t_msg_4
+       .t = t_msg_4,
+       .key = key,
+};
+
+static const uint8_t msg_5[] = {
+               0xd2, 0x12, 0x00, 0x13, 0x37
+};
+
+static const uint8_t key_5[] = {
+               0x50, 0x5E, 0x42, 0xDF, 0x96, 0x91, 0xEC, 0x72, 0xD3, 0x1F,
+               0xCD, 0xFB, 0xEB, 0x64, 0x1B, 0x61
+};
+
+static const uint8_t t_msg_5[] = {
+               0x01, 0x00, 0x00, 0x00, 0xF1, 0x87, 0x1E, 0x93, 0x3C, 0x90,
+               0x0F, 0xf2
+};
+
+static const struct test_data test_data_5 = {
+       .msg = msg_5,
+       .msg_len = sizeof(msg_5),
+       .t = t_msg_5,
+       .cnt = 1,
+       .key = key_5,
 };
 
 static void print_debug(const char *str, void *user_data)
@@ -130,7 +158,7 @@
        const struct test_data *d = data;
 
        memset(t, 0, 12);
-       if (!bt_crypto_sign_att(crypto, key, d->msg, d->msg_len, 0, t))
+       if (!bt_crypto_sign_att(crypto, d->key, d->msg, d->msg_len, d->cnt, t))
                g_assert(true);
 
        tester_debug("Result T:");
@@ -157,6 +185,7 @@
        tester_add("/crypto/sign_att_2", &test_data_2, NULL, test_sign, NULL);
        tester_add("/crypto/sign_att_3", &test_data_3, NULL, test_sign, NULL);
        tester_add("/crypto/sign_att_4", &test_data_4, NULL, test_sign, NULL);
+       tester_add("/crypto/sign_att_5", &test_data_5, NULL, test_sign, NULL);
 
        exit_status = tester_run();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/bluez-5.38/unit/test-gatt.c new/bluez-5.39/unit/test-gatt.c
--- old/bluez-5.38/unit/test-gatt.c     2016-03-18 03:18:03.000000000 +0100
+++ new/bluez-5.39/unit/test-gatt.c     2016-04-05 00:21:51.000000000 +0200
@@ -209,7 +209,7 @@
 
 #define PRIMARY_DISC_SMALL_DB                                          \
                raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),      \
-               raw_pdu(0x11, 0x06, 0x10, 0xF0, 0x17, 0xF0, 0x00, 0x18, \
+               raw_pdu(0x11, 0x06, 0x10, 0xF0, 0x18, 0xF0, 0x00, 0x18, \
                                0xFF, 0xFF, 0xFF, 0xFF, 0x0a, 0x18)
 
 #define PRIMARY_DISC_LARGE_DB_1                                                
\
@@ -223,7 +223,7 @@
                        0x60, 0x00, 0x6B, 0x00, 0x0B, 0xA0),            \
                raw_pdu(0x10, 0x6C, 0x00, 0xff, 0xff, 0x00, 0x28),      \
                raw_pdu(0x11, 0x06, 0x70, 0x00, 0x76, 0x00, 0x0B, 0xA0, \
-                       0x80, 0x00, 0x85, 0x00, 0x0B, 0xA0),            \
+                       0x80, 0x00, 0x86, 0x00, 0x0B, 0xA0),            \
                raw_pdu(0x10, 0x86, 0x00, 0xff, 0xff, 0x00, 0x28),      \
                raw_pdu(0x11, 0x14, 0x90, 0x00, 0x96, 0x00,             \
                        0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, \
@@ -244,27 +244,29 @@
                raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a)
 
 #define INCLUDE_DISC_SMALL_DB                                          \
-               raw_pdu(0x08, 0x10, 0xf0, 0x17, 0xf0, 0x02, 0x28),      \
+               raw_pdu(0x08, 0x10, 0xf0, 0x18, 0xf0, 0x02, 0x28),      \
                raw_pdu(0x09, 0x08, 0x11, 0xf0, 0x01, 0x00, 0x0f, 0x00, \
                        0x0a, 0x18),                                    \
-               raw_pdu(0x08, 0x12, 0xf0, 0x17, 0xf0, 0x02, 0x28),      \
+               raw_pdu(0x08, 0x12, 0xf0, 0x18, 0xf0, 0x02, 0x28),      \
                raw_pdu(0x01, 0x08, 0x12, 0xf0, 0x0a),                  \
                raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),      \
                raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a)
 
 #define CHARACTERISTIC_DISC_SMALL_DB                                   \
-               raw_pdu(0x08, 0x10, 0xf0, 0x17, 0xf0, 0x03, 0x28),      \
+               raw_pdu(0x08, 0x10, 0xf0, 0x18, 0xf0, 0x03, 0x28),      \
                raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00, \
                        0x2a),                                          \
-               raw_pdu(0x08, 0x13, 0xf0, 0x17, 0xf0, 0x03, 0x28),      \
+               raw_pdu(0x08, 0x13, 0xf0, 0x18, 0xf0, 0x03, 0x28),      \
                raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x02, 0x15, 0xf0, 0xef, \
                        0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00, \
                        0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00),      \
-               raw_pdu(0x08, 0x15, 0xf0, 0x17, 0xf0, 0x03, 0x28),      \
-               raw_pdu(0x09, 0x07, 0x16, 0xf0, 0x02, 0x17, 0xf0, 0x01, \
+               raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),      \
+               raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01, \
                        0x2a),                                          \
-               raw_pdu(0x08, 0x17, 0xf0, 0x17, 0xf0, 0x03, 0x28),      \
-               raw_pdu(0x01, 0x08, 0x17, 0xf0, 0x0a),                  \
+               raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),      \
+               raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a),                  \
+               raw_pdu(0x04, 0x16, 0xf0, 0x16, 0xf0),                  \
+               raw_pdu(0x05, 0x01, 0x16, 0xf0, 0x00, 0x29),            \
                raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),      \
                raw_pdu(0x09, 0x07, 0x02, 0x00, 0x32, 0x03, 0x00, 0x29, \
                        0x2a),                                          \
@@ -1560,7 +1562,10 @@
                                                BT_ATT_PERM_WRITE, 0x00, 0x00),
                DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
                                                        "Manufacturer Name"),
-               PRIMARY_SERVICE(0xF010, GAP_UUID, 8),
+               DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
+                                                                       0x00),
+
+               PRIMARY_SERVICE(0xF010, GAP_UUID, 9),
                INCLUDE(0x0001),
                CHARACTERISTIC_STR(GATT_CHARAC_DEVICE_NAME, BT_ATT_PERM_READ,
                                                        BT_GATT_CHRC_PROP_READ,
@@ -1568,6 +1573,8 @@
                CHARACTERISTIC(0000B009-0000-0000-0123-456789abcdef,
                                        BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
                                        BT_GATT_CHRC_PROP_READ, 0x09),
+               DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
+                                                                       0x00),
                CHARACTERISTIC(GATT_CHARAC_APPEARANCE, BT_ATT_PERM_READ,
                                        BT_GATT_CHRC_PROP_READ, 0x00, 0x00),
                PRIMARY_SERVICE(0xFFFF, DEVICE_INFORMATION_UUID, 1),
@@ -1607,7 +1614,7 @@
 static struct gatt_db *make_test_spec_large_db_1(void)
 {
        const struct att_handle_spec specs[] = {
-               PRIMARY_SERVICE(0x0080, "a00b", 6),
+               PRIMARY_SERVICE(0x0080, "a00b", 7),
                CHARACTERISTIC(0xb008, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
                                        BT_GATT_CHRC_PROP_READ |
                                        BT_GATT_CHRC_PROP_WRITE,
@@ -1616,6 +1623,8 @@
                DESCRIPTOR(0xb016, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE, 0x02),
                DESCRIPTOR(0xb017, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE |
                                                BT_ATT_PERM_ENCRYPT, 0x03),
+               DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
+                                                                       0x00),
 
                SECONDARY_SERVICE(0x0001, "a00d", 6),
                INCLUDE(0x0080),
@@ -2419,7 +2428,7 @@
                        raw_pdu(0x03, 0x00, 0x02),
                        raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x00,
                                0x18),
-                       raw_pdu(0x07, 0x10, 0xf0, 0x17, 0xf0),
+                       raw_pdu(0x07, 0x10, 0xf0, 0x18, 0xf0),
                        raw_pdu(0x06, 0x18, 0xf0, 0xff, 0xff, 0x00, 0x28, 0x00,
                                0x18),
                        raw_pdu(0x01, 0x06, 0x18, 0xf0, 0x0a));
@@ -2431,7 +2440,7 @@
                                0xa0),
                        raw_pdu(0x07, 0x30, 0x00, 0x32, 0x00, 0x50, 0x00, 0x52,
                                0x00, 0x60, 0x00, 0x6b, 0x00, 0x70, 0x00, 0x76,
-                               0x00, 0x80, 0x00, 0x85, 0x00),
+                               0x00, 0x80, 0x00, 0x86, 0x00),
                        raw_pdu(0x06, 0x86, 0x00, 0xff, 0xff, 0x00, 0x28, 0x0b,
                                0xa0),
                        raw_pdu(0x01, 0x06, 0x86, 0x00, 0x0a));
@@ -2507,7 +2516,7 @@
                        ts_large_db_1, NULL,
                        raw_pdu(0x03, 0x00, 0x02),
                        raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),
-                       raw_pdu(0x09, 0x08, 0x02, 0x00, 0x80, 0x00, 0x85, 0x00,
+                       raw_pdu(0x09, 0x08, 0x02, 0x00, 0x80, 0x00, 0x86, 0x00,
                                0x0b, 0xa0, 0x21, 0x00, 0x01, 0x00, 0x06, 0x00,
                                0x0d, 0xa0),
                        raw_pdu(0x08, 0x22, 0x00, 0xff, 0xff, 0x02, 0x28),
@@ -2533,19 +2542,19 @@
        define_test_server("/TP/GAD/SR/BV-04-C/small/1", test_server,
                        ts_small_db, NULL,
                        raw_pdu(0x03, 0x00, 0x02),
-                       raw_pdu(0x08, 0x10, 0xf0, 0x17, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x08, 0x10, 0xf0, 0x18, 0xf0, 0x03, 0x28),
                        raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00,
                                        0x2a),
-                       raw_pdu(0x08, 0x13, 0xf0, 0x17, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x08, 0x13, 0xf0, 0x18, 0xf0, 0x03, 0x28),
                        raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x02, 0x15, 0xf0, 0xef,
                                        0xcd, 0xab, 0x89, 0x67, 0x45, 0x23,
                                        0x01, 0x00, 0x00, 0x00, 0x00, 0x09,
                                        0xb0, 0x00, 0x00),
-                       raw_pdu(0x08, 0x15, 0xf0, 0x17, 0xf0, 0x03, 0x28),
-                       raw_pdu(0x09, 0x07, 0x16, 0xf0, 0x02, 0x17, 0xf0, 0x01,
+                       raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01,
                                        0x2a),
-                       raw_pdu(0x08, 0x17, 0xf0, 0x17, 0xf0, 0x03, 0x28),
-                       raw_pdu(0x01, 0x08, 0x17, 0xf0, 0x0a));
+                       raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a));
 
        define_test_server("/TP/GAD/SR/BV-04-C/small/2", test_server,
                        ts_small_db, NULL,
@@ -2594,11 +2603,11 @@
                                        0xcd, 0xab, 0x89, 0x67, 0x45, 0x23,
                                        0x01, 0x00, 0x00, 0x00, 0x00, 0x09,
                                        0xb0, 0x00, 0x00),
-                       raw_pdu(0x08, 0x15, 0xf0, 0x17, 0xf0, 0x03, 0x28),
-                       raw_pdu(0x09, 0x07, 0x16, 0xf0, 0x02, 0x17, 0xf0, 0x01,
+                       raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01,
                                        0x2a),
-                       raw_pdu(0x08, 0x17, 0xf0, 0x17, 0xf0, 0x03, 0x28),
-                       raw_pdu(0x01, 0x08, 0x17, 0xf0, 0x0a));
+                       raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),
+                       raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a));
 
        define_test_server("/TP/GAD/SR/BV-05-C/small/2", test_server,
                        ts_small_db, NULL,
@@ -2798,7 +2807,7 @@
                                        0x00),
                        raw_pdu(0x09, 0x03, 0x15, 0xF0, 0x09),
                        raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0x01, 0x2a),
-                       raw_pdu(0x09, 0x04, 0x17, 0xF0, 0x00, 0x00));
+                       raw_pdu(0x09, 0x04, 0x18, 0xF0, 0x00, 0x00));
 
        define_test_server("/TP/GAR/SR/BV-03-C/large-1", test_server,
                        ts_large_db_1, NULL,
@@ -3852,8 +3861,8 @@
                        raw_pdu(0x17, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-                       raw_pdu(0x16, 0x03, 0x00, 0x3f, 0x00, 0xff),
-                       raw_pdu(0x17, 0x03, 0x00, 0x3f, 0x00, 0xff),
+                       raw_pdu(0x16, 0x03, 0x00, 0x12, 0x00, 0xff),
+                       raw_pdu(0x17, 0x03, 0x00, 0x12, 0x00, 0xff),
                        raw_pdu(0x18, 0x01),
                        raw_pdu(0x19));
 
@@ -3866,8 +3875,8 @@
                        raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-                       raw_pdu(0x16, 0x82, 0x00, 0x3f, 0x00, 0xff),
-                       raw_pdu(0x17, 0x82, 0x00, 0x3f, 0x00, 0xff),
+                       raw_pdu(0x16, 0x82, 0x00, 0x12, 0x00, 0xff),
+                       raw_pdu(0x17, 0x82, 0x00, 0x12, 0x00, 0xff),
                        raw_pdu(0x18, 0x01),
                        raw_pdu(0x19));
 
@@ -3996,12 +4005,12 @@
                        raw_pdu(0x03, 0x00, 0x02),
                        raw_pdu(0x16, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
                        raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
-                       raw_pdu(0x16, 0x25, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
-                       raw_pdu(0x17, 0x25, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+                       raw_pdu(0x16, 0x72, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
+                       raw_pdu(0x17, 0x72, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
                        raw_pdu(0x16, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
                        raw_pdu(0x17, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
-                       raw_pdu(0x16, 0x25, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
-                       raw_pdu(0x17, 0x25, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
+                       raw_pdu(0x16, 0x72, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
+                       raw_pdu(0x17, 0x72, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
                        raw_pdu(0x18, 0x01),
                        raw_pdu(0x19));
 
@@ -4374,8 +4383,8 @@
                        raw_pdu(0x17, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-                       raw_pdu(0x16, 0x04, 0x00, 0x3f, 0x00, 0xff),
-                       raw_pdu(0x17, 0x04, 0x00, 0x3f, 0x00, 0xff),
+                       raw_pdu(0x16, 0x04, 0x00, 0x12, 0x00, 0xff),
+                       raw_pdu(0x17, 0x04, 0x00, 0x12, 0x00, 0xff),
                        raw_pdu(0x18, 0x01),
                        raw_pdu(0x19));
 
@@ -4388,8 +4397,8 @@
                        raw_pdu(0x17, 0x83, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-                       raw_pdu(0x16, 0x83, 0x00, 0x3f, 0x00, 0xff),
-                       raw_pdu(0x17, 0x83, 0x00, 0x3f, 0x00, 0xff),
+                       raw_pdu(0x16, 0x83, 0x00, 0x12, 0x00, 0xff),
+                       raw_pdu(0x17, 0x83, 0x00, 0x12, 0x00, 0xff),
                        raw_pdu(0x18, 0x01),
                        raw_pdu(0x19));
 


Reply via email to