summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2011-07-28 15:33:24 +0000
committerPeter Volkov <pva@gentoo.org>2011-07-28 15:33:24 +0000
commit2f986bfbc09a21340b949730504820861aabc9e5 (patch)
tree3b09ce3d8299e22ad2af4c123a725eca6ae778b4 /net-wireless
parentFix building with gtk by appending no-as-needed on quickstarter. Fixes bug #3... (diff)
downloadhistorical-2f986bfbc09a21340b949730504820861aabc9e5.tar.gz
historical-2f986bfbc09a21340b949730504820861aabc9e5.tar.bz2
historical-2f986bfbc09a21340b949730504820861aabc9e5.zip
Fix high CPU usage, bug #376677.
Package-Manager: portage-2.1.10.7/cvs/Linux x86_64
Diffstat (limited to 'net-wireless')
-rw-r--r--net-wireless/bluez/ChangeLog9
-rw-r--r--net-wireless/bluez/Manifest15
-rw-r--r--net-wireless/bluez/bluez-4.95-r2.ebuild177
-rw-r--r--net-wireless/bluez/bluez-4.95-r3.ebuild178
-rw-r--r--net-wireless/bluez/files/bluez-4.95-high-cpu-usage.patch43
5 files changed, 410 insertions, 12 deletions
diff --git a/net-wireless/bluez/ChangeLog b/net-wireless/bluez/ChangeLog
index e1bc10425cf4..5a80cd5b159b 100644
--- a/net-wireless/bluez/ChangeLog
+++ b/net-wireless/bluez/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-wireless/bluez
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/ChangeLog,v 1.98 2011/07/17 20:58:59 halcy0n Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/ChangeLog,v 1.99 2011/07/28 15:33:24 pva Exp $
+
+*bluez-4.95-r3 (28 Jul 2011)
+*bluez-4.95-r2 (28 Jul 2011)
+
+ 28 Jul 2011; Peter Volkov <pva@gentoo.org> +bluez-4.95-r2.ebuild,
+ +bluez-4.95-r3.ebuild, +files/bluez-4.95-high-cpu-usage.patch:
+ Fix high CPU usage, bug #376677.
17 Jul 2011; Mark Loeser <halcy0n@gentoo.org> bluez-4.93.ebuild:
Stable on ppc/ppc64; bug #370707
diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest
index 1272fb891d6f..2e9322d59a18 100644
--- a/net-wireless/bluez/Manifest
+++ b/net-wireless/bluez/Manifest
@@ -1,6 +1,3 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
AUX 4.18/bluetooth-conf.d 257 RMD160 d3a6cd6e9fb77f6bc0c6aac4833b15c60b781c52 SHA1 c1088c509e2182a3b5987148da03393ab2053101 SHA256 73427f2c46e7be41c24e4c536107ecf8845e0125b34997d74934b92d40f79ee4
AUX 4.18/bluetooth-init.d 1171 RMD160 6ef1d5dc53200f282ccd02aacd5ff50d78484d78 SHA1 ef39d708cf433d9ec2d8e59b1bd3729586895449 SHA256 e314970474e19b33598272c0539bb540b45fd6e65a2d1d165648f50d54308b6e
AUX 4.18/conf.d-hidd 89 RMD160 31407e00bcb00eb0b9c1adeb7434a922bfb967e9 SHA1 dc6831fa817c8bd2378830e13bc96d3ff3fdffa2 SHA256 8fc50b8c644e0bc69eacef2a9555118b2f4758aafcb42e8ea3ca1293e8f3a211
@@ -13,6 +10,7 @@ AUX bluetooth-conf.d 181 RMD160 287e1806e25a4f74b4a9f6fc401b78dac31d44ee SHA1 59
AUX bluetooth-init.d 767 RMD160 7afb50646e359ed1ede5abdc4e5e01319dc9e3c4 SHA1 3685d4dbbf56802cb03a483dad23825968dc57f8 SHA256 38efb9dffaab70477f7525dd6657dffc725c61e29c05b0649e95c31f589b31ce
AUX bluez-4.18-udev.rules 228 RMD160 ab9b4ce8907c62eb9d1f14406cc2ff3f5ec69a19 SHA1 14e652de6cfed28f215727800460e600129007c2 SHA256 7577c2ed295b67f960f17ac65a44889c6536c125b34e33860d6d9f128a59fa82
AUX bluez-4.18-udev.script 752 RMD160 d8f60749dbe497bef7362a4c3f56b2b83ca079cb SHA1 0c39b4b4f4c57fb334daa793f89c0ffac046b956 SHA256 cb41a4eeea5137fb27d82d74f34e5e7dd725ddf8442c39ea623afe0d3c041fcf
+AUX bluez-4.95-high-cpu-usage.patch 1404 RMD160 5462f40b110120fe1812161b5908a73639b9b998 SHA1 0ffa65611ab37c10da6502fd251fae90eb3eae9c SHA256 912b2344b20e1c7891e1baefbb67688e33b1427226a8058fbaad02848def489c
AUX bluez-plugdev.patch 469 RMD160 a70cd0310240491cf14a5a6d7b60e760804e9816 SHA1 b273aac740e7c19aebc441c6c77e0ba8d32f3480 SHA256 ec3f06f24f530574edf5eef308afcf16bb7e0a88336a454a0b24698d2491f5f2
AUX conf.d-dund 96 RMD160 cf0a59a45f6f1bab134e4aab3545a94dfe094ae0 SHA1 c8d3196d8a917ee5240900af8478bb5adc6c7dea SHA256 fcbf3993c373a71e14557ed35854e839fd7ebf3526f753c83cee07194afca64b
AUX conf.d-hidd 89 RMD160 31407e00bcb00eb0b9c1adeb7434a922bfb967e9 SHA1 dc6831fa817c8bd2378830e13bc96d3ff3fdffa2 SHA256 8fc50b8c644e0bc69eacef2a9555118b2f4758aafcb42e8ea3ca1293e8f3a211
@@ -30,13 +28,8 @@ EBUILD bluez-4.87.ebuild 5642 RMD160 a1da5c51be06ad13e38882f8ef0743c625039141 SH
EBUILD bluez-4.93.ebuild 4792 RMD160 54618a9ccc7016f67ac8378ae138fd7ec4d31de5 SHA1 15f00d4130d5daefda1fb85b104d1e5a0aa14b36 SHA256 8827d77280be8b5a009edd2620c1b827ef94d33b58104770a78c14af437b3131
EBUILD bluez-4.94.ebuild 4796 RMD160 3f17dcba87c2a10f0cdeef43ba9827572ba63984 SHA1 992ef07315ddcf4b519fb795ff0f2d3e16095521 SHA256 27d45cbc0896f9afe2f23a9cc8949b9f953144e9c261497db902eb5bc631a897
EBUILD bluez-4.95-r1.ebuild 4847 RMD160 d87892234a975ba3d92dce3951a51a6208c4853e SHA1 39b1913f15d75195562c205db654c0b69291d6dd SHA256 81e6e0d9f3da3d300117e1c2fa5af12342a6153dffa3b61976d73658713ee5ed
+EBUILD bluez-4.95-r2.ebuild 4889 RMD160 1e2ea4f2ee062859a6a70e63ad7efc9c80ed7c95 SHA1 1f0a8539c30617a5e74e32634b49955dff9c4b19 SHA256 efc0694a765c971c8abc10d038ba8f3196fb27752574174d26cee9e457a9dee9
+EBUILD bluez-4.95-r3.ebuild 4902 RMD160 f9ac9d90351dc433a1ddaa43984aa14ce8f44b32 SHA1 2adc533f61c4b01527aa9cfce4d5ce025f0f12b1 SHA256 c3f2134f78f635fc201f279f157a3af49bde6c9d9ed5927193fd36aee46682ab
EBUILD bluez-4.95.ebuild 4831 RMD160 51457444bea018297448490b816abcbb2fc560c1 SHA1 4359b8bee27e7946440b411d26ab732c45465e32 SHA256 cb89523966d7a2419ad6b21ad9d0c2eb7b9cbdc7cb4232415cfaffe44efe2e97
-MISC ChangeLog 18085 RMD160 de8a4a6a1201d9906a714fa212796119c90689b9 SHA1 1ef7312f334160928b1e8451f1dabb56920e43c3 SHA256 92442f7dd50fdbeb951617e2528a0a9ea10431dcb837e582a75deb34dbdeafb8
+MISC ChangeLog 18309 RMD160 29710b3c026495dc3b12dd1ccac7c2ed74102052 SHA1 215fca25e947bfc727b03b88e2602d7e1764623a SHA256 f149f7c9b4bf806bbe9bc77b7f780c9393077f7bdcf99db155f78138081a4f84
MISC metadata.xml 1052 RMD160 5df0b0075716e5e6aee6ebcb4b734c61ca4e372e SHA1 9b13c6123b253d99e742c8a1e9be5ed50b430c80 SHA256 7006466957d5bb3c892604d1e76093d1ee2ba9fc85ebe6459f643138af174c5c
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.17 (GNU/Linux)
-
-iEYEARECAAYFAk4jTRkACgkQCRZPokWLroT7WQCgv8C/n8sP/m+rtczBrAMjM6f3
-vRsAn0ajAZ4+HT5kdBTZu4jFgbOBU0s2
-=35ZP
------END PGP SIGNATURE-----
diff --git a/net-wireless/bluez/bluez-4.95-r2.ebuild b/net-wireless/bluez/bluez-4.95-r2.ebuild
new file mode 100644
index 000000000000..0c808e90f006
--- /dev/null
+++ b/net-wireless/bluez/bluez-4.95-r2.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.95-r2.ebuild,v 1.1 2011/07/28 15:33:24 pva Exp $
+
+EAPI="4"
+
+inherit multilib eutils systemd
+
+DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
+HOMEPAGE="http://www.bluez.org/"
+
+# Because of oui.txt changing from time to time without noticement, we need to supply it
+# ourselves instead of using http://standards.ieee.org/regauth/oui/oui.txt directly.
+# See bugs #345263 and #349473 for reference.
+OUIDATE="20110708"
+SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.gz
+ http://dev.gentoo.org/~pacho/bluez/oui-${OUIDATE}.txt.xz"
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86"
+
+IUSE="alsa caps +consolekit cups debug gstreamer maemo6 health old-daemons pcmcia pnat test-programs usb"
+
+CDEPEND="
+ >=dev-libs/glib-2.14:2
+ sys-apps/dbus
+ >=sys-fs/udev-146[extras]
+ alsa? (
+ media-libs/alsa-lib[alsa_pcm_plugins_extplug,alsa_pcm_plugins_ioplug]
+ media-libs/libsndfile
+ )
+ caps? ( >=sys-libs/libcap-ng-0.6.2 )
+ cups? ( net-print/cups )
+ gstreamer? (
+ >=media-libs/gstreamer-0.10:0.10
+ >=media-libs/gst-plugins-base-0.10:0.10
+ )
+ usb? ( dev-libs/libusb:1 )
+"
+DEPEND="${CDEPEND}
+ >=dev-util/pkgconfig-0.20
+ sys-devel/flex
+"
+RDEPEND="${CDEPEND}
+ !net-wireless/bluez-libs
+ !net-wireless/bluez-utils
+ consolekit? ( sys-auth/consolekit )
+ test-programs? (
+ dev-python/dbus-python
+ dev-python/pygobject:2
+ )
+"
+
+DOCS=( AUTHORS ChangeLog README )
+
+pkg_setup() {
+ if ! use consolekit; then
+ enewgroup plugdev
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-high-cpu-usage.patch" #376677
+
+ if ! use consolekit; then
+ # No consolekit for at_console etc, so we grant plugdev the rights
+ epatch "${FILESDIR}/bluez-plugdev.patch"
+ fi
+
+ if use cups; then
+ sed -i \
+ -e "s:cupsdir = \$(libdir)/cups:cupsdir = `cups-config --serverbin`:" \
+ Makefile.tools Makefile.in || die
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-audio \
+ --enable-bccmd \
+ --enable-datafiles \
+ --enable-dfutool \
+ --enable-input \
+ --enable-network \
+ --enable-serial \
+ --enable-service \
+ --enable-tools \
+ --disable-hal \
+ --localstatedir=/var \
+ --with-systemdunitdir="$(systemd_get_unitdir)" \
+ $(use_enable alsa) \
+ $(use_enable caps capng) \
+ $(use_enable cups) \
+ $(use_enable debug) \
+ $(use_enable gstreamer) \
+ $(use_enable health) \
+ $(use_enable maemo6) \
+ $(use_enable old-daemons dund) \
+ $(use_enable old-daemons hidd) \
+ $(use_enable old-daemons pand) \
+ $(use_enable pcmcia) \
+ $(use_enable pnat) \
+ $(use_enable test-programs test) \
+ $(use_enable usb)
+}
+
+src_install() {
+ default
+
+ if use test-programs ; then
+ cd "${S}/test"
+ dobin simple-agent simple-service monitor-bluetooth
+ newbin list-devices list-bluetooth-devices
+ rm test-textfile.{c,o} || die # bug #356529
+ for b in apitest hsmicro hsplay test-* ; do
+ newbin "${b}" "bluez-${b}"
+ done
+ insinto /usr/share/doc/${PF}/test-services
+ doins service-*
+
+ cd "${S}"
+ fi
+
+ if use old-daemons; then
+ newconfd "${FILESDIR}/conf.d-hidd" hidd
+ newinitd "${FILESDIR}/init.d-hidd" hidd
+ newconfd "${FILESDIR}/conf.d-dund" dund
+ newinitd "${FILESDIR}/init.d-dund" dund
+ fi
+
+ insinto /etc/bluetooth
+ doins \
+ input/input.conf \
+ audio/audio.conf \
+ network/network.conf \
+ serial/serial.conf
+
+ insinto /lib/udev/rules.d/
+ newins "${FILESDIR}/${PN}-4.18-udev.rules" 70-bluetooth.rules
+ exeinto /lib/udev/
+ newexe "${FILESDIR}/${PN}-4.18-udev.script" bluetooth.sh
+
+ newinitd "${FILESDIR}/bluetooth-init.d" bluetooth
+ newconfd "${FILESDIR}/bluetooth-conf.d" bluetooth
+
+ # Install oui.txt as requested in bug #283791 and approved by upstream
+ insinto /var/lib/misc
+ newins "${WORKDIR}/oui-${OUIDATE}.txt" oui.txt
+
+ find "${ED}" -name "*.la" -delete
+}
+
+pkg_postinst() {
+ udevadm control --reload-rules && udevadm trigger --subsystem-match=bluetooth
+
+ if ! has_version "net-dialup/ppp"; then
+ elog "To use dial up networking you must install net-dialup/ppp."
+ fi
+
+ if use old-daemons; then
+ elog "dund and hidd init scripts were installed because you have the old-daemons"
+ elog "use flag on. They are not started by default via udev so please add them"
+ elog "to the required runlevels using rc-update <runlevel> add <dund/hidd>. If"
+ elog "you need init scripts for the other daemons, please file requests"
+ elog "to https://bugs.gentoo.org."
+ fi
+
+ if use consolekit; then
+ elog "If you want to use rfcomm as a normal user, you need to add the user"
+ elog "to the uucp group."
+ else
+ elog "Since you have the consolekit use flag disabled, you will only be able to run"
+ elog "bluetooth clients as root. If you want to be able to run bluetooth clientes as "
+ elog "a regular user, you need to enable the consolekit use flag for this package or"
+ elog "to add the user to the plugdev group."
+ fi
+}
diff --git a/net-wireless/bluez/bluez-4.95-r3.ebuild b/net-wireless/bluez/bluez-4.95-r3.ebuild
new file mode 100644
index 000000000000..2c4b18b08f91
--- /dev/null
+++ b/net-wireless/bluez/bluez-4.95-r3.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.95-r3.ebuild,v 1.1 2011/07/28 15:33:24 pva Exp $
+
+EAPI="4"
+
+inherit multilib eutils systemd
+
+DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
+HOMEPAGE="http://www.bluez.org/"
+
+# Because of oui.txt changing from time to time without noticement, we need to supply it
+# ourselves instead of using http://standards.ieee.org/regauth/oui/oui.txt directly.
+# See bugs #345263 and #349473 for reference.
+OUIDATE="20110708"
+SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.gz
+ http://dev.gentoo.org/~pacho/bluez/oui-${OUIDATE}.txt.xz"
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86"
+
+IUSE="alsa caps +consolekit cups debug gstreamer maemo6 health old-daemons pcmcia pnat test-programs usb"
+
+CDEPEND="
+ >=dev-libs/glib-2.14:2
+ sys-apps/dbus
+ >=sys-fs/udev-169
+ alsa? (
+ media-libs/alsa-lib[alsa_pcm_plugins_extplug,alsa_pcm_plugins_ioplug]
+ media-libs/libsndfile
+ )
+ caps? ( >=sys-libs/libcap-ng-0.6.2 )
+ cups? ( net-print/cups )
+ gstreamer? (
+ >=media-libs/gstreamer-0.10:0.10
+ >=media-libs/gst-plugins-base-0.10:0.10
+ )
+ usb? ( dev-libs/libusb:1 )
+"
+DEPEND="${CDEPEND}
+ >=dev-util/pkgconfig-0.20
+ sys-devel/flex
+"
+RDEPEND="${CDEPEND}
+ !net-wireless/bluez-libs
+ !net-wireless/bluez-utils
+ consolekit? ( sys-auth/consolekit )
+ test-programs? (
+ dev-python/dbus-python
+ dev-python/pygobject:2
+ )
+"
+
+DOCS=( AUTHORS ChangeLog README )
+
+pkg_setup() {
+ if ! use consolekit; then
+ enewgroup plugdev
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-high-cpu-usage.patch" #376677
+
+ if ! use consolekit; then
+ # No consolekit for at_console etc, so we grant plugdev the rights
+ epatch "${FILESDIR}/bluez-plugdev.patch"
+ fi
+
+ if use cups; then
+ sed -i \
+ -e "s:cupsdir = \$(libdir)/cups:cupsdir = `cups-config --serverbin`:" \
+ Makefile.tools Makefile.in || die
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-audio \
+ --enable-bccmd \
+ --enable-datafiles \
+ --enable-dfutool \
+ --enable-hid2hci \
+ --enable-input \
+ --enable-network \
+ --enable-serial \
+ --enable-service \
+ --enable-tools \
+ --disable-hal \
+ --localstatedir=/var \
+ --with-systemdunitdir="$(systemd_get_unitdir)" \
+ $(use_enable alsa) \
+ $(use_enable caps capng) \
+ $(use_enable cups) \
+ $(use_enable debug) \
+ $(use_enable gstreamer) \
+ $(use_enable health) \
+ $(use_enable maemo6) \
+ $(use_enable old-daemons dund) \
+ $(use_enable old-daemons hidd) \
+ $(use_enable old-daemons pand) \
+ $(use_enable pcmcia) \
+ $(use_enable pnat) \
+ $(use_enable test-programs test) \
+ $(use_enable usb)
+}
+
+src_install() {
+ default
+
+ if use test-programs ; then
+ cd "${S}/test"
+ dobin simple-agent simple-service monitor-bluetooth
+ newbin list-devices list-bluetooth-devices
+ rm test-textfile.{c,o} || die # bug #356529
+ for b in apitest hsmicro hsplay test-* ; do
+ newbin "${b}" "bluez-${b}"
+ done
+ insinto /usr/share/doc/${PF}/test-services
+ doins service-*
+
+ cd "${S}"
+ fi
+
+ if use old-daemons; then
+ newconfd "${FILESDIR}/conf.d-hidd" hidd
+ newinitd "${FILESDIR}/init.d-hidd" hidd
+ newconfd "${FILESDIR}/conf.d-dund" dund
+ newinitd "${FILESDIR}/init.d-dund" dund
+ fi
+
+ insinto /etc/bluetooth
+ doins \
+ input/input.conf \
+ audio/audio.conf \
+ network/network.conf \
+ serial/serial.conf
+
+ insinto /lib/udev/rules.d/
+ newins "${FILESDIR}/${PN}-4.18-udev.rules" 70-bluetooth.rules
+ exeinto /lib/udev/
+ newexe "${FILESDIR}/${PN}-4.18-udev.script" bluetooth.sh
+
+ newinitd "${FILESDIR}/bluetooth-init.d" bluetooth
+ newconfd "${FILESDIR}/bluetooth-conf.d" bluetooth
+
+ # Install oui.txt as requested in bug #283791 and approved by upstream
+ insinto /var/lib/misc
+ newins "${WORKDIR}/oui-${OUIDATE}.txt" oui.txt
+
+ find "${ED}" -name "*.la" -delete
+}
+
+pkg_postinst() {
+ udevadm control --reload-rules && udevadm trigger --subsystem-match=bluetooth
+
+ if ! has_version "net-dialup/ppp"; then
+ elog "To use dial up networking you must install net-dialup/ppp."
+ fi
+
+ if use old-daemons; then
+ elog "dund and hidd init scripts were installed because you have the old-daemons"
+ elog "use flag on. They are not started by default via udev so please add them"
+ elog "to the required runlevels using rc-update <runlevel> add <dund/hidd>. If"
+ elog "you need init scripts for the other daemons, please file requests"
+ elog "to https://bugs.gentoo.org."
+ fi
+
+ if use consolekit; then
+ elog "If you want to use rfcomm as a normal user, you need to add the user"
+ elog "to the uucp group."
+ else
+ elog "Since you have the consolekit use flag disabled, you will only be able to run"
+ elog "bluetooth clients as root. If you want to be able to run bluetooth clientes as "
+ elog "a regular user, you need to enable the consolekit use flag for this package or"
+ elog "to add the user to the plugdev group."
+ fi
+}
diff --git a/net-wireless/bluez/files/bluez-4.95-high-cpu-usage.patch b/net-wireless/bluez/files/bluez-4.95-high-cpu-usage.patch
new file mode 100644
index 000000000000..a3029e102ef8
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-4.95-high-cpu-usage.patch
@@ -0,0 +1,43 @@
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Date: Wed, 20 Jul 2011 09:12:22 +0000 (+0300)
+Subject: Fix removing inotify watch whenever an adapter is removed
+X-Git-Url: http://git.kernel.org/?p=bluetooth%2Fbluez.git;a=commitdiff_plain;h=e2482a5ee3626e426149558e27a8e50ad07d7dad;hp=9a7e2cc81cdea7a673a2cc29cd8eae43155122c0
+
+Fix removing inotify watch whenever an adapter is removed
+
+This sometimes cause bluetoothd to burn cpu when an adapter is removed
+from the system.
+
+Since the watch is not really bond to any adapter, in fact it is added on
+plugin .init, its removal is now moved to plugin .exit.
+---
+
+diff --git a/plugins/adaptername.c b/plugins/adaptername.c
+index 2a54cc0..9e99e6a 100644
+--- a/plugins/adaptername.c
++++ b/plugins/adaptername.c
+@@ -262,10 +262,6 @@ static gboolean handle_inotify_cb(GIOChannel *channel, GIOCondition cond,
+
+ static void adaptername_remove(struct btd_adapter *adapter)
+ {
+- if (watch_fd >= 0)
+- close(watch_fd);
+- if (inotify != NULL)
+- g_io_channel_shutdown(inotify, FALSE, NULL);
+ }
+
+ static struct btd_adapter_driver adaptername_driver = {
+@@ -314,6 +310,13 @@ static int adaptername_init(void)
+
+ static void adaptername_exit(void)
+ {
++ if (watch_fd >= 0)
++ close(watch_fd);
++ if (inotify != NULL) {
++ g_io_channel_shutdown(inotify, FALSE, NULL);
++ g_io_channel_unref(inotify);
++ }
++
+ btd_unregister_adapter_driver(&adaptername_driver);
+ }
+