summaryrefslogtreecommitdiff
path: root/net-wireless/bluez
diff options
context:
space:
mode:
Diffstat (limited to 'net-wireless/bluez')
-rw-r--r--net-wireless/bluez/bluez-9999.ebuild182
-rw-r--r--net-wireless/bluez/files/4.18/bluetooth-conf.d10
-rw-r--r--net-wireless/bluez/files/4.18/bluetooth-init.d48
-rw-r--r--net-wireless/bluez/files/4.18/conf.d-hidd5
-rw-r--r--net-wireless/bluez/files/4.18/cups-location.patch18
-rw-r--r--net-wireless/bluez/files/4.18/init.d-hidd29
-rw-r--r--net-wireless/bluez/files/4.31-as_needed.patch31
-rw-r--r--net-wireless/bluez/files/4.34-conditional_libsbc.patch39
-rw-r--r--net-wireless/bluez/files/4.60/bluetooth-conf.d7
-rw-r--r--net-wireless/bluez/files/4.60/bluetooth-init.d31
-rw-r--r--net-wireless/bluez/files/4.60/cups-location.patch13
-rw-r--r--net-wireless/bluez/files/bluetooth-init.d33
-rw-r--r--net-wireless/bluez/files/bluez-4.18-udev.rules5
-rw-r--r--net-wireless/bluez/files/bluez-4.18-udev.script28
-rw-r--r--net-wireless/bluez/files/bluez-4.62-makefile_ipctest.patch29
-rw-r--r--net-wireless/bluez/files/bluez-alsa_location.patch16
-rwxr-xr-xnet-wireless/bluez/files/bluez-plugdev.patch14
-rw-r--r--net-wireless/bluez/files/conf.d-dund4
-rw-r--r--net-wireless/bluez/files/init.d-dund25
-rw-r--r--net-wireless/bluez/files/init.d-hidd30
20 files changed, 597 insertions, 0 deletions
diff --git a/net-wireless/bluez/bluez-9999.ebuild b/net-wireless/bluez/bluez-9999.ebuild
new file mode 100644
index 0000000..1a8c37a
--- /dev/null
+++ b/net-wireless/bluez/bluez-9999.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.72.ebuild,v 1.1 2010/09/24 21:32:51 pacho Exp $
+
+EAPI="2"
+
+inherit multilib eutils git autotools
+
+DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
+HOMEPAGE="http://bluez.sourceforge.net/"
+EGIT_REPO_URI="git://git.kernel.org/pub/scm/bluetooth/bluez.git"
+SRC_URI=""
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86"
+
+IUSE="alsa attrib caps +consolekit cups debug gstreamer maemo6 health old-daemons pcmcia pnat test-programs usb"
+
+CDEPEND="alsa? (
+ media-libs/alsa-lib[alsa_pcm_plugins_extplug,alsa_pcm_plugins_ioplug]
+ )
+ caps? ( >=sys-libs/libcap-ng-0.6.2 )
+ gstreamer? (
+ >=media-libs/gstreamer-0.10
+ >=media-libs/gst-plugins-base-0.10 )
+ usb? ( dev-libs/libusb )
+ cups? ( net-print/cups )
+ >=sys-fs/udev-146[extras]
+ >=dev-libs/glib-2.14
+ sys-apps/dbus
+ media-libs/libsndfile
+ >=dev-libs/libnl-1.1
+ !net-wireless/bluez-libs
+ !net-wireless/bluez-utils"
+DEPEND="sys-devel/flex
+ >=dev-util/pkgconfig-0.20
+ ${CDEPEND}"
+RDEPEND="${CDEPEND}
+ consolekit? ( sys-auth/pambase[consolekit] )
+ test-programs? (
+ dev-python/dbus-python
+ dev-python/pygobject )"
+
+pkg_setup() {
+ if ! use consolekit; then
+ enewgroup plugdev
+ fi
+}
+
+src_prepare() {
+ eautoreconf
+# 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
+# epatch "${FILESDIR}/4.60/cups-location.patch"
+# fi
+}
+
+src_configure() {
+ econf \
+ $(use_enable caps capng) \
+ --enable-network \
+ --enable-serial \
+ --enable-input \
+ --enable-audio \
+ --enable-service \
+ $(use_enable gstreamer) \
+ $(use_enable alsa) \
+ $(use_enable usb) \
+ --enable-netlink \
+ --enable-tools \
+ --enable-bccmd \
+ --enable-dfutool \
+ $(use_enable old-daemons hidd) \
+ $(use_enable old-daemons pand) \
+ $(use_enable old-daemons dund) \
+ $(use_enable attrib) \
+ $(use_enable health) \
+ $(use_enable pnat) \
+ $(use_enable maemo6) \
+ $(use_enable cups) \
+ $(use_enable test-programs test) \
+ --enable-udevrules \
+ --enable-configfiles \
+ $(use_enable pcmcia) \
+ $(use_enable debug) \
+ --localstatedir=/var \
+ --disable-hal
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "make install failed"
+
+ dodoc AUTHORS ChangeLog README || die
+
+ if use test-programs ; then
+ cd "${S}/test"
+ dobin simple-agent simple-service monitor-bluetooth
+ newbin list-devices list-bluetooth-devices
+ 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}/4.18/conf.d-hidd" hidd || die
+ newinitd "${FILESDIR}/init.d-hidd" hidd || die
+ newconfd "${FILESDIR}/conf.d-dund" dund || die
+ newinitd "${FILESDIR}/init.d-dund" dund || die
+ fi
+
+ insinto /etc/bluetooth
+ doins \
+ input/input.conf \
+ audio/audio.conf \
+ network/network.conf \
+ serial/serial.conf \
+ || die
+
+ insinto /etc/udev/rules.d/
+ newins "${FILESDIR}/${PN}-4.18-udev.rules" 70-bluetooth.rules || die
+ exeinto /$(get_libdir)/udev/
+ newexe "${FILESDIR}/${PN}-4.18-udev.script" bluetooth.sh || die
+
+ newinitd "${FILESDIR}/bluetooth-init.d" bluetooth || die
+ newconfd "${FILESDIR}/4.60/bluetooth-conf.d" bluetooth || die
+
+ # Install oui.txt as requested in bug #283791 and approved by upstream
+ insinto /var/lib/misc
+ doins "${DISTDIR}/oui.txt" || die
+}
+
+pkg_postinst() {
+ udevadm control --reload-rules && udevadm trigger --subsystem-match=bluetooth
+
+ if ! has_version "net-dialup/ppp"; then
+ elog
+ elog "To use dial up networking you must install net-dialup/ppp."
+ fi
+
+ if ! has_version "net-wireless/gnome-bluetooth" && ! has_version "net-wireless/kbluetooth"; then
+ elog
+ elog "For desktop integration you can try net-wireless/gnome-bluetooth"
+ elog "for gnome and net-wireless/kbluetooth for kde."
+ fi
+
+ if ! use old-daemons; then
+ elog
+ elog "Use the old-daemons use flag to get the old daemons like hidd or pand"
+ elog "installed. Please note that 'bluetooth' init script doesn't stop the old"
+ elog "daemons after you update it, so it's recommended to stop all of them using"
+ elog "their own init scripts or manually killing them."
+ fi
+
+ if use consolekit; then
+ elog
+ elog "If you want to use rfcomm as a normal user, you need to add the user"
+ elog "to the uucp group."
+ else
+ elog
+ 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
+
+ if use old-daemons; then
+ elog
+ 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
+}
diff --git a/net-wireless/bluez/files/4.18/bluetooth-conf.d b/net-wireless/bluez/files/4.18/bluetooth-conf.d
new file mode 100644
index 0000000..c84ac4f
--- /dev/null
+++ b/net-wireless/bluez/files/4.18/bluetooth-conf.d
@@ -0,0 +1,10 @@
+# Bluetooth configuraton file
+
+# Run hid2hci (allowed values are "true" and "false")
+HID2HCI_ENABLE=false
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=true
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
diff --git a/net-wireless/bluez/files/4.18/bluetooth-init.d b/net-wireless/bluez/files/4.18/bluetooth-init.d
new file mode 100644
index 0000000..d667084
--- /dev/null
+++ b/net-wireless/bluez/files/4.18/bluetooth-init.d
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/4.18/bluetooth-init.d,v 1.1 2008/11/28 21:21:35 dev-zero Exp $
+
+depend() {
+ after coldplug
+ need dbus localmount
+}
+
+start() {
+ ebegin "Starting Bluetooth"
+ local result=0
+
+ ebegin " Starting bluetoothd"
+ # -s enables internal sdp server
+ start-stop-daemon --start \
+ --exec /usr/sbin/bluetoothd
+ result=$?
+ eend ${result}
+
+ if [ "${HID2HCI_ENABLE}" = "true" -a -x /usr/sbin/hid2hci ]; then
+ ebegin " Running hid2hci"
+ /usr/sbin/hid2hci --tohci -q #be quiet
+ [ ${result} == 0 ] && result=$?
+ eend ${result}
+ fi
+
+ if [ "${RFCOMM_ENABLE}" = "true" -a -x /usr/bin/rfcomm ]; then
+ if [ -f "${RFCOMM_CONFIG}" ]; then
+ ebegin " Starting rfcomm"
+ /usr/bin/rfcomm -f "${RFCOMM_CONFIG}" bind all
+ [ ${result} == 0 ] && result=$?
+ eend ${result}
+ else
+ ewarn "Not enabling rfcomm because RFCOMM_CONFIG does not exists"
+ fi
+ fi
+
+ eend ${result}
+}
+
+stop() {
+ ebegin "Shutting down Bluetooth"
+
+ start-stop-daemon --stop --quiet --exec /usr/sbin/bluetoothd
+ eend $?
+}
diff --git a/net-wireless/bluez/files/4.18/conf.d-hidd b/net-wireless/bluez/files/4.18/conf.d-hidd
new file mode 100644
index 0000000..1677ef0
--- /dev/null
+++ b/net-wireless/bluez/files/4.18/conf.d-hidd
@@ -0,0 +1,5 @@
+# Bluetooth hidd daemon configuraton file
+
+# Arguments to hidd
+HIDD_OPTIONS="--encrypt"
+
diff --git a/net-wireless/bluez/files/4.18/cups-location.patch b/net-wireless/bluez/files/4.18/cups-location.patch
new file mode 100644
index 0000000..e0ddc02
--- /dev/null
+++ b/net-wireless/bluez/files/4.18/cups-location.patch
@@ -0,0 +1,18 @@
+? cups/.deps
+? cups/Makefile
+? cups/Makefile.in
+Index: cups/Makefile.am
+===================================================================
+RCS file: /cvsroot/bluez/utils/cups/Makefile.am,v
+retrieving revision 1.9
+diff -u -r1.9 Makefile.am
+--- cups/Makefile.am 20 Aug 2006 02:21:03 -0000 1.9
++++ cups/Makefile.am 1 Jun 2007 15:47:14 -0000
+@@ -1,6 +1,6 @@
+
+ if CUPS
+-cupsdir = $(libdir)/cups/backend
++cupsdir = `cups-config --serverbin`/backend
+
+ cups_PROGRAMS = bluetooth
+ else
diff --git a/net-wireless/bluez/files/4.18/init.d-hidd b/net-wireless/bluez/files/4.18/init.d-hidd
new file mode 100644
index 0000000..9e61281
--- /dev/null
+++ b/net-wireless/bluez/files/4.18/init.d-hidd
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/4.18/init.d-hidd,v 1.1 2008/11/28 21:21:35 dev-zero Exp $
+
+depend() {
+ need bluetooth
+}
+
+start() {
+ ebegin "Starting hidd"
+ start-stop-daemon --start --quiet \
+ --exec /usr/bin/hidd -- ${HIDD_OPTIONS} --server
+ local result="$?"
+ local service="/etc/bluetooth/input.service"
+ if [ "${result}" != "0" ] && grep -q "Autostart=true" ${service}; then
+ eerror "You have Autostart=true in ${service}."
+ eerror "Change this to false if you want to use hidd."
+ fi
+ eend ${result}
+}
+
+stop() {
+ ebegin "Stopping hidd"
+ hidd --killall
+ start-stop-daemon --stop --quiet --exec /usr/bin/hidd
+ eend $?
+}
+
diff --git a/net-wireless/bluez/files/4.31-as_needed.patch b/net-wireless/bluez/files/4.31-as_needed.patch
new file mode 100644
index 0000000..99b8ce4
--- /dev/null
+++ b/net-wireless/bluez/files/4.31-as_needed.patch
@@ -0,0 +1,31 @@
+diff -Naur bluez-4.31.orig/common/Makefile.am bluez-4.31/common/Makefile.am
+--- bluez-4.31.orig/common/Makefile.am 2009-02-27 22:57:29.515330134 +0100
++++ bluez-4.31/common/Makefile.am 2009-02-27 22:58:11.249328307 +0100
+@@ -4,6 +4,8 @@
+ libhelper_a_SOURCES = oui.h oui.c textfile.h textfile.c logging.h logging.c \
+ glib-helper.h glib-helper.c sdp-xml.h sdp-xml.c btio.h btio.c
+
++libhelper_a_LIBADD = @BLUEZ_LIBS@
++
+ noinst_PROGRAMS = test_textfile
+
+ test_textfile_LDADD = libhelper.a
+diff -Naur bluez-4.31.orig/test/Makefile.am bluez-4.31/test/Makefile.am
+--- bluez-4.31.orig/test/Makefile.am 2009-02-27 22:57:29.518659538 +0100
++++ bluez-4.31/test/Makefile.am 2009-02-27 23:07:09.294597176 +0100
+@@ -23,13 +23,13 @@
+
+ bdaddr_SOURCES = bdaddr.c
+
+-bdaddr_LDADD = @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
++bdaddr_LDADD = $(top_builddir)/common/libhelper.a @BLUEZ_LIBS@
+
+ lmptest_LDADD = @BLUEZ_LIBS@
+
+ agent_LDADD = @DBUS_LIBS@
+
+-btiotest_LDADD = @GLIB_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
++btiotest_LDADD = @GLIB_LIBS@ $(top_builddir)/common/libhelper.a @BLUEZ_LIBS@
+
+ noinst_MANS = bdaddr.8
+
diff --git a/net-wireless/bluez/files/4.34-conditional_libsbc.patch b/net-wireless/bluez/files/4.34-conditional_libsbc.patch
new file mode 100644
index 0000000..e4924c7
--- /dev/null
+++ b/net-wireless/bluez/files/4.34-conditional_libsbc.patch
@@ -0,0 +1,39 @@
+The configure stuff is a inconsequent:
+- even if neither alsa nor gstreamer support is enabled, SBC_LIBS gets substituted by libsbc.la
+ which doesn't get build without alsa or gstreamer. Making this conditional helps.
+- ipctest needs both libipc.la and libsbc.la and fails if SBC_LIBS/SBC_CFLAGS are empty,
+ making the build conditional helps again.
+--- acinclude.m4.orig 2009-04-06 16:26:14.570780241 +0200
++++ acinclude.m4 2009-04-06 16:26:59.540779148 +0200
+@@ -330,8 +330,10 @@
+ AC_SUBST([GDBUS_CFLAGS], ['-I$(top_srcdir)/gdbus'])
+ AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la'])
+
+- AC_SUBST([SBC_CFLAGS], ['-I$(top_srcdir)/sbc'])
+- AC_SUBST([SBC_LIBS], ['$(top_builddir)/sbc/libsbc.la'])
++ if (test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes"); then
++ AC_SUBST([SBC_CFLAGS], ['-I$(top_srcdir)/sbc'])
++ AC_SUBST([SBC_LIBS], ['$(top_builddir)/sbc/libsbc.la'])
++ fi
+
+ AM_CONDITIONAL(SNDFILE, test "${sndfile_enable}" = "yes" && test "${sndfile_found}" = "yes")
+ AM_CONDITIONAL(NETLINK, test "${netlink_enable}" = "yes" && test "${netlink_found}" = "yes")
+--- audio/Makefile.am.orig 2009-04-06 16:47:21.240681272 +0200
++++ audio/Makefile.am 2009-04-06 17:42:27.240597715 +0200
+@@ -60,10 +60,16 @@
+
+ libipc_la_SOURCES = ipc.h ipc.c
+
++if AUDIOPLUGIN
++if SBC
++
+ noinst_PROGRAMS = ipctest
+
+ ipctest_LDADD= libipc.la @SBC_LIBS@ @GLIB_LIBS@
+
++endif
++endif
++
+ AM_CFLAGS = -fvisibility=hidden @SBC_CFLAGS@ \
+ @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@
+
diff --git a/net-wireless/bluez/files/4.60/bluetooth-conf.d b/net-wireless/bluez/files/4.60/bluetooth-conf.d
new file mode 100644
index 0000000..b0cc744
--- /dev/null
+++ b/net-wireless/bluez/files/4.60/bluetooth-conf.d
@@ -0,0 +1,7 @@
+# Bluetooth configuraton file
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=true
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
diff --git a/net-wireless/bluez/files/4.60/bluetooth-init.d b/net-wireless/bluez/files/4.60/bluetooth-init.d
new file mode 100644
index 0000000..42f2238
--- /dev/null
+++ b/net-wireless/bluez/files/4.60/bluetooth-init.d
@@ -0,0 +1,31 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/4.60/bluetooth-init.d,v 1.2 2010/06/11 10:14:00 pacho Exp $
+
+depend() {
+ after coldplug
+ need dbus localmount
+}
+
+start() {
+ ebegin "Starting Bluetooth"
+
+ udevadm trigger --subsystem-match=bluetooth --action=add
+ eend $?
+
+ if [ "${RFCOMM_ENABLE}" = "true" -a -x /usr/bin/rfcomm ]; then
+ if [ -f "${RFCOMM_CONFIG}" ]; then
+ ebegin " Starting rfcomm"
+ /usr/bin/rfcomm -f "${RFCOMM_CONFIG}" bind all
+ eend $?
+ else
+ ewarn "Not enabling rfcomm because RFCOMM_CONFIG does not exists"
+ fi
+ fi
+}
+
+stop() {
+ ebegin "Shutting down Bluetooth"
+ eend 0
+}
diff --git a/net-wireless/bluez/files/4.60/cups-location.patch b/net-wireless/bluez/files/4.60/cups-location.patch
new file mode 100644
index 0000000..66ed8dc
--- /dev/null
+++ b/net-wireless/bluez/files/4.60/cups-location.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile.tools b/Makefile.tools
+index d9a2425..a382e05 100644
+--- a/Makefile.tools
++++ b/Makefile.tools
+@@ -122,7 +122,7 @@ EXTRA_DIST += tools/dfubabel.1 tools/avctrl.8
+
+
+ if CUPS
+-cupsdir = $(libdir)/cups/backend
++cupsdir = `cups-config --serverbin`/backend
+
+ cups_PROGRAMS = cups/bluetooth
+
diff --git a/net-wireless/bluez/files/bluetooth-init.d b/net-wireless/bluez/files/bluetooth-init.d
new file mode 100644
index 0000000..6e19ffb
--- /dev/null
+++ b/net-wireless/bluez/files/bluetooth-init.d
@@ -0,0 +1,33 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/bluetooth-init.d,v 1.1 2010/09/07 11:00:27 pacho Exp $
+
+depend() {
+ after coldplug
+ need dbus localmount
+}
+
+start() {
+ ebegin "Starting Bluetooth"
+
+ udevadm trigger --subsystem-match=bluetooth --action=add
+ eend $?
+
+ if [ "${RFCOMM_ENABLE}" = "true" -a -x /usr/bin/rfcomm ]; then
+ if [ -f "${RFCOMM_CONFIG}" ]; then
+ eindent
+ ebegin "Starting rfcomm"
+ /usr/bin/rfcomm -f "${RFCOMM_CONFIG}" bind all
+ eoutdent
+ eend $?
+ else
+ ewarn "Not enabling rfcomm because RFCOMM_CONFIG does not exists"
+ fi
+ fi
+}
+
+stop() {
+ ebegin "Shutting down Bluetooth"
+ eend 0
+}
diff --git a/net-wireless/bluez/files/bluez-4.18-udev.rules b/net-wireless/bluez/files/bluez-4.18-udev.rules
new file mode 100644
index 0000000..b3ccd5b
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-4.18-udev.rules
@@ -0,0 +1,5 @@
+# Start/Stop bluetooth service on device insertion. Gentoo specific.
+SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="bluetooth.sh"
+
+# So that normal users can dial out.
+SUBSYSTEM=="tty", SUBSYSTEMS=="bluetooth", GROUP="uucp"
diff --git a/net-wireless/bluez/files/bluez-4.18-udev.script b/net-wireless/bluez/files/bluez-4.18-udev.script
new file mode 100644
index 0000000..a532e26
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-4.18-udev.script
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# bluetooth.sh: udev external RUN script
+#
+# Copyright:
+# 2005-2006 Henrik Brix Andersen <brix@gentoo.org>
+# 2007 Petteri Räty <betelgeuse@gentoo.org>
+# 2008 Tiziano Müller <dev-zero@gentoo.org>
+# Distributed under the terms of the GNU General Public License v2
+
+script=/etc/init.d/bluetooth
+
+# Find out where sysfs is mounted. Exit if not available
+sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'`
+if [ "$sysfs" = "" ]; then
+ echo "sysfs is required"
+ exit 1
+fi
+
+if [ ! -d $sysfs/class/bluetooth/hci[0-9]* -a ! -d $sysfs/bus/bluetooth/devices/hci[0-9]* ]; then
+ if $script --quiet status; then
+ IN_HOTPLUG=1 $script --quiet stop
+ fi
+else
+ if ! $script --quiet status; then
+ IN_HOTPLUG=1 $script --quiet start
+ fi
+fi
diff --git a/net-wireless/bluez/files/bluez-4.62-makefile_ipctest.patch b/net-wireless/bluez/files/bluez-4.62-makefile_ipctest.patch
new file mode 100644
index 0000000..6304a6f
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-4.62-makefile_ipctest.patch
@@ -0,0 +1,29 @@
+From f62006a86143f2c8556b4e6f3e74508db6b2aa5d Mon Sep 17 00:00:00 2001
+From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
+Date: Mon, 8 Mar 2010 20:01:32 -0300
+Subject: [PATCH 1/1] Fix compilation when --enable-test is passed
+
+When --enable-test is passed along with --disable-alsa and
+--disable-gstreamer, the SBC lib is not built, which breaks
+compilation of the ipctest test program.
+---
+ acinclude.m4 | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 2e4444d..f7bb047 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -316,7 +316,8 @@ AC_DEFUN([AC_ARG_BLUEZ], [
+
+ AM_CONDITIONAL(SNDFILE, test "${sndfile_enable}" = "yes" && test "${sndfile_found}" = "yes")
+ AM_CONDITIONAL(USB, test "${usb_enable}" = "yes" && test "${usb_found}" = "yes")
+- AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes")
++ AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes" ||
++ test "${test_enable}" = "yes")
+ AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes")
+ AM_CONDITIONAL(GSTREAMER, test "${gstreamer_enable}" = "yes" && test "${gstreamer_found}" = "yes")
+ AM_CONDITIONAL(AUDIOPLUGIN, test "${audio_enable}" = "yes")
+--
+1.7.0.2
+
diff --git a/net-wireless/bluez/files/bluez-alsa_location.patch b/net-wireless/bluez/files/bluez-alsa_location.patch
new file mode 100644
index 0000000..4d0712c
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-alsa_location.patch
@@ -0,0 +1,16 @@
+bluez installs stuff into /etc/alsa, which is wrong since the
+correct location (also stated in alsa-lib configure.in) is
+/usr/share/alsa instead
+Upstream report:
+http://permalink.gmane.org/gmane.linux.bluez.kernel/4739
+--- Makefile.am~ 2010-02-12 20:26:48.000000000 +0100
++++ Makefile.am 2010-03-05 10:17:15.000000000 +0100
+@@ -241,7 +241,7 @@
+ audio_libasound_module_ctl_bluetooth_la_CFLAGS = @ALSA_CFLAGS@
+
+ if CONFIGFILES
+-alsaconfdir = $(sysconfdir)/alsa
++alsaconfdir = $(datadir)/alsa
+
+ alsaconf_DATA = audio/bluetooth.conf
+ endif
diff --git a/net-wireless/bluez/files/bluez-plugdev.patch b/net-wireless/bluez/files/bluez-plugdev.patch
new file mode 100755
index 0000000..726838a
--- /dev/null
+++ b/net-wireless/bluez/files/bluez-plugdev.patch
@@ -0,0 +1,14 @@
+diff -Nurp bluez-4.39.orig/src/bluetooth.conf bluez-4.39/src/bluetooth.conf
+--- bluez-4.39.orig/src/bluetooth.conf 2008-12-20 20:18:10.000000000 +0100
++++ bluez-4.39/src/bluetooth.conf 2009-09-05 13:30:34.411581498 +0200
+@@ -17,6 +17,10 @@
+ <allow send_destination="org.bluez"/>
+ </policy>
+
++ <policy group="plugdev">
++ <allow send_destination="org.bluez"/>
++ </policy>
++
+ <policy context="default">
+ <deny send_destination="org.bluez"/>
+ </policy>
diff --git a/net-wireless/bluez/files/conf.d-dund b/net-wireless/bluez/files/conf.d-dund
new file mode 100644
index 0000000..a199fc7
--- /dev/null
+++ b/net-wireless/bluez/files/conf.d-dund
@@ -0,0 +1,4 @@
+# Bluetooth DUN daemon configuraton file
+
+# Arguments to dund
+DUND_OPTIONS="--search --persist"
diff --git a/net-wireless/bluez/files/init.d-dund b/net-wireless/bluez/files/init.d-dund
new file mode 100644
index 0000000..c8c8663
--- /dev/null
+++ b/net-wireless/bluez/files/init.d-dund
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/init.d-dund,v 1.1 2010/09/24 21:32:51 pacho Exp $
+
+depend() {
+ need bluetooth
+}
+
+start() {
+ local result service
+
+ ebegin "Starting dund"
+ start-stop-daemon --start --quiet \
+ --exec /usr/bin/dund -- ${DUND_OPTIONS}
+ result="$?"
+ eend ${result}
+}
+
+stop() {
+ ebegin "Stopping dund"
+ /usr/bin/dund -K
+ start-stop-daemon --stop --quiet --exec /usr/bin/dund
+ eend $?
+}
diff --git a/net-wireless/bluez/files/init.d-hidd b/net-wireless/bluez/files/init.d-hidd
new file mode 100644
index 0000000..39399a9
--- /dev/null
+++ b/net-wireless/bluez/files/init.d-hidd
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/init.d-hidd,v 1.1 2010/09/07 11:00:27 pacho Exp $
+
+depend() {
+ need bluetooth
+}
+
+start() {
+ local result service
+
+ ebegin "Starting hidd"
+ start-stop-daemon --start --quiet \
+ --exec /usr/bin/hidd -- ${HIDD_OPTIONS} --server
+ result="$?"
+ service="/etc/bluetooth/input.service"
+ if [ ${result} -ne 0 ] && grep -q "Autostart=true" "${service}"; then
+ eerror "You have Autostart=true in ${service}."
+ eerror "Change this to false if you want to use hidd."
+ fi
+ eend ${result}
+}
+
+stop() {
+ ebegin "Stopping hidd"
+ hidd --killall
+ start-stop-daemon --stop --quiet --exec /usr/bin/hidd
+ eend $?
+}