diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-14 11:10:11 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-14 11:10:11 +0100 |
commit | 81b8f20732954c4508baf2f77472b5435e3f851f (patch) | |
tree | 4180177cb7ba85eab50159ce96218c2419fb24a6 /net-wireless/bluez | |
parent | 946859e0e36904cffb3e0ccbccb6b7b1347c1cc8 (diff) |
gentoo auto-resync : 14:09:2022 - 11:10:10
Diffstat (limited to 'net-wireless/bluez')
-rw-r--r-- | net-wireless/bluez/Manifest | 4 | ||||
-rw-r--r-- | net-wireless/bluez/bluez-5.65.ebuild | 298 | ||||
-rw-r--r-- | net-wireless/bluez/files/0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch | 170 |
3 files changed, 472 insertions, 0 deletions
diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest index 9e03bbbbd408..3e86aeb5804f 100644 --- a/net-wireless/bluez/Manifest +++ b/net-wireless/bluez/Manifest @@ -1,9 +1,13 @@ AUX 0001-Allow-using-obexd-without-systemd-in-the-user-session-r2.patch 1912 BLAKE2B c7226ccbf1b794b5f3d6504dcb6950bc7e7bd69995243d0e4cf30dfb161f95e15c18c96724f82916e8c83cac6ff255ed957b60c9ee9ad53e108c69eb509074d5 SHA512 65a970fa82ded9f6e97ef2f0d856010f96468cbd375447e1c47d6073be5a364f747b7b5ea93a0bc3b7dba0470dc8dccd9b5d1f6567f18b38042e424d3e06171b +AUX 0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch 5381 BLAKE2B 1dadd05cdda880f3770848e445361ec6c7d03d093d518024db776375904fcb3af31ef1f1562cbaf415d94ffff54c43551b1a5643e622f9261a2dea7402b08bed SHA512 040fde8e734c5acbf24142018942fe2bfc52e9b68235be7417c8ce82824b394df32547c3640128ac2f2787b432fc04a4a6a48184a557c3313a97eb6f75730497 AUX 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch 1252 BLAKE2B ce6d00ea244d91e76b696e60ddb9096aa48572b68474f321f05b0e3e9525932e6fdaeacc3b141dc4b118d5fa305b7a0510e9c57c935e489a9c159dcd826ad870 SHA512 774f1d9cd49dd3fc0e9f02ad93876c59d78f88f149591f384cf5d2e3541d237ce390552c8bc2cb4d4ad7e5dcc295df49220565f0b0e686a2f8b3404f68323d32 AUX bluetooth-conf.d 21 BLAKE2B 7c94e499438f441fc18f0b50178e707982ac91871a74b2e7a35c9930d32441a89f742993e993e3003f9bcb5e3ee9adde2ab1cbe33b27245b1b1e91e7c3dc1a0b SHA512 45befd3fb42ea3462fa6e1ee9f3ee9591e197d4925a4c9df6733bacfe44cf44f54ed3aad6fd7a6a2953da54b93460a1cf0ea1cadf0d7e47f811e4c3182af74d5 AUX bluetooth-init.d-r5 313 BLAKE2B 6bad1b9a75de5927ab22a229d6ce18247b32a79b994078338eff33df7f74a7dc4a5266212f6d0150101600e3a864a9b64ce6a576208218750bfbe88bc5911baa SHA512 95aff192be6207047fc01b42754bcd34d5cd7f82c16486fdd81bb1d14be040e4f3e9bafd8dc2f4e8b87bf1eb50f6634f526feaf2b38c0c6807f40784d84dac96 AUX bluez-5.63-musl-limits.patch 558 BLAKE2B 2dd66c54aee0bd8bfe3fd530a4e29139d79f6eb153e06e13680df42f2a361274d6a8f0f80989b7962173d693f37d1cac8b16506267a1319e608382511cf4bfe1 SHA512 b752414c8219befb71e0f0a59fa33be5a0d2add2b89a0c8f90de13aef1815307e5f4b8f076d3778778ab3de6656fd50d59f621af50d9ed39695b5f7978660348 AUX bluez-udevadm-path-r1.patch 564 BLAKE2B 0b4dc12f55ab60d254aa3365baf35186a5913026dbfcbc3da41c113b3c423c81189b87016dabcb2c505b684cad376d10d10df9aa17558b8fd022928995931e0e SHA512 d9b0dd452258e425802cf5ad4980a77796be79e94bf6ce641927c5ab7ea1117ce6589063f3a0b96bf25e81303234279a09d58484fec49cfc6aa1db46f245f9c6 DIST bluez-5.64.tar.xz 2175148 BLAKE2B 828c620330d1993d5c5c2a865f2d27a29425e3583aac01a1a782290a805ee0fd6456b6832c804ad323dd8714fa9329487b2616ed08f1f491ea29403ee05dba2d SHA512 f11f9974b29c5c6fce3890d7e42425c1cb02e42c1b8f49c5cc4b249234e67b64317d0e5e82721e2fbf1b53269c8569a9c869d59ce42b5e927f6622f0753e53cd +DIST bluez-5.65.tar.xz 2208100 BLAKE2B 9d2937e2e14d8d8945183c6436921d9d16a6d3bcb5dbe3e2493554fbc4972bb4c006aabc793c9fb8eae47a7e9f29ae9fdf47551dfc0a238e86f5a76ce7436ae2 SHA512 c20c09a1a75053c77d73b3ce15ac7fd321eb6df5ca1646d57c6848b87c0c9957908bc17dd928da4ef2aacfc8667877cbc7511c1ba43db839bfa9bf1fb8269907 +DIST power-state-adapter-property.patch 22488 BLAKE2B a46173c0ebe4f4822c67c2f8f2f3e67dab261753f64204f1a61665c3bba1d7a10e0f8511b38ce273d986490ffd262a737bee82694909683df7386b2015301607 SHA512 b039a578454681f291dc3b04079c8d0151b13a84b4b013e290aa3c28aba1538cef2d9e9aadfe88a0dbfb8e4cea1c251cb5043f4175fb32d53526f7b82de0451a EBUILD bluez-5.64.ebuild 9384 BLAKE2B 9763e7477924ed3255d85e1f4961e40018b6680b55d6a1eec4afa9c5e35c4e193c67cdb489147d860934d42cbd3da7bd3134eb9f80e85e703d7406b2c637adc1 SHA512 2f40e7a0b95c163c57b579b31b973ee3da519cd3ad4945bd76de674feb070f17cdf134e1b69db00f42ff2a2090deaa5bc78c22679263903f0eaec40b51f2236c +EBUILD bluez-5.65.ebuild 9526 BLAKE2B 6386b72e68036c481c99e9dc94fc32d749820f219c3197e5bcb55fbf84a4dcd68000d1b218013a1ae4bc74f83737de7299be11373a3beb6eeca9d56e5acbf190 SHA512 e43f15e761a08e4ff8f51927aaa068cd55d7f8dd664fc2d2e80b8050843be6bbb2f92d76f0174fbd995c28ac56f7d9e2ddde2c14f4d271496a816211f95d9dd7 MISC metadata.xml 1099 BLAKE2B 75b6db1d43b75f9b22ce5fb6ec640e2e06b2f2575ff75441318a2076b8486ed7d81a62714540c61ab3a35198113538546b9aa71d05ef4cd7106c8a7f09c13029 SHA512 6e4a7bba7102b4850a938ba0f6feec9cd12488d4b440b19982751c2a742b33a565933fae3967080c060e5b5eb51d90268abc87a2c0a2efb7f4c773020c29462a diff --git a/net-wireless/bluez/bluez-5.65.ebuild b/net-wireless/bluez/bluez-5.65.ebuild new file mode 100644 index 000000000000..844d8a05a66a --- /dev/null +++ b/net-wireless/bluez/bluez-5.65.ebuild @@ -0,0 +1,298 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{8..10} ) + +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 + https://dev.gentoo.org/~pacho/${PN}/power-state-adapter-property.patch" + +LICENSE="GPL-2+ LGPL-2.1+" +SLOT="0/3" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~x86" +IUSE="btpclient cups doc debug deprecated extra-tools experimental +mesh midi +obex +readline selinux systemd test test-programs +udev" + +# 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. +# btpclient needs mesh, bug #790587 +REQUIRED_USE=" + btpclient? ( mesh ) + 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_USEDEP}] + dev-python/pygobject:3[${PYTHON_USEDEP}] + ') +" +BDEPEND=" + dev-python/docutils + virtual/pkgconfig + test? ( ${TEST_DEPS} ) +" +DEPEND=" + >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}] + btpclient? ( >=dev-libs/ell-0.39 ) + cups? ( net-print/cups:= ) + mesh? ( + >=dev-libs/ell-0.39 + >=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/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 + # https://github.com/bluez/bluez/issues/268 + "${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 + + # Fixed in next release + "${FILESDIR}"/0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch + "${DISTDIR}"/power-state-adapter-property.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 ~CRYPTO_USER_API_HASH ~CRYPTO_USER_API_SKCIPHER ~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_AES ~CRYPTO_CCM ~CRYPTO_AEAD ~CRYPTO_CMAC + ~CRYPTO_MD5 ~CRYPTO_SHA1 ~KEY_DH_OPERATIONS" + 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 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 systemd; then + dosym obex.service /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 +} + +pkg_postrm() { + use udev && udev_reload +} diff --git a/net-wireless/bluez/files/0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch b/net-wireless/bluez/files/0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch new file mode 100644 index 000000000000..b9b432fadff0 --- /dev/null +++ b/net-wireless/bluez/files/0001-adapter-Reset-pending-settings-when-receiving-MGMT-e.patch @@ -0,0 +1,170 @@ +From ede7b915980fbc80eff80aa189c35ca016956c61 Mon Sep 17 00:00:00 2001 +From: Archie Pusaka <apusaka@chromium.org> +Date: Tue, 23 Aug 2022 12:15:56 +0800 +Subject: [PATCH] adapter: Reset pending settings when receiving MGMT error + +We set the pending settings flag when sending MGMT_SETTING_* +commands to the MGMT layer and clear them when receiving a +successful reply, but we don't clear them when receiving an error +reply. This might cause a setting to be stuck in pending state. + +Therefore, also clear the pending flag when receiving error. +Furthermore, this patch also postpones setting the pending flag +until we queue the MGMT command in order to avoid setting it too +soon but we return early. + +This was caught during power off test, where MGMT_OP_SET_POWERED +returns Authentication Failed because disconnection takes too long. +Future attempts to switch power will then be ignored. + +< HCI Command: Disconnect (0x01|0x0006) plen 3 #17916 [hci0] 12.502908 + Handle: 512 + Reason: Remote Device Terminated due to Power Off (0x15) +> HCI Event: Command Status (0x0f) plen 4 #17917 [hci0] 12.503185 + Disconnect (0x01|0x0006) ncmd 1 + Status: Success (0x00) +@ MGMT Event: Command Status (0x0002) plen 3 {0x0001} [hci0] 14.519491 + Set Powered (0x0005) + Status: Authentication Failed (0x05) += bluetoothd: Failed to set mode: Authentication Failed (0x05) 14.520042 += bluetoothd: adapter /org/bluez/hci0 set power to 0 14.813533 +> HCI Event: Disconnect Complete (0x05) plen 4 #17918 [hci0] 16.509043 + Status: Success (0x00) + Handle: 512 + Reason: Connection Timeout (0x08) + +Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org> +--- + src/adapter.c | 39 +++++++++++++++++++++++++++++++-------- + 1 file changed, 31 insertions(+), 8 deletions(-) + +diff --git a/src/adapter.c b/src/adapter.c +index ec26aab1a..b453e86a0 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -640,14 +640,21 @@ static void new_settings_callback(uint16_t index, uint16_t length, + settings_changed(adapter, settings); + } + ++struct set_mode_data { ++ struct btd_adapter *adapter; ++ uint32_t setting; ++}; ++ + static void set_mode_complete(uint8_t status, uint16_t length, + const void *param, void *user_data) + { +- struct btd_adapter *adapter = user_data; ++ struct set_mode_data *data = user_data; ++ struct btd_adapter *adapter = data->adapter; + + if (status != MGMT_STATUS_SUCCESS) { + btd_error(adapter->dev_id, "Failed to set mode: %s (0x%02x)", + mgmt_errstr(status), status); ++ adapter->pending_settings &= ~data->setting; + return; + } + +@@ -677,6 +684,7 @@ static bool set_mode(struct btd_adapter *adapter, uint16_t opcode, + { + struct mgmt_mode cp; + uint32_t setting = 0; ++ struct set_mode_data *data; + + memset(&cp, 0, sizeof(cp)); + cp.val = mode; +@@ -699,15 +707,20 @@ static bool set_mode(struct btd_adapter *adapter, uint16_t opcode, + break; + } + +- adapter->pending_settings |= setting; +- + DBG("sending set mode command for index %u", adapter->dev_id); + ++ data = g_new0(struct set_mode_data, 1); ++ data->adapter = adapter; ++ data->setting = setting; ++ + if (mgmt_send(adapter->mgmt, opcode, + adapter->dev_id, sizeof(cp), &cp, +- set_mode_complete, adapter, NULL) > 0) ++ set_mode_complete, data, g_free) > 0) { ++ adapter->pending_settings |= setting; + return true; ++ } + ++ g_free(data); + btd_error(adapter->dev_id, "Failed to set mode for index %u", + adapter->dev_id); + +@@ -718,6 +731,7 @@ static bool set_discoverable(struct btd_adapter *adapter, uint8_t mode, + uint16_t timeout) + { + struct mgmt_cp_set_discoverable cp; ++ struct set_mode_data *data; + + memset(&cp, 0, sizeof(cp)); + cp.val = mode; +@@ -734,11 +748,16 @@ static bool set_discoverable(struct btd_adapter *adapter, uint8_t mode, + mode); + } + ++ data = g_new0(struct set_mode_data, 1); ++ data->adapter = adapter; ++ data->setting = 0; ++ + if (mgmt_send(adapter->mgmt, MGMT_OP_SET_DISCOVERABLE, + adapter->dev_id, sizeof(cp), &cp, +- set_mode_complete, adapter, NULL) > 0) ++ set_mode_complete, data, g_free) > 0) + return true; + ++ g_free(data); + btd_error(adapter->dev_id, "Failed to set mode for index %u", + adapter->dev_id); + +@@ -2877,6 +2896,7 @@ static gboolean property_get_mode(struct btd_adapter *adapter, + + struct property_set_data { + struct btd_adapter *adapter; ++ uint32_t setting; + GDBusPendingPropertySet id; + }; + +@@ -2901,6 +2921,8 @@ static void property_set_mode_complete(uint8_t status, uint16_t length, + + g_dbus_pending_property_error(data->id, dbus_err, + mgmt_errstr(status)); ++ ++ adapter->pending_settings &= ~data->setting; + return; + } + +@@ -2969,8 +2991,6 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting, + + mode = (enable == TRUE) ? 0x01 : 0x00; + +- adapter->pending_settings |= setting; +- + switch (setting) { + case MGMT_SETTING_POWERED: + opcode = MGMT_OP_SET_POWERED; +@@ -3024,11 +3044,14 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting, + goto failed; + + data->adapter = adapter; ++ data->setting = setting; + data->id = id; + + if (mgmt_send(adapter->mgmt, opcode, adapter->dev_id, len, param, +- property_set_mode_complete, data, g_free) > 0) ++ property_set_mode_complete, data, g_free) > 0) { ++ adapter->pending_settings |= setting; + return; ++ } + + g_free(data); + +-- +2.37.2 + |