summaryrefslogtreecommitdiffstats
path: root/source/n/bluez-utils
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/bluez-utils')
-rw-r--r--source/n/bluez-utils/60-bluetooth.rules35
-rw-r--r--source/n/bluez-utils/README.SLACKWARE18
-rw-r--r--source/n/bluez-utils/add-passkey.c394
-rw-r--r--source/n/bluez-utils/bluetooth.conf24
-rwxr-xr-xsource/n/bluez-utils/bluez-utils.SlackBuild188
-rw-r--r--source/n/bluez-utils/doinst.sh30
-rw-r--r--source/n/bluez-utils/rc.bluetooth114
-rw-r--r--source/n/bluez-utils/rc.bluetooth.conf33
-rw-r--r--source/n/bluez-utils/register-passkeys19
-rw-r--r--source/n/bluez-utils/slack-desc19
10 files changed, 874 insertions, 0 deletions
diff --git a/source/n/bluez-utils/60-bluetooth.rules b/source/n/bluez-utils/60-bluetooth.rules
new file mode 100644
index 000000000..0957225fd
--- /dev/null
+++ b/source/n/bluez-utils/60-bluetooth.rules
@@ -0,0 +1,35 @@
+# Brain Boxes BL-620 Bluetooth Adapter
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Brain Boxes", SYSFS{prod_id2}=="Bluetooth PC Card", ENV{HCIOPTS}="bboxes", RUN+="bluetooth_serial"
+
+# Xircom CreditCard Bluetooth Adapter
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", ENV{HCIOPTS}="xircom", RUN+="bluetooth_serial"
+
+# Xircom RealPort2 Bluetooth Adapter
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", ENV{HCIOPTS}="xircom", RUN+="bluetooth_serial"
+
+# IBM Bluetooth PC Card II
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="IBM", SYSFS{prod_id2}=="Bluetooth PC Card II", ENV{HCIOPTS}="tdk", RUN+="bluetooth_serial"
+
+# TDK Bluetooth PC Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="TDK", SYSFS{prod_id2}=="Bluetooth PC Card II", ENV{HCIOPTS}="tdk", RUN+="bluetooth_serial"
+
+# AmbiCom BT2000C Bluetooth PC/CF Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="AmbiCom BT2000C", SYSFS{prod_id2}=="Bluetooth PC/CF Card", ENV{HCIOPTS}="bt2000c", RUN+="bluetooth_serial"
+
+# COM One Platinium Bluetooth PC Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="COM1 SA", SYSFS{prod_id2}=="MC310 CARD", ENV{HCIOPTS}="comone", RUN+="bluetooth_serial"
+
+# Sphinx PICO Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="SPHINX", SYSFS{prod_id2}=="BT-CARD", ENV{HCIOPTS}="picocard", RUN+="bluetooth_serial"
+
+# H-Soft blue+Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="H-Soft", SYSFS{prod_id2}=="Blue+CARD", ENV{HCIOPTS}="$sysfs{manf_id},$sysfs{card_id}", RUN+="bluetooth_serial"
+
+# Compaq iPAQ Bluetooth Sleeve, Belkin F8T020, any other muppet who used an OXCF950 and didn't bother to program it appropriately.
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="CF CARD", SYSFS{prod_id2}=="GENERIC", ENV{HCIOPTS}="$sysfs{manf_id},$sysfs{card_id}", RUN+="bluetooth_serial"
+
+# Zoom Bluetooth Card and Sitecom CN-504 Card
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="PCMCIA", SYSFS{prod_id2}=="Bluetooth Card", ENV{HCIOPTS}="zoom", RUN+="bluetooth_serial"
+
+# CC&C BT0100M
+SUBSYSTEM=="tty", BUS=="pcmcia", SYSFS{prod_id1}=="Bluetooth BT0100M", ENV{HCIOPTS}="bcsp 115200", RUN+="bluetooth_serial"
diff --git a/source/n/bluez-utils/README.SLACKWARE b/source/n/bluez-utils/README.SLACKWARE
new file mode 100644
index 000000000..795c8c5a2
--- /dev/null
+++ b/source/n/bluez-utils/README.SLACKWARE
@@ -0,0 +1,18 @@
+PIN (or passkey) management
+---------------------------
+since bluez 3.0 the old pin_helper script has been replaced by
+the dbus interface. To add a default passkey for every outgoing
+request (e.g. the old /etc/bluetooth/pin file) drop it into
+/etc/bluetooth/passkeys/default. (e.g. echo -n "1234" >
+/etc/bluetooth/passkeys/default )
+To add a passkey for a specific outgoing connection replace default
+with the device's address. ( /etc/bluetooth/passkeys/aa:bb:cc:dd:ee:ff
+will contain passkey for aa:bb:cc:dd:ee:ff ).
+After adding a passkey you should restart bluetooth with
+
+/etc/init.d/bluetooth restart
+
+and the new passkeys will be registered.
+
+
+(This behaviour has been copied from Debian)
diff --git a/source/n/bluez-utils/add-passkey.c b/source/n/bluez-utils/add-passkey.c
new file mode 100644
index 000000000..b9dcbb517
--- /dev/null
+++ b/source/n/bluez-utils/add-passkey.c
@@ -0,0 +1,394 @@
+/*
+ * add-passkey.c:
+ * registers as an agent for the bluez bluetooth linux stack, the code is
+ * shamelessly stolen from bluez source found at http://bluez.sf.net
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2005-2006 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <getopt.h>
+#include <string.h>
+
+#include <dbus/dbus.h>
+
+#define INTERFACE "org.bluez.Security"
+
+// FIXME assumption
+#define PASSKEYMAXLENGTH 255
+
+static char *passkey = NULL;
+static char *address = NULL;
+
+static volatile sig_atomic_t __io_canceled = 0;
+static volatile sig_atomic_t __io_terminated = 0;
+
+static void sig_term(int sig)
+{
+ __io_canceled = 1;
+}
+
+static DBusHandlerResult agent_filter(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ const char *name, *old, *new;
+
+ if (!dbus_message_is_signal(msg, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (!dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old,
+ DBUS_TYPE_STRING, &new, DBUS_TYPE_INVALID)) {
+ fprintf(stderr, "Invalid arguments for NameOwnerChanged signal");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (!strcmp(name, "org.bluez") && *new == '\0') {
+ __io_terminated = 1;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusHandlerResult request_message(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ const char *path, *address;
+
+ 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)) {
+ fprintf(stderr, "Invalid arguments for passkey Request method");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply) {
+ fprintf(stderr, "Can't create reply message\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &passkey,
+ DBUS_TYPE_INVALID);
+
+ dbus_connection_send(conn, reply, NULL);
+
+ dbus_connection_flush(conn);
+
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult release_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 Release method");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply) {
+ fprintf(stderr, "Can't create reply message\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ dbus_message_append_args(reply, DBUS_TYPE_INVALID);
+
+ dbus_connection_send(conn, reply, NULL);
+
+ dbus_connection_flush(conn);
+
+ dbus_message_unref(reply);
+
+ if (!__io_canceled)
+ fprintf(stderr, "Passkey service has been released\n");
+
+ __io_terminated = 1;
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult agent_message(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ if (dbus_message_is_method_call(msg, "org.bluez.PasskeyAgent", "Request"))
+ return request_message(conn, msg, data);
+
+ if (dbus_message_is_method_call(msg, "org.bluez.PasskeyAgent", "Release"))
+ return release_message(conn, msg, data);
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static const DBusObjectPathVTable agent_table = {
+ .message_function = agent_message,
+};
+
+static int register_agent(DBusConnection *conn, const char *agent_path,
+ const char *remote_address, int use_default)
+{
+ DBusMessage *msg, *reply;
+ DBusError err;
+ const char *path, *method, *address = remote_address;
+
+ if (!dbus_connection_register_object_path(conn, agent_path,
+ &agent_table, NULL)) {
+ fprintf(stderr, "Can't register path object path for agent\n");
+ return -1;
+ }
+
+ if (use_default) {
+ path = "/org/bluez";
+ method = "RegisterDefaultPasskeyAgent";
+ } else {
+ path = "/org/bluez/hci0";
+ method = "RegisterPasskeyAgent";
+ }
+
+ msg = dbus_message_new_method_call("org.bluez", path, INTERFACE, method);
+ if (!msg) {
+ fprintf(stderr, "Can't allocate new method call\n");
+ return -1;
+ }
+
+ if (use_default)
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path,
+ DBUS_TYPE_INVALID);
+ else
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path,
+ DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID);
+
+ 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 register passkey agent\n");
+ if (dbus_error_is_set(&err)) {
+ fprintf(stderr, "%s\n", err.message);
+ dbus_error_free(&err);
+ }
+ return -1;
+ }
+
+ dbus_message_unref(reply);
+
+ dbus_connection_flush(conn);
+
+ return 0;
+}
+
+static int unregister_agent(DBusConnection *conn, const char *agent_path,
+ const char *remote_address, int use_default)
+{
+ DBusMessage *msg, *reply;
+ DBusError err;
+ const char *path, *method, *address = remote_address;
+
+ if (use_default) {
+ path = "/org/bluez";
+ method = "UnregisterDefaultPasskeyAgent";
+ } else {
+ path = "/org/bluez/hci0";
+ method = "UnregisterPasskeyAgent";
+ }
+
+ msg = dbus_message_new_method_call("org.bluez", path, INTERFACE, method);
+ if (!msg) {
+ fprintf(stderr, "Can't allocate new method call\n");
+ dbus_connection_close(conn);
+ exit(1);
+ }
+
+ if (use_default)
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path,
+ DBUS_TYPE_INVALID);
+ else
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path,
+ DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID);
+
+ 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 unregister passkey agent\n");
+ if (dbus_error_is_set(&err)) {
+ fprintf(stderr, "%s\n", err.message);
+ dbus_error_free(&err);
+ }
+ return -1;
+ }
+
+ dbus_message_unref(reply);
+
+ dbus_connection_flush(conn);
+
+ dbus_connection_unregister_object_path(conn, agent_path);
+
+ return 0;
+}
+
+static void usage(void)
+{
+// printf("Bluetooth passkey agent ver %s\n\n", VERSION);
+
+ printf("Usage:\n"
+ "\tadd-passkey [--passkey-fd n] [--default] [--path agent-path] [address]\n"
+ "\n"
+ "add-passkey will read from passkey-fd (default: stdin) adding a default passkey\n"
+ "if --default is given, or for a specific address if supplied on commandline.\n\n"
+ "--default or address are mandatory.\n"
+ "this program is based on bluez passkey-agent.c from http://bluez.sf.net\n"
+ "\n");
+}
+
+static struct option main_options[] = {
+ { "passkey-fd", 1, 0, 'f'},
+ { "default", 0, 0, 'd' },
+ { "path", 1, 0, 'p' },
+ { "help", 0, 0, 'h' },
+ { 0, 0, 0, 0 }
+};
+
+int main(int argc, char *argv[])
+{
+ struct sigaction sa;
+ DBusConnection *conn;
+ char match_string[128], default_path[128], *agent_path = NULL;
+ int opt, use_default = 0, passkey_fd = 0;
+ char *tmppasskey;
+
+ snprintf(default_path, sizeof(default_path),
+ "/org/bluez/passkey_agent_%d", getpid());
+
+ while ((opt = getopt_long(argc, argv, "+fdp:h", main_options, NULL)) != EOF) {
+ switch(opt) {
+ case 'f':
+ passkey_fd = atoi(optarg);
+ case 'd':
+ use_default = 1;
+ break;
+ case 'p':
+ if (optarg[0] != '/') {
+ fprintf(stderr, "Invalid path\n");
+ exit(1);
+ }
+ agent_path = strdup(optarg);
+ break;
+ case 'h':
+ usage();
+ exit(0);
+ default:
+ exit(1);
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ optind = 0;
+
+ if (argc < 1 && !use_default) {
+ usage();
+ exit(1);
+ }
+
+ passkey = malloc(PASSKEYMAXLENGTH * sizeof(char));
+
+ if (!read(passkey_fd, passkey, PASSKEYMAXLENGTH)) {
+ fprintf(stderr, "Unable to read passkey from fd %d\n", passkey_fd);
+ exit(1);
+ }
+
+ if (tmppasskey = index(passkey, '\n')) {
+ *tmppasskey = '\0';
+ }
+
+ address = (argc > 0) ? strdup(argv[0]) : NULL;
+
+ if (!use_default && !address) {
+ usage();
+ exit(1);
+ }
+
+ if (!agent_path)
+ agent_path = strdup(default_path);
+
+ conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (!conn) {
+ fprintf(stderr, "Can't get on system bus");
+ exit(1);
+ }
+
+ if (register_agent(conn, agent_path, address, use_default) < 0) {
+ dbus_connection_close(conn);
+ exit(1);
+ }
+
+ if (!dbus_connection_add_filter(conn, agent_filter, NULL, NULL))
+ fprintf(stderr, "Can't add signal filter");
+
+ snprintf(match_string, sizeof(match_string),
+ "interface=%s,member=NameOwnerChanged,arg0=%s",
+ DBUS_INTERFACE_DBUS, "org.bluez");
+
+ dbus_bus_add_match(conn, match_string, NULL);
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_flags = SA_NOCLDSTOP;
+ sa.sa_handler = sig_term;
+ sigaction(SIGTERM, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+
+ while (!__io_canceled && !__io_terminated) {
+ if (dbus_connection_read_write_dispatch(conn, 100) != TRUE)
+ break;
+ }
+
+ if (!__io_terminated)
+ unregister_agent(conn, agent_path, address, use_default);
+
+ if (passkey)
+ free(passkey);
+
+ dbus_connection_close(conn);
+
+ return 0;
+}
diff --git a/source/n/bluez-utils/bluetooth.conf b/source/n/bluez-utils/bluetooth.conf
new file mode 100644
index 000000000..c0476237a
--- /dev/null
+++ b/source/n/bluez-utils/bluetooth.conf
@@ -0,0 +1,24 @@
+<!-- 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 send_interface="org.bluez.Agent"/>
+ </policy>
+
+ <policy at_console="true">
+ <allow send_destination="org.bluez"/>
+ </policy>
+
+ <policy context="default">
+ <deny send_destination="org.bluez"/>
+ </policy>
+
+</busconfig>
diff --git a/source/n/bluez-utils/bluez-utils.SlackBuild b/source/n/bluez-utils/bluez-utils.SlackBuild
new file mode 100755
index 000000000..7f8b95746
--- /dev/null
+++ b/source/n/bluez-utils/bluez-utils.SlackBuild
@@ -0,0 +1,188 @@
+#!/bin/sh
+#
+# SlackBuild for bluez-utils
+# http://www.bluez.org
+# By SukkoPera <enjoy.the.silence@iol.it>
+# Thanks a lot to CAT for his Slackware package cration
+# guide (http://www.slacky.it/misto/tutorial/spunleashed.txt)
+#
+# Check out
+# - http://www.sukkopera.tk
+# - http://www.slacky.it
+# - http://www.nyft.org
+#
+# Notes:
+# - Many files and the whole PIN management system have been stolen from the
+# Debian package. Thanks.
+#
+# Rewritten for Slackware 2007-05 <pjv>
+
+NAME=bluez-utils
+VERSION=${VERSION:-3.36}
+ARCH=${ARCH:-x86_64}
+NUMJOBS=${NUMJOBS:-" -j7 "}
+BUILD=${BUILD:-7}
+
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$NAME
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+mkdir -p $PKG/etc/rc.d \
+ $PKG/etc/bluetooth/passkeys \
+ $PKG/usr/lib${LIBDIRSUFFIX}/bluetooth
+# Is there any reason for a non-root user to be able to see these?
+chmod 700 $PKG/etc/bluetooth/passkeys
+cd $TMP
+rm -rf $NAME-$VERSION
+tar xvf $CWD/${NAME}-${VERSION}.tar.bz2 || exit 1
+cd $NAME-$VERSION
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --mandir=/usr/man \
+ --localstatedir=/var \
+ --enable-tools\
+ --enable-bccmd \
+ --enable-hid2hci \
+ --enable-dfutool \
+ --enable-hidd \
+ --enable-pand \
+ --enable-dund \
+ --enable-cups \
+ --enable-manpages \
+ --enable-configfiles \
+ --build=$ARCH-slackware-linux
+
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG
+
+mkdir -p $PKG/lib/udev
+cp -a scripts/bluetooth_serial $PKG/lib/udev/bluetooth_serial || exit 1
+chmod 755 $PKG/lib/udev/bluetooth_serial
+
+mkdir -p $PKG/lib/udev/rules.d
+cp -a scripts/bluetooth.rules $PKG/lib/udev/rules.d/60-bluetooth.rules || exit 1
+chmod 644 $PKG/lib/udev/rules.d/60-bluetooth.rules
+
+# This appears to be gone/obsolete:
+#if [ ! -e $PKG/etc/bluetooth/transfer.service ]; then
+# cat transfer/transfer.service > $PKG/etc/bluetooth/transfer.service
+#fi
+#if [ ! -e $PKG/usr/lib${LIBDIRSUFFIX}/bluetooth/bluetoothd-service-transfer -a -e transfer/bluetoothd-service-transfer ]; then
+# cat transfer/bluetoothd-service-transfer > $PKG/usr/lib${LIBDIRSUFFIX}/bluetooth/bluetoothd-service-transfer
+# chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/bluetooth/bluetoothd-service-transfer
+#fi
+
+# Install Debian's add-passkey program:
+DEBDEST=/usr/lib${LIBDIRSUFFIX}/bluetooth
+gcc $(pkg-config --libs --cflags dbus-1) -DDBUS_API_SUBJECT_TO_CHANGE \
+ $CWD/add-passkey.c -o $PKG/$DEBDEST/add-passkey || exit 1
+cp $CWD/register-passkeys $PKG/$DEBDEST
+if [ "$ARCH" = "x86_64" ]; then
+ sed -i "s,/usr/lib/,/usr/lib${LIBDIRSUFFIX}/,g" $PKG/$DEBDEST/register-passkeys
+fi
+chmod a+x $PKG/$DEBDEST/*
+
+# Default PIN (wow, does this seem insecure!)
+#echo "1234" > $PKG/etc/bluetooth/passkeys/default
+touch $PKG/etc/bluetooth/passkeys/default
+
+mkdir -p $PKG/usr/doc/$NAME-$VERSION
+cp -a \
+ AUTHORS ChangeLog COPYING* INSTALL NEWS README $CWD/README.SLACKWARE \
+ $PKG/usr/doc/$NAME-$VERSION
+( cd $PKG/etc/bluetooth
+ ln -sf /usr/doc/$NAME-$VERSION/README.SLACKWARE .
+)
+
+# Arrange init scripts and config files:
+CONF=/etc/rc.d/rc.bluetooth.conf
+mkdir -p $PKG/etc/rc.d
+cp $CWD/rc.bluetooth $PKG/etc/rc.d/rc.bluetooth
+if [ "$ARCH" = "x86_64" ]; then
+ sed -i "s,/usr/lib/,/usr/lib${LIBDIRSUFFIX}/,g" $PKG/etc/rc.d/rc.bluetooth
+fi
+cp -a $CWD/rc.bluetooth.conf $PKG/etc/rc.d/rc.bluetooth.conf
+sed -i "s:\(HIDD_ENABLE=\).*:\1false:" $PKG/$CONF || exit 1
+sed -i "s:\(HID2HCI_ENABLE=\).*:\1false:" $PKG/$CONF || exit 1
+
+mkdir -p $PKG/etc/bluetooth
+cp -a audio/audio.conf $PKG/etc/bluetooth
+cp -a audio/asound.conf $PKG/etc/bluetooth
+cp -a input/input.conf $PKG/etc/bluetooth
+cp -a hcid/hcid.conf $PKG/etc/bluetooth
+cp -a network/network.conf $PKG/etc/bluetooth
+cp -a rfcomm/rfcomm.conf $PKG/etc/bluetooth
+chmod 644 $PKG/etc/bluetooth/*.conf
+
+# Do not overwrite configuration
+# Well, let the dbus file be overwritten, as it is not usually user-edited.
+( cd $PKG
+ for file in \
+ etc/bluetooth/audio.conf \
+ etc/asound.conf \
+ etc/bluetooth/asound.conf \
+ etc/bluetooth/input.conf \
+ etc/bluetooth/hcid.conf \
+ etc/bluetooth/network.conf \
+ etc/bluetooth/rfcomm.conf \
+ etc/bluetooth/passkeys/default \
+ etc/rc.d/rc.bluetooth \
+ etc/rc.d/rc.bluetooth.conf ; do
+ mv ${file} ${file}.new
+ done
+)
+
+# Replace the bluetooth.conf file with one from BlueZ4 that works with the newest dbus:
+cat $CWD/bluetooth.conf > $PKG/etc/dbus-1/system.d/bluetooth.conf
+
+# Compress and if needed symlink the man pages:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1) ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.?
+ )
+ done
+ )
+fi
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$NAME-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/n/bluez-utils/doinst.sh b/source/n/bluez-utils/doinst.sh
new file mode 100644
index 000000000..e738d14bd
--- /dev/null
+++ b/source/n/bluez-utils/doinst.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+config() {
+ NEW="$1"
+ OLD="`dirname $NEW`/`basename $NEW .new`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+if [ ! -e etc/rc.d/rc.bluetooth -o ! -x etc/rc.d/rc.bluetooth ]; then
+ chmod 644 etc/rc.d/rc.bluetooth.new
+else
+ chmod 755 etc/rc.d/rc.bluetooth.new
+fi
+config etc/rc.d/rc.bluetooth.new
+config etc/rc.d/rc.bluetooth.conf.new
+config etc/bluetooth/asound.conf.new
+config etc/bluetooth/audio.conf.new
+config etc/bluetooth/hcid.conf.new
+config etc/bluetooth/input.conf.new
+config etc/bluetooth/network.conf.new
+config etc/bluetooth/rfcomm.conf.new
+config etc/bluetooth/passkeys/default.new
+
+if [ ! -e etc/asound.conf ]; then
+ ( cd etc ; ln -sf bluetooth/asound.conf . )
+fi
diff --git a/source/n/bluez-utils/rc.bluetooth b/source/n/bluez-utils/rc.bluetooth
new file mode 100644
index 000000000..cf891dcf9
--- /dev/null
+++ b/source/n/bluez-utils/rc.bluetooth
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# Start/stop the Bluetooth daemons
+#
+# This version has been modified by SukkoPera, taking inspiration from then
+# Debian init script, to add support for register-passkeys. Modified by
+# Patrick Volkerding to add "restart" support, and cleaned up a tiny bit.
+
+set -e
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DESC="Bluetooth subsystem"
+
+# The register-passkeys script was originally written by Debian:
+REGISTER_PASSKEYS=/usr/lib/bluetooth/register-passkeys
+
+HCID_NAME=hcid
+HIDD_NAME=hidd
+HID2HCI_NAME=hid2hci
+RFCOMM_NAME=rfcomm
+PAND_NAME=pand
+DUND_NAME=dund
+
+HCID_EXEC="`which $HCID_NAME || true`"
+HIDD_EXEC="`which $HIDD_NAME || true`"
+HID2HCI_EXEC="`which $HID2HCI_NAME || true`"
+RFCOMM_EXEC="`which $RFCOMM_NAME || true`"
+PAND_EXEC="`which $PAND_NAME || true`"
+DUND_EXEC="`which $DUND_NAME || true`"
+
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+# Source rc.bluetooth.conf
+. /etc/rc.d/rc.bluetooth.conf
+
+bluetooth_start() {
+ echo -n "Starting $DESC: "
+ if [ -x "$HIDD_EXEC" ] ; then
+ if $HIDD_ENABLE && [ -x "$HIDD_EXEC" -a -n "$HIDD_OPTIONS" ] ; then
+ $HIDD_EXEC $HIDD_OPTIONS || true
+ echo -n " $HIDD_NAME"
+ fi
+ else
+ echo "BlueZ does not appear to be installed!"
+ exit
+ fi
+ # Separate sdp daemon is depreciated, now internal function.
+ if $SDPD_ENABLE ; then
+ $HCID_EXEC -s -f $HCID_CONFIG
+ echo -n " $HCID_NAME sdp"
+ else
+ $HCID_EXEC -f $HCID_CONFIG
+ echo -n " $HCID_NAME"
+ fi
+ if $HID2HCI_ENABLE && [ -x "$HID2HCI_EXEC" ] ; then
+ $HID2HCI_EXEC --tohci > /dev/null 2>&1 || true
+ echo -n " $HID2HCI_NAME"
+ fi
+ if $RFCOMM_ENABLE && [ -x "$RFCOMM_EXEC" -a -f "$RFCOMM_CONFIG" ] ; then
+ $RFCOMM_EXEC -f $RFCOMM_CONFIG bind all || true
+ echo -n " $RFCOMM_NAME"
+ fi
+ if $DUND_ENABLE && [ -x "$DUND_EXEC" -a -n "$DUND_OPTIONS" ] ; then
+ $DUND_EXEC $DUND_OPTIONS
+ echo -n " $DUND_NAME"
+ fi
+ if $PAND_ENABLE && [ -x "$PAND_EXEC" -a -n "$PAND_OPTIONS" ] ; then
+ $PAND_EXEC $PAND_OPTIONS
+ echo -n " $PAND_NAME"
+ fi
+ if [ -x $REGISTER_PASSKEYS ]; then
+ $REGISTER_PASSKEYS
+ echo -n " passkeys"
+ fi
+ echo "."
+}
+
+bluetooth_stop() {
+ echo -n "Stopping $DESC: "
+ killall $PAND_NAME > /dev/null 2>&1 || true
+ echo -n " $PAND_NAME"
+ killall $DUND_NAME > /dev/null 2>&1 || true
+ echo -n " $DUND_NAME"
+ if [ -x "$RFCOMM_EXEC" ] ; then
+ $RFCOMM_EXEC release all > /dev/null 2>&1 || true
+ echo -n " $RFCOMM_NAME"
+ fi
+ killall $HIDD_NAME > /dev/null 2>&1 || true
+ echo -n " $HIDD_NAME"
+ killall $HCID_NAME > /dev/null 2>&1 || true
+ echo -n " $HCID_NAME"
+ echo "."
+}
+
+case "$1" in
+ start)
+ bluetooth_start
+ ;;
+ stop)
+ bluetooth_stop
+ ;;
+ restart)
+ bluetooth_stop
+ sleep 1
+ bluetooth_start
+ ;;
+ *)
+ echo "Usage: $0 start|stop|restart" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/source/n/bluez-utils/rc.bluetooth.conf b/source/n/bluez-utils/rc.bluetooth.conf
new file mode 100644
index 000000000..09df405fb
--- /dev/null
+++ b/source/n/bluez-utils/rc.bluetooth.conf
@@ -0,0 +1,33 @@
+# /etc/rc.d/rc.bluetooth.conf
+#
+# This file contains the configuration for the Bluetooth subsystem, BlueZ.
+
+# The lines below allow you to configure which BlueZ daemons will be started,
+# along with any daemon-specific options.
+
+# Allowed values for each (unless otherwise noted) are "true" and "false"
+
+# =============================================================================
+
+# The SDP daemon allows clients to detect supported Bluetooth services
+SDPD_ENABLE=true
+
+# The HID daemon supports Bluetooth Human Interface Devices
+HIDD_ENABLE=false
+HIDD_OPTIONS="--server"
+
+# This switches your Bluetooth device into HCI mode, use this if your input
+# device does not support Bluetooth HID
+HID2HCI_ENABLE=false
+
+# The RFCOMM daemon is used to simulate serial connections over Bluetooth
+RFCOMM_ENABLE=true
+
+# The DUN daemon is used for Dial Up Networking over Bluetooth
+DUND_ENABLE=false
+DUND_OPTIONS="--listen --persist --msdun call dun"
+
+# The PAN daemon is used to setup a Bluetooth network.
+PAND_ENABLE=false
+PAND_OPTIONS="--listen --role NAP"
+
diff --git a/source/n/bluez-utils/register-passkeys b/source/n/bluez-utils/register-passkeys
new file mode 100644
index 000000000..f57042c3c
--- /dev/null
+++ b/source/n/bluez-utils/register-passkeys
@@ -0,0 +1,19 @@
+#!/bin/bash
+# register every passkey found in $PASSKEYS_DIR
+
+PASSKEYS_DIR="/etc/bluetooth/passkeys/"
+PASSKEY_AGENT="/usr/lib/bluetooth/add-passkey"
+
+cd $PASSKEYS_DIR
+
+for f in $(ls -1 ${PASSKEYS_DIR}); do
+ if [ ! -r "$f" ]; then continue; fi
+
+ # default passkey
+ if [ "$f" == "default" ]; then
+ cat "$f" | $PASSKEY_AGENT --default > /dev/null 2>&1 &
+ # specific passkey
+ elif echo "$f" | egrep -q '([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}'; then
+ cat "$f" | $PASSKEY_AGENT "$f" > /dev/null 2>&1 &
+ fi
+done
diff --git a/source/n/bluez-utils/slack-desc b/source/n/bluez-utils/slack-desc
new file mode 100644
index 000000000..159f02466
--- /dev/null
+++ b/source/n/bluez-utils/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+bluez-utils: bluez-utils (Utilities for working with Bluetooth(TM))
+bluez-utils:
+bluez-utils: The bluez-utils package contains utilities for supporting
+bluez-utils: Bluetooth(TM) on Linux.
+bluez-utils:
+bluez-utils: For more info, visit: http://www.bluez.org
+bluez-utils:
+bluez-utils:
+bluez-utils:
+bluez-utils:
+bluez-utils: