--- bluez-4.42.orig/debian/bluez.postinst
+++ bluez-4.42/debian/bluez.postinst
@@ -0,0 +1,53 @@
+#!/bin/sh
+# snippet from http://www.dpkg.org/dpkg/ConffileHandling
+
+# Move a conffile without triggering a dpkg question
+mv_conffile() {
+    OLDCONFFILE="$1"
+    NEWCONFFILE="$2"
+
+    if [ -e "$OLDCONFFILE" ]; then
+        echo "Preserving user changes to $NEWCONFFILE ..."
+        mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
+        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
+    fi
+}
+
+set -e
+case "$1" in
+    configure)
+        if [ -e /etc/init.d/bluez-utils ]; then
+            update-rc.d -f bluez-utils remove
+            # maybe a (medium/low debconf?) notice is best suited here
+        fi
+
+        # use MAKEDEV instead of the original bluez script below as per policy 10.6
+        if [ -x /dev/MAKEDEV ]; then
+            echo "Creating device nodes ..."
+            cd /dev && ./MAKEDEV bluetooth 1>/dev/null 2>/dev/null
+        fi
+
+        # create bluetooth group if not already present
+        if ! getent group bluetooth > /dev/null; then
+            addgroup --quiet --system bluetooth
+        fi
+
+        # reload dbus config file
+        if [ -x /etc/init.d/dbus ]; then
+            invoke-rc.d dbus force-reload || true
+        fi
+
+        #reload udev rules
+        if [ -x /etc/init.d/udev ]; then
+            invoke-rc.d udev reload || true
+        fi
+
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+#DEBHELPER#
--- bluez-4.42.orig/debian/bluez-compat.README.Debian
+++ bluez-4.42/debian/bluez-compat.README.Debian
@@ -0,0 +1,14 @@
+bluez compatibility daemons
+===========================
+This package contains old daemons like dund/pand/hidd which have been obsoleted
+by bluetoothd and the D-Bus API, they are provided for backward compatibility.
+
+It is possibile to start the daemons at boot if needed via /etc/rc.local file.
+
+If options were used via /etc/default/bluetooth this can be accomplished by a
+snippet like:
+
+test -f /etc/default/bluetooth && . /etc/default/bluetooth
+[ "$HIDD_ENABLED" -eq 1 ] && /usr/bin/hidd $HIDD_OPTIONS	
+[ "$PAND_ENABLED" -eq 1 ] && /usr/bin/pand $PAND_OPTIONS	
+[ "$DUND_ENABLED" -eq 1 ] && /usr/bin/dund $DUND_OPTIONS	
--- bluez-4.42.orig/debian/watch
+++ bluez-4.42/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://www.kernel.org/pub/linux/bluetooth/ .*bluez-([.\d]+)\.tar\.gz
--- bluez-4.42.orig/debian/bluetooth.lintian-overrides
+++ bluez-4.42/debian/bluetooth.lintian-overrides
@@ -0,0 +1,2 @@
+# package description looks fine, "Bluetooth stack utilities"
+bluetooth binary: description-starts-with-package-name
--- bluez-4.42.orig/debian/bluetooth-dbus.conf
+++ bluez-4.42/debian/bluetooth-dbus.conf
@@ -0,0 +1,32 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth core daemon to work. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez"/>
+    <allow send_destination="org.bluez"/>
+
+    <!-- allow root to send to agents -->
+    <allow send_interface="org.bluez.Agent"/>
+  </policy>
+
+  <!-- allow users at the console, see consolekit or libpam-foreground -->
+  <policy at_console="true">
+    <allow send_destination="org.bluez"/>
+  </policy>
+
+  <!-- allow users of bluetooth group to communicate with hcid -->
+  <policy group="bluetooth">
+    <allow send_destination="org.bluez"/>
+  </policy>
+
+  <policy context="default">
+    <deny send_destination="org.bluez"/>
+  </policy>
+
+</busconfig>
--- bluez-4.42.orig/debian/bluez-cups.install
+++ bluez-4.42/debian/bluez-cups.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/cups/backend/*
--- bluez-4.42.orig/debian/bluez_agent.udev
+++ bluez-4.42/debian/bluez_agent.udev
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+# /usr is not guaranteed to be mounted when udev starts
+
+(
+	. /lib/udev/hotplug.functions
+	wait_for_file /usr/sbin/hid2hci
+	exec /usr/sbin/hid2hci "$@"
+) &
--- bluez-4.42.orig/debian/bluez-alsa.preinst
+++ bluez-4.42/debian/bluez-alsa.preinst
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+
+# snippet from http://wiki.debian.org/DpkgConffileHandling
+
+# Remove a no-longer used conffile
+rm_conffile() {
+    PKGNAME="$1"
+    CONFFILE="$2"
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+            echo "Saving as $CONFFILE.dpkg-bak ..."
+            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+        else
+            echo "Removing obsolete conffile $CONFFILE ..."
+            rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "3.24-1+b1"; then
+        rm_conffile bluez-audio "/etc/bluetooth/audio.service"
+    fi
+esac
+
+#DEBHELPER#
--- bluez-4.42.orig/debian/bluez.bluetooth.init
+++ bluez-4.42/debian/bluez.bluetooth.init
@@ -0,0 +1,201 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: bluetooth
+# Required-Start:    $local_fs $syslog $remote_fs dbus
+# Required-Stop:     $local_fs $syslog $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start bluetooth daemons
+### END INIT INFO
+#
+# bluez    Bluetooth subsystem starting and stopping
+#
+# originally from bluez's scripts/bluetooth.init
+#
+# Edd Dumbill <ejad@debian.org>
+# LSB 3.0 compilance and enhancements by Filippo Giunchedi <filippo@debian.org>
+#
+# Updated for bluez 4.7 by Mario Limonciello <mario_limonciello@dell.com>
+#
+# Note: older daemons like dund pand hidd are now shipped inside the
+# bluez-compat package
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DESC=bluetooth
+
+DAEMON=/usr/sbin/bluetoothd
+HCIATTACH=/usr/sbin/hciattach
+
+HID2HCI=/usr/sbin/hid2hci
+HID2HCI_ENABLED=1
+HID2HCI_UNDO=1
+
+UART_CONF=/etc/bluetooth/uart
+
+RFCOMM=/usr/bin/rfcomm
+RFCOMM_NAME=rfcomm
+RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
+SDPTOOL=/usr/bin/sdptool
+
+SSD_OPTIONS="--oknodo --quiet --exec $DAEMON"
+
+test -f /etc/default/bluetooth && . /etc/default/bluetooth
+test -f /etc/default/rcS && . /etc/default/rcS
+
+. /lib/lsb/init-functions
+
+set -e
+
+run_sdptool()
+{
+	test -x $SDPTOOL || return 1
+
+	if ! test -z "$SDPTOOL_OPTIONS" ; then
+		oldifs="$IFS"
+		IFS=";"
+		for o in $SDPTOOL_OPTIONS ; do
+			#echo "execing $SDPTOOL $o"
+			IFS=" "
+			if [ "$VERBOSE" != "no" ]; then
+				$SDPTOOL $o
+			else
+				$SDPTOOL $o >/dev/null 2>&1
+			fi
+		done
+		IFS="$oldifs"
+	fi
+
+}
+
+enable_hci_input()
+{
+    log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz"
+}
+
+disable_hci_input()
+{
+    log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz"
+}
+
+start_uarts()
+{
+	[ -f $HCIATTACH ] && [ -f $UART_CONF ] || return
+	grep -v '^#' $UART_CONF | while read i; do
+               if [ "$VERBOSE" != no ]; then
+                       $HCIATTACH $i
+               else
+                       $HCIATTACH $i >/dev/null 2>&1
+               fi
+	done
+}
+
+stop_uarts()
+{
+	killall hciattach > /dev/null 2>&1 || true
+}
+
+start_rfcomm()
+{
+	if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
+		# rfcomm must always succeed for now: users
+		# may not yet have an rfcomm-enabled kernel
+                if [ "$VERBOSE" != no ]; then
+                       log_progress_msg "rfcomm"
+                       $RFCOMM -f $RFCOMM_CONF bind all || true
+                else
+                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
+                fi
+	fi
+}
+
+stop_rfcomm()
+{
+	if [ -x $RFCOMM ] ; then
+               if [ "$VERBOSE" != no ]; then
+                       log_progress_msg "rfcomm"
+                       $RFCOMM unbind all || true
+               else
+                       $RFCOMM unbind all >/dev/null 2>&1 || true
+               fi
+	fi
+}
+
+restart_rfcomm()
+{
+	if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
+               if [ "$VERBOSE" != no ]; then
+                       log_progress_msg  "rfcomm"
+                       $RFCOMM unbind all || true
+                       $RFCOMM -f $RFCOMM_CONF bind all || true
+               else
+                       $RFCOMM unbind all >/dev/null 2>&1|| true
+                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
+               fi
+	fi
+}
+
+case "$1" in
+  start)
+	log_daemon_msg "Starting $DESC"
+
+	if test "$BLUETOOTH_ENABLED" = "0"; then
+		log_progress_msg "disabled. see /etc/default/bluetooth"
+		log_end_msg 0
+		exit 0
+	fi
+
+	start-stop-daemon --start $SSD_OPTIONS
+	log_progress_msg "bluetoothd"
+
+	run_sdptool || true
+
+	start_uarts || true
+
+	if test "$HID2HCI_ENABLED" = "1"; then
+		enable_hci_input || true
+	fi
+	start_rfcomm || true
+
+	if test "$HIDD_ENABLED" = "1" ||
+			test "$PAND_ENABLED" = "1" ||
+			test "$DUND_ENABLED" = "1"; then
+		log_progress_msg "compatibily daemons not started, see bluez-compat package"
+	fi
+
+	log_end_msg 0
+  ;;
+  stop)
+	log_daemon_msg "Stopping $DESC"
+	if test "$BLUETOOTH_ENABLED" = "0"; then
+		log_progress_msg "disabled."
+		log_end_msg 0
+		exit 0
+	fi
+	stop_rfcomm || true
+	if test "$HID2HCI_UNDO" = "1"; then
+		disable_hci_input || true
+	fi
+	start-stop-daemon --stop $SSD_OPTIONS
+	log_progress_msg "bluetoothd"
+	stop_uarts || true
+	log_end_msg 0
+  ;;
+  restart|force-reload)
+	$0 stop
+	sleep 1
+	$0 start
+  ;;
+  status)
+	status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $?
+  ;;
+  *)
+	N=/etc/init.d/bluetooth
+	# echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
+	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
+
+# vim:noet
--- bluez-4.42.orig/debian/bluez.install
+++ bluez-4.42/debian/bluez.install
@@ -0,0 +1,7 @@
+debian/tmp/etc/bluetooth/main.conf
+debian/tmp/etc/bluetooth/rfcomm.conf
+debian/tmp/etc/dbus*/*
+debian/tmp/usr/sbin/*
+debian/tmp/usr/bin/*
+debian/tmp/usr/share/man/man*
+debian/tmp/usr/lib/bluetooth/plugins/*.so
--- bluez-4.42.orig/debian/compat
+++ bluez-4.42/debian/compat
@@ -0,0 +1 @@
+7
--- bluez-4.42.orig/debian/bluez-pcmcia-support.postinst
+++ bluez-4.42/debian/bluez-pcmcia-support.postinst
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+#DEBHELPER#
--- bluez-4.42.orig/debian/libbluetooth3.install
+++ bluez-4.42/debian/libbluetooth3.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/lib*.so.*
--- bluez-4.42.orig/debian/README.examples
+++ bluez-4.42/debian/README.examples
@@ -0,0 +1,2 @@
+These examples are from the test/ directory of bluez distribution, you'll need
+python-gobject and python-dbus to run some of them.
--- bluez-4.42.orig/debian/bluez-gstreamer.install
+++ bluez-4.42/debian/bluez-gstreamer.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/gstreamer-*/*.so
+
--- bluez-4.42.orig/debian/changelog
+++ bluez-4.42/debian/changelog
@@ -0,0 +1,246 @@
+bluez (4.42-2~bpo50+1) lenny-backports; urgency=low
+
+  * Rebuild for lenny.
+  * Add myself as an uploader.
+
+ -- Andres Salomon <dilinger@debian.org>  Fri, 09 Oct 2009 21:44:34 +0000
+
+bluez (4.42-2) unstable; urgency=low
+
+  * Fix "Bashisms in init script" (Closes: #534511)
+  * Handle upgrade of old /etc/modprobe.d/bluez (Closes: #523050)
+  * Conflict/Replace bluez-audio in bluez (Closes: #535089)
+
+ -- Filippo Giunchedi <filippo@debian.org>  Tue, 30 Jun 2009 20:05:13 +0200
+
+bluez (4.42-1) unstable; urgency=low
+
+  * New upstream release
+    + drop not needed debian/patches/003_configure_amd64_rpath.patch
+  * Provide transitional bluez-audio to migrate to bluez-alsa and
+    bluez-gstreamer (Closes: #531449)
+  * Install README.Debian in binary bluez (Closes: #532018)
+  * Make bluez-{alsa,gstreamer} depend on bluez
+  * Switch to group bluetooth from netdev for authorized users
+    (Closes: #534118)
+  * Mention pand/hidd/dund move to bluez-compat in init script and default
+    (Closes: #532622)
+  * debian/patches/002_test_agent_newapi.patch port bluetooth-agent to new
+    D-Bus API
+  * Update to S-V 3.8.2: no changes  
+  * Introduce common SSD_OPTIONS in init script and sleep 1 on restart 
+
+ -- Filippo Giunchedi <filippo@debian.org>  Sun, 21 Jun 2009 14:01:04 +0200
+
+bluez (4.40-2) unstable; urgency=low
+
+  * Ship a libbluetooth3.symbols file instead of shlibs
+  * Ship more examples from test/, thus suggest: python-gobject and
+    python-dbus together with README.examples
+  * Provide a script in /lib/udev/bluez for waiting on /usr being available
+    and a patch udev rules to use it
+
+ -- Filippo Giunchedi <filippo@debian.org>  Tue, 26 May 2009 00:02:53 +0200
+
+bluez (4.40-1) unstable; urgency=low
+
+  * New upstream release
+    - scripts/bluetooth.rules -> scripts/bluetooth-serial.rules
+  * Upload to unstable
+  * Change usage for hid2hci: install udev rules and issue a warning from init
+    script
+
+ -- Filippo Giunchedi <filippo@debian.org>  Fri, 22 May 2009 14:56:07 +0200
+
+bluez (4.34-0exp1) experimental; urgency=low
+
+  * First upload of bluez 4.x (Closes: #499529)
+    - include parts of the packaging from ubuntu, thanks!
+    - bluez-utils and bluez-libs are now a single source package 
+    - libbluetooth2 -> libbluetooth3 bump
+    - conflict bluez with bluez-utils (<= 3.36-3)
+    - update debian/copyright, thanks to Nobuhiro Iwamatsu
+  * Remove hid2hci patches/script
+  * Remove broken link to documentation (Closes: #504675)
+  * Install a sample commandline agent from test/ into bluetooth-agent
+    - add 001_test_agent_default_adapter.patch to get the default adapter
+  * Install test/simple-agent and test/list-devices as examples
+  * Remove old commented code from maintainer scripts (pcmcia-support postinst
+    and bluez preinst)
+  * Update watch file to match bluez only
+  * Add #DEBHELPER# to debian/bluez-utils.postrm
+  * Update to S-V 3.8.1: no changes needed
+  * Fix lintian warnings:
+    - add -e to remaining maintainer scripts
+    - remove full path to update-rc.d in debian/bluez.postinst
+    - override "bluez-utils: maintainer-script-empty postrm" for transitional
+      bluez-utils postrm
+  * Use 7 in debian/compat
+  * Fix debian/bluez.preinst to use dpkg-query, thus removing the lintian
+    override
+
+ -- Filippo Giunchedi <filippo@debian.org>  Wed, 01 Apr 2009 12:20:01 +0200
+
+bluez (4.29-0ubuntu1) jaunty; urgency=low
+
+  * New upstream version (LP: #326811)
+    - Use AVRCP version 1.0 for now.
+    - Decrease AVDTP idle timeout to one second.
+    - Delay AVRCP connection when remote device connects A2DP.
+    - Add workaround for AVDTP stream setup with broken headsets.
+    - Add missing three-way calling feature bit for Handsfree.
+    - Fix handsfree callheld indicator updating.
+    - Fix parsing of all AT commands within the buffer.
+    - Fix authentication replies when disconnected.
+    - Fix handling of debug combination keys.
+    - Fix handling of changed combination keys.
+    - Fix handling of link keys when using no bonding.
+    - Fix handling of invalid/unknown authentication requirements.
+    - Fix closing of L2CAP raw socket used for dedicated bonding. 
+
+ -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>  Sun, 08 Feb 2009 10:48:36 +0100
+
+bluez (4.28-0ubuntu1) jaunty; urgency=low
+
+  * New upstream version. (LP: #324492)
+    - Add AVDTP signal fragmentation support.
+    - Add more SBC performance optimizations.
+    - Add more SBC audio quality improvements.
+    - Use native byte order for audio plugins.
+    - Set the adapter alias only after checking the EIR data.
+    - Fix auto-disconnect issue with explicit A2DP connections.
+    - Fix invalid memory access of ALSA plugin.
+    - Fix compilation with -Wsign-compare.
+
+ -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>  Mon, 02 Feb 2009 21:57:08 +0100
+
+bluez (4.27-0ubuntu1) jaunty; urgency=low
+
+  * New upstream version. (LP: #304784)
+    - Improves interoperability and security handling
+      with Bluetooth 2.1 based devices.
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Tue, 27 Jan 2009 12:44:39 -0600
+
+bluez (4.25-0ubuntu6) jaunty; urgency=low
+
+  * Drop previous patch, bluez is a bit strange and this is basically ok.
+
+ -- Scott James Remnant <scott@ubuntu.com>  Mon, 19 Jan 2009 17:01:14 +0000
+
+bluez (4.25-0ubuntu5) jaunty; urgency=low
+
+  * debian/patches/ubuntu_dbus_policy.patch:
+    - Drop send_interface allow which isn't service-specific.  LP: #318740. 
+
+ -- Scott James Remnant <scott@ubuntu.com>  Mon, 19 Jan 2009 15:38:43 +0000
+
+bluez (4.25-0ubuntu4) jaunty; urgency=low
+
+  * Add Breaks to ensure the right udev version is used.
+
+ -- Scott James Remnant <scott@ubuntu.com>  Fri, 09 Jan 2009 11:35:06 +0000
+
+bluez (4.25-0ubuntu3) jaunty; urgency=low
+
+  * debian/hid2hci.rules: Update to use ATTRS{} instead of SYSFS{}
+
+ -- Scott James Remnant <scott@ubuntu.com>  Wed, 07 Jan 2009 14:18:52 +0000
+
+bluez (4.25-0ubuntu2) jaunty; urgency=low
+
+  * debian/rules: Install rules into /lib/udev/rules.d
+  * debian/bluez.preinst: Remove old rule if unchanged.
+
+ -- Scott James Remnant <scott@ubuntu.com>  Wed, 07 Jan 2009 11:35:39 +0000
+
+bluez (4.25-0ubuntu1) jaunty; urgency=low
+
+  * New upstream release. (LP: #312087)
+
+ -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>  Tue, 30 Dec 2008 19:53:44 +0100
+
+bluez (4.21-0ubuntu1) jaunty; urgency=low
+
+  * New upstream version. (LP: #304109)
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Wed, 03 Dec 2008 15:56:03 -0600
+
+bluez (4.17-0ubuntu1) jaunty; urgency=low
+
+  * New upstream version. (LP: #284039)
+  * Drop the following patches that landed upstream:
+    - logitech_5500_ids.patch
+    - dell_bt_365.patch
+    - sco_connect_git.patch
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Wed, 05 Nov 2008 13:28:35 -0600
+
+bluez (4.12-0ubuntu5) intrepid; urgency=low
+
+  * Add debian/hid2hci.rules to enable running hid2hci
+    as soon as some bluetooth dongles get plugged in. (LP: #288294)
+  * debian/bluez.postinst:
+    - Update udev rules on postinst.
+  * debian/rules:
+    - Install debian/hid2hci.rules to 62-bluez-hid2hci.rules
+
+ -- Mario Limonciello <superm1@ubuntu.com>  Sat, 25 Oct 2008 23:32:00 -0500
+
+bluez (4.12-0ubuntu4) intrepid; urgency=low
+
+  * Add hid2hci.patch to enable hid2hci to be ran after
+    suspending a machine. (LP: #268877)
+  * debian/rules:
+    - Install new script from above patch.
+  * Add logitech_5500_ids.patch for enabling hid2hci on
+    more logitech devices. (LP: #272352)
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Wed, 22 Oct 2008 16:01:59 -0500
+
+bluez (4.12-0ubuntu3) intrepid; urgency=low
+
+  * debian/bluez.postinst:
+    - Don't show output for MAKEDEV. (LP: 280360)
+  * Add dell_bt_365.patch which will enable putting the Dell BT365
+    adapter into HCI mode upon bootup. (LP: #286724)
+  * debian/control:
+    - Add one more binary package for old compatibility binaries. (LP: #281580)
+  * debian/rules:
+    - Enable compatibility binaries.  These are HIGHLY discouraged from usage
+      and will not necessarily be here in the future.
+  * debian/bluez.install:
+    - Adjust what binaries get installed, to be able to pull out hidd, dund,
+      and pand as necessary.
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Mon, 20 Oct 2008 20:37:24 -0500
+
+bluez (4.12-0ubuntu2) intrepid; urgency=low
+
+  * debian/control:
+    - Move libbluetooth3 to the top of the list so that it is the
+      package that gets to keep the real changelog rather than symlinks.
+    - Only Replaces: packages rather than conflicts to help with 
+      upgrades (LP: #279954)
+
+ -- Mario Limonciello <mario_limonciello@dell.com>  Tue, 07 Oct 2008 16:32:31 -0500
+
+bluez (4.12-0ubuntu1) intrepid; urgency=low
+
+  * Initial Release. (LP: #274950)
+    - This package replaces bluez-utils and bluez-libs source packages.
+    - It was generated by merging the contents of bluez-utils and bluez-libs
+      and updating content.
+    - Legacy functionality for hidd, dund, and pand are not present, and 
+      have been removed from all configuration files.
+  * This release introduces encryption (LP: #182191)
+  * debian/patches:
+    - bluez-utils-oui-usage.patch was borrowed from the Fedora 10 packaging.
+    - sco-connect-git.patch was taken from bluez git shortly after 4.12 release.
+      It should "help" with some sco headset issues.
+  * debian/control:
+    - Update different packages per upstream's recommendations.
+    - Update conflicts/replaces for earlier packages.
+    - Add a transitional bluez-utils package to help with the transition.
+
+ -- Mario Limonciello <superm1@ubuntu.com>  Tue, 07 Oct 2008 12:10:29 -0500
--- bluez-4.42.orig/debian/bluez-alsa.install
+++ bluez-4.42/debian/bluez-alsa.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/alsa-lib/*.so
--- bluez-4.42.orig/debian/README.Debian
+++ bluez-4.42/debian/README.Debian
@@ -0,0 +1,118 @@
+bluez for Debian
+================
+
+The /dev/rfcomm* serial devices entries are automatically created for using
+RFCOMM with legacy applications -- see rfcomm(8).  Users must be in group
+'dialout' to have privileges to use these devices.
+
+You can edit /etc/bluetooth/rfcomm.conf to have some rfcomm devices bound
+automatically at boot time.
+
+If you wish to install PCMCIA card services support for your Bluetooth
+devices you should install the bluez-pcmcia-support package.
+
+Some USB dongles require firmware to make them work: bluez-firmware from the
+"non-free" section provides the required firmware.
+
+
+Mailing lists and documentation
+-------------------------------
+The old sourceforge lists have been discontinued, the new lists can be found at:
+
+http://www.bluez.org/development/lists/
+
+plus a wiki at: http://wiki.bluez.org/
+
+PIN (or passkey) management
+---------------------------
+Interaction with the local user can be required while BT connection is
+being established (pairing process) and the PIN is not yet known or
+needs to be changed.
+
+To retrieve the passkey (or PIN) from the user a service program (agent)
+running in user's interactive session needs to be prepared and listen
+for requests of the bluez daemon when pairing begins.
+
+Examples of such programs are kblueplugd (kdebluetooth package) and
+bluetooth-applet (bluez-gnome or gnome-bluetooth packages). A minimal
+command-line agent is also provided by bluetooth-agent.
+
+Headset support
+---------------
+There's support for bluetooth headset both via ALSA and GStreamer, respectively
+via bluez-alsa and bluez-gstreamer packages.
+
+ALSA
+~~~~
+You might setup your headset by discovering it with gnome-bluetooth, once setup
+add the following configuration to ~/.asoundrc:
+
+	pcm.bluetooth {
+		   type bluetooth
+		   device <BT address>
+	}
+
+then audio can be played with supported player, e.g. mplayer:
+
+	mplayer -ao alsa:device=bluetooth
+
+See also: http://wiki.bluez.org/wiki/HOWTO/AudioDevices
+
+Legacy daemons
+--------------
+The bluez-compat package includes old legacy daemons such as dund, pand and hidd
+for enabling dial-up, ethernet networking and input devices over bluetooth.
+
+Bluetooth Networking Quickstart with legacy daemons
++++++++++++++++++++++++++++++++++++++++++++++++++++
+1. Start dund and pand at boot time
+ 
+2. PPP over RFCOMM
+
+This is what most devices call "LAN Access" or "Serial Access".  It
+uses normal PPP over a serial connection.  Most PDAs will be able to
+connect using this method.
+
+Use the 'dund' tool to accept incoming connections.  Configure pppd
+as per the instructions in the ppp package.  Then run:
+
+dund --listen --sdp --nodetach
+
+Try and connect your device and you'll see something like:
+
+dund[9801]: DUN daemon ver 1.1pre4
+dund[9811]: New connection from 00:02:31:24:17:6A
+
+The --sdp option causes the DUN access to be advertised to other
+devices via the SDP protocol.  Most devices need this in order to be
+able to connect.
+
+Run dund --help to see the various other options available to you.
+
+If you want to make an outgoing connection using PPP, for instance to
+a mobile phone, use the 'rfcomm' program from bluez-utils to bind a
+/dev/rfcommX serial port to the phone, and then then use pppd as you
+would with a normal modem.
+
+3. PAN
+
+The 'pand' tool allows you to use ethernet style networking over
+Bluetooth.  It creates a network interface on your machine that can be
+configured in the same way normal network devices are.
+
+For full details see the PAN HOWTO at
+<http://bluez.sourceforge.net/contrib/HOWTO-PAN>
+
+Keyboard and mouse support with hidd
+++++++++++++++++++++++++++++++++++++
+The hidd daemon allows keyboards and mice to be connected to your system.
+Make sure you have hidd starting at boot as user root.
+Discover you mouse or keyboard bluetooth address (bdaddr) by running
+"hcitool scan".  You must then connect to your keyboard or mouse using hidd
+--connect <bdaddr>.  On first connection, pairing is likely and you should
+press "connect" button on mice/keyboard, if any.  Mice normally have a
+preset PIN which should be in the manufacturer's documentation, try 0000.
+For keyboards, type the PIN on the Bluetooth keyboard and hit enter, and
+then supply it to the passkey agent (using a cable-attached keyboard).  In
+future your keyboard or mouse should reconnect to your computer
+automatically.  You must invoke hidd as root.
--- bluez-4.42.orig/debian/libbluetooth3.symbols
+++ bluez-4.42/debian/libbluetooth3.symbols
@@ -0,0 +1,193 @@
+libbluetooth.so.3 libbluetooth3 #MINVER#
+ ba2oui@Base 4.40
+ ba2str@Base 4.40
+ bachk@Base 4.40
+ bafprintf@Base 4.40
+ baprintf@Base 4.40
+ basnprintf@Base 4.40
+ basprintf@Base 4.40
+ baswap@Base 4.40
+ batostr@Base 4.40
+ bt_compidtostr@Base 4.40
+ bt_error@Base 4.40
+ bt_free@Base 4.40
+ bt_malloc@Base 4.40
+ hci_authenticate_link@Base 4.40
+ hci_change_link_key@Base 4.40
+ hci_close_dev@Base 4.40
+ hci_cmdtostr@Base 4.40
+ hci_commandstostr@Base 4.40
+ hci_create_connection@Base 4.40
+ hci_delete_stored_link_key@Base 4.40
+ hci_devba@Base 4.40
+ hci_devid@Base 4.40
+ hci_devinfo@Base 4.40
+ hci_dflagstostr@Base 4.40
+ hci_disconnect@Base 4.40
+ hci_dtypetostr@Base 4.40
+ hci_encrypt_link@Base 4.40
+ hci_exit_park_mode@Base 4.40
+ hci_for_each_dev@Base 4.40
+ hci_get_route@Base 4.40
+ hci_inquiry@Base 4.40
+ hci_lmtostr@Base 4.40
+ hci_lptostr@Base 4.40
+ hci_open_dev@Base 4.40
+ hci_park_mode@Base 4.40
+ hci_ptypetostr@Base 4.40
+ hci_read_afh_map@Base 4.40
+ hci_read_afh_mode@Base 4.40
+ hci_read_bd_addr@Base 4.40
+ hci_read_class_of_dev@Base 4.40
+ hci_read_clock@Base 4.40
+ hci_read_clock_offset@Base 4.40
+ hci_read_current_iac_lap@Base 4.40
+ hci_read_ext_inquiry_response@Base 4.40
+ hci_read_inquiry_mode@Base 4.40
+ hci_read_inquiry_scan_type@Base 4.40
+ hci_read_inquiry_transmit_power_level@Base 4.40
+ hci_read_link_policy@Base 4.40
+ hci_read_link_quality@Base 4.40
+ hci_read_link_supervision_timeout@Base 4.40
+ hci_read_local_commands@Base 4.40
+ hci_read_local_ext_features@Base 4.40
+ hci_read_local_features@Base 4.40
+ hci_read_local_name@Base 4.40
+ hci_read_local_oob_data@Base 4.40
+ hci_read_local_version@Base 4.40
+ hci_read_remote_ext_features@Base 4.40
+ hci_read_remote_features@Base 4.40
+ hci_read_remote_name@Base 4.40
+ hci_read_remote_name_cancel@Base 4.40
+ hci_read_remote_name_with_clock_offset@Base 4.40
+ hci_read_remote_version@Base 4.40
+ hci_read_rssi@Base 4.40
+ hci_read_simple_pairing_mode@Base 4.40
+ hci_read_stored_link_key@Base 4.40
+ hci_read_transmit_power_level@Base 4.40
+ hci_read_voice_setting@Base 4.40
+ hci_scoptypetostr@Base 4.40
+ hci_send_cmd@Base 4.40
+ hci_send_req@Base 4.40
+ hci_set_afh_classification@Base 4.40
+ hci_strtolm@Base 4.40
+ hci_strtolp@Base 4.40
+ hci_strtoptype@Base 4.40
+ hci_strtoscoptype@Base 4.40
+ hci_strtover@Base 4.40
+ hci_switch_role@Base 4.40
+ hci_vertostr@Base 4.40
+ hci_write_afh_mode@Base 4.40
+ hci_write_class_of_dev@Base 4.40
+ hci_write_current_iac_lap@Base 4.40
+ hci_write_ext_inquiry_response@Base 4.40
+ hci_write_inquiry_mode@Base 4.40
+ hci_write_inquiry_scan_type@Base 4.40
+ hci_write_inquiry_transmit_power_level@Base 4.40
+ hci_write_link_policy@Base 4.40
+ hci_write_link_supervision_timeout@Base 4.40
+ hci_write_local_name@Base 4.40
+ hci_write_simple_pairing_mode@Base 4.40
+ hci_write_stored_link_key@Base 4.40
+ hci_write_voice_setting@Base 4.40
+ lmp_featurestostr@Base 4.40
+ lmp_strtover@Base 4.40
+ lmp_vertostr@Base 4.40
+ sdp_append_to_buf@Base 4.40
+ sdp_append_to_pdu@Base 4.40
+ sdp_attr_add@Base 4.40
+ sdp_attr_add_new@Base 4.40
+ sdp_attr_remove@Base 4.40
+ sdp_attr_replace@Base 4.40
+ sdp_attrid_comp_func@Base 4.40
+ sdp_close@Base 4.40
+ sdp_connect@Base 4.40
+ sdp_copy_record@Base 4.40
+ sdp_create@Base 4.40
+ sdp_data_alloc@Base 4.40
+ sdp_data_alloc_with_length@Base 4.40
+ sdp_data_free@Base 4.40
+ sdp_data_get@Base 4.40
+ sdp_device_record_register@Base 4.40
+ sdp_device_record_register_binary@Base 4.40
+ sdp_device_record_unregister@Base 4.40
+ sdp_device_record_unregister_binary@Base 4.40
+ sdp_device_record_update@Base 4.40
+ sdp_device_record_update_binary@Base 4.40
+ sdp_extract_attr@Base 4.40
+ sdp_extract_pdu@Base 4.40
+ sdp_extract_seqtype@Base 4.40
+ sdp_gen_pdu@Base 4.40
+ sdp_gen_record_pdu@Base 4.40
+ sdp_gen_tid@Base 4.40
+ sdp_general_inquiry@Base 4.40
+ sdp_get_access_protos@Base 4.40
+ sdp_get_add_access_protos@Base 4.40
+ sdp_get_database_state@Base 4.40
+ sdp_get_error@Base 4.40
+ sdp_get_group_id@Base 4.40
+ sdp_get_int_attr@Base 4.40
+ sdp_get_lang_attr@Base 4.40
+ sdp_get_profile_descs@Base 4.40
+ sdp_get_proto_desc@Base 4.40
+ sdp_get_proto_port@Base 4.40
+ sdp_get_record_state@Base 4.40
+ sdp_get_server_ver@Base 4.40
+ sdp_get_service_avail@Base 4.40
+ sdp_get_service_id@Base 4.40
+ sdp_get_service_ttl@Base 4.40
+ sdp_get_socket@Base 4.40
+ sdp_get_string_attr@Base 4.40
+ sdp_get_uuidseq_attr@Base 4.40
+ sdp_list_append@Base 4.40
+ sdp_list_free@Base 4.40
+ sdp_list_insert_sorted@Base 4.40
+ sdp_list_remove@Base 4.40
+ sdp_pattern_add_uuid@Base 4.40
+ sdp_pattern_add_uuidseq@Base 4.40
+ sdp_process@Base 4.40
+ sdp_profile_uuid2strn@Base 4.40
+ sdp_proto_uuid2strn@Base 4.40
+ sdp_record_alloc@Base 4.40
+ sdp_record_free@Base 4.40
+ sdp_record_print@Base 4.40
+ sdp_record_register@Base 4.40
+ sdp_record_unregister@Base 4.40
+ sdp_record_update@Base 4.40
+ sdp_send_req_w4_rsp@Base 4.40
+ sdp_seq_alloc@Base 4.40
+ sdp_seq_alloc_with_length@Base 4.40
+ sdp_seq_append@Base 4.40
+ sdp_service_attr_async@Base 4.40
+ sdp_service_attr_req@Base 4.40
+ sdp_service_search_async@Base 4.40
+ sdp_service_search_attr_async@Base 4.40
+ sdp_service_search_attr_req@Base 4.40
+ sdp_service_search_req@Base 4.40
+ sdp_set_access_protos@Base 4.40
+ sdp_set_add_access_protos@Base 4.40
+ sdp_set_attrid@Base 4.40
+ sdp_set_group_id@Base 4.40
+ sdp_set_info_attr@Base 4.40
+ sdp_set_lang_attr@Base 4.40
+ sdp_set_notify@Base 4.40
+ sdp_set_profile_descs@Base 4.40
+ sdp_set_seq_len@Base 4.40
+ sdp_set_service_id@Base 4.40
+ sdp_set_url_attr@Base 4.40
+ sdp_set_uuidseq_attr@Base 4.40
+ sdp_svclass_uuid2strn@Base 4.40
+ sdp_uuid128_cmp@Base 4.40
+ sdp_uuid128_create@Base 4.40
+ sdp_uuid128_to_uuid@Base 4.40
+ sdp_uuid16_cmp@Base 4.40
+ sdp_uuid16_create@Base 4.40
+ sdp_uuid16_to_uuid128@Base 4.40
+ sdp_uuid2strn@Base 4.40
+ sdp_uuid32_create@Base 4.40
+ sdp_uuid32_to_uuid128@Base 4.40
+ sdp_uuid_extract@Base 4.40
+ sdp_uuid_to_proto@Base 4.40
+ sdp_uuid_to_uuid128@Base 4.40
+ str2ba@Base 4.40
+ strtoba@Base 4.40
--- bluez-4.42.orig/debian/bluez.docs
+++ bluez-4.42/debian/bluez.docs
@@ -0,0 +1,2 @@
+*/*-api.txt
+debian/README.Debian
--- bluez-4.42.orig/debian/bluez.dirs
+++ bluez-4.42/debian/bluez.dirs
@@ -0,0 +1 @@
+usr/bin
--- bluez-4.42.orig/debian/bluez.preinst
+++ bluez-4.42/debian/bluez.preinst
@@ -0,0 +1,62 @@
+#!/bin/sh -e
+
+# snippet from http://www.dpkg.org/dpkg/ConffileHandling
+
+# Prepare to move a conffile without triggering a dpkg question
+prep_mv_conffile() {
+    CONFFILE="$1"
+
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
+        if [ "$md5sum" = "$old_md5sum" ]; then
+            rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+# Remove a no-longer used conffile
+rm_conffile() {
+    PKGNAME="$1"
+    CONFFILE="$2"
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+            echo "Saving as $CONFFILE.dpkg-bak ..."
+            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+        else
+            echo "Removing obsolete conffile $CONFFILE ..."
+            rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "3.7-1"; then
+        prep_mv_conffile "/etc/dbus-1/system.d/bluez-hcid.conf"
+    fi
+
+    if dpkg --compare-versions "$2" le "3.30-1"; then
+        rm_conffile bluez-utils "/etc/bluetooth/network.service"
+        rm_conffile bluez-utils "/etc/bluetooth/serial.service"
+        rm_conffile bluez-utils "/etc/bluetooth/input.service"
+    fi
+    
+    # now that modprobe whines remove this old conffile, will be
+    # http://bugs.debian.org/523050
+    base="/etc/modprobe.d/bluez"
+    rm_conffile "$base"
+    if [ -e "$base.dpkg-bak" ]; then
+        if [ -e "$base.conf" ]; then
+            echo "$base.conf exists, not touching"
+        else
+            echo "Moving $base.dpkg-bak to $base.conf"
+            mv -f "$base.dpkg-bak" "$base.conf"
+        fi
+    fi
+esac
+
+#DEBHELPER#
--- bluez-4.42.orig/debian/bluez-pcmcia-support.install
+++ bluez-4.42/debian/bluez-pcmcia-support.install
@@ -0,0 +1 @@
+scripts/bluetooth_serial /lib/udev
--- bluez-4.42.orig/debian/bluez-utils.postrm
+++ bluez-4.42/debian/bluez-utils.postrm
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+#Dummy transitional postrm script
+#Don't do anything.
+
+#DEBHELPER#
--- bluez-4.42.orig/debian/bluez.bluetooth.default
+++ bluez-4.42/debian/bluez.bluetooth.default
@@ -0,0 +1,20 @@
+# Defaults for bluez
+
+# start bluetooth on boot?
+# compatibility note: if this variable is _not_ found bluetooth will start
+BLUETOOTH_ENABLED=1
+
+# This setting used to switch HID devices (e.g mouse/keyboad) to HCI mode, that
+# is you will have bluetooth functionality from your dongle instead of only
+# HID. This is accomplished for supported devices by udev in
+# /lib/udev/rules.d/62-bluez-hid2hci.rules by invoking hid2hci with correct
+# parameters.
+# See /usr/share/doc/bluez/NEWS.Debian.gz for further information.
+
+# Older daemons like pand dund and hidd can be found in bluez-compat package as
+# they are deprecated and provided for backward compatibility only.
+
+# Note that not every bluetooth dongle is capable of switching back to HID mode,
+# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=355497
+HID2HCI_ENABLED=0
+HID2HCI_UNDO=0
--- bluez-4.42.orig/debian/rules
+++ bluez-4.42/debian/rules
@@ -0,0 +1,76 @@
+#!/usr/bin/make -f
+# build rules for bluez
+
+include /usr/share/cdbs/1/rules/buildcore.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+DEB_UPDATE_RCD_PARAMS = "start 25 2 3 4 5 . stop 74 0 1 6 ."
+DEB_DH_INSTALLINIT_ARGS = "--name=bluetooth"
+DEB_CONFIGURE_EXTRA_FLAGS := --enable-gstreamer \
+                             --enable-alsa \
+                             --enable-usb \
+                             --enable-netlink \
+                             --enable-tools \
+                             --enable-test \
+                             --enable-bccmd \
+                             --enable-hid2hci \
+                             --enable-dfutool \
+                             --enable-cups \
+                             --enable-manpages \
+                             --enable-pcmciarules \
+                             --enable-debug \
+                             --enable-hidd \
+                             --enable-pand \
+                             --enable-dund
+
+
+DEB_DESTDIR := $(CURDIR)/debian/tmp
+
+#install/bluetooth::
+	#install -D -m 0644 $(CURDIR)/debian/bluetooth.override $(CURDIR)/debian/bluetooth/usr/share/lintian/overrides/bluetooth
+
+install/bluez::
+	# conf files
+	install -D -m 0644 $(CURDIR)/input/input.conf $(CURDIR)/debian/bluez/etc/bluetooth/input.conf
+	install -D -m 0644 $(CURDIR)/audio/audio.conf $(CURDIR)/debian/bluez/etc/bluetooth/audio.conf
+	install -D -m 0644 $(CURDIR)/network/network.conf $(CURDIR)/debian/bluez/etc/bluetooth/network.conf
+	
+	# udev rules, actually upstream version is changed with
+	# sed -i 's@RUN+="/usr/sbin/hid2hci@RUN+="/lib/udev/bluez@' scripts/bluetooth-hid2hci.rules
+	# and the diff is in debian/patches/010_udev_rules_agent.patch
+	install -D -m 0644 $(CURDIR)/scripts/bluetooth-hid2hci.rules $(CURDIR)/debian/bluez/lib/udev/rules.d/62-bluez-hid2hci.rules
+	install -D -m 0755 $(CURDIR)/debian/bluez_agent.udev $(CURDIR)/debian/bluez/lib/udev/bluez
+
+	# misc
+	install -D -m 0755 $(CURDIR)/test/agent $(CURDIR)/debian/bluez/usr/bin/bluetooth-agent
+	install -D -m 0644 $(CURDIR)/debian/README.examples $(CURDIR)/debian/bluez/usr/share/doc/bluez/examples/README
+	mv $(DEB_DESTDIR)/usr/share/man/man1/l2ping.1 $(DEB_DESTDIR)/usr/share/man/man8/l2ping.8
+
+#install/bluez-utils::
+	#install -D -m 0644 $(CURDIR)/debian/bluez-utils.override $(CURDIR)/debian/bluez-utils/usr/share/lintian/overrides/bluez-utils
+
+install/bluez-alsa::
+	install -D -m 0644 $(CURDIR)/audio/bluetooth.conf $(CURDIR)/debian/bluez-alsa/usr/share/alsa/bluetooth.conf
+
+install/bluez-pcmcia-support::
+	cp -f $(CURDIR)/scripts/bluetooth-serial.rules $(CURDIR)/debian/bluez-pcmcia-support.udev
+
+binary-install/bluez-compat::
+	for d in pand dund hidd; do \
+		mv -v $(CURDIR)/debian/bluez/usr/bin/$$d $(CURDIR)/debian/bluez-compat/usr/bin/;\
+		mv -v $(CURDIR)/debian/bluez/usr/share/man/man1/$$d* $(CURDIR)/debian/bluez-compat/usr/share/man/man1/;\
+	done
+
+binary-install/bluez-gstreamer::
+	LD_LIBRARY_PATH="$(CURDIR)/debian/tmp/usr/lib:$(LD_LIBRARY_PATH)" dh_gstscancodecs -pbluez-gstreamer
+
+binary-install/bluez::
+	install -D -m 0644 $(CURDIR)/debian/bluetooth-dbus.conf $(CURDIR)/debian/bluez/etc/dbus-1/system.d/bluetooth.conf
+
+binary-install/bluez-pcmcia-support::
+	chmod a+x $(CURDIR)/debian/bluez-pcmcia-support/lib/udev/bluetooth_serial
+
+clean::
+	-rm -f $(CURDIR)/debian/bluez-pcmcia-support.udev
--- bluez-4.42.orig/debian/source.lintian-overrides
+++ bluez-4.42/debian/source.lintian-overrides
@@ -0,0 +1,5 @@
+# transitional packages
+bluez source: debhelper-but-no-misc-depends bluez-utils
+bluez source: debhelper-but-no-misc-depends bluez-audio
+# metapackage
+bluez source: debhelper-but-no-misc-depends bluetooth
--- bluez-4.42.orig/debian/libbluetooth-dev.install
+++ bluez-4.42/debian/libbluetooth-dev.install
@@ -0,0 +1,5 @@
+debian/tmp/usr/include/*
+debian/tmp/usr/lib/lib*.so
+debian/tmp/usr/lib/*.la
+debian/tmp/usr/lib/pkgconfig/*
+debian/tmp/usr/lib/bluetooth/plugins/*.la
--- bluez-4.42.orig/debian/NEWS
+++ bluez-4.42/debian/NEWS
@@ -0,0 +1,176 @@
+bluez-utils (4.40-3) unstable; urgency=low
+
+  This version requires users to be in bluetooth group to be allowed to send
+  messages via dbus or be users in front of the computer (see consolekit for
+  example). The group was previously netdev and has been changed to allow for
+  more granularity.
+
+ -- Filippo Giunchedi <filippo@debian.org>  Fri, 19 Jun 2009 12:49:33 +0200
+
+bluez-utils (4.40-1) unstable; urgency=low
+
+  This version includes a new hid2hci program which expects the vendor ID and
+  product ID of the device to be switched to HID/HCI mode, this means the
+  switching is no longer done in init script but via udev rules for supported
+  devices. Adding new devices can be done by dropping rules into
+  /etc/udev/rules.d/ similar to ones found in
+  /lib/udev/rules.d/62-bluez-hid2hci.rules or by manually running hid2hci, see
+  hid2hci(8) manpage for further information.
+
+  This version also ships a simple commandline agent (bluetooth-agent) to do
+  pairing on the command line 
+
+ -- Filippo Giunchedi <filippo@debian.org>  Fri, 22 May 2009 15:21:35 +0200
+
+bluez-utils (3.36-3) unstable; urgency=low
+
+  This version includes an new d-bus policy with updated access control.
+  As a result of this, only users of netdev group or which are in front of the
+  computer (i.e. match the at_console="true" rule) are able to communicate
+  with hcid via dbus. See also #510644.
+
+ -- Filippo Giunchedi <filippo@debian.org>  Thu, 08 Jan 2009 18:35:38 +0100
+
+bluez-utils (3.30-2) unstable; urgency=low
+
+  This upstream version switches the service infrastructure from external
+  processes to shared objects. Services (i.e. audio) are started automatically
+  and do not require a .service file in /etc/bluetooth/. audio.service will be
+  removed automatically by the upgrade unless modified.
+
+ -- Filippo Giunchedi <filippo@debian.org>  Mon, 14 Apr 2008 17:34:21 +0200
+
+bluez-utils (3.7-1) unstable; urgency=low
+
+  This version reverts the /etc/bluetooth/passkeys infrastructure as agents for
+  passkeys are not supposed to be system-wide.
+  A bluez-passkey-gnome is provided as a passkey agent, plus there's a example
+  passkey-agent in /usr/share/doc/bluez-utils/examples/passkey-agent.c 
+
+ -- Filippo Giunchedi <filippo@debian.org>  Sat,  7 Oct 2006 11:43:09 +0200
+
+bluez-utils (3.1-3) unstable; urgency=low
+
+  This version includes a new management for outgoing passkey (PIN) requests
+  while the incoming passkeys defaults to 1234 in /etc/bluetooth/hcid.conf.
+  See README.Debian for further informations. 
+
+ -- Filippo Giunchedi <filippo@debian.org>  Wed, 26 Jul 2006 11:37:14 +0200
+
+bluez-utils (3.1-1) unstable; urgency=low
+
+  This new upstream version removes the need for external pin helper, pin
+  requests are handled via dbus.  The default pin (or now-called "passkey") is
+  set to 1234 for backward compatibility.
+
+  Also, udev rules for pcmcia card are included along with
+  /lib/udev/bluetooth.sh (setserial required) in the bluez-pcmcia-support.
+
+ -- Filippo Giunchedi <filippo@debian.org>  Wed, 26 Jul 2006 11:37:02 +0200
+
+bluez-utils (2.24-1) unstable; urgency=low
+
+  This version moves /etc/{init.d,default}/bluez-utils to
+  /etc/{init.d,default}/bluetooth for LSB compilance.
+  If local modifications are detected the new files will be installed with
+  the ".dpkg-new" suffix
+
+ -- Filippo Giunchedi <filippo@debian.org>  Wed,  7 Jun 2006 13:57:35 +0200
+
+bluez-utils (2.19-1) unstable; urgency=high
+
+  * Includes new D-BUS support: sends signals for inquiry results and
+    remote name resolves.
+
+  * Also adds support for device-specific SDP records.
+
+ -- Edd Dumbill <ejad@debian.org>  Fri, 19 Aug 2005 01:12:02 +0100
+
+bluez-utils (2.9-1) unstable; urgency=low
+
+  * This release improves input device support: EPoX keyboards and
+    their new HID presenters should now work correctly in report
+    protocol mode.
+
+ -- Edd Dumbill <ejad@debian.org>  Sun,  8 Aug 2004 15:19:24 +0100
+
+bluez-utils (2.8-1) unstable; urgency=low
+
+  * Users of dongles with HID proxy capability (this is where the dongle
+    pretends to be a keyboard and mouse until it is switched into Bluetooth
+    mode, allowing Bluetooth input devices to be used in BIOS etc.) are
+    now supported.  The switch is made as part of the bluez-utils init
+    script.
+
+ -- Edd Dumbill <ejad@debian.org>  Mon, 14 Jun 2004 14:24:12 +0100
+
+bluez-utils (2.7-1) experimental; urgency=low
+
+  * Upstream has merged bluez-pan with this package.  You should
+    remove the /etc/init.d/bluez-pan script, and use 
+    /etc/default/bluez-utils to configure dund and pand, although
+    for the moment the old /etc/default/bluez-pan is also read.
+
+  * This source package now has Bluetooth printing support, which
+    is built into the bluez-cups binary package.
+
+  * DBUS support has been enabled in this build.  To use it, add
+    'dbus_pin_helper' into the options section, and comment out
+    the pin_helper.  DBUS-aware pin helpers such as that in
+    bluez-pin will now be used.
+
+  * Bluetooth HID devices (eg, mouse, keyboard) are now supported
+    for Linux 2.6.6 or better running the hidp patch from bluez.org.
+    If running these, set HIDD_ENABLED to 1 in /etc/default/bluez-utils
+    to enable support, then run hidd --connect <bdaddr> to connect
+    to your keyboard or mouse.
+
+ -- Edd Dumbill <ejad@debian.org>  Wed, 26 May 2004 12:43:08 +0100
+
+bluez-utils (2.6-1) experimental; urgency=low
+
+  * Upstream has merged bluez-sdp with this package. The sdp tools
+    are now in this package.  You should remove the /etc/init.d/bluez-sdp
+    script.
+
+  * All tools from /sbin now live in /usr/sbin: hciattach hciconfig
+    hcid l2ping.
+
+ -- Edd Dumbill <ejad@debian.org>  Thu,  6 May 2004 11:58:16 +0100
+
+bluez-utils (2.4-4) unstable; urgency=high
+
+  * If you still use the old 'bluepin' PIN assistant: note it has moved
+    from /bin/ to /usr/bin/.  You will need to update your hcid.conf
+    accordingly.  Even better, install bluez-pin and use the helper from
+    there instead.
+  * hcitool has also moved to /usr/bin, and l2ping to /sbin.
+
+ -- Edd Dumbill <ejad@debian.org>  Wed, 15 Jan 2004 18:37:32 +0000
+
+bluez-utils (2.4-3) unstable; urgency=low
+
+  * If you're using devfsd and a recent Linux kernel (2.4.22 or later, or
+    2.6.x), remove the file /etc/devfs/devices.d/bluez and run update-devfsd.
+    This will stop your system complaining when devfsd is started.  This
+    package no longer installs that file, but you must remove it yourself.
+    If you need it in future, you can find it in /usr/share/doc/bluez-utils.
+
+ -- Edd Dumbill <ejad@debian.org>  Wed, 14 Jan 2004 21:14:35 +0000
+
+bluez-utils (2.4-1) unstable; urgency=low
+
+  * The rfcomm program has changed slightly: you now need a "bind yes"
+    in each entry in /etc/bluetooth/rfcomm.conf to ensure they are bound
+    at startup time.  See man rfcomm for more details.
+
+ -- Edd Dumbill <ejad@debian.org>  Thu,  1 Jan 2004 18:38:35 +0100
+
+bluez-utils (2.3-2) unstable; urgency=low
+
+  * This package now depends on a new PIN helper bluez-pin.  If you are
+    upgrading this package and want to use the new helper instead of the
+    default one (highly recommended) then alter your pin_helper line in
+    /etc/bluetooth/hcid.conf to specify /usr/bin/bluez-pin.
+
+ -- Edd Dumbill <ejad@debian.org>  Thu, 28 Aug 2003 12:38:35 +0100
--- bluez-4.42.orig/debian/bluez-compat.dirs
+++ bluez-4.42/debian/bluez-compat.dirs
@@ -0,0 +1,2 @@
+usr/bin
+usr/share/man/man1
--- bluez-4.42.orig/debian/copyright
+++ bluez-4.42/debian/copyright
@@ -0,0 +1,111 @@
+This package was debianized by Edd Dumbill <edd@usefulinc.com> on
+Sat, 13 Apr 2002 16:09:02 +0100.
+
+It was downloaded from http://www.bluez.org/
+
+BlueZ - Bluetooth protocol stack for Linux
+
+Copyright:
+	Copyright (C) 2001-2009  Marcel Holtmann <marcel@holtmann.org>
+	Copyright (C) 2006-2009  Nokia Corporation
+	Copyright (C) 2000-2003  Maxim Krasnyansky <maxk@qualcomm.com>
+	Copyright (C) 2002-2003  Jean Tourrilhes <jt@hpl.hp.com>
+	Copyright (C) 2007-2008  Frederic Dalleau <fdalleau@free.fr>
+	Copyright (C) 2007-2008  Texas Instruments, Inc.
+	Copyright (C) 2000-2005  CSR Ltd.
+	Copyright (C) 2005-2008  Brad Midgley <bmidgley@xmission.com>
+	Copyright (C) 2007-2008  David Stockwell <dstockwell@frequency-one.com>
+	Copyright (C) 2007-2008  Fabien Chevalier <fabchevalier@free.fr>
+	Copyright (C) 2005-2006  Claudio Takahasi <claudio.takahasi@indt.org.br>
+	Copyright (C) 2006-2007  Luiz von Dentz <luiz.dentz@indt.org.br>
+	Copyright (C) 2005-2007  Johan Hedberg <johan.hedberg@nokia.com>
+	Copyright (C) 2005-2006  Brad Midgley <bmidgley@xmission.com>
+	Copyright (C) 2004-2005  Henryk Ploetz <henryk@ploetzli.ch>
+	Copyright (C) 2002-2003  Stephen Crane <steve.crane@rococosoft.com>
+	Copyright (C) 2000-2001  Qualcomm Incorporated
+	Copyright (C) 2008	Joao Paulo Rechi Vita
+	Copyright (C) 2009	Lennart Poettering
+	Copyright (C) 2004	Scott James Remnant <scott@netsplit.com>.
+
+License:
+	audio/
+		a2dp.c a2dp.h avdtp.c avdtp.h control.c control.h device.c device.h
+		gateway.c gateway.h headset.c headset.h main.c manager.c manager.h
+		sink.c sink.h telephony-dummy.c telephony-maemo.c telephony.h
+		unix.c unix.h
+
+		License: GPL version 2 or any later version
+
+		gsta2dpsink.c gsta2dpsink.h gstavdtpsink.c
+		gstavdtpsink.h gstbluetooth.c gstrtpsbcpay.c gstrtpsbcpay.h
+		gstsbcdec.c gstsbcdec.h gstsbcenc.c gstsbcenc.h
+		gstsbcparse.c gstsbcparse.h gstsbcutil.c gstsbcutil.h
+		pcm_bluetooth.c gstbluetooth.c: ctl_bluetooth.c
+		ipc.c ipc.h rtp.h
+		ipctest.c
+
+		License: LGPL version 2.1 or any later version
+
+	sbc/
+		formats.h sbcdec.c sbcenc.c sbcinfo.c
+		sbctester.c
+
+		License: GPL version 2 or any later version
+		
+		sbc.c sbc.h
+		sbc_math.h sbc_primitives.c sbc_primitives.h
+		sbc_primitives_mmx.c sbc_primitives_mmx.h sbc_primitives_neon.c
+		sbc_primitives_neon.h sbc_tables.h
+
+		License: LGPL version 2.1 or any later version
+
+	tools/
+		ubcsp.c ubcsp.h
+
+		License: MIT License
+   
+		Permission is hereby granted, free of charge, to any person
+		obtaining a copy of this software and associated documentation
+		files (the "Software"), to deal in the Software without
+		restriction, including without limitation the rights to use,
+		copy, modify, merge, publish, distribute, sublicense, and/or sell
+		copies of the Software, and to permit persons to whom the 
+		Software is furnished to do so, subject to the following
+		conditions:
+    
+		The above copyright notice and this permission notice shall be
+		included in all copies or substantial portions of the Software.
+
+		THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+		EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+		OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+		NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+		HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+		WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+		FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+		OTHER DEALINGS IN THE SOFTWARE.
+
+		avctrl.c bccmd.c avinfo.c
+		ciptool.c csr.c csr.h csr_3wire.c csr_bcsp.c csr_h4.c
+		csr_hci.c csr_usb.c dfu.c dfu.h dfubabel.c dfutool.c
+		hciattach.h hciattach_st.c hciattach_tialt.c hid2hci.c ppporc.c
+		hciattach_ti.c
+		hciattach.c hciconfig.c hcitool.c l2ping.c
+		hcisecfilter.c sdptool.c
+
+		License: GPL version 2 or any later version
+
+	doc/
+		All files.
+		
+		License: GFDL version 1.1 or any later version
+		No Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+
+	other:
+		License: GPL version 2 or any later version
+
+On Debian GNU/Linux systems, the complete text of the GNU General Public
+License can be found in `/usr/share/common-licenses/GPL', the GNU Lesser
+General Public License can be found in `/usr/share/common-licenses/LGPL' and
+the GNU Free Documentation License can be found in
+`/usr/share/common-licenses/GFDL'.
--- bluez-4.42.orig/debian/control
+++ bluez-4.42/debian/control
@@ -0,0 +1,135 @@
+Source: bluez
+Section: admin
+Priority: optional
+Maintainer: Debian Bluetooth Maintainers <pkg-bluetooth-maintainers@lists.alioth.debian.org>
+Uploaders: Filippo Giunchedi <filippo@debian.org>, Andres Salomon <dilinger@debian.org>
+Build-Depends: debhelper (>= 7),
+               autotools-dev,
+               cdbs,
+               flex,
+               bison,
+               gstreamer-tools,
+               libasound2-dev,
+               libdbus-1-dev,
+               libdbus-glib-1-dev,
+               libglib2.0-dev,
+               libgstreamer0.10-dev,
+               libgstreamer-plugins-base0.10-dev,
+               libnl-dev,
+               libsndfile1-dev,
+               libusb-dev,
+Vcs-Svn: svn://svn.debian.org/svn/pkg-bluetooth/packages/bluez/trunk
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk
+Homepage: http://www.bluez.org
+Standards-Version: 3.8.2
+
+Package: libbluetooth3
+Section: libs
+Conflicts: libsdp2 (<= 1.5-2)
+Replaces: libsdp2 (<= 1.5-2)
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Architecture: any
+Description: Library to use the BlueZ Linux Bluetooth stack
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: libbluetooth-dev
+Section: libdevel
+Provides: libbluetooth3-dev
+Conflicts: libbluetooth-dev, libsdp2-dev (<= 1.5.2), bluez-pan
+Replaces: libsdp2-dev (<= 1.5.2)
+Depends: libbluetooth3 (= ${binary:Version}), libc6-dev | libc-dev, ${misc:Depends}
+Suggests: pkg-config
+Priority: extra
+Architecture: any
+Description: Development files for using the BlueZ Linux Bluetooth library
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluetooth
+Architecture: all
+Depends: bluez
+Recommends: bluez-alsa, bluez-cups, bluez-gstreamer
+Description: Bluetooth support
+ This package provides all of the different plugins supported
+ by the Bluez bluetooth stack.
+
+Package: bluez
+Architecture: any
+Depends: ${shlibs:Depends}, module-init-tools, makedev | udev, lsb-base, dbus, ${misc:Depends}
+Replaces: bluez-input, bluez-network, bluez-serial, bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3)
+Conflicts: bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3)
+Suggests: python-gobject, python-dbus
+Description: Bluetooth tools and daemons
+ This package contains tools and system daemons for using Bluetooth devices.
+ .
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluez-alsa
+Replaces: bluez-audio
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, bluez
+Description: Bluetooth ALSA support
+ This package contains a driver operate with the ALSA stack.
+ .
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluez-gstreamer
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, bluez
+Replaces: bluez-audio
+Description: Bluetooth GStreamer support
+ This package contains a plugin to operate with GStreamer applications.
+ .
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluez-cups
+Architecture: any
+Depends: ${shlibs:Depends}, cups, ${misc:Depends}
+Description: Bluetooth printer driver for CUPS
+ This package contains a driver to let CUPS print to Bluetooth-connected
+ printers.
+ .
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluez-pcmcia-support
+Architecture: any
+Priority: extra
+Depends: pcmciautils, ${misc:Depends}
+Recommends: setserial
+Description: PCMCIA support files for BlueZ 2.0 Bluetooth tools
+ This package contains files to enable PCMCIA card services to recognise
+ and initialise PCMCIA Bluetooth devices.
+ .
+ BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
+ project distributed under GNU General Public License (GPL).
+
+Package: bluez-compat
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: BlueZ 3.x compatibility binaries
+ This package provides the legacy binaries that were reminiscent of the
+ BlueZ 3.x pairing methods.  These binaries are not supported, and will
+ go away again in the future. The provided binaries are:
+ .
+ hidd
+ dund
+ pand
+
+Package: bluez-utils
+Depends: bluetooth
+Architecture: all
+Description: Transitional package
+ This is a transitional package to assist with moving people to the
+ BlueZ 4.x stack.
+ 
+Package: bluez-audio
+Depends: bluez-alsa (>= 4), bluez-gstreamer (>= 4)
+Architecture: all
+Description: Transitional package
+ This is a transitional package to assist with moving people to the
+ BlueZ 4.x stack.
--- bluez-4.42.orig/debian/bluez-utils.lintian-overrides
+++ bluez-4.42/debian/bluez-utils.lintian-overrides
@@ -0,0 +1,2 @@
+# empty transitional postrm
+bluez-utils: maintainer-script-empty postrm
--- bluez-4.42.orig/debian/bluez.examples
+++ bluez-4.42/debian/bluez.examples
@@ -0,0 +1,5 @@
+test/simple-agent
+test/simple-service
+test/list-devices
+test/monitor-bluetooth
+test/test-*
--- bluez-4.42.orig/debian/bluez-cups.README.Debian
+++ bluez-4.42/debian/bluez-cups.README.Debian
@@ -0,0 +1,11 @@
+bluez-cups
+
+To configure a Bluetooth printer, set it up in CUPS like it was connected to
+your parallel or USB port. Then edit your /etc/cups/printers.conf and replace
+the device URI with a bluetooth one.
+
+The printer's URI will look something like this: bluetooth://00408C5E5DA4/spp
+If your printer uses HCRP (hardcopy cable replacement protocol) then remove
+the "/spp" from the end.  SPP is serial port protocol.
+
+ -- Edd Dumbill <ejad@debian.org>, Fri Jul 16 19:25:21 BST 2004
--- bluez-4.42.orig/debian/patches/005_l2ping_section.patch
+++ bluez-4.42/debian/patches/005_l2ping_section.patch
@@ -0,0 +1,8 @@
+--- bluez-utils-2.4.orig/tools/l2ping.1	2004-01-15 20:43:05.000000000 +0000
++++ bluez-utils-2.4/tools/l2ping.1	2004-01-15 20:42:13.000000000 +0000
+@@ -1,4 +1,4 @@
+-.TH L2PING 1 "Jan 22 2002" BlueZ "Linux System Administration"
++.TH L2PING 8 "Jan 22 2002" BlueZ "Linux System Administration"
+ .SH NAME
+ l2ping \- Send L2CAP echo request and receive answer
+ .SH SYNOPSIS
--- bluez-4.42.orig/debian/patches/001_agent_fixes.patch
+++ bluez-4.42/debian/patches/001_agent_fixes.patch
@@ -0,0 +1,328 @@
+diff --git a/test/agent.c b/test/agent.c
+index b256f52..cd3f6c5 100644
+--- a/test/agent.c
++++ b/test/agent.c
+@@ -70,20 +70,18 @@ static DBusHandlerResult agent_filter(DBusConnection *conn,
+ 	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ 
+-static DBusHandlerResult request_message(DBusConnection *conn,
++static DBusHandlerResult request_pincode_message(DBusConnection *conn,
+ 						DBusMessage *msg, void *data)
+ {
+ 	DBusMessage *reply;
+-	const char *path, *address;
+-	dbus_bool_t numeric;
++	const char *path;
+ 
+ 	if (!passkey)
+ 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ 
+ 	if (!dbus_message_get_args(msg, NULL,
+-			DBUS_TYPE_STRING, &path, DBUS_TYPE_STRING, &address,
+-			DBUS_TYPE_BOOLEAN, &numeric, DBUS_TYPE_INVALID)) {
+-		fprintf(stderr, "Invalid arguments for passkey Request method");
++			DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
++		fprintf(stderr, "Invalid arguments for RequestPinCode method");
+ 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ 	}
+ 
+@@ -99,7 +97,7 @@ static DBusHandlerResult request_message(DBusConnection *conn,
+ 		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ 	}
+ 
+-	printf("Passkey request for device %s\n", address);
++	printf("Pincode request for device %s\n", path);
+ 
+ 	dbus_message_append_args(reply, DBUS_TYPE_STRING, &passkey,
+ 					DBUS_TYPE_INVALID);
+@@ -114,20 +112,63 @@ send:
+ 	return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ 
+-static DBusHandlerResult cancel_message(DBusConnection *conn,
++static DBusHandlerResult request_passkey_message(DBusConnection *conn,
+ 						DBusMessage *msg, void *data)
+ {
+ 	DBusMessage *reply;
+-	const char *path, *address;
++	const char *path;
++	unsigned int int_passkey;
++
++	if (!passkey)
++		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++
+ 
+ 	if (!dbus_message_get_args(msg, NULL,
+-			DBUS_TYPE_STRING, &path, DBUS_TYPE_STRING, &address,
+-							DBUS_TYPE_INVALID)) {
++			DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
++		fprintf(stderr, "Invalid arguments for RequestPasskey method");
++		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++	}
++
++	if (do_reject) {
++		reply = dbus_message_new_error(msg,
++					"org.bluez.Error.Rejected", "");
++		goto send;
++	}
++
++	reply = dbus_message_new_method_return(msg);
++	if (!reply) {
++		fprintf(stderr, "Can't create reply message\n");
++		return DBUS_HANDLER_RESULT_NEED_MEMORY;
++	}
++
++	printf("Passkey request for device %s\n", path);
++
++	int_passkey = strtoul(passkey, NULL, 10);
++
++	dbus_message_append_args(reply, DBUS_TYPE_UINT32, &int_passkey,
++					DBUS_TYPE_INVALID);
++
++send:
++	dbus_connection_send(conn, reply, NULL);
++
++	dbus_connection_flush(conn);
++
++	dbus_message_unref(reply);
++
++	return DBUS_HANDLER_RESULT_HANDLED;
++}
++
++static DBusHandlerResult cancel_message(DBusConnection *conn,
++						DBusMessage *msg, void *data)
++{
++	DBusMessage *reply;
++
++	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_INVALID)) {
+ 		fprintf(stderr, "Invalid arguments for passkey Confirm method");
+ 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ 	}
+ 
+-	printf("Request canceled for device %s\n", address);
++	printf("Request canceled\n");
+ 
+ 	reply = dbus_message_new_method_return(msg);
+ 	if (!reply) {
+@@ -174,11 +215,50 @@ static DBusHandlerResult release_message(DBusConnection *conn,
+ 	return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ 
++static DBusHandlerResult authorize_message(DBusConnection *conn,
++						DBusMessage *msg, void *data)
++{
++	DBusMessage *reply;
++	const char *path, *uuid;
++
++	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
++			DBUS_TYPE_STRING, &uuid, DBUS_TYPE_INVALID)) {
++		fprintf(stderr, "Invalid arguments for Authorize method");
++		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++	}
++
++	if (do_reject) {
++		reply = dbus_message_new_error(msg,
++					"org.bluez.Error.Rejected", "");
++		goto send;
++	}
++
++	reply = dbus_message_new_method_return(msg);
++	if (!reply) {
++		fprintf(stderr, "Can't create reply message\n");
++		return DBUS_HANDLER_RESULT_NEED_MEMORY;
++	}
++
++	printf("Authorizing request for %s\n", path);
++
++send:
++	dbus_connection_send(conn, reply, NULL);
++
++	dbus_connection_flush(conn);
++
++	dbus_message_unref(reply);
++
++	return DBUS_HANDLER_RESULT_HANDLED;
++}
++
+ static DBusHandlerResult agent_message(DBusConnection *conn,
+ 						DBusMessage *msg, void *data)
+ {
+-	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "Request"))
+-		return request_message(conn, msg, data);
++	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "RequestPinCode"))
++		return request_pincode_message(conn, msg, data);
++
++	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "RequestPasskey"))
++		return request_passkey_message(conn, msg, data);
+ 
+ 	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "Cancel"))
+ 		return cancel_message(conn, msg, data);
+@@ -186,6 +266,9 @@ static DBusHandlerResult agent_message(DBusConnection *conn,
+ 	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "Release"))
+ 		return release_message(conn, msg, data);
+ 
++	if (dbus_message_is_method_call(msg, "org.bluez.Agent", "Authorize"))
++		return authorize_message(conn, msg, data);
++
+ 	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ 
+@@ -279,11 +362,89 @@ static int unregister_agent(DBusConnection *conn, const char *device_path,
+ 	return 0;
+ }
+ 
+-static char *get_device(const char *device)
++static int create_paired_device(DBusConnection *conn, const char *device_path,
++						const char *agent_path,
++						const char *capabilities, const char *target)
++{
++	dbus_bool_t success;
++	DBusMessage *msg;
++
++	msg = dbus_message_new_method_call("org.bluez", device_path,
++					"org.bluez.Adapter", "CreatePairedDevice");
++	if (!msg) {
++		fprintf(stderr, "Can't allocate new method call\n");
++		return -1;
++	}
++
++	dbus_message_append_args(msg, DBUS_TYPE_STRING, &target,
++					DBUS_TYPE_OBJECT_PATH, &agent_path,
++					DBUS_TYPE_STRING, &capabilities,
++							DBUS_TYPE_INVALID);
++
++	success = dbus_connection_send(conn, msg, NULL);
++
++	dbus_message_unref(msg);
++
++	if (!success) {
++		fprintf(stderr, "Not enough memory for message send\n");
++		return -1;
++	}
++
++	dbus_connection_flush(conn);
++
++	return 0;
++}
++
++static char *get_device(DBusConnection *conn, const char *device)
+ {
+-	char *path;
++	DBusMessage *msg, *reply;
++	DBusError err;
++	const char *tmppath;
++	char *path, *default_path = "/org/bluez/hci0";
+ 
+-	path = strdup("/org/bluez/hci0");
++	if (device) {
++		path = strdup(device);
++		return path;
++	}
++
++	msg = dbus_message_new_method_call("org.bluez", "/",
++					"org.bluez.Manager", "DefaultAdapter");
++
++	if (!msg) {
++		fprintf(stderr, "Can't allocate new method call\n");
++		return default_path;
++	}
++
++	dbus_error_init(&err);
++
++	reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
++
++	dbus_message_unref(msg);
++
++	if (!reply) {
++		fprintf(stderr, "Can't get default adapter, using default adapter\n");
++		if (dbus_error_is_set(&err)) {
++			fprintf(stderr, "%s\n", err.message);
++			dbus_error_free(&err);
++		}
++		return default_path;
++	}
++
++	if (!dbus_message_get_args(reply, &err,
++			DBUS_TYPE_OBJECT_PATH, &tmppath, DBUS_TYPE_INVALID)) {
++		fprintf(stderr, "Can't get reply arguments, using default adapter\n");
++		if (dbus_error_is_set(&err)) {
++			fprintf(stderr, "%s\n", err.message);
++			dbus_error_free(&err);
++		}
++		return default_path;
++	}
++
++	path = strdup(tmppath);
++
++	dbus_message_unref(reply);
++
++	dbus_connection_flush(conn);
+ 
+ 	return path;
+ }
+@@ -293,7 +454,7 @@ static void usage(void)
+ 	printf("Bluetooth agent ver %s\n\n", VERSION);
+ 
+ 	printf("Usage:\n"
+-		"\tagent [--device interface] [--path agent-path] <passkey>\n"
++		"\tagent [--device interface] [--path agent-path] <passkey> [<target_device>]\n"
+ 		"\n");
+ }
+ 
+@@ -312,7 +473,7 @@ int main(int argc, char *argv[])
+ 	struct sigaction sa;
+ 	DBusConnection *conn;
+ 	char match_string[128], default_path[128], *device_id = NULL;
+-	char *device_path = NULL, *agent_path = NULL;
++	char *device_path = NULL, *agent_path = NULL, *target = NULL;
+ 	int opt;
+ 
+ 	snprintf(default_path, sizeof(default_path),
+@@ -355,6 +516,9 @@ int main(int argc, char *argv[])
+ 
+ 	passkey = strdup(argv[0]);
+ 
++	if (argc > 1)
++		target = strdup(argv[1]);
++
+ 	if (!agent_path)
+ 		agent_path = strdup(default_path);
+ 
+@@ -365,11 +529,19 @@ int main(int argc, char *argv[])
+ 	}
+ 
+ 	if (!device_path)
+-		device_path = get_device(device_id);
++		device_path = get_device(conn, device_id);
+ 
+-	if (register_agent(conn, device_path, agent_path, capabilities) < 0) {
+-		dbus_connection_unref(conn);
+-		exit(1);
++	if (!target) {
++		if (register_agent(conn, device_path, agent_path, capabilities) < 0) {
++			dbus_connection_unref(conn);
++			exit(1);
++		}
++	} else {
++		if (create_paired_device(conn, device_path, agent_path,
++						capabilities, target) < 0) {
++			dbus_connection_unref(conn);
++			exit(1);
++		}
+ 	}
+ 
+ 	if (!dbus_connection_add_filter(conn, agent_filter, NULL, NULL))
+@@ -392,8 +564,10 @@ int main(int argc, char *argv[])
+ 			break;
+ 	}
+ 
+-	if (!__io_terminated)
+-		unregister_agent(conn, device_path, agent_path);
++	if (!__io_terminated) {
++		if (!target)
++			unregister_agent(conn, device_path, agent_path);
++	}
+ 
+ 	free(device_path);
+ 	free(agent_path);
--- bluez-4.42.orig/debian/patches/010_udev_rules_agent.patch
+++ bluez-4.42/debian/patches/010_udev_rules_agent.patch
@@ -0,0 +1,54 @@
+diff --git a/scripts/bluetooth-hid2hci.rules b/scripts/bluetooth-hid2hci.rules
+index 1b231d1..ced32ee 100644
+--- a/scripts/bluetooth-hid2hci.rules
++++ b/scripts/bluetooth-hid2hci.rules
+@@ -8,29 +8,29 @@
+ #   413c:8154
+ #   413c:8158
+ #   413c:8162
+-ACTION=="add", ENV{ID_VENDOR}=="413c", ENV{ID_CLASS}=="mouse", ATTRS{bmAttributes}=="e0", KERNEL=="mouse*", RUN+="/usr/sbin/hid2hci --method dell -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="413c", ENV{ID_CLASS}=="mouse", ATTRS{bmAttributes}=="e0", KERNEL=="mouse*", RUN+="/lib/udev/bluez --method dell -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+ 
+ # Logitech devices
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c703" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c704" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c705" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70a" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70b" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70c" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70e" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c713" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c714" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71b" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71c" RUN+="/usr/sbin/hid2hci --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c703" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c704" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c705" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70a" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70b" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70c" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c70e" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c713" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c714" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71b" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="046d", ENV{ID_MODEL}=="c71c" RUN+="/lib/udev/bluez --method logitech -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+ 
+ # CSR devices (in HID mode)
+-ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+-ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="1000" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="1000" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="1000" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
++ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="1000" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hci"
+ 
+ # CSR devices (in HCI mode)
+-#ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="0001" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+-#ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="003f" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+-#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8203" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+-#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8204" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
+-#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8207" RUN+="/usr/sbin/hid2hci --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
++#ACTION=="add", ENV{ID_VENDOR}=="0a12", ENV{ID_MODEL}=="0001" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
++#ACTION=="add", ENV{ID_VENDOR}=="0458", ENV{ID_MODEL}=="003f" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
++#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8203" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
++#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8204" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
++#ACTION=="add", ENV{ID_VENDOR}=="05ac", ENV{ID_MODEL}=="8207" RUN+="/lib/udev/bluez --method csr -v $env{ID_VENDOR} -p $env{ID_MODEL} --mode hid"
--- bluez-4.42.orig/debian/patches/002_a2dpsink_marginal.patch
+++ bluez-4.42/debian/patches/002_a2dpsink_marginal.patch
@@ -0,0 +1,12 @@
+diff --git a/audio/gsta2dpsink.c b/audio/gsta2dpsink.c
+index b6df119..0753f38 100644
+--- a/audio/gsta2dpsink.c
++++ b/audio/gsta2dpsink.c
+@@ -698,6 +698,6 @@ static void gst_a2dp_sink_init(GstA2dpSink *self,
+ gboolean gst_a2dp_sink_plugin_init(GstPlugin *plugin)
+ {
+ 	return gst_element_register(plugin, "a2dpsink",
+-			GST_RANK_PRIMARY, GST_TYPE_A2DP_SINK);
++			GST_RANK_MARGINAL, GST_TYPE_A2DP_SINK);
+ }
+ 
