summaryrefslogtreecommitdiff
path: root/net-wireless/bluez
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-03-27 06:06:27 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-03-27 06:06:27 +0000
commit8d5dbd847cbc704a6a06405856e94b461011afe3 (patch)
tree4d26462d027b14926335894749d2e01d982234d0 /net-wireless/bluez
parent5bb9ff1ee56d2b5e75e01a7f066d8b0cec84ec02 (diff)
gentoo resync : 27.03.2021
Diffstat (limited to 'net-wireless/bluez')
-rw-r--r--net-wireless/bluez/Manifest4
-rw-r--r--net-wireless/bluez/bluez-5.56-r1.ebuild296
-rw-r--r--net-wireless/bluez/files/bluetooth-conf.d1
-rw-r--r--net-wireless/bluez/files/bluetooth-init.d-r513
-rw-r--r--net-wireless/bluez/files/bluez-5.56-avdtp-disconnects.patch41
5 files changed, 355 insertions, 0 deletions
diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest
index 9991aa9678eb..13c4a807bd24 100644
--- a/net-wireless/bluez/Manifest
+++ b/net-wireless/bluez/Manifest
@@ -1,12 +1,16 @@
AUX 0001-Allow-using-obexd-without-systemd-in-the-user-session-r2.patch 1912 BLAKE2B c7226ccbf1b794b5f3d6504dcb6950bc7e7bd69995243d0e4cf30dfb161f95e15c18c96724f82916e8c83cac6ff255ed957b60c9ee9ad53e108c69eb509074d5 SHA512 65a970fa82ded9f6e97ef2f0d856010f96468cbd375447e1c47d6073be5a364f747b7b5ea93a0bc3b7dba0470dc8dccd9b5d1f6567f18b38042e424d3e06171b
AUX 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch 1252 BLAKE2B ce6d00ea244d91e76b696e60ddb9096aa48572b68474f321f05b0e3e9525932e6fdaeacc3b141dc4b118d5fa305b7a0510e9c57c935e489a9c159dcd826ad870 SHA512 774f1d9cd49dd3fc0e9f02ad93876c59d78f88f149591f384cf5d2e3541d237ce390552c8bc2cb4d4ad7e5dcc295df49220565f0b0e686a2f8b3404f68323d32
AUX 69-btattach-bcm.rules 2141 BLAKE2B 07fe8306e29f05082a603bd5a4b9d51c8c23b4ed48eaeebd01591970c0e29ea37198abaa8725023fd00cd38c67451910b6028d6725be3aca5ed1c495e02555ee SHA512 ecf535d737b9f1dc7a077f2a13e3712c959c505a93c24f48d63b04db0d42f8feef3918d48b7db5e8e115574a9b62f47aaa9c3e77230cff682d3f35da2f09047e
+AUX bluetooth-conf.d 21 BLAKE2B 7c94e499438f441fc18f0b50178e707982ac91871a74b2e7a35c9930d32441a89f742993e993e3003f9bcb5e3ee9adde2ab1cbe33b27245b1b1e91e7c3dc1a0b SHA512 45befd3fb42ea3462fa6e1ee9f3ee9591e197d4925a4c9df6733bacfe44cf44f54ed3aad6fd7a6a2953da54b93460a1cf0ea1cadf0d7e47f811e4c3182af74d5
AUX bluetooth-init.d-r4 280 BLAKE2B ecb807dec050b7c754e87b43848292ffd68afb36465739462208d1564c59d59b3c8801dca5f9ba8547efc982d972cdaeef340403c82c9fa1ad8922b0396d29bd SHA512 05fd235483c65decc8badeca1b3ec60ae59f4881cc9125f6b148afe2cbc269a636df620b6bab72ce20b6b265c73074b1afef1029aecd884dc1dbb2694c0d16d9
+AUX bluetooth-init.d-r5 313 BLAKE2B 6bad1b9a75de5927ab22a229d6ce18247b32a79b994078338eff33df7f74a7dc4a5266212f6d0150101600e3a864a9b64ce6a576208218750bfbe88bc5911baa SHA512 95aff192be6207047fc01b42754bcd34d5cd7f82c16486fdd81bb1d14be040e4f3e9bafd8dc2f4e8b87bf1eb50f6634f526feaf2b38c0c6807f40784d84dac96
+AUX bluez-5.56-avdtp-disconnects.patch 1424 BLAKE2B 200325eb1c1c5ed7d3dfada1214fca26f2eb8de70bbffe0810c7ffc7dd3d672b0c834f25ccba79e35c0c1322047e45fdd8076e4e54644e50ef71fb6415e33a6c SHA512 e44856abfc8ca92744c90723b0d76aab8c19fc44c3f84231c5c9340b85ce0b7a7cb9c41d65b68515845195ef8a50a274067d00555f2751ab1597403a87b80a2d
AUX bluez-udevadm-path-r1.patch 564 BLAKE2B 0b4dc12f55ab60d254aa3365baf35186a5913026dbfcbc3da41c113b3c423c81189b87016dabcb2c505b684cad376d10d10df9aa17558b8fd022928995931e0e SHA512 d9b0dd452258e425802cf5ad4980a77796be79e94bf6ce641927c5ab7ea1117ce6589063f3a0b96bf25e81303234279a09d58484fec49cfc6aa1db46f245f9c6
AUX btattach-bcm-service.sh 935 BLAKE2B cae7d78269b56038883ff74ddc7c5a3238fe4399a37cbba5c414d0396f2aff7c2a4965b56a1125dc8568e7bc848011106ab993e4c1211e704f485259373ab65a SHA512 259d10df16f4b23364da971063345b25cbf7c6a1b9f2576d3ecbd48620675392601cba017a591af1f44fe8eff8ea0c8cabeafa8adbddeb3e1014f428d37d1690
AUX btattach-bcm_at.service 132 BLAKE2B 0af9a066a8d08d917fe80676f460297e244152d88ee02774b1e30c50febdb3fa9838c3818b80fbbf9248020dce4e1e33e2babf15a18609fddc1fd61465ecb6ed SHA512 ca6c89a676386cdaad6bfdd8a80062abe217ebd2b4484a125e4b5d0832b2c03ebed986f1806ff785664c99e1244bc164f1d152e5015fc87e46f2f6d847567b29
DIST bluez-5.55.tar.xz 2041428 BLAKE2B 7eee44063ea53188d35324bcc5b5f0539cf92a5934632743677bbf41822b8b79a899a82a93fd79887fe058e6f0c0e66ed8d5da46e5585682613bc1847cb009a8 SHA512 9423cb60d15a6f068838497a1eaea9f5a32d70c07191c313ba821a6919d6e0c436ada4f547cc5f2db5eacc0123429ad54851f57df2554f61fa293743ec14a033
DIST bluez-5.56.tar.xz 2053080 BLAKE2B b901deae4047ebe96c034c20c9d7e6c275d3c1fd311dc57ed2f1f927d6e778b213af3e09caaeebbb11110f1733fc9bf341cf8f7c63a37aaa6b896607c0026d92 SHA512 b320ee9d49a516f5cecb5fbc410ba42e9127f44ebcfb95647f68bd5d300147d0eaf633f8e8d0678631a2184ea3afae7b01b5f228157328874fa2a87832ed0ae1
EBUILD bluez-5.55.ebuild 9650 BLAKE2B 30746b26e632aee07a0480d11493a8f45b7236863454956cc42b9e5a7448b132cf906f3ed4fdf51fdee7ebbdf57b55dda77f20407c8fd3595dbd26338f48af51 SHA512 300c443a9b0a1e54902ee928e1cd34ee2eb3de36624c6d2e0c3f839cffe5415667c92049be539983d456526f94f733be5f54fd7fef06342f856ac94ced0be785
+EBUILD bluez-5.56-r1.ebuild 9551 BLAKE2B 752a728bbc6834f2a3698fd3b24fec59f155a6d9f631c52a3ea368b7b80723da73f7a7a9e079cce4dd027fb5dba9732eeeac492ed3b45c496437cdff1976dc3e SHA512 d5b6f9b73e9ac45a21e9e204e69f4fbcb3e511e91e9b927468d79549b8c0f4b069eb6d1d2d5bda80d013c98d0614784d17b200980bcd52d89e6ce3bc0ea516a5
EBUILD bluez-5.56.ebuild 9656 BLAKE2B a92958e82b380201e90e694aa62d8c0988250411d9e6a62e13baf6ac105afc20074d0fef619e528b24f3b6383deb375da0152faee16d25c7ae25cc617d51e58e SHA512 212bb331d14bdd1f080a34221132267e3c5adfa17d51692d6fe8172dc6c2b9215c62ef114e1ad0e78eb276add76cba37b7e650e7b385a14572a32aba30cc2ba0
MISC metadata.xml 1211 BLAKE2B 5e605af395041afd8b790d21b33b816ce3b960458375d51243e8a763302ce1fdc69da2ffd119966c88c261f3e13fd9b48241c2955eebc78d64da887599bb9830 SHA512 c35cd78b8f49fe1142f2ae203571e558a8d45d435eeb7a5e57260192869658d5c39c4f671f99225cdb1530309a7bdea37d572522d8fe9d5354b1e25f5ffd556f
diff --git a/net-wireless/bluez/bluez-5.56-r1.ebuild b/net-wireless/bluez/bluez-5.56-r1.ebuild
new file mode 100644
index 000000000000..928432949d18
--- /dev/null
+++ b/net-wireless/bluez/bluez-5.56-r1.ebuild
@@ -0,0 +1,296 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{7..9} )
+
+inherit autotools linux-info python-single-r1 readme.gentoo-r1 systemd udev multilib-minimal
+
+DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
+HOMEPAGE="http://www.bluez.org"
+SRC_URI="https://www.kernel.org/pub/linux/bluetooth/${P}.tar.xz"
+
+LICENSE="GPL-2+ LGPL-2.1+"
+SLOT="0/3"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~x86"
+IUSE="btpclient cups doc debug deprecated extra-tools experimental +mesh midi +obex +readline selinux systemd test test-programs +udev user-session"
+
+# Since this release all remaining extra-tools need readline support, but this could
+# change in the future, hence, this REQUIRED_USE constraint could be dropped
+# again in the future.
+REQUIRED_USE="
+ extra-tools? ( deprecated readline )
+ test? ( ${PYTHON_REQUIRED_USE} )
+ test-programs? ( ${PYTHON_REQUIRED_USE} )
+"
+
+TEST_DEPS="${PYTHON_DEPS}
+ $(python_gen_cond_dep '
+ >=dev-python/dbus-python-1[${PYTHON_MULTI_USEDEP}]
+ dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
+ ')
+"
+BDEPEND="
+ virtual/pkgconfig
+ test? ( ${TEST_DEPS} )
+"
+DEPEND="
+ >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}]
+ >=sys-apps/hwids-20121202.2
+ btpclient? ( >=dev-libs/ell-0.28 )
+ cups? ( net-print/cups:= )
+ mesh? (
+ >=dev-libs/ell-0.37
+ >=dev-libs/json-c-0.13:=
+ sys-libs/readline:0=
+ )
+ midi? ( media-libs/alsa-lib )
+ obex? ( dev-libs/libical:= )
+ readline? ( sys-libs/readline:0= )
+ systemd? (
+ >=sys-apps/dbus-1.6:=[user-session=]
+ sys-apps/systemd
+ )
+ !systemd? ( >=sys-apps/dbus-1.6:= )
+ udev? ( >=virtual/udev-172 )
+"
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-bluetooth )
+ test-programs? ( ${TEST_DEPS} )
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844)
+ # http://www.spinics.net/lists/linux-bluetooth/msg58739.html
+ # https://bugs.gentoo.org/539844
+ "${FILESDIR}"/${PN}-udevadm-path-r1.patch
+
+ # Fedora patches
+ # http://www.spinics.net/lists/linux-bluetooth/msg40136.html
+ "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
+
+ # avdtp: Fix removing all remote SEPs when loading from cache (from 'master')
+ "${FILESDIR}"/${P}-avdtp-disconnects.patch
+)
+
+pkg_setup() {
+ # From http://www.linuxfromscratch.org/blfs/view/svn/general/bluez.html
+ # to prevent bugs like:
+ # https://bugzilla.kernel.org/show_bug.cgi?id=196621
+ CONFIG_CHECK="~NET ~BT ~BT_RFCOMM ~BT_RFCOMM_TTY ~BT_BNEP ~BT_BNEP_MC_FILTER
+ ~BT_BNEP_PROTO_FILTER ~BT_HIDP ~RFKILL"
+ # https://bugzilla.kernel.org/show_bug.cgi?id=196621
+ # https://bugzilla.kernel.org/show_bug.cgi?id=206815
+ if use mesh || use test; then
+ CONFIG_CHECK="${CONFIG_CHECK} ~CRYPTO_USER
+ ~CRYPTO_USER_API ~CRYPTO_USER_API_AEAD ~CRYPTO_USER_API_HASH
+ ~CRYPTO_AES ~CRYPTO_CCM ~CRYPTO_AEAD ~CRYPTO_CMAC"
+ fi
+ if use test; then
+ # http://www.linuxfromscratch.org/blfs/view/svn/general/bluez.html
+ CONFIG_CHECK="${CONFIG_CHECK} ~CRYPTO ~CRYPTO_USER_API_HASH ~CRYPTO_USER_API_SKCIPHER"
+ fi
+ linux-info_pkg_setup
+
+ if use test || use test-programs; then
+ python-single-r1_pkg_setup
+ fi
+
+ if ! use udev; then
+ ewarn
+ ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth"
+ ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work,"
+ ewarn "and hid2hci will not be available."
+ ewarn
+ fi
+}
+
+src_prepare() {
+ default
+
+ # http://www.spinics.net/lists/linux-bluetooth/msg38490.html
+ if ! use user-session || ! use systemd; then
+ eapply "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-session-r2.patch
+ fi
+
+ eautoreconf
+
+ if use cups; then
+ # Only not .am to not need to run eautoreconf only because of this
+ sed -i \
+ -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
+ Makefile.{in,tools} || die
+ fi
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local myconf=(
+ # readline is automagic when client is enabled
+ # --enable-client always needs readline, bug #504038
+ # --enable-mesh is handled in the same way
+ ac_cv_header_readline_readline_h=$(multilib_native_usex readline)
+ ac_cv_header_readline_readline_h=$(multilib_native_usex mesh)
+ )
+
+ if ! multilib_is_native_abi; then
+ myconf+=(
+ # deps not used for the library
+ {DBUS,GLIB}_{CFLAGS,LIBS}=' '
+ )
+ fi
+
+ econf \
+ --localstatedir=/var \
+ --disable-android \
+ --enable-datafiles \
+ --enable-optimization \
+ $(use_enable debug) \
+ --enable-pie \
+ --enable-threads \
+ --enable-library \
+ --enable-tools \
+ --enable-manpages \
+ --enable-monitor \
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
+ --with-systemduserunitdir="$(systemd_get_userunitdir)" \
+ $(multilib_native_use_enable btpclient) \
+ $(multilib_native_use_enable btpclient external-ell) \
+ $(multilib_native_use_enable cups) \
+ $(multilib_native_use_enable deprecated) \
+ $(multilib_native_use_enable experimental) \
+ $(multilib_native_use_enable mesh) \
+ $(multilib_native_use_enable mesh external-ell) \
+ $(multilib_native_use_enable midi) \
+ $(multilib_native_use_enable obex) \
+ $(multilib_native_use_enable readline client) \
+ $(multilib_native_use_enable systemd) \
+ $(multilib_native_use_enable test-programs test) \
+ $(multilib_native_use_enable udev) \
+ $(multilib_native_use_enable udev hid2hci) \
+ $(multilib_native_use_enable udev sixaxis)
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi; then
+ default
+ else
+ emake -f Makefile -f - libs \
+ <<<'libs: $(lib_LTLIBRARIES)'
+ fi
+}
+
+multilib_src_test() {
+ multilib_is_native_abi && default
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi; then
+ emake DESTDIR="${D}" install
+
+ # Only install extra-tools when relevant USE flag is enabled
+ if use extra-tools; then
+ ewarn "Upstream doesn't support using this tools and their bugs are"
+ ewarn "likely to be ignored forever, also they can break without"
+ ewarn "previous announcement."
+ ewarn "Upstream also states all this tools are not really needed,"
+ ewarn "then, if you still need to rely on them, you must ask them"
+ ewarn "to either install that tool by default or add the needed"
+ ewarn "functionality to the existing 'official' tools."
+ ewarn "Please report this issues to:"
+ ewarn "http://www.bluez.org/development/lists/"
+
+ # Upstream doesn't install this, bug #524640
+ # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115
+ # http://comments.gmane.org/gmane.linux.bluez.kernel/54564
+ dobin tools/btmgmt
+ # gatttool is only built with readline, bug #530776
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1141909
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720486
+ # https://bugs.archlinux.org/task/37686
+ dobin attrib/gatttool
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1699680
+ dobin tools/avinfo
+ fi
+
+ # Not installed by default after being built, bug #666756
+ use btpclient && dobin tools/btpclient
+
+ # Unittests are not that useful once installed, so make them optional
+ if use test-programs; then
+ # Drop python2 only test tools
+ # https://bugzilla.kernel.org/show_bug.cgi?id=206819
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/simple-player || die
+ # https://bugzilla.kernel.org/show_bug.cgi?id=206821
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/test-hfp || die
+ # https://bugzilla.kernel.org/show_bug.cgi?id=206823
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/test-sap-server || die
+
+ python_fix_shebang "${ED}"/usr/$(get_libdir)/bluez/test
+
+ for i in $(find "${ED}"/usr/$(get_libdir)/bluez/test -maxdepth 1 -type f ! -name "*.*"); do
+ dosym "${i}" /usr/bin/bluez-"${i##*/}"
+ done
+ fi
+ else
+ emake DESTDIR="${D}" \
+ install-pkgincludeHEADERS \
+ install-libLTLIBRARIES \
+ install-pkgconfigDATA
+ fi
+}
+
+multilib_src_install_all() {
+ # We need to ensure obexd can be spawned automatically by systemd
+ # when user-session is enabled:
+ # http://marc.info/?l=linux-bluetooth&m=148096094716386&w=2
+ # https://bugs.gentoo.org/show_bug.cgi?id=577842
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804908
+ # https://bugs.archlinux.org/task/45816
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1318441
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1389347
+ if use user-session && use systemd; then
+ ln -s "${ED}"/usr/lib/systemd/user/obex.service "${ED}"/usr/lib/systemd/user/dbus-org.bluez.obex.service
+ fi
+
+ find "${D}" -name '*.la' -type f -delete || die
+
+ keepdir /var/lib/bluetooth
+
+ # Upstream don't want people to play with them
+ # But we keep installing them due to 'historical' reasons
+ insinto /etc/bluetooth
+ local d
+ for d in input network; do
+ doins profiles/${d}/${d}.conf
+ done
+ # Setup auto enable as Fedora does for allowing to use
+ # keyboards/mouse as soon as possible
+ sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' src/main.conf || die
+ doins src/main.conf
+
+ newinitd "${FILESDIR}"/bluetooth-init.d-r5 bluetooth
+ newconfd "${FILESDIR}"/bluetooth-conf.d bluetooth
+
+ einstalldocs
+ use doc && dodoc doc/*.txt
+ # Install .json files as examples to be used by meshctl
+ if use mesh; then
+ dodoc tools/mesh-gatt/*.json
+ local DOC_CONTENTS="Some example .json files were installed into
+ /usr/share/doc/${PF} to be used with meshctl. Feel free to
+ uncompress and copy them to ~/.config/meshctl to use them."
+ readme.gentoo_create_doc
+ fi
+}
+
+pkg_postinst() {
+ use udev && udev_reload
+ systemd_reenable bluetooth.service
+
+ has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp"
+ use mesh && readme.gentoo_print_elog
+}
diff --git a/net-wireless/bluez/files/bluetooth-conf.d b/net-wireless/bluez/files/bluetooth-conf.d
new file mode 100644
index 000000000000..d5b5005ce7fc
--- /dev/null
+++ b/net-wireless/bluez/files/bluetooth-conf.d
@@ -0,0 +1 @@
+#BLUETOOTH_OPTS="-E"
diff --git a/net-wireless/bluez/files/bluetooth-init.d-r5 b/net-wireless/bluez/files/bluetooth-init.d-r5
new file mode 100644
index 000000000000..4d60234e0304
--- /dev/null
+++ b/net-wireless/bluez/files/bluetooth-init.d-r5
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+pidfile="/run/bluetoothd.pid"
+command="/usr/libexec/bluetooth/bluetoothd"
+command_args="${BLUETOOTH_OPTS}"
+command_background=1
+
+depend() {
+ after coldplug
+ need dbus localmount hostname
+}
diff --git a/net-wireless/bluez/files/bluez-5.56-avdtp-disconnects.patch b/net-wireless/bluez/files/bluez-5.56-avdtp-disconnects.patch
new file mode 100644
index 000000000000..c2e34152748d
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-5.56-avdtp-disconnects.patch
@@ -0,0 +1,41 @@
+From 28ddec8d6b829e002fa268c07b71e4c564ba9e16 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Date: Thu, 11 Mar 2021 07:36:07 -0800
+Subject: [PATCH] avdtp: Fix removing all remote SEPs when loading from cache
+
+If avdtp_discover is called after cache has been loaded it end up
+removing all remote SEPs as they have not been discovered yet.
+
+Fixes: https://github.com/bluez/bluez/issues/102
+---
+ profiles/audio/avdtp.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
+index 088ca58b3..1d5871c62 100644
+--- a/profiles/audio/avdtp.c
++++ b/profiles/audio/avdtp.c
+@@ -3381,10 +3381,18 @@ int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb,
+ session->discover = g_new0(struct discover_callback, 1);
+
+ if (session->seps) {
+- session->discover->cb = cb;
+- session->discover->user_data = user_data;
+- session->discover->id = g_idle_add(process_discover, session);
+- return 0;
++ struct avdtp_remote_sep *sep = session->seps->data;
++
++ /* Check that SEP have been discovered as it may be loaded from
++ * cache.
++ */
++ if (sep->discovered) {
++ session->discover->cb = cb;
++ session->discover->user_data = user_data;
++ session->discover->id = g_idle_add(process_discover,
++ session);
++ return 0;
++ }
+ }
+
+ err = send_request(session, FALSE, NULL, AVDTP_DISCOVER, NULL, 0);
+