update to cooker

This commit is contained in:
root 2012-08-21 13:12:03 +04:00
parent 4e28347b1b
commit ea9dd811c4
12 changed files with 1115 additions and 396 deletions

View file

@ -1,2 +1,2 @@
sources:
"bluez-4.93.tar.gz": 30cabd0deec55ba44ca25f5621485e1d6a6e10d4
"bluez-4.101.tar.xz": 5e6d94686b1a0492c4aed59ba16601f4903c15e8

View file

@ -0,0 +1,554 @@
From 64f9449656dbbb718d53a54ed8e7904e289280ec Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 30 Dec 2011 12:34:29 +0100
Subject: [PATCH] Add sixaxis cable-pairing plugin
Implement the old "sixpair" using libudev and libusb-1.0.
When a Sixaxis device is plugged in, events are filtered, and
the device is selected, poked around to set the default Bluetooth
address, and added to the database of the current default adapter.
---
Makefile.am | 9 +-
acinclude.m4 | 16 +++
configure.ac | 1 +
plugins/cable.c | 382 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/adapter.c | 19 +++
src/adapter.h | 3 +
6 files changed, 428 insertions(+), 2 deletions(-)
create mode 100644 plugins/cable.c
diff --git a/Makefile.am b/Makefile.am
index 53fcbe9..f831a72 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -238,6 +238,11 @@ builtin_sources += thermometer/main.c \
endif
+if CABLE
+builtin_modules += cable
+builtin_sources += plugins/cable.c
+endif
+
builtin_modules += hciops mgmtops
builtin_sources += plugins/hciops.c plugins/mgmtops.c
@@ -306,7 +311,7 @@ src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \
src/event.h src/event.c \
src/oob.h src/oob.c src/eir.h src/eir.c
src_bluetoothd_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@ @DBUS_LIBS@ \
- -ldl -lrt
+ @CABLE_LIBS@ -ldl -lrt
src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
-Wl,--version-script=$(srcdir)/src/bluetooth.ver
@@ -428,7 +433,7 @@ EXTRA_DIST += doc/manager-api.txt \
AM_YFLAGS = -d
-AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
+AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CABLE_CFLAGS@
INCLUDES = -I$(builddir)/lib -I$(builddir)/src -I$(srcdir)/src \
-I$(srcdir)/audio -I$(srcdir)/sbc -I$(srcdir)/gdbus \
diff --git a/acinclude.m4 b/acinclude.m4
index 6505ad3..3f59989 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -139,6 +139,12 @@ AC_DEFUN([AC_PATH_UDEV], [
AC_SUBST(UDEV_LIBS)
])
+AC_DEFUN([AC_PATH_CABLE], [
+ PKG_CHECK_MODULES(CABLE, libudev libusb-1.0, cable_found=yes, cable_found=no)
+ AC_SUBST(CABLE_CFLAGS)
+ AC_SUBST(CABLE_LIBS)
+])
+
AC_DEFUN([AC_PATH_SNDFILE], [
PKG_CHECK_MODULES(SNDFILE, sndfile, sndfile_found=yes, sndfile_found=no)
AC_SUBST(SNDFILE_CFLAGS)
@@ -176,6 +182,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
sndfile_enable=${sndfile_found}
hal_enable=no
usb_enable=${usb_found}
+ cable_enable=${cable_found}
alsa_enable=${alsa_found}
gstreamer_enable=${gstreamer_found}
audio_enable=yes
@@ -265,6 +272,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
usb_enable=${enableval}
])
+ AC_ARG_ENABLE(cable, AC_HELP_STRING([--enable-cable], [enable DeviceKit support]), [
+ cable_enable=${enableval}
+ ])
+
AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools], [install Bluetooth utilities]), [
tools_enable=${enableval}
])
@@ -366,6 +377,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have USB library.])
fi
+ if (test "${cable_enable}" = "yes" && test "${cable_found}" = "yes"); then
+ AC_DEFINE(HAVE_CABLE, 1, [Define to 1 if you have libcable.])
+ fi
+
AM_CONDITIONAL(SNDFILE, test "${sndfile_enable}" = "yes" && test "${sndfile_found}" = "yes")
AM_CONDITIONAL(USB, test "${usb_enable}" = "yes" && test "${usb_found}" = "yes")
AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes" ||
@@ -398,4 +413,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AM_CONDITIONAL(DBUSOOBPLUGIN, test "${dbusoob_enable}" = "yes")
AM_CONDITIONAL(WIIMOTEPLUGIN, test "${wiimote_enable}" = "yes")
AM_CONDITIONAL(GATTMODULES, test "${gatt_enable}" = "yes")
+ AM_CONDITIONAL(CABLE, test "${cable_enable}" = "yes" && test "${cable_found}" = "yes")
])
diff --git a/configure.ac b/configure.ac
index 48b181e..45a4b15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ AC_PATH_GSTREAMER
AC_PATH_USB
AC_PATH_UDEV
AC_PATH_SNDFILE
+AC_PATH_CABLE
AC_PATH_OUI
AC_PATH_READLINE
AC_PATH_CHECK
diff --git a/plugins/cable.c b/plugins/cable.c
new file mode 100644
index 0000000..fe758db
--- /dev/null
+++ b/plugins/cable.c
@@ -0,0 +1,382 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2009 Bastien Nocera <hadess@hadess.net>
+ *
+ *
+ * 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 <glib.h>
+#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1
+#include <libudev.h>
+#include <dbus/dbus.h>
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/sdp.h>
+#include <libusb.h>
+
+#include "plugin.h"
+#include "log.h"
+
+#include "adapter.h"
+#include "manager.h"
+#include "device.h"
+
+#include "storage.h"
+#include "sdp_lib.h"
+
+/* Vendor and product ID for the Sixaxis PS3 controller */
+#define VENDOR 0x054c
+#define PRODUCT 0x0268
+#define SIXAXIS_PNP_RECORD "3601920900000A000100000900013503191124090004350D35061901000900113503190011090006350909656E09006A0901000900093508350619112409010009000D350F350D350619010009001335031900110901002513576972656C65737320436F6E74726F6C6C65720901012513576972656C65737320436F6E74726F6C6C6572090102251B536F6E7920436F6D707574657220456E7465727461696E6D656E740902000901000902010901000902020800090203082109020428010902052801090206359A35980822259405010904A101A102850175089501150026FF00810375019513150025013500450105091901291381027501950D0600FF8103150026FF0005010901A10075089504350046FF0009300931093209358102C0050175089527090181027508953009019102750895300901B102C0A1028502750895300901B102C0A10285EE750895300901B102C0A10285EF750895300901B102C0C0090207350835060904090901000902082800090209280109020A280109020B09010009020C093E8009020D280009020E2800"
+#define HID_UUID "00001124-0000-1000-8000-00805f9b34fb"
+
+static struct btd_device *create_cable_association(DBusConnection *conn,
+ struct btd_adapter *adapter,
+ const char *name,
+ const char *address,
+ guint32 vendor_id,
+ guint32 product_id,
+ const char *pnp_record)
+{
+ sdp_record_t *rec;
+ struct btd_device *device;
+ bdaddr_t src, dst;
+ char srcaddr[18];
+
+ device = adapter_find_device(adapter, address);
+ if (device == NULL) {
+ device = device_create(conn, adapter, address, BDADDR_BREDR);
+ if (device != NULL)
+ adapter_create_device_for_device(conn, adapter, device);
+ }
+ if (device != NULL) {
+ device_set_temporary(device, FALSE);
+ device_set_name(device, name);
+ }
+
+ str2ba(address, &dst);
+ adapter_get_address(adapter, &src);
+ ba2str(&src, srcaddr);
+
+ write_device_name(&dst, &src, (char *) name);
+
+ /* Store the device's SDP record */
+ rec = record_from_string(pnp_record);
+ store_record(srcaddr, address, rec);
+ sdp_record_free(rec);
+ /* Set the device id */
+ store_device_id(srcaddr, address, 0xffff, vendor_id, product_id, 0);
+ /* Don't write a profile, it will be updated when the device connects */
+
+ write_trust(srcaddr, address, "[all]", TRUE);
+
+ return device;
+}
+
+static char *get_bdaddr(libusb_device_handle *devh, int itfnum)
+{
+ unsigned char msg[17];
+ char *address;
+ int res;
+
+ res = libusb_control_transfer(devh,
+ LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE,
+ 0x01, 0x03f2, itfnum,
+ (void*) msg, sizeof(msg),
+ 5000);
+
+ if (res < 0) {
+ DBG("Getting the device Bluetooth address failed");
+ return NULL;
+ }
+
+ address = g_strdup_printf("%02X:%02X:%02X:%02X:%02X:%02X",
+ msg[4], msg[5], msg[6], msg[7], msg[8], msg[9]);
+
+ DBG("Device Bluetooth address: %s\n", address);
+
+ return address;
+}
+
+static gboolean set_master_bdaddr(libusb_device_handle *devh, int itfnum, char *host)
+{
+ unsigned char msg[8];
+ int mac[6];
+ int res;
+
+ if (sscanf(host, "%X:%X:%X:%X:%X:%X",
+ &mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5]) != 6) {
+ return FALSE;
+ }
+
+ msg[0] = 0x01;
+ msg[1] = 0x00;
+ msg[2] = mac[0];
+ msg[3] = mac[1];
+ msg[4] = mac[2];
+ msg[5] = mac[3];
+ msg[6] = mac[4];
+ msg[7] = mac[5];
+
+ res = libusb_control_transfer(devh,
+ LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE,
+ 0x09, 0x03f5, itfnum,
+ (void*) msg, sizeof(msg),
+ 5000);
+
+ if (res < 0) {
+ DBG("Setting the master Bluetooth address failed");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+static void handle_usb_device(struct btd_adapter *adapter,
+ libusb_device *dev,
+ struct libusb_config_descriptor *cfg,
+ int itfnum,
+ const struct libusb_interface_descriptor *alt)
+{
+ DBusConnection *conn;
+ libusb_device_handle *devh;
+ char *device_bdaddr;
+ char adapter_bdaddr[18];
+ struct btd_device *device;
+ bdaddr_t dst;
+
+ device_bdaddr = NULL;
+ conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (conn == NULL) {
+ DBG("Failed to get on the bus");
+ return;
+ }
+
+ if (libusb_open(dev, &devh) < 0) {
+ DBG("Can't open device");
+ goto bail;
+ }
+ libusb_detach_kernel_driver(devh, itfnum);
+
+ if (libusb_claim_interface(devh, itfnum) < 0) {
+ DBG("Can't claim interface %d", itfnum);
+ goto bail;
+ }
+
+ device_bdaddr = get_bdaddr(devh, itfnum);
+ if (device_bdaddr == NULL) {
+ DBG("Failed to get the Bluetooth address from the device");
+ goto bail;
+ }
+
+ device = create_cable_association(conn,
+ adapter,
+ "PLAYSTATION(R)3 Controller",
+ device_bdaddr,
+ VENDOR, PRODUCT, SIXAXIS_PNP_RECORD);
+ btd_device_add_uuid(device, HID_UUID);
+
+ adapter_get_address(adapter, &dst);
+ ba2str(&dst, adapter_bdaddr);
+ DBG("Adapter bdaddr %s", adapter_bdaddr);
+
+ if (set_master_bdaddr(devh, itfnum, adapter_bdaddr) == FALSE) {
+ DBG("Failed to set the master Bluetooth address");
+ goto bail;
+ }
+
+bail:
+ dbus_connection_unref(conn);
+ g_free(device_bdaddr);
+ libusb_release_interface(devh, itfnum);
+ /* We ignore errors from the reattach, as there's nothing we
+ * can do about it */
+ libusb_attach_kernel_driver(devh, itfnum);
+ if (devh != NULL)
+ libusb_close(devh);
+}
+
+static void handle_device_plug(struct udev_device *udevice)
+{
+ struct btd_adapter *adapter;
+ guint i;
+
+ libusb_device **list, *usbdev;
+ ssize_t num_devices;
+ struct libusb_device_descriptor desc;
+ guint8 j;
+
+ if (g_strcmp0(udev_device_get_property_value(udevice, "ID_SERIAL"),
+ "Sony_PLAYSTATION_R_3_Controller") != 0)
+ return;
+ /* Don't look at events with an associated driver */
+ if (udev_device_get_property_value(udevice, "ID_USB_DRIVER") != NULL)
+ return;
+
+ DBG("Found Sixaxis device");
+
+ /* Look for the default adapter */
+ adapter = manager_get_default_adapter();
+ if (adapter == NULL)
+ return;
+
+ /* Look for the USB device */
+ libusb_init(NULL);
+
+ num_devices = libusb_get_device_list(NULL, &list);
+ if (num_devices < 0) {
+ DBG("libusb_get_device_list failed");
+ return;
+ }
+
+ usbdev = NULL;
+ for (i = 0; i < num_devices; i++) {
+ char *path;
+
+ path = g_strdup_printf("%s/%03d/%03d", "/dev/bus/usb",
+ libusb_get_bus_number(list[i]),
+ libusb_get_device_address(list[i]));
+ if (g_strcmp0(path, udev_device_get_devnode(udevice)) == 0) {
+ g_free(path);
+ usbdev = libusb_ref_device(list[i]);
+ break;
+ }
+ g_free(path);
+ }
+
+ libusb_free_device_list(list, TRUE);
+ if (usbdev == NULL) {
+ DBG("Found a Sixaxis, but couldn't find it via libusb");
+ goto out;
+ }
+
+ if (libusb_get_device_descriptor(usbdev, &desc) < 0) {
+ DBG("libusb_get_device_descriptor() failed");
+ goto out;
+ }
+
+ /* Look for the interface number that interests us */
+ for (j = 0; j < desc.bNumConfigurations; j++) {
+ struct libusb_config_descriptor *config;
+ guint8 k;
+
+ if (libusb_get_config_descriptor(usbdev, j, &config) < 0) {
+ DBG("Failed to get config descriptor %d", j);
+ continue;
+ }
+
+ for (k = 0; k < config->bNumInterfaces; k++) {
+ const struct libusb_interface *itf = &config->interface[k];
+ int l;
+
+ for (l = 0; l < itf->num_altsetting ; l++) {
+ struct libusb_interface_descriptor alt;
+
+ alt = itf->altsetting[l];
+ if (alt.bInterfaceClass == 3) {
+ handle_usb_device(adapter, usbdev, config, l, &alt);
+ }
+ }
+ }
+ }
+
+out:
+ if (usbdev != NULL)
+ libusb_unref_device(usbdev);
+ libusb_exit(NULL);
+}
+
+static gboolean device_event_idle(struct udev_device *udevice)
+{
+ handle_device_plug(udevice);
+ udev_device_unref(udevice);
+ return FALSE;
+}
+
+static struct udev *ctx = NULL;
+static struct udev_monitor *monitor = NULL;
+static guint watch_id = 0;
+
+static gboolean
+monitor_event(GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ struct udev_device *udevice;
+
+ udevice = udev_monitor_receive_device(monitor);
+ if (udevice == NULL)
+ goto out;
+ if (g_strcmp0(udev_device_get_action(udevice), "add") != 0)
+ goto out;
+
+ g_timeout_add_seconds(1, (GSourceFunc) device_event_idle, udevice);
+
+out:
+ return TRUE;
+}
+
+
+static int cable_init(void)
+{
+ GIOChannel *channel;
+
+ DBG("Setup cable plugin");
+
+ ctx = udev_new();
+ monitor = udev_monitor_new_from_netlink(ctx, "udev");
+ if (monitor == NULL) {
+ error ("Could not get udev monitor");
+ return -1;
+ }
+
+ /* Listen for newly connected usb device */
+ udev_monitor_filter_add_match_subsystem_devtype(monitor,
+ "usb", NULL);
+ udev_monitor_enable_receiving(monitor);
+
+ channel = g_io_channel_unix_new(udev_monitor_get_fd(monitor));
+ watch_id = g_io_add_watch(channel, G_IO_IN, monitor_event, NULL);
+ g_io_channel_unref(channel);
+
+ return 0;
+}
+
+static void cable_exit(void)
+{
+ DBG("Cleanup cable plugin");
+
+ if (watch_id != 0) {
+ g_source_remove(watch_id);
+ watch_id = 0;
+ }
+ if (monitor != NULL) {
+ udev_monitor_unref(monitor);
+ monitor = NULL;
+ }
+ if (ctx != NULL) {
+ udev_unref(ctx);
+ ctx = NULL;
+ }
+}
+
+BLUETOOTH_PLUGIN_DEFINE(cable, VERSION,
+ BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, cable_init, cable_exit)
diff --git a/src/adapter.c b/src/adapter.c
index 6e04faf..0488891 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -952,6 +952,25 @@ static struct btd_device *adapter_create_device(DBusConnection *conn,
return device;
}
+void adapter_create_device_for_device(DBusConnection *conn,
+ struct btd_adapter *adapter,
+ struct btd_device *device)
+{
+ const char *path;
+
+ device_set_temporary(device, TRUE);
+
+ adapter->devices = g_slist_append(adapter->devices, device);
+
+ path = device_get_path(device);
+ g_dbus_emit_signal(conn, adapter->path,
+ ADAPTER_INTERFACE, "DeviceCreated",
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);
+
+ adapter_update_devices(adapter);
+}
+
void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter,
struct btd_device *device,
gboolean remove_storage)
diff --git a/src/adapter.h b/src/adapter.h
index b7ea62b..ac0aa2e 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -114,6 +114,9 @@ void adapter_update_found_devices(struct btd_adapter *adapter,
uint8_t *data, uint8_t data_len);
void adapter_emit_device_found(struct btd_adapter *adapter,
struct remote_dev_info *dev);
+void adapter_create_device_for_device(DBusConnection *conn,
+ struct btd_adapter *adapter,
+ struct btd_device *device);
void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode);
int adapter_set_name(struct btd_adapter *adapter, const char *name);
void adapter_name_changed(struct btd_adapter *adapter, const char *name);
--
1.7.10.2

