diff --git a/.abf.yml b/.abf.yml index 8068b7f..89c10a1 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,2 +1,2 @@ sources: - "bluez-4.93.tar.gz": 30cabd0deec55ba44ca25f5621485e1d6a6e10d4 + "bluez-4.96.tar.gz": c9327784cbcf1efc03cc547ceb18de90c8fb4c7c diff --git a/0001-Add-sixaxis-cable-pairing-plugin.patch b/0001-Add-sixaxis-cable-pairing-plugin.patch new file mode 100644 index 0000000..76f37e8 --- /dev/null +++ b/0001-Add-sixaxis-cable-pairing-plugin.patch @@ -0,0 +1,554 @@ +From 3c2e6dab927acfa3dfbeb7b9bc910d6a9780b095 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Tue, 1 Sep 2009 17:32:48 +0100 +Subject: [PATCH 1/2] 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 7eadf82..aecc8f2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -223,6 +223,11 @@ builtin_sources += thermometer/main.c \ + thermometer/thermometer.h thermometer/thermometer.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 + +@@ -282,7 +287,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.la @GLIB_LIBS@ @DBUS_LIBS@ \ +- @CAPNG_LIBS@ -ldl -lrt ++ @CAPNG_LIBS@ @CABLE_LIBS@ -ldl -lrt + src_bluetoothd_LDFLAGS = -Wl,--export-dynamic \ + -Wl,--version-script=$(srcdir)/src/bluetooth.ver + +@@ -397,7 +402,7 @@ EXTRA_DIST += doc/manager-api.txt \ + + AM_YFLAGS = -d + +-AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ \ ++AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ @CABLE_CFLAGS@ \ + -DBLUETOOTH_PLUGIN_BUILTIN -DPLUGINDIR=\""$(plugindir)"\" + + INCLUDES = -I$(builddir)/lib -I$(builddir)/src -I$(srcdir)/src \ +diff --git a/acinclude.m4 b/acinclude.m4 +index 3cb9459..c23368b 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -155,6 +155,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) +@@ -186,6 +192,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 +@@ -286,6 +293,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(tracer, AC_HELP_STRING([--enable-tracer], [install Tracing daemon]), [ + tracer_enable=${enableval} + ]) +@@ -385,6 +396,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" || +@@ -421,4 +436,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [ + AM_CONDITIONAL(DBUSOOBPLUGIN, test "${dbusoob_enable}" = "yes") + AM_CONDITIONAL(WIIMOTEPLUGIN, test "${wiimote_enable}" = "yes") + AM_CONDITIONAL(THERMOMETERPLUGIN, test "${thermometer_enable}" = "yes") ++ AM_CONDITIONAL(CABLE, test "${cable_enable}" = "yes" && test "${cable_found}" = "yes") + ]) +diff --git a/configure.ac b/configure.ac +index 908ad55..bc2658c 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 + +diff --git a/plugins/cable.c b/plugins/cable.c +new file mode 100644 +index 0000000..e8cff76 +--- /dev/null ++++ b/plugins/cable.c +@@ -0,0 +1,382 @@ ++/* ++ * ++ * BlueZ - Bluetooth protocol stack for Linux ++ * ++ * Copyright (C) 2009 Bastien Nocera ++ * ++ * ++ * 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 ++#endif ++ ++#include ++#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 ++#include ++#include ++#include ++#include ++#include ++ ++#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, DEVICE_TYPE_UNKNOWN); ++ 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 4c88a0e..09d8392 100644 +--- a/src/adapter.c ++++ b/src/adapter.c +@@ -1092,6 +1092,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 687275a..7f7cb55 100644 +--- a/src/adapter.h ++++ b/src/adapter.h +@@ -116,6 +116,9 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr, + int adapter_remove_found_device(struct btd_adapter *adapter, bdaddr_t *bdaddr); + 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_update_local_name(struct btd_adapter *adapter, const char *name); + void adapter_service_insert(struct btd_adapter *adapter, void *rec); +-- +1.7.6 + diff --git a/0001-systemd-install-systemd-unit-files.patch b/0001-systemd-install-systemd-unit-files.patch new file mode 100644 index 0000000..a036423 --- /dev/null +++ b/0001-systemd-install-systemd-unit-files.patch @@ -0,0 +1,121 @@ +From 0080ce8a37152b0ee7750799e01de3bf810f8caf Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 21 Jul 2010 19:20:44 +0200 +Subject: [PATCH] systemd: install systemd unit files + +This also enables bus activation for bluetoothd, but only if systemd is +running. Only if that's the case we can make sure in a race-free fashion +that bluetoothd is not started twice at the same time. +--- + Makefile.am | 21 ++++++++++++++++++--- + configure.ac | 9 +++++++++ + scripts/.gitignore | 1 + + scripts/bluetooth.service.in | 13 +++++++++++++ + scripts/org.bluez.service | 5 +++++ + 5 files changed, 46 insertions(+), 3 deletions(-) + create mode 100644 scripts/.gitignore + create mode 100644 scripts/bluetooth.service.in + create mode 100644 scripts/org.bluez.service + +diff --git a/Makefile.am b/Makefile.am +index aecc8f2..6e18003 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -387,10 +387,25 @@ 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.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 + + EXTRA_DIST += doc/manager-api.txt \ + doc/adapter-api.txt doc/device-api.txt \ +@@ -417,9 +432,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 bc2658c..b4502ab 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -71,5 +71,14 @@ if (test -n "${path_systemdunit}"); then + 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 scripts/bluetooth.rules doc/version.xml + src/bluetoothd.8 src/bluetooth.service bluez.pc) +diff --git a/scripts/.gitignore b/scripts/.gitignore +new file mode 100644 +index 0000000..4b9f765 +--- /dev/null ++++ b/scripts/.gitignore +@@ -0,0 +1 @@ ++bluetooth.service +diff --git a/scripts/bluetooth.service.in b/scripts/bluetooth.service.in +new file mode 100644 +index 0000000..d0089ea +--- /dev/null ++++ b/scripts/bluetooth.service.in +@@ -0,0 +1,13 @@ ++[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.6 + diff --git a/bluez-4.93-systemd_support.patch b/bluez-4.93-systemd_support.patch deleted file mode 100644 index 036b0ee..0000000 --- a/bluez-4.93-systemd_support.patch +++ /dev/null @@ -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 diff --git a/bluez-socket-mobile-cf-connection-kit.patch b/bluez-socket-mobile-cf-connection-kit.patch new file mode 100644 index 0000000..c3ef889 --- /dev/null +++ b/bluez-socket-mobile-cf-connection-kit.patch @@ -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" ++ diff --git a/bluez.spec b/bluez.spec index 824a8fa..d7c11f3 100644 --- a/bluez.spec +++ b/bluez.spec @@ -6,29 +6,26 @@ Name: bluez Summary: Official Linux Bluetooth protocol stack -Version: 4.93 -Release: %mkrel 2 +Version: 4.96 +Release: %mkrel 1 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 +Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz Source6: pand.conf Source7: dund.conf Source8: hidd.conf Source9: rfcomm.conf -#Source10: hidd.hotplug -#Source11: hidd.udev.rules # (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 +# (kazancas) patch from Fedora +# https://bugzilla.redhat.com/show_bug.cgi?id=498756 +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 +# http://thread.gmane.org/gmane.linux.bluez.kernel/8645 +Patch6: 0001-systemd-install-systemd-unit-files.patch BuildRequires: dbus-devel BuildRequires: flex @@ -37,22 +34,24 @@ BuildRequires: libusb-devel BuildRequires: libalsa-devel BuildRequires: udev-tools BuildRequires: libgstreamer0.10-plugins-base-devel -BuildRequires: gstreamer0.10-devel hal-devel +BuildRequires: gstreamer0.10-devel BuildRequires: expat-devel BuildRequires: udev-devel BuildRequires: libcap-ng-devel # (bor) for P101 BuildRequires: automake autoconf +# (kazancas) +Buildrequires: systemd, readline Requires: python-gobject Requires: bluez-pin Requires: obex-data-server Provides: bluez-sdp -Obsoletes: bluez-sdp < 4.0 +Obsoletes: bluez-sdp < 4.5 Provides: bluez-pan Provides: bluez-hciemu Obsoletes: bluez-hciemu Provides: bluez-utils -Obsoletes: bluez-utils < 4.0 +Obsoletes: bluez-utils < 4.5 Suggests: bluez-firmware %description @@ -67,27 +66,22 @@ 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) @@ -97,7 +91,7 @@ fi /sbin/bluetoothd %if %{_with_systemd} /lib/systemd/system/bluetooth.service -/lib/systemd/system/bluetooth.target.wants/bluetooth.service +#/lib/systemd/system/bluetooth.target.wants/bluetooth.service %endif #/sbin/udev_bluetooth_helper %{_mandir}/man?/* @@ -203,8 +197,9 @@ applications which will use libraries from %{name}. %prep %setup -q -n %name-%{version} %patch100 -p1 -b .fail_event -%patch101 -p1 -b .systemd - +%patch4 -p1 -b .socket-mobile +%patch5 -p1 -b .cable-pairing +%patch6 -p1 -b .systemd %build # (bor) for P101 @@ -226,7 +221,8 @@ autoreconf -fi --enable-hid2hci \ --enable-pcmcia \ --enable-udevrules \ - --enable-capng + --enable-capng \ + --with-systemdsystemunitdir=/lib/systemd/system %make @@ -268,9 +264,6 @@ cp %{buildroot}%{_sbindir}/bluetoothd %{buildroot}/sbin/ cp test/test-* %{buildroot}%{_bindir} cp test/simple-agent %{buildroot}%{_bindir}/simple-agent -#install -D -m0755 %{SOURCE10} %{buildroot}/sbin/udev_bluetooth_helper -#install -D -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/udev/rules.d/60-bluetooth.rules - #install more config files install -m0644 audio/audio.conf %{buildroot}%{_sysconfdir}/bluetooth/ install -m0644 network/network.conf %{buildroot}%{_sysconfdir}/bluetooth/ @@ -291,7 +284,21 @@ rm -fr %{buildroot} %changelog -* Wed Jun 29 2011 Michael Scherer 4.93-2mdv2011.0 +* Tue Oct 04 2011 Александр Казанцев 4.96-1mdv2012.0 ++ 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 + - removed unnecessary hal-devel BR + +* Wed Jun 29 2011 Michael Scherer 4.93-2 + Revision: 688284 - fix requires @@ -418,8 +425,7 @@ rm -fr %{buildroot} * Wed Aug 19 2009 Emmanuel Andry 4.48-1mdv2010.0 + Revision: 418001 -- New version 4.48 - ?\195- update files list +- update files list * Sun Aug 02 2009 Emmanuel Andry 4.47-1mdv2010.0 + Revision: 407555 @@ -652,7 +658,7 @@ rm -fr %{buildroot} + Revision: 63509 - new release: 3.14 -* Thu Aug 02 2007 Olivier Blin 3.13-1mdv2008.0 +* Thu Aug 02 2007 Olivier Blin 3.13-1mdv2008.0 + Revision: 58035 - drop pkgconfig buildrequires, it's required by rpm-mandriva-setup-build - 3.13