summaryrefslogtreecommitdiff
path: root/meta/packages/bluez
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/bluez')
-rw-r--r--meta/packages/bluez/bluez-hcidump_1.32.bb13
-rw-r--r--meta/packages/bluez/bluez-libs_3.4.bb22
-rw-r--r--meta/packages/bluez/bluez-utils-dbus/dbus-2.24.patch53
-rw-r--r--meta/packages/bluez/bluez-utils-dbus/dbus.patch58
-rw-r--r--meta/packages/bluez/bluez-utils-dbus/hcid-alignment-fix.patch42
-rw-r--r--meta/packages/bluez/bluez-utils-dbus/hcid.conf72
-rw-r--r--meta/packages/bluez/bluez-utils-dbus/smash.patch11
-rw-r--r--meta/packages/bluez/bluez-utils.inc60
-rw-r--r--meta/packages/bluez/bluez-utils/02dtl1_cs.sh57
-rw-r--r--meta/packages/bluez/bluez-utils/hciattach-ti-bts.patch489
-rw-r--r--meta/packages/bluez/bluez-utils/hcid.conf57
-rw-r--r--meta/packages/bluez/bluez-utils_3.4.bb53
-rw-r--r--meta/packages/bluez/files/02dtl1_cs.sh57
-rw-r--r--meta/packages/bluez/files/base.patch33
-rw-r--r--meta/packages/bluez/files/blueboxes.patch18
-rw-r--r--meta/packages/bluez/files/bluetooth.conf13
-rw-r--r--meta/packages/bluez/files/bluetooth.default37
-rw-r--r--meta/packages/bluez/files/default-manfid-0x0-to-bcps.patch22
-rw-r--r--meta/packages/bluez/files/hciattach-ti-bts.patch489
-rw-r--r--meta/packages/bluez/files/hciattach_devlength.patch11
-rw-r--r--meta/packages/bluez/files/hcid.conf72
-rw-r--r--meta/packages/bluez/files/no-user-include.patch18
-rw-r--r--meta/packages/bluez/files/openmn/bluetooth.default37
-rw-r--r--meta/packages/bluez/files/openmn/hcid.conf70
-rw-r--r--meta/packages/bluez/files/openzaurus/bluetooth.default37
-rw-r--r--meta/packages/bluez/files/slugos/bluetooth.default37
-rw-r--r--meta/packages/bluez/files/slugos/hcid.conf70
27 files changed, 2008 insertions, 0 deletions
diff --git a/meta/packages/bluez/bluez-hcidump_1.32.bb b/meta/packages/bluez/bluez-hcidump_1.32.bb
new file mode 100644
index 0000000000..877c8db33c
--- /dev/null
+++ b/meta/packages/bluez/bluez-hcidump_1.32.bb
@@ -0,0 +1,13 @@
+DESCRIPTION = "Linux Bluetooth Stack HCI Debugger Tool."
+SECTION = "console"
+PRIORITY = "optional"
+DEPENDS = "bluez-libs"
+LICENSE = "GPL"
+PR = "r0"
+
+SRC_URI = "http://bluez.sourceforge.net/download/bluez-hcidump-${PV}.tar.gz"
+S = "${WORKDIR}/bluez-hcidump-${PV}"
+
+EXTRA_OECONF = "--with-bluez-libs=${STAGING_LIBDIR} --with-bluez-includes=${STAGING_INCDIR}"
+
+inherit autotools
diff --git a/meta/packages/bluez/bluez-libs_3.4.bb b/meta/packages/bluez/bluez-libs_3.4.bb
new file mode 100644
index 0000000000..d740bd80a9
--- /dev/null
+++ b/meta/packages/bluez/bluez-libs_3.4.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Linux Bluetooth Stack Userland Libaries."
+SECTION = "libs"
+PRIORITY = "optional"
+HOMEPAGE = "http://www.bluez.org"
+LICENSE = "GPL"
+PR = "r0"
+
+SRC_URI = "http://bluez.sourceforge.net/download/bluez-libs-${PV}.tar.gz"
+
+inherit autotools pkgconfig
+
+HEADERS = "bluetooth.h bnep.h cmtp.h hci.h hci_lib.h hidp.h l2cap.h rfcomm.h sco.h sdp.h sdp_lib.h"
+
+do_stage() {
+ oe_libinstall -a -so -C src libbluetooth ${STAGING_LIBDIR}
+
+ install -d ${STAGING_INCDIR}/bluetooth/
+ for f in ${HEADERS}
+ do
+ install -m 0644 include/$f ${STAGING_INCDIR}/bluetooth/$f
+ done
+}
diff --git a/meta/packages/bluez/bluez-utils-dbus/dbus-2.24.patch b/meta/packages/bluez/bluez-utils-dbus/dbus-2.24.patch
new file mode 100644
index 0000000000..d8ec946a0b
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils-dbus/dbus-2.24.patch
@@ -0,0 +1,53 @@
+--- bluez-utils-2.24/acinclude.m4.orig 2006-01-12 08:21:38.000000000 +0100
++++ bluez-utils-2.24/acinclude.m4 2006-01-12 08:23:18.000000000 +0100
+@@ -131,46 +131,15 @@
+ ])
+
+ AC_DEFUN([AC_PATH_DBUS], [
+- dbus_prefix=${prefix}
+-
+- AC_ARG_WITH(dbus, AC_HELP_STRING([--with-dbus=DIR], [D-BUS library is installed in DIR]), [
+- if (test "${withval}" != "yes"); then
+- dbus_prefix=${withval}
+- fi
+- ])
+-
+- ac_save_CPPFLAGS=$CPPFLAGS
+- ac_save_LDFLAGS=$LDFLAGS
+-
+- DBUS_CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE"
+- test -d "${dbus_prefix}/include/dbus-1.0" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/include/dbus-1.0"
+- if (test "${prefix}" = "${bluez_prefix}"); then
+- test -d "${libdir}/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${libdir}/dbus-1.0/include"
+- else
+- test -d "${dbus_prefix}/lib64/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/lib64/dbus-1.0/include"
+- test -d "${dbus_prefix}/lib/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/lib/dbus-1.0/include"
+- fi
++ if pkg-config --exists dbus-1; then
++ dbus_found=yes ; DBUS_CFLAGS="`pkg-config --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
++ DBUS_LIBS="`pkg-config --libs dbus-1`"
+
+ CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+- AC_CHECK_HEADER(dbus/dbus.h, dbus_found=yes, dbus_found=no)
+-
+- DBUS_LIBS=""
+- if (test "${prefix}" = "${dbus_prefix}"); then
+- test -d "${libdir}" && DBUS_LIBS="$DBUS_LIBS -L${libdir}"
+- else
+- test -d "${dbus_prefix}/lib64" && DBUS_LIBS="$DBUS_LIBS -L${dbus_prefix}/lib64"
+- test -d "${dbus_prefix}/lib" && DBUS_LIBS="$DBUS_LIBS -L${dbus_prefix}/lib"
+- fi
+-
+ LDFLAGS="$LDFLAGS $DBUS_LIBS"
+- AC_CHECK_LIB(dbus-1, dbus_error_init, DBUS_LIBS="$DBUS_LIBS -ldbus-1", dbus_found=no)
+- AC_CHECK_LIB(dbus-1, dbus_message_iter_get_basic, dummy=yes, dbus_found=no)
+-
+- CPPFLAGS=$ac_save_CPPFLAGS
+- LDFLAGS=$ac_save_LDFLAGS
+-
+ AC_SUBST(DBUS_CFLAGS)
+ AC_SUBST(DBUS_LIBS)
++ fi
+ ])
+
+ AC_DEFUN([AC_PATH_FUSE], [
diff --git a/meta/packages/bluez/bluez-utils-dbus/dbus.patch b/meta/packages/bluez/bluez-utils-dbus/dbus.patch
new file mode 100644
index 0000000000..c5ab129469
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils-dbus/dbus.patch
@@ -0,0 +1,58 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- bluez-utils-2.20/acinclude.m4~dbus.patch
++++ bluez-utils-2.20/acinclude.m4
+@@ -211,46 +211,15 @@
+ ])
+
+ AC_DEFUN([AC_PATH_DBUS], [
+- dbus_prefix=${prefix}
+-
+- AC_ARG_WITH(dbus, AC_HELP_STRING([--with-dbus=DIR], [D-BUS library is installed in DIR]), [
+- if (test "${withval}" != "yes"); then
+- dbus_prefix=${withval}
+- fi
+- ])
+-
+- ac_save_CPPFLAGS=$CPPFLAGS
+- ac_save_LDFLAGS=$LDFLAGS
+-
+- DBUS_CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE"
+- test -d "${dbus_prefix}/include/dbus-1.0" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/include/dbus-1.0"
+- if (test "${prefix}" = "${bluez_prefix}"); then
+- test -d "${libdir}/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${libdir}/dbus-1.0/include"
+- else
+- test -d "${dbus_prefix}/lib64/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/lib64/dbus-1.0/include"
+- test -d "${dbus_prefix}/lib/dbus-1.0/include" && DBUS_CFLAGS="$DBUS_CFLAGS -I${dbus_prefix}/lib/dbus-1.0/include"
+- fi
++ if pkg-config --exists dbus-1; then
++ dbus_found=yes ; DBUS_CFLAGS="`pkg-config --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
++ DBUS_LIBS="`pkg-config --libs dbus-1`"
+
+ CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+- AC_CHECK_HEADER(dbus/dbus.h, dbus_found=yes, dbus_found=no)
+-
+- DBUS_LIBS=""
+- if (test "${prefix}" = "${dbus_prefix}"); then
+- test -d "${libdir}" && DBUS_LIBS="$DBUS_LIBS -L${libdir}"
+- else
+- test -d "${dbus_prefix}/lib64" && DBUS_LIBS="$DBUS_LIBS -L${dbus_prefix}/lib64"
+- test -d "${dbus_prefix}/lib" && DBUS_LIBS="$DBUS_LIBS -L${dbus_prefix}/lib"
+- fi
+-
+ LDFLAGS="$LDFLAGS $DBUS_LIBS"
+- AC_CHECK_LIB(dbus-1, dbus_error_init, DBUS_LIBS="$DBUS_LIBS -ldbus-1", dbus_found=no)
+- AC_CHECK_LIB(dbus-1, dbus_message_iter_get_basic, AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_GET_BASIC, 1, [Define to 1 if you have the dbus_message_iter_get_basic() function.]))
+-
+- CPPFLAGS=$ac_save_CPPFLAGS
+- LDFLAGS=$ac_save_LDFLAGS
+-
+ AC_SUBST(DBUS_CFLAGS)
+ AC_SUBST(DBUS_LIBS)
++ fi
+ ])
+
+ AC_DEFUN([AC_ARG_BLUEZ], [
diff --git a/meta/packages/bluez/bluez-utils-dbus/hcid-alignment-fix.patch b/meta/packages/bluez/bluez-utils-dbus/hcid-alignment-fix.patch
new file mode 100644
index 0000000000..276281c14e
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils-dbus/hcid-alignment-fix.patch
@@ -0,0 +1,42 @@
+--- bluez-utils-2.20/hcid/dbus.c.orig 2005-09-21 11:27:26 +0200
++++ bluez-utils-2.20/hcid/dbus.c 2005-09-21 11:27:35 +0200
+@@ -120,6 +121,7 @@
+ DBusMessage *message;
+ #ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+ uint8_t *addr = (uint8_t *) &ci->bdaddr;
++ uint32_t ci_out = ci->out;
+ #else
+ DBusMessageIter iter;
+ #endif
+@@ -138,7 +140,7 @@
+ bacpy(&req->bda, &ci->bdaddr);
+
+ #ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+- dbus_message_append_args(message, DBUS_TYPE_BOOLEAN, &ci->out,
++ dbus_message_append_args(message, DBUS_TYPE_BOOLEAN, &ci_out,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+ &addr, sizeof(bdaddr_t), DBUS_TYPE_INVALID);
+ #else
+@@ -261,6 +263,8 @@
+ DBusMessage *message;
+ #ifndef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+ DBusMessageIter iter;
++#else
++ int32_t tmp_rssi = rssi;
+ #endif
+ char *local_addr, *peer_addr;
+ bdaddr_t tmp;
+@@ -276,11 +280,12 @@
+ }
+
+ #ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
++
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &local_addr,
+ DBUS_TYPE_STRING, &peer_addr,
+ DBUS_TYPE_UINT32, &class,
+- DBUS_TYPE_INT32, &rssi,
++ DBUS_TYPE_INT32, &tmp_rssi,
+ DBUS_TYPE_INVALID);
+ #else
+ dbus_message_append_iter_init(message, &iter);
diff --git a/meta/packages/bluez/bluez-utils-dbus/hcid.conf b/meta/packages/bluez/bluez-utils-dbus/hcid.conf
new file mode 100644
index 0000000000..ab3ca2aaee
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils-dbus/hcid.conf
@@ -0,0 +1,72 @@
+#
+# HCI daemon configuration file.
+#
+# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # PIN helper
+ # pin_helper /usr/bin/bluepin;
+
+ # D-Bus PIN helper
+ dbus_pin_helper;
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "%h";
+
+ # Local device class
+ class 0x120112;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ #
+ #lm accept,master;
+ #
+ lm accept;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ #
+ #lp hold,sniff;
+ #
+ lp rswitch,hold,sniff,park;
+
+ # Authentication and Encryption
+ #auth enable;
+ encrypt enable;
+}
diff --git a/meta/packages/bluez/bluez-utils-dbus/smash.patch b/meta/packages/bluez/bluez-utils-dbus/smash.patch
new file mode 100644
index 0000000000..55cdbb7284
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils-dbus/smash.patch
@@ -0,0 +1,11 @@
+--- bluez-utils-2.11/hcid/dbus.c.old 2004-12-31 16:35:12.000000000 +0000
++++ bluez-utils-2.11/hcid/dbus.c 2004-12-31 16:39:58.000000000 +0000
+@@ -89,6 +89,8 @@
+
+ memset(&pr, 0, sizeof(pr));
+ bacpy(&pr.bdaddr, &req->bda);
++ if (len > sizeof (pr.pin_code))
++ goto error;
+ memcpy(pr.pin_code, pin, len);
+ pr.pin_len = len;
+ hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY,
diff --git a/meta/packages/bluez/bluez-utils.inc b/meta/packages/bluez/bluez-utils.inc
new file mode 100644
index 0000000000..ff3916ea94
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils.inc
@@ -0,0 +1,60 @@
+DESCRIPTION = "Linux Bluetooth Stack Userland Utilities."
+SECTION = "console"
+PRIORITY = "optional"
+DEPENDS = "bluez-libs-${PV} pcmcia-cs"
+RPROVIDES_${PN} = "bluez-pan bluez-sdp bluez-utils"
+LICENSE = "GPL"
+
+SRC_URI = "http://bluez.sourceforge.net/download/bluez-utils-${PV}.tar.gz \
+ file://base.patch;patch=1 \
+ file://blueboxes.patch;patch=1 \
+ file://no-user-include.patch;patch=1 \
+ file://hcid.conf \
+ file://bluetooth.default \
+ file://bluetooth.conf \
+ file://02dtl1_cs.sh"
+
+# Almost all serial CF cards w/ manfid 0x0000,0x0000 seem to use the bcs protocol
+# Let's default to that instead of 'any' until further notice...
+SRC_URI += " file://default-manfid-0x0-to-bcps.patch;patch=1"
+
+S = "${WORKDIR}/bluez-utils-${PV}"
+
+# We don't depend on openobex, fuse, alsa or usb but we set paths into staging
+# otherwise /usr/lib and /usr/include make it onto command lines with unpredictable results
+# Ideally acinclude.m4 needs fixing
+EXTRA_OECONF = "--with-bluez-libs=${STAGING_LIBDIR} --with-bluez-includes=${STAGING_INCDIR} \
+ --enable-pcmcia --enable-initscripts --enable-bcm203x --enable-hid2hci \
+ --disable-obex --disable-alsa \
+ --with-openobex=${STAGING_DIR}/${HOST_SYS} --with-fuse=${STAGING_DIR}/${HOST_SYS} \
+ --with-alsa=${STAGING_DIR}/${HOST_SYS} --with-usb=${STAGING_DIR}/${HOST_SYS} \
+ --with-bluez=${STAGING_LIBDIR}/${HOST_SYS}"
+
+inherit autotools update-rc.d
+
+INITSCRIPT_NAME = "bluetooth"
+INITSCRIPT_PARAMS = "defaults 23 19"
+
+do_compile_prepend() {
+ find ${S} -name Makefile | xargs sed -i 's:/usr/include:${STAGING_INCDIR}:'
+}
+
+do_install_append() {
+ install -d ${D}${base_sbindir} ${D}${base_bindir}/ ${D}${sysconfdir}/apm/event.d/
+ mv ${D}${sbindir}/* ${D}${base_sbindir}/
+ mv ${D}${bindir}/* ${D}${base_bindir}/
+ rmdir ${D}${bindir} ${D}${sbindir}
+ chmod u+s ${D}${base_sbindir}/hciattach ${D}${base_sbindir}/hciconfig
+ chmod 755 ${D}${sysconfdir}/pcmcia/bluetooth
+ install -m 0644 ${WORKDIR}/hcid.conf ${D}${sysconfdir}/bluetooth/
+ install -m 0644 ${WORKDIR}/bluetooth.default ${D}${sysconfdir}/default/bluetooth
+ cat ${WORKDIR}/bluetooth.conf >> ${D}${sysconfdir}/pcmcia/bluetooth.conf
+ install -m 0755 ${WORKDIR}/02dtl1_cs.sh ${D}${sysconfdir}/apm/event.d/
+}
+
+CONFFILES_${PN} = "${sysconfdir}/bluetooth/hcid.conf ${sysconfdir}/bluetooth/rfcomm.conf \
+ ${sysconfdir}/bluetooth/pin ${sysconfdir}/default/bluetooth"
+
+PACKAGES =+ "${PN}-ciptool ${PN}-bluepin"
+FILES_${PN}-ciptool = "/bin/ciptool"
+FILES_${PN}-bluepin = "/bin/bluepin"
diff --git a/meta/packages/bluez/bluez-utils/02dtl1_cs.sh b/meta/packages/bluez/bluez-utils/02dtl1_cs.sh
new file mode 100644
index 0000000000..fd81508010
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils/02dtl1_cs.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+case "$1" in
+ suspend)
+ if [ "`/bin/hciconfig`" != "" ]; then
+ #If hciconfig outputs anything then there's probably a Bluetooth
+ # CF card in the slot so shut it down.
+ hcitool dc `hcitool con | grep ACL | sed 's/^.*\([0-9A-F]\{2\}\(:[0-9A-F]\{2\}\)\{5\}\).*$/\1/'`
+ hciconfig hci0 down
+ killall hciattach > /dev/null 2>&1
+ fi
+ ;;
+
+ resume)
+ #check for kernel version
+ if [ "`uname -r | grep 2.4.`" != "" ]; then
+ k="o"
+ elif [ "`uname -r | grep 2.6.`" != "" ]; then
+ k="ko"
+ else
+ exit 0
+ fi
+
+ if test -e /sbin/cardctl; then
+ CARDCTL=/sbin/cardctl
+ elif test -e /sbin/pccardctl; then
+ CARDCTL=/sbin/pccardctl
+ else
+ exit 0
+ fi
+
+ if [ "`lsmod | grep hci_uart`" != "" ]; then
+ #If the hci_usb module is still loaded then there's a serial based
+ # Bluetooth CF card in the slot, which only needs a resume to get it going
+ # again.
+ rfcomm bind all
+ $CARDCTL resume
+ hciconfig hci0 up
+ else
+ # only works for nokia dtl1 cards
+ for f in /lib/modules/`uname -r`/kernel/drivers/bluetooth/dtl1_cs.$k
+ do
+ #Enumerate all the self-contained Bluetooth CF card drivers
+ f=`echo $f | sed 's/\.'$k'$//'`
+ f=`basename $f`
+ if [ "`lsmod | grep $f`" != "" ]; then
+ #If one of these drivers is still loaded, then there is probably
+ #a non-serial based Bluetooth CF card in the slot that needs
+ #ejecting and reinserting to get it going again
+ rfcomm bind all
+ $CARDCTL eject
+ $CARDCTL insert
+ hciconfig hci0 up
+ fi
+ done
+ fi
+esac
diff --git a/meta/packages/bluez/bluez-utils/hciattach-ti-bts.patch b/meta/packages/bluez/bluez-utils/hciattach-ti-bts.patch
new file mode 100644
index 0000000000..217c32619d
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils/hciattach-ti-bts.patch
@@ -0,0 +1,489 @@
+--- bluez-utils-3.1/tools/hciattach.c.orig 2006-07-23 14:02:14.000000000 +0200
++++ bluez-utils-3.1/tools/hciattach.c 2006-07-23 14:06:29.000000000 +0200
+@@ -58,6 +58,8 @@
+ #define HCI_UART_3WIRE 2
+ #define HCI_UART_H4DS 3
+
++#include "ti_bts.h"
++
+ struct uart_t {
+ char *type;
+ int m_id;
+@@ -67,6 +69,7 @@
+ int speed;
+ int flags;
+ int (*init) (int fd, struct uart_t *u, struct termios *ti);
++ char *bts; /* bluetooth script */
+ };
+
+ #define FLOW_CTL 0x0001
+@@ -256,6 +259,114 @@
+ return 0;
+ }
+
++static int brf6150(int fd, struct uart_t *u, struct termios *ti)
++{
++ bts_t *bfp;
++ int i;
++ unsigned long vers;
++ unsigned char actionbuf[256];
++ unsigned char resp[128]; /* Response */
++ unsigned long count;
++ unsigned short atype;
++
++ if (u->bts == NULL) /* no script, ignore */
++ return 0;
++
++ bfp = bts_load_script( u->bts, &vers );
++ if (bfp == NULL)
++ return -1;
++
++ fprintf( stderr, "Loading BTS script version %lu\n", vers );
++
++ while ((count = bts_next_action( bfp, actionbuf,
++ sizeof actionbuf - 1, &atype )) != 0) {
++ if (atype == ACTION_REMARKS) {
++ if (actionbuf[0] != 0)
++ fprintf( stderr, "%s\n", actionbuf );
++ }
++ else if (atype == ACTION_SEND_COMMAND) {
++#if 0
++ fprintf( stderr, "ACTION_SEND_COMMAND: ", (int)atype );
++ for (i=0; i<count; i++) {
++ fprintf( stderr, "0x%02x ", actionbuf[i] );
++ }
++ fprintf( stderr, "\n" );
++#endif
++ int n;
++ n = write(fd, actionbuf, count);
++ if (n < 0 || n < count) {
++ perror("Failed to write TI action command");
++ return -1;
++ }
++ }
++ else if (atype == ACTION_WAIT_EVENT) {
++ action_wait_t *wait = (action_wait_t *)actionbuf;
++#if 0
++ fprintf( stderr, "ACTION_WAIT_EVENT: %u msec, %u size, data = ", wait->msec, wait->size );
++ for (i=0; i<wait->size; i++) {
++ fprintf( stderr, "0x%02x ", wait->data[i] );
++ }
++ fprintf( stderr, "\n" );
++#endif
++ usleep(wait->msec); /* seems they give usec, not msec */
++ /* Read reply. */
++ if ((count = read_hci_event(fd, resp, sizeof resp)) < 0) {
++ perror("Failed to read TI command response");
++ return -1;
++ }
++ if (count < wait->size) {
++ fprintf( stderr, "TI command response is short.");
++ }
++ for (i=0; i<wait->size; i++) {
++ if (i == 3) continue; /* ignore */
++ if (resp[i] != wait->data[i]) {
++ fprintf( stderr, "TI command response does not match expected result.\n" );
++ }
++ }
++ }
++ else if (atype == ACTION_SERIAL_PORT_PARAMETERS) {
++ action_serial_t *sercmd = (action_serial_t *)actionbuf;
++
++ /* Set actual baudrate */
++ fprintf( stderr,
++ "BTS changing baud rate to %u, flow control to %u\n",
++ sercmd->baud, sercmd->flow_control );
++
++ tcflush(fd, TCIOFLUSH);
++
++ if (sercmd->flow_control)
++ ti->c_cflag |= CRTSCTS;
++ else
++ ti->c_cflag &= ~CRTSCTS;
++ if (tcsetattr(fd, TCSANOW, ti) < 0) {
++ perror("Can't set port settings");
++ return -1;
++ }
++
++ u->speed = sercmd->baud;
++
++ tcflush(fd, TCIOFLUSH);
++ if (set_speed(fd, ti, sercmd->baud) < 0) {
++ perror("Can't set baud rate");
++ return -1;
++ }
++ }
++ else if (atype == ACTION_DELAY) {
++ action_delay_t *delay = (action_delay_t *)actionbuf;
++ usleep(delay->msec); /* seems they give usec, not msec */
++ }
++ else {
++ fprintf( stderr, "BTS action type = %d: ", (int)atype );
++ for (i=0; i<count; i++) {
++ fprintf( stderr, "0x%02x ", actionbuf[i] );
++ }
++ fprintf( stderr, "\n" );
++ }
++ }
++ bts_unload_script( bfp );
++ return 0;
++}
++
+ static int texas(int fd, struct uart_t *u, struct termios *ti)
+ {
+ struct timespec tm = {0, 50000};
+@@ -296,15 +407,26 @@
+ } while (resp[4] != cmd[1] && resp[5] != cmd[2]);
+
+ /* Verify manufacturer */
+- if ((resp[11] & 0xFF) != 0x0d)
++ if (resp[11] != 0x0d)
+ fprintf(stderr,"WARNING : module's manufacturer is not Texas Instrument\n");
+
+ /* Print LMP version */
+- fprintf(stderr, "Texas module LMP version : 0x%02x\n", resp[10] & 0xFF);
++ fprintf(stderr, "TI module LMP version : 0x%02x\n", resp[10]);
+
+ /* Print LMP subversion */
+- fprintf(stderr, "Texas module LMP sub-version : 0x%02x%02x\n", resp[14] & 0xFF, resp[13] & 0xFF);
++ fprintf(stderr, "TI module LMP sub-version : 0x%02x%02x\n", resp[14], resp[13]);
++ if ((resp[14] >> 2) == 3) {
++ int err;
++ nanosleep(&tm, NULL);
+
++ /* BRF6150 */
++ if ((err=brf6150( fd, u, ti )) != 0) {
++ fprintf( stderr, "TI script failed (err=%d)\n",
++ err );
++ return -1;
++ }
++ }
++
+ nanosleep(&tm, NULL);
+ return 0;
+ }
+@@ -1103,7 +1225,7 @@
+ {
+ printf("hciattach - HCI UART driver initialization utility\n");
+ printf("Usage:\n");
+- printf("\thciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow]\n");
++ printf("\thciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] [-S bts-script] <tty> <type | id> [speed] [flow|noflow]\n");
+ printf("\thciattach -l\n");
+ }
+
+@@ -1118,11 +1240,12 @@
+ struct sigaction sa;
+ struct pollfd p;
+ char dev[PATH_MAX];
++ char *bts = NULL;
+
+ detach = 1;
+ printpid = 0;
+
+- while ((opt=getopt(argc, argv, "bnpt:s:l")) != EOF) {
++ while ((opt=getopt(argc, argv, "bnpt:s:S:l")) != EOF) {
+ switch(opt) {
+ case 'b':
+ send_break = 1;
+@@ -1144,6 +1267,10 @@
+ init_speed = atoi(optarg);
+ break;
+
++ case 'S':
++ bts = optarg;
++ break;
++
+ case 'l':
+ for (i = 0; uart[i].type; i++) {
+ printf("%-10s0x%04x,0x%04x\n", uart[i].type,
+@@ -1215,6 +1342,8 @@
+ if (init_speed)
+ u->init_speed = init_speed;
+
++ u->bts = bts;
++
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_flags = SA_NOCLDSTOP;
+ sa.sa_handler = sig_alarm;
+--- bluez-utils-3.1/tools/Makefile.am.orig 2006-07-23 14:06:59.000000000 +0200
++++ bluez-utils-3.1/tools/Makefile.am 2006-07-23 14:07:18.000000000 +0200
+@@ -37,7 +37,7 @@
+
+ noinst_PROGRAMS = hcisecfilter ppporc
+
+-hciattach_SOURCES = hciattach.c hciattach_st.c
++hciattach_SOURCES = hciattach.c hciattach_st.c ti_bts.h ti_bts.c
+
+ hciconfig_SOURCES = hciconfig.c csr.h csr.c
+ hciconfig_LDADD = @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
+--- bluez-utils-3.1/tools/ti_bts.h.orig 2006-07-23 14:07:26.000000000 +0200
++++ bluez-utils-3.1/tools/ti_bts.h 2006-07-23 14:07:46.000000000 +0200
+@@ -0,0 +1,116 @@
++/*
++ * Copyright (c) 2005 Texas Instruments, Inc.
++ * Ported by SDG Systems, LLC
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * 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 OF THIRD PARTY RIGHTS.
++ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
++ * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
++ * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
++ * SOFTWARE IS DISCLAIMED.
++ *
++ */
++
++#ifndef BT_SCRIPT_H
++#define BT_SCRIPT_H
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++ * Define the interface of Bluetooth Script
++ */
++
++typedef void bts_t;
++
++
++#define ACTION_SEND_COMMAND 1 /* Send out raw data (as is) */
++#define ACTION_WAIT_EVENT 2 /* Wait for data */
++#define ACTION_SERIAL_PORT_PARAMETERS 3
++#define ACTION_DELAY 4
++#define ACTION_RUN_SCRIPT 5
++#define ACTION_REMARKS 6
++
++/*
++ * Structure for ACTION_SEND_COMMAND
++ */
++typedef struct tagCActionCommand
++{
++ unsigned char data[1]; /* Data to send */
++} action_command_t;
++
++/*
++ * Structure for ACTION_WAIT_EVENT
++ */
++typedef struct tagCActionWaitEvent
++{
++ unsigned long msec; /* in milliseconds */
++ unsigned long size;
++ unsigned char data[1]; /* Data to wait for */
++} action_wait_t;
++
++
++/*
++ * Structure for ACTION_SERIAL_PORT_PARAMETERS
++ */
++typedef struct tagCActionSerialPortParameters
++{
++ unsigned long baud;
++ unsigned long flow_control;
++} action_serial_t;
++
++/* Flow Control Type */
++#define FCT_NONE 0
++#define FCT_HARDWARE 1
++
++#define DONT_CHANGE 0xFFFFFFFF /* For both baud rate and flow control */
++
++
++/*
++ * Structure for ACTION_DELAY
++ */
++typedef struct tagCActionDelay
++{
++ unsigned long msec; /* in milliseconds */
++} action_delay_t;
++
++/*
++ * Structure for ACTION_RUN_SCRIPT
++ */
++typedef struct tagCActionRunScript
++{
++ char filename[1];
++} action_run_t;
++
++/*
++ * Structure for ACTION_REMARKS
++ */
++typedef struct tagCActionRemarks
++{
++ char m_szRemarks[1];
++} action_remarks_t;
++
++
++const char *cis_create_filename(const unsigned char* cmdparms);
++bts_t * bts_load_script(const char* fname, unsigned long* version);
++unsigned long bts_next_action(const bts_t* bts_fp, unsigned char* action_buf,
++ unsigned long nMaxSize, unsigned short* ptype);
++void bts_unload_script(bts_t* bts_fp);
++
++#ifdef __cplusplus
++};
++#endif
++
++#endif /* BT_SCRIPT_H */
++
+--- bluez-utils-3.1/tools/ti_bts.c.orig 2006-07-23 14:07:28.000000000 +0200
++++ bluez-utils-3.1/tools/ti_bts.c 2006-07-23 14:07:46.000000000 +0200
+@@ -0,0 +1,149 @@
++/*
++ * Copyright (c) 2005 Texas Instruments, Inc.
++ * Ported by SDG Systems, LLC
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * 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 OF THIRD PARTY RIGHTS.
++ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
++ * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
++ * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
++ * SOFTWARE IS DISCLAIMED.
++ *
++ */
++
++
++#include <stdio.h>
++#include <stdlib.h>
++#include "ti_bts.h"
++
++#ifndef MAKEWORD
++#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) | ((unsigned short)((unsigned char)(b))) << 8))
++#endif
++
++#define TI_MANUFACTURER_ID 13
++
++/*
++ * Common Init Script specific
++ */
++const char *
++cis_create_filename(const unsigned char* cmdparms)
++{
++ static char bts_file[50];
++
++ /* Check for TI's id */
++ unsigned short manfid = MAKEWORD(cmdparms[8], cmdparms[9]);
++
++ if (TI_MANUFACTURER_ID == manfid) {
++ unsigned short version = MAKEWORD(cmdparms[10], cmdparms[11]);
++
++ unsigned short chip = (version & 0x7C00) >> 10;
++ unsigned short min_ver = (version & 0x007F);
++ unsigned short maj_ver = (version & 0x0380) >> 7;
++
++ if (0 != (version & 0x8000)) {
++ maj_ver |= 0x0008;
++ }
++
++ sprintf( bts_file, "TIInit_%d.%d.%d.bts",
++ (int)chip, (int)maj_ver, (int)min_ver);
++
++ return &bts_file[0];
++ }
++ return NULL;
++}
++
++typedef struct tagCHeader
++{
++ unsigned long magic;
++ unsigned long version;
++ unsigned char future[24];
++} cheader_t;
++
++
++/* The value 0x42535442 stands for (in ASCII) BTSB */
++/* which is Bluetooth Script Binary */
++#define FILE_HEADER_MAGIC 0x42535442
++
++
++bts_t *
++bts_load_script(const char* fname, unsigned long* version)
++{
++ bts_t* bts = NULL;
++ FILE* fp = fopen(fname, "rb");
++
++ if (NULL != fp) {
++ /* Read header */
++ cheader_t header;
++
++ /* Read header */
++ if (1 == fread(&header, sizeof(header), 1, fp)) {
++ /* Check magic number for correctness */
++ if (header.magic == FILE_HEADER_MAGIC) {
++ /* If user wants the version number */
++ if (NULL != version) {
++ *version = header.version;
++ }
++ bts = (bts_t*)fp;
++ }
++ }
++ /* If failed reading the file, close it */
++ if (NULL == bts) {
++ fclose(fp);
++ }
++ }
++ return bts;
++}
++
++unsigned long
++bts_next_action(const bts_t* bts_fp, unsigned char* action_buf,
++ unsigned long nMaxSize, unsigned short* ptype)
++{
++ unsigned long bytes = 0;
++ FILE* fp = (FILE*)bts_fp;
++ unsigned char action_hdr[4];
++
++ if (bts_fp == NULL)
++ return 0;
++
++ /* Each Action has the following: */
++ /* UINT16 type of this action */
++ /* UINT16 size of rest */
++ /* BYTE[] action buffer (for HCI, includes the type byte e.g. 1 for hci command) */
++
++ if (1 == fread(&action_hdr[0], sizeof(action_hdr), 1, fp)) {
++ unsigned short type = *(unsigned short*)&action_hdr[0];
++ unsigned short size = *(unsigned short*)&action_hdr[2];
++
++ if (size <= nMaxSize) {
++ int nread = fread(action_buf, sizeof(action_buf[0]), size, fp);
++
++ if (nread == size) {
++ *ptype = type;
++ bytes = (unsigned long)size;
++ }
++ }
++ }
++
++ return bytes;
++}
++
++void
++bts_unload_script(bts_t* bts_fp)
++{
++ FILE* fp = (FILE*)bts_fp;
++
++ if (NULL != fp) {
++ fclose(fp);
++ }
++}
++
diff --git a/meta/packages/bluez/bluez-utils/hcid.conf b/meta/packages/bluez/bluez-utils/hcid.conf
new file mode 100644
index 0000000000..bb935aa23d
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils/hcid.conf
@@ -0,0 +1,57 @@
+#
+# HCI daemon configuration file.
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # Default PIN code for incoming connections
+ passkey "BlueZ";
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "BlueZ (%d)";
+
+ # Local device class
+ class 0x120112;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ lm accept;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ lp rswitch,hold,sniff,park;
+}
diff --git a/meta/packages/bluez/bluez-utils_3.4.bb b/meta/packages/bluez/bluez-utils_3.4.bb
new file mode 100644
index 0000000000..49e6ded250
--- /dev/null
+++ b/meta/packages/bluez/bluez-utils_3.4.bb
@@ -0,0 +1,53 @@
+DESCRIPTION = "Linux Bluetooth Stack Userland Utilities."
+SECTION = "console"
+PRIORITY = "optional"
+DEPENDS = "bluez-libs-${PV} dbus"
+PROVIDES = "bluez-utils-dbus"
+RPROVIDES_${PN} = "bluez-pan bluez-sdp bluez-utils-dbus"
+RREPLACES = "bluez-utils-dbus"
+RCONFLICTS_${PN} = "bluez-utils-nodbus"
+LICENSE = "GPL"
+PR = "r1"
+
+SRC_URI = "http://bluez.sourceforge.net/download/bluez-utils-${PV}.tar.gz \
+ file://hcid.conf \
+ file://02dtl1_cs.sh \
+ file://hciattach-ti-bts.patch;patch=1"
+
+# Almost all serial CF cards w/ manfid 0x0000,0x0000 seem to use the bcs protocol
+# Let's default to that instead of 'any' until further notice...
+SRC_URI += " file://default-manfid-0x0-to-bcps.patch;patch=1"
+
+S = "${WORKDIR}/bluez-utils-${PV}"
+
+EXTRA_OECONF = "--enable-initscripts --enable-bcm203x --enable-hid2hci"
+# --enable-obex enable OBEX support
+# --enable-alsa enable ALSA support
+# --enable-cups install CUPS backend support
+# --enable-bccmd install BCCMD interface utility
+# --enable-avctrl install Audio/Video control utility
+# --enable-hid2hci install HID mode switching utility
+# --enable-dfutool install DFU firmware upgrade utility
+
+inherit autotools update-rc.d
+
+INITSCRIPT_NAME = "bluetooth"
+INITSCRIPT_PARAMS = "defaults 23 19"
+
+do_install_append() {
+ install -d ${D}${base_sbindir} ${D}${base_bindir}/ ${D}${sysconfdir}/apm/event.d/
+ mv ${D}${sbindir}/* ${D}${base_sbindir}/
+ mv ${D}${bindir}/* ${D}${base_bindir}/
+ rmdir ${D}${bindir} ${D}${sbindir}
+ chmod u+s ${D}${base_sbindir}/hciattach ${D}${base_sbindir}/hciconfig
+ install -m 0644 ${WORKDIR}/hcid.conf ${D}${sysconfdir}/bluetooth/
+ install -m 0755 ${WORKDIR}/02dtl1_cs.sh ${D}${sysconfdir}/apm/event.d/
+}
+
+CONFFILES_${PN} = "${sysconfdir}/bluetooth/hcid.conf ${sysconfdir}/bluetooth/rfcomm.conf \
+ ${sysconfdir}/default/bluetooth"
+
+PACKAGES =+ "${PN}-ciptool"
+FILES_${PN}-ciptool = "/bin/ciptool"
+RREPLACES_${PN}-ciptool = "bluez-utils-dbus-ciptool"
+RCONFLICTS_${PN}-ciptool = "bluez-utils-dbus-ciptool bluez-utils-nodbus"
diff --git a/meta/packages/bluez/files/02dtl1_cs.sh b/meta/packages/bluez/files/02dtl1_cs.sh
new file mode 100644
index 0000000000..fefc72e07a
--- /dev/null
+++ b/meta/packages/bluez/files/02dtl1_cs.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+case "$1" in
+ suspend)
+ if [ "`/sbin/hciconfig`" != "" ]; then
+ #If hciconfig outputs anything then there's probably a Bluetooth
+ # CF card in the slot so shut it down.
+ hcitool dc `hcitool con | grep ACL | sed 's/^.*\([0-9A-F]\{2\}\(:[0-9A-F]\{2\}\)\{5\}\).*$/\1/'`
+ hciconfig hci0 down
+ killall hciattach > /dev/null 2>&1
+ fi
+ ;;
+
+ resume)
+ #check for kernel version
+ if [ "`uname -r | grep 2.4.`" != "" ]; then
+ k="o"
+ elif [ "`uname -r | grep 2.6.`" != "" ]; then
+ k="ko"
+ else
+ exit 0
+ fi
+
+ if test -e /sbin/cardctl; then
+ CARDCTL=/sbin/cardctl
+ elif test -e /sbin/pccardctl; then
+ CARDCTL=/sbin/pccardctl
+ else
+ exit 0
+ fi
+
+ if [ "`lsmod | grep hci_uart`" != "" ]; then
+ #If the hci_usb module is still loaded then there's a serial based
+ # Bluetooth CF card in the slot, which only needs a resume to get it going
+ # again.
+ rfcomm bind all
+ $CARDCTL resume
+ hciconfig hci0 up
+ else
+ # only works for nokia dtl1 cards
+ for f in /lib/modules/`uname -r`/kernel/drivers/bluetooth/dtl1_cs.$k
+ do
+ #Enumerate all the self-contained Bluetooth CF card drivers
+ f=`echo $f | sed 's/\.'$k'$//'`
+ f=`basename $f`
+ if [ "`lsmod | grep $f`" != "" ]; then
+ #If one of these drivers is still loaded, then there is probably
+ #a non-serial based Bluetooth CF card in the slot that needs
+ #ejecting and reinserting to get it going again
+ rfcomm bind all
+ $CARDCTL eject
+ $CARDCTL insert
+ hciconfig hci0 up
+ fi
+ done
+ fi
+esac
diff --git a/meta/packages/bluez/files/base.patch b/meta/packages/bluez/files/base.patch
new file mode 100644
index 0000000000..337c9aa73e
--- /dev/null
+++ b/meta/packages/bluez/files/base.patch
@@ -0,0 +1,33 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- bluez-utils-2.17/pcmcia/bluetooth~base.patch
++++ bluez-utils-2.17/pcmcia/bluetooth
+@@ -15,9 +15,16 @@
+
+ if [ -r ./shared ]; then . ./shared ; else . /etc/pcmcia/shared ; fi
+
++# Give the port some time to complete initialization
++sleep 5
++
+ # Get device attributes
+ get_info $DEVICE
+
++test "$DEVICE" = "ttyS7" && DEVICE="/dev/tts/7"
++test -z "$MANFID" && MANFID="bcsp"
++test "$MANFID" = "0000,0000" && MANFID="bcsp"
++
+ #
+ # Serial devices
+ #
+@@ -25,7 +32,7 @@
+ IRQ=`setserial /dev/$DEVICE | sed -e 's/.*IRQ: //'`
+ setserial /dev/$DEVICE irq 0 ; setserial /dev/$DEVICE irq $IRQ
+
+- /usr/sbin/hciattach $DEVICE $MANFID
++ /sbin/hciattach $DEVICE $MANFID
+ }
+ stop_serial() {
+ do_fuser -k -HUP /dev/$DEVICE > /dev/null
diff --git a/meta/packages/bluez/files/blueboxes.patch b/meta/packages/bluez/files/blueboxes.patch
new file mode 100644
index 0000000000..c429b06c06
--- /dev/null
+++ b/meta/packages/bluez/files/blueboxes.patch
@@ -0,0 +1,18 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- bluez-utils-2.14/pcmcia/bluetooth.conf~base
++++ bluez-utils-2.14/pcmcia/bluetooth.conf
+@@ -26,6 +26,10 @@
+ version "Brain Boxes", "Bluetooth PC Card"
+ bind "serial_cs" class "bluetooth"
+
++card "F+ Bluetooth_Card, BCSP"
++ manfid 0x0160, 0xaba0
++ bind "serial_cs" class "bluetooth"
++
+ card "IBM Bluetooth PC Card II"
+ version "IBM", "Bluetooth PC Card II"
+ bind "serial_cs" class "bluetooth"
diff --git a/meta/packages/bluez/files/bluetooth.conf b/meta/packages/bluez/files/bluetooth.conf
new file mode 100644
index 0000000000..872084702a
--- /dev/null
+++ b/meta/packages/bluez/files/bluetooth.conf
@@ -0,0 +1,13 @@
+#
+# additional cards for /etc/pcmcia/bluetooth.conf
+# Note for OE: This file is _appended_ to the stock
+# bluetooth.conf in bluez-utils, so no need to duplicate
+# entries for individual cards.
+#
+card "CSR BT01x0M Bluetooth CF Card"
+ version "Bluetooth BT0100M", "", ""
+ bind "serial_cs" class "bluetooth"
+
+card "Socket Bluetooth CF Card Rev. G"
+ manfid 0x0104, 0x0096
+ bind "serial_cs" class "bluetooth"
diff --git a/meta/packages/bluez/files/bluetooth.default b/meta/packages/bluez/files/bluetooth.default
new file mode 100644
index 0000000000..4817d38c60
--- /dev/null
+++ b/meta/packages/bluez/files/bluetooth.default
@@ -0,0 +1,37 @@
+# Bluetooth configuraton file
+
+# Start of hcid (allowed values are "true" and "false")
+HCID_ENABLE=true
+
+# Config file for hcid
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+
+# Start sdpd (allowed values are "true" and "false")
+SDPD_ENABLE=true
+
+# Start hidd (allowed values are "true" and "false")
+HIDD_ENABLE=true
+
+# Arguments to hidd
+HIDD_OPTIONS=""
+
+# Run hid2hci (allowed values are "true" and "false")
+HID2HCI_ENABLE=true
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=true
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+# Start dund (allowed values are "true" and "false")
+DUND_ENABLE=false
+
+# Arguments to dund
+DUND_OPTIONS="--listen --persist"
+
+# Start pand (allowed values are "true" and "false")
+PAND_ENABLE=false
+
+# Arguments to pand
+PAND_OPTIONS="--listen --role NAP"
diff --git a/meta/packages/bluez/files/default-manfid-0x0-to-bcps.patch b/meta/packages/bluez/files/default-manfid-0x0-to-bcps.patch
new file mode 100644
index 0000000000..3d993543b3
--- /dev/null
+++ b/meta/packages/bluez/files/default-manfid-0x0-to-bcps.patch
@@ -0,0 +1,22 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- bluez-utils-2.16/tools/hciattach.c~default-manfid-0x0-to-bcps
++++ bluez-utils-2.16/tools/hciattach.c
+@@ -796,13 +796,12 @@
+ }
+
+ struct uart_t uart[] = {
++ { "bcsp", 0x0000, 0x0000, HCI_UART_BCSP, 115200, 115200, 0, bcsp },
+ { "any", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL },
+ { "ericsson", 0x0000, 0x0000, HCI_UART_H4, 57600, 115200, FLOW_CTL, ericsson },
+ { "digi", 0x0000, 0x0000, HCI_UART_H4, 9600, 115200, FLOW_CTL, digi },
+ { "texas", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, texas },
+
+- { "bcsp", 0x0000, 0x0000, HCI_UART_BCSP, 115200, 115200, 0, bcsp },
+-
+ /* Xircom PCMCIA cards: Credit Card Adapter and Real Port Adapter */
+ { "xircom", 0x0105, 0x080a, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL },
+
diff --git a/meta/packages/bluez/files/hciattach-ti-bts.patch b/meta/packages/bluez/files/hciattach-ti-bts.patch
new file mode 100644
index 0000000000..8fe37de9d3
--- /dev/null
+++ b/meta/packages/bluez/files/hciattach-ti-bts.patch
@@ -0,0 +1,489 @@
+--- bluez-utils-2.24/tools/hciattach.c.orig 2005-12-10 15:14:36.000000000 +0100
++++ bluez-utils-2.24/tools/hciattach.c 2006-01-22 13:56:13.000000000 +0100
+@@ -57,6 +57,8 @@
+ #define HCI_UART_3WIRE 2
+ #define HCI_UART_H4DS 3
+
++#include "ti_bts.h"
++
+ struct uart_t {
+ char *type;
+ int m_id;
+@@ -66,6 +68,7 @@
+ int speed;
+ int flags;
+ int (*init) (int fd, struct uart_t *u, struct termios *ti);
++ char *bts; /* bluetooth script */
+ };
+
+ #define FLOW_CTL 0x0001
+@@ -241,6 +244,114 @@
+ return 0;
+ }
+
++static int brf6150(int fd, struct uart_t *u, struct termios *ti)
++{
++ bts_t *bfp;
++ int i;
++ unsigned long vers;
++ unsigned char actionbuf[256];
++ unsigned char resp[128]; /* Response */
++ unsigned long count;
++ unsigned short atype;
++
++ if (u->bts == NULL) /* no script, ignore */
++ return 0;
++
++ bfp = bts_load_script( u->bts, &vers );
++ if (bfp == NULL)
++ return -1;
++
++ fprintf( stderr, "Loading BTS script version %lu\n", vers );
++
++ while ((count = bts_next_action( bfp, actionbuf,
++ sizeof actionbuf - 1, &atype )) != 0) {
++ if (atype == ACTION_REMARKS) {
++ if (actionbuf[0] != 0)
++ fprintf( stderr, "%s\n", actionbuf );
++ }
++ else if (atype == ACTION_SEND_COMMAND) {
++#if 0
++ fprintf( stderr, "ACTION_SEND_COMMAND: ", (int)atype );
++ for (i=0; i<count; i++) {
++ fprintf( stderr, "0x%02x ", actionbuf[i] );
++ }
++ fprintf( stderr, "\n" );
++#endif
++ int n;
++ n = write(fd, actionbuf, count);
++ if (n < 0 || n < count) {
++ perror("Failed to write TI action command");
++ return -1;
++ }
++ }
++ else if (atype == ACTION_WAIT_EVENT) {
++ action_wait_t *wait = (action_wait_t *)actionbuf;
++#if 0
++ fprintf( stderr, "ACTION_WAIT_EVENT: %u msec, %u size, data = ", wait->msec, wait->size );
++ for (i=0; i<wait->size; i++) {
++ fprintf( stderr, "0x%02x ", wait->data[i] );
++ }
++ fprintf( stderr, "\n" );
++#endif
++ usleep(wait->msec); /* seems they give usec, not msec */
++ /* Read reply. */
++ if ((count = read_hci_event(fd, resp, sizeof resp)) < 0) {
++ perror("Failed to read TI command response");
++ return -1;
++ }
++ if (count < wait->size) {
++ fprintf( stderr, "TI command response is short.");
++ }
++ for (i=0; i<wait->size; i++) {
++ if (i == 3) continue; /* ignore */
++ if (resp[i] != wait->data[i]) {
++ fprintf( stderr, "TI command response does not match expected result.\n" );
++ }
++ }
++ }
++ else if (atype == ACTION_SERIAL_PORT_PARAMETERS) {
++ action_serial_t *sercmd = (action_serial_t *)actionbuf;
++
++ /* Set actual baudrate */
++ fprintf( stderr,
++ "BTS changing baud rate to %u, flow control to %u\n",
++ sercmd->baud, sercmd->flow_control );
++
++ tcflush(fd, TCIOFLUSH);
++
++ if (sercmd->flow_control)
++ ti->c_cflag |= CRTSCTS;
++ else
++ ti->c_cflag &= ~CRTSCTS;
++ if (tcsetattr(fd, TCSANOW, ti) < 0) {
++ perror("Can't set port settings");
++ return -1;
++ }
++
++ u->speed = sercmd->baud;
++
++ tcflush(fd, TCIOFLUSH);
++ if (set_speed(fd, ti, sercmd->baud) < 0) {
++ perror("Can't set baud rate");
++ return -1;
++ }
++ }
++ else if (atype == ACTION_DELAY) {
++ action_delay_t *delay = (action_delay_t *)actionbuf;
++ usleep(delay->msec); /* seems they give usec, not msec */
++ }
++ else {
++ fprintf( stderr, "BTS action type = %d: ", (int)atype );
++ for (i=0; i<count; i++) {
++ fprintf( stderr, "0x%02x ", actionbuf[i] );
++ }
++ fprintf( stderr, "\n" );
++ }
++ }
++ bts_unload_script( bfp );
++ return 0;
++}
++
+ static int texas(int fd, struct uart_t *u, struct termios *ti)
+ {
+ struct timespec tm = {0, 50000};
+@@ -281,14 +392,25 @@
+ } while (resp[4] != cmd[1] && resp[5] != cmd[2]);
+
+ /* Verify manufacturer */
+- if ((resp[11] & 0xFF) != 0x0d)
++ if (resp[11] != 0x0d)
+ fprintf(stderr,"WARNING : module's manufacturer is not Texas Instrument\n");
+
+ /* Print LMP version */
+- fprintf(stderr, "Texas module LMP version : 0x%02x\n", resp[10] & 0xFF);
++ fprintf(stderr, "TI module LMP version : 0x%02x\n", resp[10]);
+
+ /* Print LMP subversion */
+- fprintf(stderr, "Texas module LMP sub-version : 0x%02x%02x\n", resp[14] & 0xFF, resp[13] & 0xFF);
++ fprintf(stderr, "TI module LMP sub-version : 0x%02x%02x\n", resp[14], resp[13]);
++ if ((resp[14] >> 2) == 3) {
++ int err;
++ nanosleep(&tm, NULL);
++
++ /* BRF6150 */
++ if ((err=brf6150( fd, u, ti )) != 0) {
++ fprintf( stderr, "TI script failed (err=%d)\n",
++ err );
++ return -1;
++ }
++ }
+
+ nanosleep(&tm, NULL);
+ return 0;
+@@ -953,7 +1075,7 @@
+ {
+ printf("hciattach - HCI UART driver initialization utility\n");
+ printf("Usage:\n");
+- printf("\thciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow]\n");
++ printf("\thciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] [-S bts-script] <tty> <type | id> [speed] [flow|noflow]\n");
+ printf("\thciattach -l\n");
+ }
+
+@@ -970,11 +1092,12 @@
+ pid_t pid;
+ struct sigaction sa;
+ char dev[PATH_MAX];
++ char *bts = NULL;
+
+ detach = 1;
+ printpid = 0;
+
+- while ((opt=getopt(argc, argv, "bnpt:s:l")) != EOF) {
++ while ((opt=getopt(argc, argv, "bnpt:s:S:l")) != EOF) {
+ switch(opt) {
+ case 'b':
+ send_break = 1;
+@@ -996,6 +1119,10 @@
+ init_speed = atoi(optarg);
+ break;
+
++ case 'S':
++ bts = optarg;
++ break;
++
+ case 'l':
+ for (i = 0; uart[i].type; i++) {
+ printf("%-10s0x%04x,0x%04x\n", uart[i].type,
+@@ -1067,6 +1194,8 @@
+ if (init_speed)
+ u->init_speed = init_speed;
+
++ u->bts = bts;
++
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_flags = SA_NOCLDSTOP;
+ sa.sa_handler = sig_alarm;
+--- bluez-utils-2.24/tools/Makefile.am.orig 2005-12-03 07:22:16.000000000 +0100
++++ bluez-utils-2.24/tools/Makefile.am 2006-01-22 13:53:59.000000000 +0100
+@@ -37,6 +37,9 @@
+
+ noinst_PROGRAMS = hcisecfilter ppporc
+
++hciattach_SOURCES = hciattach.c ti_bts.h ti_bts.c
++hciattach_LDADD = @BLUEZ_LIBS@
++
+ hciconfig_SOURCES = hciconfig.c csr.h csr.c
+ hciconfig_LDADD = @BLUEZ_LIBS@ $(top_builddir)/common/libtextfile.a
+
+--- bluez-utils-2.24/tools/ti_bts.h.orig 2006-01-22 13:56:38.000000000 +0100
++++ bluez-utils-2.24/tools/ti_bts.h 2006-01-22 13:53:59.000000000 +0100
+@@ -0,0 +1,116 @@
++/*
++ * Copyright (c) 2005 Texas Instruments, Inc.
++ * Ported by SDG Systems, LLC
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * 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 OF THIRD PARTY RIGHTS.
++ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
++ * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
++ * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
++ * SOFTWARE IS DISCLAIMED.
++ *
++ */
++
++#ifndef BT_SCRIPT_H
++#define BT_SCRIPT_H
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++ * Define the interface of Bluetooth Script
++ */
++
++typedef void bts_t;
++
++
++#define ACTION_SEND_COMMAND 1 /* Send out raw data (as is) */
++#define ACTION_WAIT_EVENT 2 /* Wait for data */
++#define ACTION_SERIAL_PORT_PARAMETERS 3
++#define ACTION_DELAY 4
++#define ACTION_RUN_SCRIPT 5
++#define ACTION_REMARKS 6
++
++/*
++ * Structure for ACTION_SEND_COMMAND
++ */
++typedef struct tagCActionCommand
++{
++ unsigned char data[1]; /* Data to send */
++} action_command_t;
++
++/*
++ * Structure for ACTION_WAIT_EVENT
++ */
++typedef struct tagCActionWaitEvent
++{
++ unsigned long msec; /* in milliseconds */
++ unsigned long size;
++ unsigned char data[1]; /* Data to wait for */
++} action_wait_t;
++
++
++/*
++ * Structure for ACTION_SERIAL_PORT_PARAMETERS
++ */
++typedef struct tagCActionSerialPortParameters
++{
++ unsigned long baud;
++ unsigned long flow_control;
++} action_serial_t;
++
++/* Flow Control Type */
++#define FCT_NONE 0
++#define FCT_HARDWARE 1
++
++#define DONT_CHANGE 0xFFFFFFFF /* For both baud rate and flow control */
++
++
++/*
++ * Structure for ACTION_DELAY
++ */
++typedef struct tagCActionDelay
++{
++ unsigned long msec; /* in milliseconds */
++} action_delay_t;
++
++/*
++ * Structure for ACTION_RUN_SCRIPT
++ */
++typedef struct tagCActionRunScript
++{
++ char filename[1];
++} action_run_t;
++
++/*
++ * Structure for ACTION_REMARKS
++ */
++typedef struct tagCActionRemarks
++{
++ char m_szRemarks[1];
++} action_remarks_t;
++
++
++const char *cis_create_filename(const unsigned char* cmdparms);
++bts_t * bts_load_script(const char* fname, unsigned long* version);
++unsigned long bts_next_action(const bts_t* bts_fp, unsigned char* action_buf,
++ unsigned long nMaxSize, unsigned short* ptype);
++void bts_unload_script(bts_t* bts_fp);
++
++#ifdef __cplusplus
++};
++#endif
++
++#endif /* BT_SCRIPT_H */
++
+--- bluez-utils-2.24/tools/ti_bts.c.orig 2006-01-22 13:56:36.000000000 +0100
++++ bluez-utils-2.24/tools/ti_bts.c 2006-01-22 13:56:31.000000000 +0100
+@@ -0,0 +1,149 @@
++/*
++ * Copyright (c) 2005 Texas Instruments, Inc.
++ * Ported by SDG Systems, LLC
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation;
++ *
++ * 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 OF THIRD PARTY RIGHTS.
++ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
++ * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
++ * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
++ * SOFTWARE IS DISCLAIMED.
++ *
++ */
++
++
++#include <stdio.h>
++#include <stdlib.h>
++#include "ti_bts.h"
++
++#ifndef MAKEWORD
++#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) | ((unsigned short)((unsigned char)(b))) << 8))
++#endif
++
++#define TI_MANUFACTURER_ID 13
++
++/*
++ * Common Init Script specific
++ */
++const char *
++cis_create_filename(const unsigned char* cmdparms)
++{
++ static char bts_file[50];
++
++ /* Check for TI's id */
++ unsigned short manfid = MAKEWORD(cmdparms[8], cmdparms[9]);
++
++ if (TI_MANUFACTURER_ID == manfid) {
++ unsigned short version = MAKEWORD(cmdparms[10], cmdparms[11]);
++
++ unsigned short chip = (version & 0x7C00) >> 10;
++ unsigned short min_ver = (version & 0x007F);
++ unsigned short maj_ver = (version & 0x0380) >> 7;
++
++ if (0 != (version & 0x8000)) {
++ maj_ver |= 0x0008;
++ }
++
++ sprintf( bts_file, "TIInit_%d.%d.%d.bts",
++ (int)chip, (int)maj_ver, (int)min_ver);
++
++ return &bts_file[0];
++ }
++ return NULL;
++}
++
++typedef struct tagCHeader
++{
++ unsigned long magic;
++ unsigned long version;
++ unsigned char future[24];
++} cheader_t;
++
++
++/* The value 0x42535442 stands for (in ASCII) BTSB */
++/* which is Bluetooth Script Binary */
++#define FILE_HEADER_MAGIC 0x42535442
++
++
++bts_t *
++bts_load_script(const char* fname, unsigned long* version)
++{
++ bts_t* bts = NULL;
++ FILE* fp = fopen(fname, "rb");
++
++ if (NULL != fp) {
++ /* Read header */
++ cheader_t header;
++
++ /* Read header */
++ if (1 == fread(&header, sizeof(header), 1, fp)) {
++ /* Check magic number for correctness */
++ if (header.magic == FILE_HEADER_MAGIC) {
++ /* If user wants the version number */
++ if (NULL != version) {
++ *version = header.version;
++ }
++ bts = (bts_t*)fp;
++ }
++ }
++ /* If failed reading the file, close it */
++ if (NULL == bts) {
++ fclose(fp);
++ }
++ }
++ return bts;
++}
++
++unsigned long
++bts_next_action(const bts_t* bts_fp, unsigned char* action_buf,
++ unsigned long nMaxSize, unsigned short* ptype)
++{
++ unsigned long bytes = 0;
++ FILE* fp = (FILE*)bts_fp;
++ unsigned char action_hdr[4];
++
++ if (bts_fp == NULL)
++ return 0;
++
++ /* Each Action has the following: */
++ /* UINT16 type of this action */
++ /* UINT16 size of rest */
++ /* BYTE[] action buffer (for HCI, includes the type byte e.g. 1 for hci command) */
++
++ if (1 == fread(&action_hdr[0], sizeof(action_hdr), 1, fp)) {
++ unsigned short type = *(unsigned short*)&action_hdr[0];
++ unsigned short size = *(unsigned short*)&action_hdr[2];
++
++ if (size <= nMaxSize) {
++ int nread = fread(action_buf, sizeof(action_buf[0]), size, fp);
++
++ if (nread == size) {
++ *ptype = type;
++ bytes = (unsigned long)size;
++ }
++ }
++ }
++
++ return bytes;
++}
++
++void
++bts_unload_script(bts_t* bts_fp)
++{
++ FILE* fp = (FILE*)bts_fp;
++
++ if (NULL != fp) {
++ fclose(fp);
++ }
++}
++
diff --git a/meta/packages/bluez/files/hciattach_devlength.patch b/meta/packages/bluez/files/hciattach_devlength.patch
new file mode 100644
index 0000000000..8d84cb1b00
--- /dev/null
+++ b/meta/packages/bluez/files/hciattach_devlength.patch
@@ -0,0 +1,11 @@
+--- bluez-utils-2.21/tools/hciattach.c.orig 2005-12-15 16:29:55.000000000 +0100
++++ bluez-utils-2.21/tools/hciattach.c 2005-12-15 16:29:37.000000000 +0100
+@@ -973,7 +973,7 @@
+ int send_break = 0;
+ pid_t pid;
+ struct sigaction sa;
+- char dev[20];
++ char dev[25];
+
+ detach = 1;
+ printpid = 0;
diff --git a/meta/packages/bluez/files/hcid.conf b/meta/packages/bluez/files/hcid.conf
new file mode 100644
index 0000000000..44e9c46fb0
--- /dev/null
+++ b/meta/packages/bluez/files/hcid.conf
@@ -0,0 +1,72 @@
+#
+# HCI daemon configuration file.
+#
+# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # PIN helper
+ pin_helper /bin/bluepin;
+
+ # D-Bus PIN helper
+ # dbus_pin_helper;
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "%h";
+
+ # Local device class
+ class 0x120112;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ #
+ #lm accept,master;
+ #
+ lm accept;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ #
+ #lp hold,sniff;
+ #
+ lp rswitch,hold,sniff,park;
+
+ # Authentication and Encryption
+ #auth enable;
+ encrypt enable;
+}
diff --git a/meta/packages/bluez/files/no-user-include.patch b/meta/packages/bluez/files/no-user-include.patch
new file mode 100644
index 0000000000..8c1b1b6d6d
--- /dev/null
+++ b/meta/packages/bluez/files/no-user-include.patch
@@ -0,0 +1,18 @@
+Do not add -I/usr/include to the compile line just because we will
+install bluez-utils there says zecke...
+
+Index: bluez-utils-2.25/acinclude.m4
+===================================================================
+--- bluez-utils-2.25.orig/acinclude.m4 2006-05-18 12:39:57.473577920 +0200
++++ bluez-utils-2.25/acinclude.m4 2006-05-19 00:58:52.694599848 +0200
+@@ -69,7 +69,9 @@
+ ac_save_LDFLAGS=$LDFLAGS
+
+ BLUEZ_CFLAGS=""
+- test -d "${bluez_prefix}/include" && BLUEZ_CFLAGS="$BLUEZ_CFLAGS -I${bluez_prefix}/include"
++ if test "$cross_compiling" = no; then
++ test -d "${bluez_prefix}/include" && BLUEZ_CFLAGS="$BLUEZ_CFLAGS -I${bluez_prefix}/include"
++ fi
+
+ CPPFLAGS="$CPPFLAGS $BLUEZ_CFLAGS"
+ AC_CHECK_HEADER(bluetooth/bluetooth.h, dummy=yes, AC_MSG_ERROR(Bluetooth header files not found))
diff --git a/meta/packages/bluez/files/openmn/bluetooth.default b/meta/packages/bluez/files/openmn/bluetooth.default
new file mode 100644
index 0000000000..06c52d7960
--- /dev/null
+++ b/meta/packages/bluez/files/openmn/bluetooth.default
@@ -0,0 +1,37 @@
+# Bluetooth configuraton file
+
+# Start of hcid (allowed values are "true" and "false")
+HCID_ENABLE=true
+
+# Config file for hcid
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+
+# Start sdpd (allowed values are "true" and "false")
+SDPD_ENABLE=false
+
+# Start hidd (allowed values are "true" and "false")
+HIDD_ENABLE=false
+
+# Arguments to hidd
+HIDD_OPTIONS=""
+
+# Run hid2hci (allowed values are "true" and "false")
+HID2HCI_ENABLE=false
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=false
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+# Start dund (allowed values are "true" and "false")
+DUND_ENABLE=false
+
+# Arguments to dund
+DUND_OPTIONS="--listen --persist"
+
+# Start pand (allowed values are "true" and "false")
+PAND_ENABLE=false
+
+# Arguments to pand
+PAND_OPTIONS="--listen --role NAP"
diff --git a/meta/packages/bluez/files/openmn/hcid.conf b/meta/packages/bluez/files/openmn/hcid.conf
new file mode 100644
index 0000000000..46a5d5fd54
--- /dev/null
+++ b/meta/packages/bluez/files/openmn/hcid.conf
@@ -0,0 +1,70 @@
+#
+# HCI daemon configuration file.
+#
+# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # PIN helper
+ # pin_helper /bin/bluepin;
+
+ # D-Bus PIN helper
+ # dbus_pin_helper;
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "%h";
+
+ # Local device class
+ class 0x820100;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ #
+ lm accept,master;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ #
+ #lp hold,sniff;
+ #
+ lp rswitch,hold,sniff,park;
+
+ # Authentication and Encryption
+ auth enable;
+ encrypt enable;
+}
diff --git a/meta/packages/bluez/files/openzaurus/bluetooth.default b/meta/packages/bluez/files/openzaurus/bluetooth.default
new file mode 100644
index 0000000000..e63ab137cc
--- /dev/null
+++ b/meta/packages/bluez/files/openzaurus/bluetooth.default
@@ -0,0 +1,37 @@
+# Bluetooth configuraton file
+
+# Start of hcid (allowed values are "true" and "false")
+HCID_ENABLE=true
+
+# Config file for hcid
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+
+# Start sdpd (allowed values are "true" and "false")
+SDPD_ENABLE=true
+
+# Start hidd (allowed values are "true" and "false")
+HIDD_ENABLE=false
+
+# Arguments to hidd
+HIDD_OPTIONS=""
+
+# Run hid2hci (allowed values are "true" and "false")
+HID2HCI_ENABLE=true
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=true
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+# Start dund (allowed values are "true" and "false")
+DUND_ENABLE=false
+
+# Arguments to dund
+DUND_OPTIONS="--listen --persist"
+
+# Start pand (allowed values are "true" and "false")
+PAND_ENABLE=false
+
+# Arguments to pand
+PAND_OPTIONS="--listen --role NAP"
diff --git a/meta/packages/bluez/files/slugos/bluetooth.default b/meta/packages/bluez/files/slugos/bluetooth.default
new file mode 100644
index 0000000000..10f628e314
--- /dev/null
+++ b/meta/packages/bluez/files/slugos/bluetooth.default
@@ -0,0 +1,37 @@
+# Bluetooth configuraton file
+
+# Start of hcid (allowed values are "true" and "false")
+HCID_ENABLE=true
+
+# Config file for hcid
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+
+# Start sdpd (allowed values are "true" and "false")
+SDPD_ENABLE=true
+
+# Start hidd (allowed values are "true" and "false")
+HIDD_ENABLE=false
+
+# Arguments to hidd
+HIDD_OPTIONS=""
+
+# 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"
+
+# Start dund (allowed values are "true" and "false")
+DUND_ENABLE=true
+
+# Arguments to dund
+DUND_OPTIONS="--listen --persist"
+
+# Start pand (allowed values are "true" and "false")
+PAND_ENABLE=true
+
+# Arguments to pand
+PAND_OPTIONS="--listen --role NAP"
diff --git a/meta/packages/bluez/files/slugos/hcid.conf b/meta/packages/bluez/files/slugos/hcid.conf
new file mode 100644
index 0000000000..46a5d5fd54
--- /dev/null
+++ b/meta/packages/bluez/files/slugos/hcid.conf
@@ -0,0 +1,70 @@
+#
+# HCI daemon configuration file.
+#
+# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # PIN helper
+ # pin_helper /bin/bluepin;
+
+ # D-Bus PIN helper
+ # dbus_pin_helper;
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "%h";
+
+ # Local device class
+ class 0x820100;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ #
+ lm accept,master;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ #
+ #lp hold,sniff;
+ #
+ lp rswitch,hold,sniff,park;
+
+ # Authentication and Encryption
+ auth enable;
+ encrypt enable;
+}