commit: 8573dd804a8531cab9dd1ba1de47f94eb33641fd Author: layman <layman <AT> localhost> AuthorDate: Sat Oct 4 14:46:48 2014 +0000 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> CommitDate: Sat Oct 4 14:47:56 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=8573dd80
net-wireless/bluez: fix build on musl, bug #524454 --- net-wireless/bluez/bluez-5.23-r99.ebuild | 205 +++++++++++++++++++++ ...-obexd-without-systemd-in-the-user-sessio.patch | 58 ++++++ ...erial.c-use-posix_openpt-instead-of-getpt.patch | 37 ++++ ...-GLib-helper-function-to-manipulate-paths.patch | 38 ++++ ...01-tools-Fix-compilation-errors-with-musl.patch | 189 +++++++++++++++++++ ...-Logitech-diNovo-Edge-keyboard-firmware-i.patch | 29 +++ .../0002-autopair-Don-t-handle-the-iCade.patch | 47 +++++ .../0004-agent-Assert-possible-infinite-loop.patch | 25 +++ net-wireless/bluez/files/bluetooth-init.d-r3 | 21 +++ .../bluez/files/bluez-5.23-use-posix_openpt.patch | 20 ++ net-wireless/bluez/files/bluez-plugdev.patch | 14 ++ net-wireless/bluez/files/rfcomm-init.d-r2 | 35 ++++ net-wireless/bluez/metadata.xml | 21 +++ 13 files changed, 739 insertions(+) diff --git a/net-wireless/bluez/bluez-5.23-r99.ebuild b/net-wireless/bluez/bluez-5.23-r99.ebuild new file mode 100644 index 0000000..5dc607b --- /dev/null +++ b/net-wireless/bluez/bluez-5.23-r99.ebuild @@ -0,0 +1,205 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-5.23.ebuild,v 1.2 2014/09/25 09:11:55 pacho Exp $ + +EAPI=5 +PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} ) + +inherit autotools eutils multilib python-any-r1 readme.gentoo systemd udev user multilib-minimal + +DESCRIPTION="Bluetooth Tools and System Daemons for Linux" +HOMEPAGE="http://www.bluez.org" +SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.xz" + +LICENSE="GPL-2+ LGPL-2.1+" +SLOT="0/3" +KEYWORDS="amd64 arm ~mips x86" +IUSE="cups debug +obex +readline selinux systemd test +udev" +REQUIRED_USE="test? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND=" + >=dev-libs/glib-2.28:2 + >=sys-apps/dbus-1.6:= + >=sys-apps/hwids-20121202.2 + cups? ( net-print/cups:= ) + obex? ( dev-libs/libical ) + readline? ( sys-libs/readline:= ) + selinux? ( sec-policy/selinux-bluetooth ) + systemd? ( sys-apps/systemd ) + udev? ( >=virtual/udev-172 ) + abi_x86_32? ( + !<app-emulation/emul-linux-x86-soundlibs-20140406-r1 + !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32] + ) +" +DEPEND="${RDEPEND} + virtual/pkgconfig + test? ( + ${PYTHON_DEPS} + >=dev-python/dbus-python-1 + dev-python/pygobject:2 + dev-python/pygobject:3 + ) +" + +DOC_CONTENTS=" + If you want to use rfcomm as a normal user, you need to add the user + to the uucp group. +" + +pkg_setup() { + enewgroup plugdev + use test && python-any-r1_pkg_setup + + if ! use udev; then + ewarn + ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth" + ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work," + ewarn "and hid2hci will not be available." + ewarn + fi +} + +src_prepare() { + # Use static group "plugdev" if there is no ConsoleKit (or systemd logind) + epatch "${FILESDIR}"/bluez-plugdev.patch + + # Fedora patches + # http://www.spinics.net/lists/linux-bluetooth/msg38490.html + epatch "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch + + # http://www.spinics.net/lists/linux-bluetooth/msg40136.html + epatch "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch + + # http://www.spinics.net/lists/linux-bluetooth/msg41264.html + epatch "${FILESDIR}"/0002-autopair-Don-t-handle-the-iCade.patch + + # ??? + epatch "${FILESDIR}"/0004-agent-Assert-possible-infinite-loop.patch + + # Ubuntu workaround for bug #501120 + epatch "${FILESDIR}"/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch + + # Patches for musl + epatch "${FILESDIR}"/0001-tools-Fix-compilation-errors-with-musl.patch + epatch "${FILESDIR}"/0001-emulator-serial.c-use-posix_openpt-instead-of-getpt.patch + + if use cups; then + sed -i \ + -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \ + Makefile.{in,tools} || die + fi + + eautoreconf + + multilib_copy_sources +} + +multilib_src_configure() { + local myconf=( + # readline is automagic when client is enabled + # --enable-client always needs readline, bug #504038 + ac_cv_header_readline_readline_h=$(multilib_native_usex readline) + ) + + if ! multilib_is_native_abi; then + myconf+=( + # deps not used for the library + {DBUS,GLIB}_{CFLAGS,LIBS}=' ' + ) + fi + + # Missing flags: experimental (sap, nfc, ...) + econf \ + --localstatedir=/var \ + --disable-android \ + --enable-datafiles \ + --enable-experimental \ + --enable-optimization \ + $(use_enable debug) \ + --enable-pie \ + --enable-threads \ + --enable-library \ + $(multilib_native_use_enable test) \ + --enable-tools \ + --enable-manpages \ + --enable-monitor \ + $(multilib_native_use_enable cups) \ + $(multilib_native_use_enable obex) \ + $(multilib_native_use_enable readline client) \ + $(multilib_native_use_enable systemd) \ + $(systemd_with_unitdir) \ + $(multilib_native_use_enable udev) \ + $(multilib_native_use_enable udev sixaxis) +} + +multilib_src_compile() { + if multilib_is_native_abi; then + default + else + emake -f Makefile -f - libs \ + <<<'libs: $(lib_LTLIBRARIES)' + fi +} + +multilib_src_test() { + multilib_is_native_abi && default +} + +multilib_src_install() { + if multilib_is_native_abi; then + emake DESTDIR="${D}" install + + # Unittests are not that useful once installed + if use test ; then + rm -r "${ED}"/usr/$(get_libdir)/bluez/test || die + fi + else + emake DESTDIR="${D}" \ + install-includeHEADERS \ + install-libLTLIBRARIES \ + install-pkgconfigDATA + fi +} + +multilib_src_install_all() { + prune_libtool_files --modules + + keepdir /var/lib/bluetooth + + # Upstream don't want people to play with them + # But we keep installing them due 'historical' reasons + insinto /etc/bluetooth + local d + for d in input network proximity; do + doins profiles/${d}/${d}.conf + done + doins src/main.conf + doins src/bluetooth.conf + +# FIXME: +# Looks like upstream installs it only for systemd, probably not needed +# insinto /usr/share/dbus-1/system-services +# doins src/org.bluez.service + + newinitd "${FILESDIR}"/bluetooth-init.d-r3 bluetooth + newinitd "${FILESDIR}"/rfcomm-init.d-r2 rfcomm + + einstalldocs + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog + + use udev && udev_reload + + has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp." + + if ! has_version sys-auth/consolekit && ! has_version sys-apps/systemd; then + elog "Since you don't have sys-auth/consolekit neither sys-apps/systemd, you will only" + elog "be able to run bluetooth clients as root. If you want to be able to run bluetooth clients as" + elog "a regular user, you need to add the user to the plugdev group." + fi +} diff --git a/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch b/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch new file mode 100644 index 0000000..1ea3e6f --- /dev/null +++ b/net-wireless/bluez/files/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch @@ -0,0 +1,58 @@ +From 3027cb7141fb65cf3eeda69c688db8c4045e2d3f Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna <gcampagna-cnudlrotfmnnlxjtenl...@public.gmane.org> +Date: Sat, 12 Oct 2013 17:45:25 +0200 +Subject: [PATCH] Allow using obexd without systemd in the user session + +Not all sessions run systemd --user (actually, the majority +doesn't), so the dbus daemon must be able to spawn obexd +directly, and to do so it needs the full path of the daemon. +--- + Makefile.obexd | 4 ++-- + obexd/src/org.bluez.obex.service | 4 ---- + obexd/src/org.bluez.obex.service.in | 4 ++++ + 3 files changed, 6 insertions(+), 6 deletions(-) + delete mode 100644 obexd/src/org.bluez.obex.service + create mode 100644 obexd/src/org.bluez.obex.service.in + +diff --git a/Makefile.obexd b/Makefile.obexd +index 3760867..142e7c3 100644 +--- a/Makefile.obexd ++++ b/Makefile.obexd +@@ -2,12 +2,12 @@ + if SYSTEMD + systemduserunitdir = @SYSTEMD_USERUNITDIR@ + systemduserunit_DATA = obexd/src/obex.service ++endif + + dbussessionbusdir = @DBUS_SESSIONBUSDIR@ + dbussessionbus_DATA = obexd/src/org.bluez.obex.service +-endif + +-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service ++EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in + + obex_plugindir = $(libdir)/obex/plugins + +diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service +deleted file mode 100644 +index a538088..0000000 +--- a/obexd/src/org.bluez.obex.service ++++ /dev/null +@@ -1,4 +0,0 @@ +-[D-BUS Service] +-Name=org.bluez.obex +-Exec=/bin/false +-SystemdService=dbus-org.bluez.obex.service +diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in +new file mode 100644 +index 0000000..9c815f2 +--- /dev/null ++++ b/obexd/src/org.bluez.obex.service.in +@@ -0,0 +1,4 @@ ++[D-BUS Service] ++Name=org.bluez.obex ++Exec=@libexecdir@/obexd ++SystemdService=dbus-org.bluez.obex.service +-- +1.8.3.1 + diff --git a/net-wireless/bluez/files/0001-emulator-serial.c-use-posix_openpt-instead-of-getpt.patch b/net-wireless/bluez/files/0001-emulator-serial.c-use-posix_openpt-instead-of-getpt.patch new file mode 100644 index 0000000..766734a --- /dev/null +++ b/net-wireless/bluez/files/0001-emulator-serial.c-use-posix_openpt-instead-of-getpt.patch @@ -0,0 +1,37 @@ +From 57c33317f5c3f6d21a9b3c56f8d1e97179e4c457 Mon Sep 17 00:00:00 2001 +From: "Anthony G. Basile" <bluen...@gentoo.org> +Date: Sat, 4 Oct 2014 09:34:05 -0400 +Subject: [PATCH] emulator/serial.c: use posix_openpt() instead of getpt() + +getpt(3) is glibc-specific and is not provided on musl. Instead, we +use use posix_openpt(3) which is equivalent and portable. + +Signed-off-by: Anthony G. Basile <bluen...@gentoo.org> +--- + emulator/serial.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/emulator/serial.c b/emulator/serial.c +index 9583be4..8b49dc6 100644 +--- a/emulator/serial.c ++++ b/emulator/serial.c +@@ -32,6 +32,7 @@ + #include <unistd.h> + #include <stdlib.h> + #include <string.h> ++#include <fcntl.h> + #include <sys/param.h> + #include <sys/epoll.h> + #include <sys/uio.h> +@@ -160,7 +161,7 @@ static void open_pty(struct serial *serial) + { + enum btdev_type uninitialized_var(type); + +- serial->fd = getpt(); ++ serial->fd = posix_openpt(O_RDWR | O_NOCTTY); + if (serial->fd < 0) { + perror("Failed to get master pseudo terminal"); + return; +-- +2.0.4 + diff --git a/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch b/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch new file mode 100644 index 0000000..004a389 --- /dev/null +++ b/net-wireless/bluez/files/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch @@ -0,0 +1,38 @@ +From f7861d27fbcbc519f57d8496aa9486f487908821 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <had...@hadess.net> +Date: Sat, 9 Nov 2013 18:13:43 +0100 +Subject: [PATCH 1/5] obex: Use GLib helper function to manipulate paths + +Instead of trying to do it by hand. This also makes sure that +relative paths aren't used by the agent. +--- + obexd/src/manager.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/obexd/src/manager.c b/obexd/src/manager.c +index cec8a39..f18896e 100644 +--- a/obexd/src/manager.c ++++ b/obexd/src/manager.c +@@ -651,14 +651,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data) + DBUS_TYPE_STRING, &name, + DBUS_TYPE_INVALID)) { + /* Splits folder and name */ +- const char *slash = strrchr(name, '/'); ++ gboolean is_relative = !g_path_is_absolute(name); + DBG("Agent replied with %s", name); +- if (!slash) { +- agent->new_name = g_strdup(name); ++ if (is_relative) { ++ agent->new_name = g_path_get_basename(name); + agent->new_folder = NULL; + } else { +- agent->new_name = g_strdup(slash + 1); +- agent->new_folder = g_strndup(name, slash - name); ++ agent->new_name = g_path_get_basename(name); ++ agent->new_folder = g_path_get_dirname(name); + } + } + +-- +1.8.4.2 + diff --git a/net-wireless/bluez/files/0001-tools-Fix-compilation-errors-with-musl.patch b/net-wireless/bluez/files/0001-tools-Fix-compilation-errors-with-musl.patch new file mode 100644 index 0000000..501e75a --- /dev/null +++ b/net-wireless/bluez/files/0001-tools-Fix-compilation-errors-with-musl.patch @@ -0,0 +1,189 @@ +From 51ec4fd847369bc77e72850fe93d727ae9c656b9 Mon Sep 17 00:00:00 2001 +From: Szymon Janc <szymon.j...@tieto.com> +Date: Fri, 19 Sep 2014 16:10:07 +0200 +Subject: [PATCH] tools: Fix compilation errors with musl + +This fix number of includes for <sys/poll.h> instead of <poll.h> + + CC tools/hciattach.o +In file included from tools/hciattach.c:41:0: +/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect + #include <sys/poll.h> to <poll.h> [-Werror=cpp] + #warning redirecting incorrect #include <sys/poll.h> to <poll.h> + ^ +--- + tools/amptest.c | 2 +- + tools/btattach.c | 2 +- + tools/btsnoop.c | 1 + + tools/ciptool.c | 2 +- + tools/cltest.c | 2 +- + tools/hciattach.c | 2 +- + tools/hciattach_qualcomm.c | 2 +- + tools/hciattach_tialt.c | 2 +- + tools/hcidump.c | 2 +- + tools/l2ping.c | 2 +- + tools/l2test.c | 2 +- + tools/rfcomm.c | 2 +- + 12 files changed, 12 insertions(+), 11 deletions(-) + +diff --git a/tools/amptest.c b/tools/amptest.c +index 6192f7e..bba0a9a 100644 +--- a/tools/amptest.c ++++ b/tools/amptest.c +@@ -32,7 +32,7 @@ + #include <alloca.h> + #include <stdlib.h> + #include <stdbool.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/ioctl.h> + #include <sys/socket.h> + +diff --git a/tools/btattach.c b/tools/btattach.c +index 9458fd7..bdbbe16 100644 +--- a/tools/btattach.c ++++ b/tools/btattach.c +@@ -35,7 +35,7 @@ + #include <getopt.h> + #include <termios.h> + #include <sys/ioctl.h> +-#include <sys/poll.h> ++#include <poll.h> + + #include <bluetooth/bluetooth.h> + #include <bluetooth/hci.h> +diff --git a/tools/btsnoop.c b/tools/btsnoop.c +index 14581f2..71191eb 100644 +--- a/tools/btsnoop.c ++++ b/tools/btsnoop.c +@@ -35,6 +35,7 @@ + #include <stdbool.h> + #include <string.h> + #include <getopt.h> ++#include <endian.h> + #include <arpa/inet.h> + #include <sys/stat.h> + +diff --git a/tools/ciptool.c b/tools/ciptool.c +index 72338dc..3ff9fb1 100644 +--- a/tools/ciptool.c ++++ b/tools/ciptool.c +@@ -32,7 +32,7 @@ + #include <string.h> + #include <getopt.h> + #include <signal.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/ioctl.h> + #include <sys/socket.h> + +diff --git a/tools/cltest.c b/tools/cltest.c +index 4ddb98a..0231805 100644 +--- a/tools/cltest.c ++++ b/tools/cltest.c +@@ -32,7 +32,7 @@ + #include <alloca.h> + #include <stdlib.h> + #include <stdbool.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/ioctl.h> + #include <sys/socket.h> + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 1904ac5..d8ef7e7 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -37,8 +37,8 @@ + #include <syslog.h> + #include <termios.h> + #include <time.h> ++#include <poll.h> + #include <sys/time.h> +-#include <sys/poll.h> + #include <sys/param.h> + #include <sys/ioctl.h> + +diff --git a/tools/hciattach_qualcomm.c b/tools/hciattach_qualcomm.c +index eb72a0f..0e25905 100644 +--- a/tools/hciattach_qualcomm.c ++++ b/tools/hciattach_qualcomm.c +@@ -36,8 +36,8 @@ + #include <syslog.h> + #include <termios.h> + #include <time.h> ++#include <poll.h> + #include <sys/time.h> +-#include <sys/poll.h> + #include <sys/param.h> + #include <sys/ioctl.h> + #include <sys/uio.h> +diff --git a/tools/hciattach_tialt.c b/tools/hciattach_tialt.c +index 5c7f3a5..a7c1706 100644 +--- a/tools/hciattach_tialt.c ++++ b/tools/hciattach_tialt.c +@@ -35,8 +35,8 @@ + #include <syslog.h> + #include <termios.h> + #include <time.h> ++#include <poll.h> + #include <sys/time.h> +-#include <sys/poll.h> + #include <sys/param.h> + #include <sys/ioctl.h> + #include <sys/uio.h> +diff --git a/tools/hcidump.c b/tools/hcidump.c +index 37a9f00..8839eb0 100644 +--- a/tools/hcidump.c ++++ b/tools/hcidump.c +@@ -33,7 +33,7 @@ + #include <stdlib.h> + #include <string.h> + #include <getopt.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/stat.h> + #include <sys/types.h> + #include <sys/ioctl.h> +diff --git a/tools/l2ping.c b/tools/l2ping.c +index 29fb3d0..3dd437e 100644 +--- a/tools/l2ping.c ++++ b/tools/l2ping.c +@@ -35,7 +35,7 @@ + #include <getopt.h> + #include <signal.h> + #include <sys/time.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/socket.h> + + #include <bluetooth/bluetooth.h> +diff --git a/tools/l2test.c b/tools/l2test.c +index 67ca70a..71ad109 100644 +--- a/tools/l2test.c ++++ b/tools/l2test.c +@@ -38,7 +38,7 @@ + #include <syslog.h> + #include <signal.h> + #include <sys/time.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/ioctl.h> + #include <sys/socket.h> + +diff --git a/tools/rfcomm.c b/tools/rfcomm.c +index b5bea38..659bbec 100644 +--- a/tools/rfcomm.c ++++ b/tools/rfcomm.c +@@ -34,7 +34,7 @@ + #include <getopt.h> + #include <signal.h> + #include <termios.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/param.h> + #include <sys/ioctl.h> + #include <sys/socket.h> +-- +2.0.4 + diff --git a/net-wireless/bluez/files/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch b/net-wireless/bluez/files/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch new file mode 100644 index 0000000..55d5af6 --- /dev/null +++ b/net-wireless/bluez/files/0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch @@ -0,0 +1,29 @@ +From aa73bf5039dfd2cf0a52dd6fd22501d955cc1a00 Mon Sep 17 00:00:00 2001 +From: Tommy <mesill...@gmail.com> +Date: Thu, 10 Jan 2013 09:18:43 +0100 +Subject: [PATCH] work around Logitech diNovo Edge keyboard firmware issue + +https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/269851 +--- + tools/hid2hci.rules | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules +index db6bb03..7db4572 100644 +--- a/tools/hid2hci.rules ++++ b/tools/hid2hci.rules +@@ -11,7 +11,10 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt + RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" + + # Logitech devices +-KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ ++KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[5e]", \ ++ RUN+="hid2hci --method=logitech-hid --devpath=%p" ++# Logitech, Inc. RAW communicating devices ++KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[34abc]|c71[34bc]", \ + RUN+="hid2hci --method=logitech-hid --devpath=%p" + + ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" +-- +1.8.0.1 + diff --git a/net-wireless/bluez/files/0002-autopair-Don-t-handle-the-iCade.patch b/net-wireless/bluez/files/0002-autopair-Don-t-handle-the-iCade.patch new file mode 100644 index 0000000..68751ae --- /dev/null +++ b/net-wireless/bluez/files/0002-autopair-Don-t-handle-the-iCade.patch @@ -0,0 +1,47 @@ +From c16ae7041c7511d8d1ed8441f696716fa6a9117e Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <had...@hadess.net> +Date: Tue, 19 Nov 2013 14:11:39 +0100 +Subject: [PATCH 2/5] autopair: Don't handle the iCade + +We can't easily enter digits other than 1 through 4 (inclusive) +so leave it up to the agent to figure out a good passcode +for the iCade. + +Note that we can not use the VID/PID of the device, as it is not +yet known at that point. +--- + plugins/autopair.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/plugins/autopair.c b/plugins/autopair.c +index 8c98c12..5d2f6f7 100644 +--- a/plugins/autopair.c ++++ b/plugins/autopair.c +@@ -57,13 +57,23 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter, + { + char addr[18]; + char pinstr[7]; ++ char name[25]; + uint32_t class; + + ba2str(device_get_address(device), addr); + + class = btd_device_get_class(device); + +- DBG("device %s 0x%x", addr, class); ++ device_get_name(device, name, sizeof(name)); ++ name[sizeof(name) - 1] = 0; ++ ++ DBG("device %s (%s) 0x%x", addr, name, class); ++ ++ g_message ("vendor 0x%X product: 0x%X", btd_device_get_vendor (device), btd_device_get_product (device)); ++ ++ /* The iCade shouldn't use random PINs like normal keyboards */ ++ if (name != NULL && strstr(name, "iCade") != NULL) ++ return 0; + + /* This is a class-based pincode guesser. Ignore devices with an + * unknown class. +-- +1.8.4.2 + diff --git a/net-wireless/bluez/files/0004-agent-Assert-possible-infinite-loop.patch b/net-wireless/bluez/files/0004-agent-Assert-possible-infinite-loop.patch new file mode 100644 index 0000000..2746e0c --- /dev/null +++ b/net-wireless/bluez/files/0004-agent-Assert-possible-infinite-loop.patch @@ -0,0 +1,25 @@ +From 67e5477687a2753d3f7b300bcfdc74464d8ad41f Mon Sep 17 00:00:00 2001 +From: Bastien Nocera <had...@hadess.net> +Date: Mon, 9 Dec 2013 18:04:56 +0100 +Subject: [PATCH 4/5] agent: Assert possible infinite loop + +--- + src/agent.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/agent.c b/src/agent.c +index bcba969..b292881 100644 +--- a/src/agent.c ++++ b/src/agent.c +@@ -203,6 +203,8 @@ void agent_unref(struct agent *agent) + if (agent->ref > 0) + return; + ++ g_assert (agent->ref == 0); ++ + if (agent->request) { + DBusError err; + agent_pincode_cb pincode_cb; +-- +1.8.4.2 + diff --git a/net-wireless/bluez/files/bluetooth-init.d-r3 b/net-wireless/bluez/files/bluetooth-init.d-r3 new file mode 100644 index 0000000..f97fdb2 --- /dev/null +++ b/net-wireless/bluez/files/bluetooth-init.d-r3 @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/bluetooth-init.d-r3,v 1.2 2014/01/09 13:24:42 joker Exp $ + +depend() { + after coldplug + need dbus localmount hostname +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --background --exec /usr/libexec/bluetooth/bluetoothd + eend $? +} + +stop() { + ebegin "Shutting down ${SVCNAME}" + start-stop-daemon --stop --quiet --exec /usr/libexec/bluetooth/bluetoothd + eend $? +} diff --git a/net-wireless/bluez/files/bluez-5.23-use-posix_openpt.patch b/net-wireless/bluez/files/bluez-5.23-use-posix_openpt.patch new file mode 100644 index 0000000..3630df6 --- /dev/null +++ b/net-wireless/bluez/files/bluez-5.23-use-posix_openpt.patch @@ -0,0 +1,20 @@ +diff -Naur bluez-5.23.orig/emulator/serial.c bluez-5.23/emulator/serial.c +--- bluez-5.23.orig/emulator/serial.c 2014-08-06 17:25:36.000000000 +0000 ++++ bluez-5.23/emulator/serial.c 2014-10-04 13:02:38.081336391 +0000 +@@ -32,6 +32,7 @@ + #include <unistd.h> + #include <stdlib.h> + #include <string.h> ++#include <fcntl.h> + #include <sys/param.h> + #include <sys/epoll.h> + +@@ -159,7 +160,7 @@ + { + enum btdev_type uninitialized_var(type); + +- serial->fd = getpt(); ++ serial->fd = posix_openpt(O_RDWR | O_NOCTTY); + if (serial->fd < 0) { + perror("Failed to get master pseudo terminal"); + return; diff --git a/net-wireless/bluez/files/bluez-plugdev.patch b/net-wireless/bluez/files/bluez-plugdev.patch new file mode 100755 index 0000000..726838a --- /dev/null +++ b/net-wireless/bluez/files/bluez-plugdev.patch @@ -0,0 +1,14 @@ +diff -Nurp bluez-4.39.orig/src/bluetooth.conf bluez-4.39/src/bluetooth.conf +--- bluez-4.39.orig/src/bluetooth.conf 2008-12-20 20:18:10.000000000 +0100 ++++ bluez-4.39/src/bluetooth.conf 2009-09-05 13:30:34.411581498 +0200 +@@ -17,6 +17,10 @@ + <allow send_destination="org.bluez"/> + </policy> + ++ <policy group="plugdev"> ++ <allow send_destination="org.bluez"/> ++ </policy> ++ + <policy context="default"> + <deny send_destination="org.bluez"/> + </policy> diff --git a/net-wireless/bluez/files/rfcomm-init.d-r2 b/net-wireless/bluez/files/rfcomm-init.d-r2 new file mode 100755 index 0000000..c564055 --- /dev/null +++ b/net-wireless/bluez/files/rfcomm-init.d-r2 @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/rfcomm-init.d-r2,v 1.1 2014/06/26 17:18:43 alonbl Exp $ + +depend() { + need bluetooth +} + +checkconfig() { + if [ -z "${ADDRESS}" ]; then + eerror "ADDRESS must be set" + return 1 + fi + + return 0 +} + +start() { + local DEVICE=${RC_SVCNAME#*.} + + checkconfig || return 1 + + ebegin "Starting ${RC_SVCNAME}" + rfcomm bind "${DEVICE}" "${ADDRESS}" ${CHANNEL} + eend $? +} + +stop() { + local DEVICE=${RC_SVCNAME#*.} + + ebegin "Shutting down ${RC_SVCNAME}" + rfcomm release "${DEVICE}" + eend $? +} diff --git a/net-wireless/bluez/metadata.xml b/net-wireless/bluez/metadata.xml new file mode 100644 index 0000000..de19c8b --- /dev/null +++ b/net-wireless/bluez/metadata.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>pa...@gentoo.org</email> + <name>Pacho Ramos</name> + </maintainer> + <use> + <flag name="test-programs">Install tools for testing of + various Bluetooth functions</flag> + <flag name="hid2hci">The HID proxying makes the keyboard / mouse show up + as regular USB HID devices, but needs them to be + paired before enabling this, otherwise they won't be + detected</flag> + <flag name="obex">Enable OBEX transfer support.</flag> + </use> + <upstream> + <remote-id type="cpe">cpe:/a:bluez:bluez</remote-id> + <remote-id type="cpe">cpe:/a:bluez:bluez-libs</remote-id> + </upstream> +</pkgmetadata>