View file

@ -0,0 +1,37 @@
From c70bf65af6e301f18063491b22112300c0fb9b89 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sun, 17 Jun 2012 01:25:46 +0200
Subject: [PATCH 1/3] input: Add helper function to request disconnect
---
input/device.c | 7 +++++++
input/device.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/input/device.c b/input/device.c
index 0e3f4a9..8fdd4e0 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1306,3 +1306,10 @@ int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst)
return 0;
}
+
+void input_device_request_disconnect(struct fake_input *fake)
+{
+ if (fake == NULL || fake->idev == NULL)
+ return;
+ device_request_disconnect(fake->idev->device, NULL);
+}
diff --git a/input/device.h b/input/device.h
index 509a353..ff52967 100644
--- a/input/device.h
+++ b/input/device.h
@@ -49,3 +49,4 @@ int input_device_unregister(const char *path, const char *uuid);
int input_device_set_channel(const bdaddr_t *src, const bdaddr_t *dst, int psm,
GIOChannel *io);
int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst);
+void input_device_request_disconnect(struct fake_input *fake);
--
1.7.10

View file

@ -0,0 +1,118 @@
From cca11542bcd4d1748c850806c1599ed1b76ea19a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sun, 17 Jun 2012 01:26:18 +0200
Subject: [PATCH 2/3] fakehid: Disconnect from PS3 remote after 10 mins
After 10 minutes, disconnect the PS3 BD Remote to avoid draining its
battery. This is consistent with its behaviour on the PS3.
Original patch by Ruslan N. Marchenko <rufferson@gmail.com>
---
input/device.h | 1 +
input/fakehid.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/input/device.h b/input/device.h
index ff52967..d8baa2c 100644
--- a/input/device.h
+++ b/input/device.h
@@ -33,6 +33,7 @@ struct fake_input {
int uinput; /* uinput socket */
int rfcomm; /* RFCOMM socket */
uint8_t ch; /* RFCOMM channel number */
+ guint timeout_id; /* Disconnect timeout ID */
gboolean (*connect) (struct input_conn *iconn, GError **err);
int (*disconnect) (struct input_conn *iconn);
void *priv;
diff --git a/input/fakehid.c b/input/fakehid.c
index 3181538..a125356 100644
--- a/input/fakehid.c
+++ b/input/fakehid.c
@@ -44,6 +44,9 @@
#include "fakehid.h"
#include "uinput.h"
+/* Timeout to get the PS3 remote disconnected, in seconds */
+#define PS3_REMOTE_TIMEOUT 10 * 60
+
enum ps3remote_special_keys {
PS3R_BIT_PS = 0,
PS3R_BIT_ENTER = 3,
@@ -141,6 +144,20 @@ static unsigned int ps3remote_keymap[] = {
[0xff] = KEY_MAX,
};
+static gboolean ps3_remote_timeout_cb(gpointer user_data);
+
+static void ps3remote_set_timeout(struct fake_input *fake, gboolean enable)
+{
+ if (enable) {
+ fake->timeout_id = g_timeout_add_seconds(PS3_REMOTE_TIMEOUT, ps3_remote_timeout_cb, fake);
+ } else {
+ if (fake->timeout_id > 0) {
+ g_source_remove(fake->timeout_id);
+ fake->timeout_id = 0;
+ }
+ }
+}
+
static int ps3remote_decode(char *buff, int size, unsigned int *value)
{
static unsigned int lastkey = 0;
@@ -203,6 +220,16 @@ error:
return -1;
}
+static gboolean
+ps3_remote_timeout_cb(gpointer user_data)
+{
+ struct fake_input *fake = (struct fake_input *) user_data;
+ input_device_request_disconnect(fake);
+ DBG("Disconnected PS3 BD Remote after timeout");
+ fake->timeout_id = 0;
+ return FALSE;
+}
+
static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
gpointer data)
{
@@ -221,6 +248,9 @@ static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
goto failed;
}
+ /* Remove the old timeout */
+ ps3remote_set_timeout(fake, FALSE);
+
fd = g_io_channel_unix_get_fd(chan);
memset(buff, 0, sizeof(buff));
@@ -256,6 +286,8 @@ static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
goto failed;
}
+ ps3remote_set_timeout(fake, TRUE);
+
return TRUE;
failed:
@@ -318,6 +350,8 @@ static int ps3remote_setup_uinput(struct fake_input *fake,
goto err;
}
+ ps3remote_set_timeout(fake, TRUE);
+
return 0;
err:
@@ -378,6 +412,8 @@ struct fake_input *fake_hid_connadd(struct fake_input *fake,
for (l = fake_hid->devices; l != NULL; l = l->next) {
old = l->data;
if (old->idev == fake->idev) {
+ if (fake->timeout_id > 0)
+ g_source_remove(fake->timeout_id);
g_free(fake);
fake = old;
fake_hid->connect(fake, NULL);
--
1.7.10

View file

@ -0,0 +1,107 @@
From 4319a0601457772591e520e407019b606780d035 Mon Sep 17 00:00:00 2001
From: Alexander Khryukin <alexander@mezon.ru>
Date: Mon, 25 Jun 2012 13:16:23 -0400
Subject: [PATCH 2/2] test
---
Makefile.am | 21 ++++++++++++++++++---
configure.ac | 7 +++++++
scripts/bluetooth.service.in | 14 ++++++++++++++
scripts/org.bluez.service | 5 +++++
4 files changed, 44 insertions(+), 3 deletions(-)
create mode 100644 scripts/bluetooth.service.in
create mode 100644 scripts/org.bluez.service
diff --git a/Makefile.am b/Makefile.am
index 1c214c6..024aa36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -414,9 +414,24 @@ endif
rules_DATA = $(foreach file,$(udev_files), scripts/97-$(notdir $(file)))
endif
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ scripts/bluetooth.service
+
+scripts/bluetooth.service: scripts/bluetooth.service.in
+ @$(SED) -e "s|\@sbindir\@|$(sbindir)|" $< >$@
+
+dbussystemservicesdir = $(datadir)/dbus-1/system-services
+
+dbussystemservices_DATA = \
+ scripts/org.bluez.service
+endif
+
+
CLEANFILES += $(rules_DATA)
-EXTRA_DIST += scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules
+EXTRA_DIST += scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules \
+ scripts/bluetooth.service.in scripts/org.bluez.service
EXTRA_DIST += doc/manager-api.txt \
doc/adapter-api.txt doc/device-api.txt \
@@ -460,9 +475,9 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = bluez.pc
-DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles
+DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --with-systemdsystemunitdir=
-DISTCLEANFILES = $(pkgconfig_DATA)
+DISTCLEANFILES = $(pkgconfig_DATA) scripts/bluetooth.service
MAINTAINERCLEANFILES = Makefile.in \
aclocal.m4 configure config.h.in config.sub config.guess \
diff --git a/configure.ac b/configure.ac
index f2db920..6f6b4c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,5 +60,12 @@ if (test -n "${path_systemdunit}"); then
AC_SUBST(SYSTEMD_UNITDIR)
fi
AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
+# systemd
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
AC_OUTPUT(Makefile doc/version.xml src/bluetoothd.8 src/bluetooth.service bluez.pc)
diff --git a/scripts/bluetooth.service.in b/scripts/bluetooth.service.in
new file mode 100644
index 0000000..5ec0e2a
--- /dev/null
+++ b/scripts/bluetooth.service.in
@@ -0,0 +1,14 @@
+[Unit]
+Description=Bluetooth Manager
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.bluez
+ExecStart=@sbindir@/bluetoothd -n
+StandardOutput=syslog
+
+[Install]
+WantedBy=bluetooth.target
+Alias=dbus-org.bluez.service
+
diff --git a/scripts/org.bluez.service b/scripts/org.bluez.service
new file mode 100644
index 0000000..dd7ae8f
--- /dev/null
+++ b/scripts/org.bluez.service
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.bluez
+Exec=/bin/false
+User=root
+SystemdService=dbus-org.bluez.service
--
1.7.9.2

View file

@ -0,0 +1,26 @@
From a354165e58f937ee12c16ab48ce334b664c8f163 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sun, 17 Jun 2012 01:29:01 +0200
Subject: [PATCH 3/3] fakehid: Use the same constant as declared
ps3remote_keymap[] uses 0xff as the max value, so should we.
---
input/fakehid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/fakehid.c b/input/fakehid.c
index a125356..a758413 100644
--- a/input/fakehid.c
+++ b/input/fakehid.c
@@ -335,7 +335,7 @@ static int ps3remote_setup_uinput(struct fake_input *fake,
}
/* enabling keys */
- for (i = 0; i < 256; i++)
+ for (i = 0; i < 0xff; i++)
if (ps3remote_keymap[i] != KEY_RESERVED)
if (ioctl(fake->uinput, UI_SET_KEYBIT,
ps3remote_keymap[i]) < 0) {
--
1.7.10

View file

@ -0,0 +1,23 @@
--- bluez-4.101/lib/bluetooth.h.c++11~ 2012-06-28 23:59:45.676069338 +0200
+++ bluez-4.101/lib/bluetooth.h 2012-06-28 23:59:50.973003117 +0200
@@ -140,16 +140,16 @@ enum {
#define bt_get_unaligned(ptr) \
({ \
struct __attribute__((packed)) { \
- typeof(*(ptr)) __v; \
- } *__p = (typeof(__p)) (ptr); \
+ __typeof__(*(ptr)) __v; \
+ } *__p = (__typeof__(__p)) (ptr); \
__p->__v; \
})
#define bt_put_unaligned(val, ptr) \
do { \
struct __attribute__((packed)) { \
- typeof(*(ptr)) __v; \
- } *__p = (typeof(__p)) (ptr); \
+ __typeof__(*(ptr)) __v; \
+ } *__p = (__typeof__(__p)) (ptr); \
__p->__v = (val); \
} while(0)

View file

@ -1,23 +0,0 @@
Subject: [PATCH]
From: Andrey Borzenkov <arvidjaar@gmail.com>
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
---
scripts/bluetooth.rules.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/bluetooth.rules.in b/scripts/bluetooth.rules.in
index 64df69d..f9733bc 100644
--- a/scripts/bluetooth.rules.in
+++ b/scripts/bluetooth.rules.in
@@ -1,4 +1,4 @@
# Run helper every time a Bluetooth device appears
# On remove actions, bluetoothd should go away by itself
-ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="@prefix@/sbin/bluetoothd --udev"
-ACTION=="change", SUBSYSTEM=="bluetooth", RUN+="@prefix@/sbin/bluetoothd --udev"
+TEST{040000}!="/sys/fs/cgroup/systemd", ACTION=="add", SUBSYSTEM=="bluetooth", RUN{fail_event_on_error}+="@prefix@/sbin/bluetoothd --udev"
+TEST{040000}!="/sys/fs/cgroup/systemd", ACTION=="change", SUBSYSTEM=="bluetooth", RUN+="@prefix@/sbin/bluetoothd --udev"

View file

@ -1,92 +0,0 @@
--- bluez-4.93/Makefile.am.systemd 2011-05-03 10:20:36.000000000 +0200
+++ bluez-4.93/Makefile.am 2011-05-16 10:44:20.000000000 +0200
@@ -352,7 +352,8 @@
CLEANFILES += $(rules_DATA)
EXTRA_DIST += scripts/bluetooth.rules \
- scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules
+ scripts/bluetooth-hid2hci.rules scripts/bluetooth-serial.rules \
+ scripts/bluetooth.service.in scripts/org.bluez.service
if PCMCIA
udevdir = $(libexecdir)/udev
@@ -360,6 +361,27 @@
dist_udev_SCRIPTS = scripts/bluetooth_serial
endif
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ scripts/bluetooth.service
+
+scripts/bluetooth.service: scripts/bluetooth.service.in
+ @$(SED) -e "s|\@sbindir\@|$(sbindir)|" $< >$@
+
+dbussystemservicesdir = $(datadir)/dbus-1/system-services
+
+dbussystemservices_DATA = \
+ scripts/org.bluez.service
+
+endif
+
+install-data-hook:
+if HAVE_SYSTEMD
+ $(MKDIR_P) $(DESTDIR)$(systemdsystemunitdir)/bluetooth.target.wants
+ ( cd $(DESTDIR)$(systemdsystemunitdir)/bluetooth.target.wants && \
+ $(LN_S) ../bluetooth.service bluetooth.service )
+endif
+
EXTRA_DIST += doc/manager-api.txt \
doc/adapter-api.txt doc/device-api.txt \
doc/service-api.txt doc/agent-api.txt doc/attribute-api.txt \
@@ -385,9 +407,9 @@
pkgconfig_DATA = bluez.pc
-DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
+DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdsystemunitdir=
-DISTCLEANFILES = $(pkgconfig_DATA)
+DISTCLEANFILES = $(pkgconfig_DATA) scripts/bluetooth.service
MAINTAINERCLEANFILES = Makefile.in \
aclocal.m4 configure config.h.in config.sub config.guess \
--- bluez-4.93/configure.ac.systemd 2011-05-03 10:20:36.000000000 +0200
+++ bluez-4.93/configure.ac 2011-05-16 10:40:24.000000000 +0200
@@ -57,5 +57,14 @@
AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
fi
+# systemd
+
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
+
AC_OUTPUT(Makefile scripts/bluetooth.rules doc/version.xml
src/bluetoothd.8 bluez.pc)
--- bluez-4.93/scripts/.gitignore.systemd 2011-05-16 10:40:24.000000000 +0200
+++ bluez-4.93/scripts/.gitignore 2011-05-16 10:40:24.000000000 +0200
@@ -0,0 +1 @@
+bluetooth.service
--- bluez-4.93/scripts/bluetooth.service.in.systemd 2011-05-16 10:40:24.000000000 +0200
+++ bluez-4.93/scripts/bluetooth.service.in 2011-05-16 10:40:24.000000000 +0200
@@ -0,0 +1,8 @@
+[Unit]
+Description=Bluetooth Manager
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.bluez
+ExecStart=@sbindir@/bluetoothd -n
--- bluez-4.93/scripts/org.bluez.service.systemd 2011-05-16 10:40:24.000000000 +0200
+++ bluez-4.93/scripts/org.bluez.service 2011-05-16 10:40:24.000000000 +0200
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.bluez
+Exec=/bin/false
+User=root
+SystemdService=bluetooth.service

View file

@ -0,0 +1,12 @@
diff --git a/scripts/bluetooth-serial.rules b/scripts/bluetooth-serial.rules
index 072335f..f6284ff 100644
--- a/scripts/bluetooth-serial.rules
+++ b/scripts/bluetooth-serial.rules
@@ -33,3 +33,7 @@ SUBSYSTEM=="tty", SUBSYSTEMS=="pcmcia", ATTRS{prod_id1}=="PCMCIA", ATTRS{prod_id
# CC&C BT0100M
SUBSYSTEM=="tty", SUBSYSTEMS=="pcmcia", ATTRS{prod_id1}=="Bluetooth BT0100M", ENV{HCIOPTS}="bcsp 115200", RUN+="bluetooth_serial"
+
+# SocketMobile CF Connection Kit
+SUBSYSTEM=="tty", SUBSYSTEMS=="pcmcia", ATTRS{prod_id1}=="Socket", ATTRS{prod_id2}=="CF+ Personal Network Card Rev 2.5", ENV{HCIOPTS}="socket", RUN+="bluetooth_serial"
+

6
bluez-uinput.modules Normal file
View file

@ -0,0 +1,6 @@
#!/bin/sh
if [ ! -c /dev/input/uinput ] ; then
exec /sbin/modprobe uinput >/dev/null 2>&1
fi

View file

@ -2,61 +2,50 @@
%define libname %mklibname %{name} %{major}
%define devname %mklibname -d %{name}
%define _with_systemd 1
%bcond_without systemd
Name: bluez
Summary: Official Linux Bluetooth protocol stack
Version: 4.93
Release: %mkrel 2
Version: 4.101
Release: 4
License: GPLv2+
Group: Communications
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
URL: http://bluez.sourceforge.net/
Source0: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
#Source1: bluetooth.init
#Source2: pand.init
#Source3: dund.init
#Source4: hidd.init
#Source5: bluetooth.conf
URL: http://www.bluez.org/
Source0: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.xz
Source6: pand.conf
Source7: dund.conf
Source8: hidd.conf
Source9: rfcomm.conf
#Source10: hidd.hotplug
#Source11: hidd.udev.rules
Source10: bluez-uinput.modules
# (bor) also disable rule if systemd is active
Patch100: bluez-4.79-fail_udev_event_on_error.patch
# (bor) based on http://article.gmane.org/gmane.linux.bluez.kernel/6479
Patch101: bluez-4.93-systemd_support.patch
# http://thread.gmane.org/gmane.linux.bluez.kernel/8645
Patch0: 0002-systemd-unitdir-enable.patch
Patch4: bluez-socket-mobile-cf-connection-kit.patch
# http://thread.gmane.org/gmane.linux.bluez.kernel/2396
Patch5: 0001-Add-sixaxis-cable-pairing-plugin.patch
# PS3 BD Remote patches
Patch6: 0001-input-Add-helper-function-to-request-disconnect.patch
Patch7: 0002-fakehid-Disconnect-from-PS3-remote-after-10-mins.patch
Patch8: 0003-fakehid-Use-the-same-constant-as-declared.patch
Patch9: bluez-4.101-fix-c++11-compatibility.patch
BuildRequires: dbus-devel
BuildRequires: flex
BuildRequires: bison
BuildRequires: libusb-devel
BuildRequires: libalsa-devel
BuildRequires: udev-tools
BuildRequires: libgstreamer0.10-plugins-base-devel
BuildRequires: gstreamer0.10-devel hal-devel
Buildrequires: systemd
BuildRequires: readline-devel
BuildRequires: expat-devel
BuildRequires: udev-devel
BuildRequires: libcap-ng-devel
# (bor) for P101
BuildRequires: automake autoconf
%if %{_with_systemd}
BuildRequires: systemd-units
BuildRequires: libsystemd-daemon-devel
%endif
Requires: python-gobject
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(gstreamer-plugins-base-0.10)
BuildRequires: pkgconfig(gstreamer-0.10)
BuildRequires: pkgconfig(libcap-ng)
BuildRequires: pkgconfig(libusb)
BuildRequires: usb1-devel
BuildRequires: pkgconfig(udev) >= 186
Requires: bluez-pin
Requires: obex-data-server
Provides: bluez-sdp
Obsoletes: bluez-sdp < 4.0
Provides: bluez-pan
Provides: bluez-hciemu
Obsoletes: bluez-hciemu
Provides: bluez-utils
Obsoletes: bluez-utils < 4.0
Suggests: obex-data-server
Suggests: bluez-firmware
%description
@ -71,39 +60,45 @@ if [ "$1" = "2" -a -d %{_var}/lib/lib/bluetooth ]; then
rmdir %{_var}/lib/lib/ > /dev/null 2>&1 || exit 0
fi
##%_post_service bluetooth
##%_post_service dund
##%_post_service hidd
##%_post_service pand
%preun
##%_preun_service bluetooth
##%_preun_service dund
##%_preun_service hidd
##%_preun_service pand
if [ $1 -eq 1 ]; then
/bin/systemctl enable bluetooth.service >/dev/null 2>&1 || :
fi
%postun
if [ "$1" = "0" ]; then
update-alternatives --remove bluepin /usr/bin/bluepin
fi
%triggerin -- bluez < 4.46-4mdv
/sbin/chkconfig --del bluetooth
/sbin/chkconfig --del dund
/sbin/chkconfig --del hidd
/sbin/chkconfig --del pand
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart bluetooth.service >/dev/null 2>&1 || :
fi
%triggerun -- bluez < 4.94-4
/bin/systemctl --no-reload enable bluetooth.service >/dev/null 2>&1 || :
%files
%defattr(-,root,root)
%{_bindir}/*
%{_sbindir}/*
/sbin/hidd
%{_bindir}/ciptool
%{_bindir}/dfutool
%{_bindir}/gatttool
%{_bindir}/hcitool
%{_bindir}/hidd
%{_bindir}/l2ping
%{_bindir}/rfcomm
%{_bindir}/sdptool
### compat
%{_bindir}/dund
%{_bindir}/pand
###
%{_sbindir}/bccmd
%{_sbindir}/hciattach
%{_sbindir}/hciconfig
%{_sbindir}/bluetoothd
/bin/hidd
/sbin/bluetoothd
%if %{_with_systemd}
/lib/systemd/system/bluetooth.service
/lib/systemd/system/bluetooth.target.wants/bluetooth.service
%if %{with systemd}
/lib/systemd/system/*.service
%endif
#/sbin/udev_bluetooth_helper
%{_mandir}/man?/*
%config(noreplace) %{_sysconfdir}/sysconfig/*
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/*.conf
@ -113,50 +108,43 @@ fi
/lib/udev/hid2hci
%{_sysconfdir}/udev/rules.d/97-bluetooth-serial.rules
%{_sysconfdir}/udev/rules.d/97-bluetooth-hid2hci.rules
%{_sysconfdir}/udev/rules.d/97-bluetooth.rules
%{_localstatedir}/lib/bluetooth
#--------------------------------------------------------------------
%package cups
Summary: CUPS printer backend for Bluetooth printers
Group: System/Servers
Requires: cups
Obsoletes: %name-utils-cups
%package cups
Summary: CUPS printer backend for Bluetooth printers
Group: System/Servers
Requires: cups
%description cups
%description cups
This package contains the CUPS backend for Bluetooth printers.
%files cups
%defattr(-, root, root)
%files cups
%{_prefix}/lib/cups/backend/bluetooth
#--------------------------------------------------------------------
%package gstreamer
Summary: Gstreamer support for SBC audio format
Group: Sound
Obsoletes: %name-utils-gstreamer
%package gstreamer
Summary: Gstreamer support for SBC audio format
Group: Sound
%description gstreamer
%description gstreamer
This package contains gstreamer plugins for the Bluetooth SBC audio format
%files gstreamer
%defattr(-, root, root)
%files gstreamer
%{_libdir}/gstreamer-*/*.so
#--------------------------------------------------------------------
%package alsa
Summary: ALSA support for Bluetooth audio devices
Group: Sound
Obsoletes: %name-utils-alsa
%package alsa
Summary: ALSA support for Bluetooth audio devices
Group: Sound
%description alsa
%description alsa
This package contains ALSA support for Bluetooth audio devices
%files alsa
%defattr(-, root, root)
%files alsa
%{_libdir}/alsa-lib/*.so
%{_datadir}/alsa/bluetooth.conf
@ -165,115 +153,121 @@ This package contains ALSA support for Bluetooth audio devices
%package -n %{libname}
Summary: Official Linux Bluetooth protocol stack
Group: System/Libraries
Provides: lib%{name}-sdp2
Obsoletes: lib%{name}-sdp2
%description -n %{libname}
These are the official Bluetooth communication libraries for Linux.
%files -n %{libname}
%defattr(-,root,root)
/%{_lib}/lib*.so.%{major}*
#--------------------------------------------------------------------
%package test
Summary: Tools for testing of various Bluetooth-functions
Group: System/Servers
Requires: python-dbus
Requires: python-gobject
%description test
Contains a few tools for testing various bluetooth functions. The
BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.
%files test
%{_bindir}/simple-agent
%{_bindir}/test-*
#--------------------------------------------------------------------
%package -n %{devname}
Summary: Headers for developing programs that will use %name
Summary: Headers for developing programs that will use %{name}
Group: Development/C++
Requires: %{libname} = %{version}
Provides: lib%{name}-devel = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Provides: lib%{name}-sdp-devel, lib%{name}-sdp2-devel
Obsoletes: lib%{name}-sdp-devel, lib%{name}-sdp2-devel
Provides: %{name}-sdp-devel
Obsoletes: %{name}-sdp-devel
Obsoletes: %{libname}-devel
%description -n %{devname}
This package contains the headers that programmers will need to develop
applications which will use libraries from %{name}.
%files -n %{devname}
%defattr(-,root,root)
%files -n %{devname}
%doc AUTHORS ChangeLog README
%dir %{_includedir}/bluetooth
%{_includedir}/bluetooth/*.h
/%{_lib}/*.so
/%{_lib}/*.la
%{_libdir}/pkgconfig/bluez.pc
#--------------------------------------------------------------------
%prep
%setup -q -n %name-%{version}
%patch100 -p1 -b .fail_event
%patch101 -p1 -b .systemd
%setup -q
%apply_patches
libtoolize -f -c
autoreconf -fi
%build
# (bor) for P101
autoreconf -fi
# fix mdv bug 35444
%define _localstatedir %{_var}
%configure2_5x --libdir=/%{_lib} \
%if !%{_with_systemd}
--without-systemdsystemunitdir \
%configure2_5x \
--libdir=/%{_lib} \
%if !%{with systemd}
--without-systemdsystemunitdir \
%endif
--enable-cups \
--enable-dfutool \
--enable-tools \
--enable-bccmd \
--enable-gstreamer \
--enable-hidd \
--enable-pand \
--enable-dund \
--enable-hid2hci \
--enable-pcmcia \
--enable-udevrules \
--enable-capng
--enable-cups \
--enable-dfutool \
--enable-audio \
--enable-health \
--disable-hal \
--enable-pnat \
--enable-wiimote \
--enable-tools \
--enable-bccmd \
--enable-gstreamer \
--enable-hidd \
--enable-pand \
--enable-dund \
--enable-hid2hci \
--enable-pcmcia \
--with-systemdsystemunitdir=/lib/systemd/system
%make
%install
rm -rf %{buildroot}
%makeinstall_std rulesdir=%{_sysconfdir}/udev/rules.d udevdir=/lib/udev
mkdir -p %{buildroot}%{_libdir}
mv %{buildroot}/%{_lib}/gstreamer-0.10 %{buildroot}%{_libdir}
cat << EOF > %{buildroot}%{_sysconfdir}/bluetooth/pin
1234
EOF
chmod 600 %{buildroot}%{_sysconfdir}/bluetooth/pin
rm -f %{buildroot}/etc/default/bluetooth %{buildroot}/etc/init.d/bluetooth
for a in dund hidd pand ; do
install -D -m0644 $RPM_SOURCE_DIR/$a.conf %{buildroot}%{_sysconfdir}/sysconfig/$a
done
rm -f %{buildroot}%{_sysconfdir}/default/bluetooth %{buildroot}%{_sysconfdir}/init.d/bluetooth
install -m644 %{SOURCE6} -D %{buildroot}%{_sysconfdir}/sysconfig/pand
install -m644 %{SOURCE7} -D %{buildroot}%{_sysconfdir}/sysconfig/dund
install -m644 %{SOURCE8} -D %{buildroot}%{_sysconfdir}/sysconfig/hidd
install -m644 %{SOURCE9} -D %{buildroot}%{_sysconfdir}/sysconfig/rfcomm
rm -rf %{buildroot}/%{_lib}/pkgconfig
install -m644 bluez.pc -D %{buildroot}%{_libdir}/pkgconfig/bluez.pc
# Remove the cups backend from libdir, and install it in /usr/lib whatever the install
if test -d %{buildroot}/%{_lib}/cups ; then
install -D -m0755 %{buildroot}/%{_lib}/cups/backend/bluetooth %{buildroot}/usr/lib/cups/backend/bluetooth
install -D -m0755 %{buildroot}/%{_lib}/cups/backend/bluetooth %{buildroot}%{_prefix}/lib/cups/backend/bluetooth
rm -rf %{buildroot}/%{_lib}/cups
fi
mkdir -p %{buildroot}/sbin
cp %{buildroot}%{_bindir}/hidd %{buildroot}/sbin/
cp %{buildroot}%{_sbindir}/bluetoothd %{buildroot}/sbin/
cp test/test-* %{buildroot}%{_bindir}
cp test/simple-agent %{buildroot}%{_bindir}/simple-agent
rm -f %{buildroot}%{_bindir}/test-*.c
#install -D -m0755 %{SOURCE10} %{buildroot}/sbin/udev_bluetooth_helper
#install -D -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/udev/rules.d/60-bluetooth.rules
mkdir -p %{buildroot}/{bin,sbin}
mv %{buildroot}%{_bindir}/hidd %{buildroot}/bin
mv %{buildroot}%{_sbindir}/bluetoothd %{buildroot}/sbin
# sym link just to be safe
pushd %{buildroot}
ln -s /bin/hidd %{buildroot}%{_bindir}/hidd
ln -s /sbin/bluetoothd %{buildroot}%{_sbindir}/bluetoothd
popd
#install more config files
install -m0644 audio/audio.conf %{buildroot}%{_sysconfdir}/bluetooth/
@ -281,21 +275,78 @@ install -m0644 network/network.conf %{buildroot}%{_sysconfdir}/bluetooth/
install -m0644 input/input.conf %{buildroot}%{_sysconfdir}/bluetooth/
install -m0644 serial/serial.conf %{buildroot}%{_sysconfdir}/bluetooth/
%__mkdir -p %{buildroot}%{_libdir}/alsa-lib/
%__mv %{buildroot}/%{_lib}/alsa-lib/*.so %{buildroot}%{_libdir}/alsa-lib/
mkdir -p %{buildroot}%{_libdir}/alsa-lib/
mv %{buildroot}/%{_lib}/alsa-lib/*.so %{buildroot}%{_libdir}/alsa-lib/
# remove unpackaged files
rm -f %{buildroot}/%{_libdir}/*/*.la
rm -f %{buildroot}/%{_lib}/*/*.la
install -d -m0755 %{buildroot}%{_localstatedir}/lib/bluetooth
install -d -m0755 %{buildroot}/%{_localstatedir}/lib/bluetooth
%clean
rm -fr %{buildroot}
ln -s bluetooth.service %buildroot/lib/systemd/system/dbus-org.bluez.service
%changelog
* Wed Jun 29 2011 Michael Scherer <misc@mandriva.org> 4.93-2mdv2011.0
* Sun Jul 08 2012 Bernhard Rosenkraenzer <bero@bero.eu> 4.101-4
+ Revision: 808508
- Rebuild for libudev.so.1
* Fri Jun 29 2012 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.101-3
+ Revision: 807491
- fix buildrequires
- get rid of /usr/bin/test-textfile.c that got packaged
- add url
- package gatttool
- move libtoolize & autoreconf to %%prep
- cleanups
- fix compatibility with ISO C++11 (P9)
* Tue Jun 26 2012 Alexander Khrukin <akhrukin@mandriva.org> 4.101-2
+ Revision: 807024
- rel up
* Tue Jun 26 2012 Alexander Khrukin <akhrukin@mandriva.org> 4.101-1
+ Revision: 806985
- removed unneeded file
- BR usb1-devel
- version update 4.10118
* Fri May 11 2012 Matthew Dawkins <mattydaw@mandriva.org> 4.99-2
+ Revision: 798165
- rebuild
- split out test package
- cleaned up spec
- made obex-data-server a suggests
+ Per Øyvind Karlsen <peroyvind@mandriva.org>
- move hidd to /bin rather than /sbin
- don't copy files within package to /sbin, move them in stead
- drop dead --enable-udevrules option
* Fri Mar 09 2012 Götz Waschk <waschk@mandriva.org> 4.99-1
+ Revision: 783683
- new version
- rediff patch 5
* Fri Feb 24 2012 Bernhard Rosenkraenzer <bero@bero.eu> 4.98-1
+ Revision: 780214
- 4.98
- Remove RPM_SOURCE_DIR usage
- Fix dbus systemd startup
- Adapt sixaxis patch to 4.98
* Tue Oct 04 2011 Александр Казанцев <kazancas@mandriva.org> 4.96-1
+ Revision: 702844
- new version 4.96
- enable bluetoothd by default
- drop systemd patch rather upstream impliment
- add patches from Fedora
- remove obsoletes dating back to october 2008
- remove old obsoletes ( likely no longer needed )
- drop hal buildrequires. No longer needed
- br systemd, readline
+ Matthew Dawkins <mattydaw@mandriva.org>
- removed unnecessary hal-devel BR
* Wed Jun 29 2011 Michael Scherer <misc@mandriva.org> 4.93-2
+ Revision: 688284
- fix requires
@ -422,8 +473,7 @@ rm -fr %{buildroot}
* Wed Aug 19 2009 Emmanuel Andry <eandry@mandriva.org> 4.48-1mdv2010.0
+ Revision: 418001
- New version 4.48
?\195- update files list
- update files list
* Sun Aug 02 2009 Emmanuel Andry <eandry@mandriva.org> 4.47-1mdv2010.0
+ Revision: 407555
@ -443,11 +493,11 @@ rm -fr %{buildroot}
- don't package initscripts, daemon is now handled with udev
- update files list
* Wed May 13 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.39-2mdv2010.0
* Wed May 13 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.39-2mdv2010.0
+ Revision: 375382
- Install alsa libs at the good place
* Wed May 13 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.39-1mdv2010.0
* Wed May 13 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.39-1mdv2010.0
+ Revision: 375351
- Update to version 4.39
@ -455,7 +505,7 @@ rm -fr %{buildroot}
+ Revision: 368734
- Fix incorrect provides / requires which could prevent installation of main package
* Sun Apr 05 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.33-2mdv2009.1
* Sun Apr 05 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.33-2mdv2009.1
+ Revision: 364106
- Fix dbus file
@ -474,12 +524,12 @@ rm -fr %{buildroot}
+ Revision: 345705
- New version 4.31
* Wed Feb 18 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.30-4mdv2009.1
* Wed Feb 18 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.30-4mdv2009.1
+ Revision: 342549
- Bump release
- remove my debugs :/
* Wed Feb 18 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.30-3mdv2009.1
* Wed Feb 18 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.30-3mdv2009.1
+ Revision: 342533
- Fix communication of bluez/dbus
- package simple-agent ( discussed on bluez irc channel )
@ -498,7 +548,7 @@ rm -fr %{buildroot}
+ Revision: 339582
- New version 4.29
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
- Add more config files
* Wed Feb 04 2009 Guillaume Rousse <guillomovitch@mandriva.org> 4.28-2mdv2009.1
@ -506,10 +556,10 @@ rm -fr %{buildroot}
- fix build with new libtool
- keep bash completion in its own package
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
- New version 4.28
* Mon Jan 19 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.27-1mdv2009.1
* Mon Jan 19 2009 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.27-1mdv2009.1
+ Revision: 331191
- update to new version 4.27
@ -517,11 +567,11 @@ rm -fr %{buildroot}
+ Revision: 326910
- New version 4.25
* Thu Dec 11 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.22-2mdv2009.1
* Thu Dec 11 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.22-2mdv2009.1
+ Revision: 312872
- Rebuild for missing package
* Wed Dec 10 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.22-1mdv2009.1
* Wed Dec 10 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.22-1mdv2009.1
+ Revision: 312464
- update to new version 4.22
@ -533,33 +583,33 @@ rm -fr %{buildroot}
+ Revision: 308855
- No longer start passkey-agent when starting X session
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
+ Nicolas Lécureuil <nlecureuil@mandriva.com>
- Own /var/lib/bluetooth
* Sun Oct 26 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.17-1mdv2009.1
* Sun Oct 26 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.17-1mdv2009.1
+ Revision: 297440
- update to new version 4.17
* Wed Oct 22 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.16-1mdv2009.1
* Wed Oct 22 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.16-1mdv2009.1
+ Revision: 296374
- update to new version 4.16
* Sun Oct 19 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.14-1mdv2009.1
* Sun Oct 19 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.14-1mdv2009.1
+ Revision: 295366
- Update to 4.14
- Remove wrong -s arg
* Wed Oct 15 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-3mdv2009.1
* Wed Oct 15 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-3mdv2009.1
+ Revision: 293903
- Fix File list
- Fix service files
- Provides bluez-utils as suggested by Adam
* Wed Oct 15 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-2mdv2009.1
* Wed Oct 15 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-2mdv2009.1
+ Revision: 293832
- More Obsoletes
* Fri Oct 10 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-1mdv2009.1
* Fri Oct 10 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 4.13-1mdv2009.1
+ Revision: 291621
- clean configure
Fix file list
@ -573,11 +623,11 @@ rm -fr %{buildroot}
+ Revision: 260785
- New version
* Thu Jul 03 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.35-1mdv2009.0
* Thu Jul 03 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.35-1mdv2009.0
+ Revision: 231283
- New version
* Sun Jun 29 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.34-1mdv2009.0
* Sun Jun 29 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.34-1mdv2009.0
+ Revision: 230082
- New version 3.34
@ -588,7 +638,7 @@ rm -fr %{buildroot}
+ Revision: 214627
- update to new version 3.32
* Thu May 08 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.31-1mdv2009.0
* Thu May 08 2008 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.31-1mdv2009.0
+ Revision: 204512
- New version 3.31
@ -611,7 +661,7 @@ rm -fr %{buildroot}
+ Revision: 161743
- New version
* Tue Dec 25 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.24-1mdv2008.1
* Tue Dec 25 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.24-1mdv2008.1
+ Revision: 137802
- New bugfix release
@ -620,31 +670,31 @@ rm -fr %{buildroot}
- new license policy
- new release 3.23
* Sat Nov 10 2007 Jérôme Soyer <saispo@mandriva.org> 3.22-1mdv2008.1
* Sat Nov 10 2007 Jérôme Soyer <saispo@mandriva.org> 3.22-1mdv2008.1
+ Revision: 107312
- New release
* Wed Oct 10 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.20-1mdv2008.1
* Wed Oct 10 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.20-1mdv2008.1
+ Revision: 96915
- New version 3.20
* Mon Aug 27 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.15-1mdv2008.0
* Mon Aug 27 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.15-1mdv2008.0
+ Revision: 71793
- new release: 3.15
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-6mdv2008.0
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-6mdv2008.0
+ Revision: 63901
- bah
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-5mdv2008.0
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-5mdv2008.0
+ Revision: 63893
+ rebuild (emptylog)
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-4mdv2008.0
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-4mdv2008.0
+ Revision: 63839
- bah, fix path headers
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-3mdv2008.0
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-3mdv2008.0
+ Revision: 63827
- fix location of library
@ -652,11 +702,11 @@ rm -fr %{buildroot}
+ Revision: 63671
- fix upgrading
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-1mdv2008.0
* Wed Aug 15 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.14-1mdv2008.0
+ Revision: 63509
- new release: 3.16
- new release: 3.14
* Thu Aug 02 2007 Olivier Blin <oblin@mandriva.com> 3.13-1mdv2008.0
* Thu Aug 02 2007 Olivier Blin <blino@mandriva.org> 3.13-1mdv2008.0
+ Revision: 58035
- drop pkgconfig buildrequires, it's required by rpm-mandriva-setup-build
- 3.13
@ -665,7 +715,7 @@ rm -fr %{buildroot}
+ Revision: 31134
- new version
* Thu May 10 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.10-1mdv2008.0
* Thu May 10 2007 Nicolas Lécureuil <nlecureuil@mandriva.com> 3.10-1mdv2008.0
+ Revision: 26147
- New version 3.10
@ -673,102 +723,3 @@ rm -fr %{buildroot}
+ Revision: 20512
- build requires pkg-config for proper pkgconfig automatic dependencies computation
* Mon Jan 29 2007 Nicolas Lécureuil <neoclust@mandriva.org> 3.9-1mdv2007.0
+ Revision: 114833
- New version 3.9
* Tue Dec 26 2006 Nicolas Lécureuil <neoclust@mandriva.org> 3.8-2mdv2007.1
+ Revision: 102080
-x Rebuild
* Mon Dec 25 2006 Nicolas Lécureuil <neoclust@mandriva.org> 3.8-1mdv2007.1
+ Revision: 102036
- New Version 3.8
- New release 3.7
- bluez-3.4-2mdv2007.0
- Fix rpmlint warnings
- Import bluez
* Sun Aug 27 2006 Nicolas Lécureuil <neoclust@mandriva.org> 3.4-1mdv2007.0
- New release 3.4
* Mon Aug 14 2006 Austin Acton <austin@mandriva.org> 3.2-1mdv2007.0
- 3.2
* Mon Jun 19 2006 Nicolas Lécureuil <neoclust@mandriva.org> 3.1-1
- New release 3.1
* Wed Jun 14 2006 Frederic Crozat <fcrozat@mandriva.com> 3.0-2mdv2007.0
- Fix major
* Tue Jun 13 2006 Nicolas Lécureuil <neoclust@mandriva.org> 3.0-1mdv2007.0
- New release 3.0
* Thu Jan 19 2006 Nicolas Lécureuil <neoclust@mandriva.org> 2.25-1mdk
- New release 2.25
* Sat Dec 24 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.24-1mdk
- New release 2.24
* Mon Dec 12 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.23-1mdk
- New release 2.23
* Tue Nov 01 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.22-1mdk
- New release 2.22
* Tue Oct 04 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.21-1mdk
- New release 2.21
* Tue Aug 09 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.19-3mdk
- Revert previous changes
* Tue Aug 09 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.19-2mdk
- Cosmetics
* Tue Aug 09 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.19-1mdk
- New release 2.19
* Tue Jul 05 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.18-1mdk
- New release 2.18
* Wed May 11 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.17-1mdk
- New release 2.17
- Drop P0 ( Merged upstream )
* Tue May 10 2005 Pascal Terjan <pterjan@mandriva.org> 2.16-2mdk
- include stdio in bluetooth.h (P0)
* Sat Apr 30 2005 Nicolas Lécureuil <neoclust@mandriva.org> 2.16-1mdk
- 2.16
- Drop Patch0 ( Merged upstream )
* Thu Jan 27 2005 Frederic Crozat <fcrozat@mandrakesoft.com> 2.14-2mdk
- Patch0 (CVS): add removed calls needed by libbtctl
* Sat Jan 15 2005 Austin Acton <austin@mandrake.org> 2.14-1mdk
- 2.14
- fix summaries
- add automake macro
* Wed Sep 22 2004 Frederic Crozat <fcrozat@mandrakesoft.com> 2.10-1mdk
- Release 2.10
- Move to /%%{_lib}, needed for initscript
* Fri Aug 13 2004 Frederic Crozat <fcrozat@mandrakesoft.com> 2.9-1mdk
- Release 2.9
* Sun Jul 18 2004 Austin Acton <austin@mandrake.org> 2.8-1mdk
- 2.8
- add pkgconfig file
* Fri May 14 2004 Austin Acton <austin@mandrake.org> 2.7-1mdk
- 2.7
- configure 2.5
* Sun May 02 2004 Arnaud de Lorbeau <adelorbeau@mandrakesoft.com> 2.6-2mdk
- Obsoletes bluez-sdp libs
* Sat May 01 2004 Arnaud de Lorbeau <adelorbeau@mandrakesoft.com> 2.6-1mdk
- 2.6