Commit 4f972aa9 authored by João Paulo Rechi Vita's avatar João Paulo Rechi Vita Committed by Tanu Kaskinen

bluetooth: Remove module-bluetooth-proximity

module-bluetooth-proximity has not worked for quite a while, since it
uses pre-BlueZ4 APIs. Nobody complained since then, which is a good
indication that it doesn't have much users. Even the original commit
message refers to it more as a toy than as something of great use: "add
new fun module that automatically mutes your audio devices when you
leave with your bluetooth phone, and unmutes when you come back"

Removing it we completely remove the dependency on libbluetooth.
parent e647e74f
......@@ -2,16 +2,16 @@ All PulseAudio source files are licensed under the GNU Lesser General Public
License. (see file LGPL for details)
However, the server side has optional GPL dependencies. These include the
libsamplerate and gdbm (core libraries), LIRC (lirc module), FFTW (equalizer
module) and bluez (bluetooth proximity helper program) libraries, although
others may also be included in the future. If PulseAudio is compiled with these
optional components, this effectively downgrades the license of the server part
to GPL (see the file GPL for details), exercising section 3 of the LGPL. In
such circumstances, you should treat the client library (libpulse) of PulseAudio
as being LGPL licensed and the server part (libpulsecore) as being GPL licensed.
Since the PulseAudio daemon, tests, various utilities/helpers and the modules
link to libpulsecore and/or the afore mentioned optional GPL dependencies they
are of course also GPL licensed also in this scenario.
libsamplerate and gdbm (core libraries), LIRC (lirc module) and FFTW (equalizer
module), although others may also be included in the future. If PulseAudio is
compiled with these optional components, this effectively downgrades the
license of the server part to GPL (see the file GPL for details), exercising
section 3 of the LGPL. In such circumstances, you should treat the client
library (libpulse) of PulseAudio as being LGPL licensed and the server part
(libpulsecore) as being GPL licensed. Since the PulseAudio daemon, tests,
various utilities/helpers and the modules link to libpulsecore and/or the afore
mentioned optional GPL dependencies they are of course also GPL licensed also
in this scenario.
In addition to this, if D-Bus support is enabled, the PulseAudio client library
(libpulse) MAY need to be licensed under the GPL, depending on the license
......
......@@ -15,7 +15,6 @@ src/modules/alsa/module-alsa-card.c
src/modules/alsa/module-alsa-sink.c
src/modules/alsa/module-alsa-source.c
src/modules/bluetooth/module-bluetooth-device.c
src/modules/bluetooth/module-bluetooth-proximity.c
src/modules/bluetooth/proximity-helper.c
src/modules/echo-cancel/module-echo-cancel.c
src/modules/gconf/gconf-helper.c
......
......@@ -7,7 +7,6 @@ TAGS
.libs
/Makefile
/Makefile.in
proximity-helper
client.conf
daemon.conf
default.pa
......
......@@ -1322,14 +1322,10 @@ endif
if HAVE_BLUEZ
modlibexec_LTLIBRARIES += \
module-bluetooth-proximity.la \
module-bluetooth-policy.la \
libbluez4-util.la \
module-bluez4-discover.la \
module-bluez4-device.la
pulselibexec_PROGRAMS += \
proximity-helper
endif
if HAVE_OPENSSL
......@@ -1418,7 +1414,6 @@ SYMDEF_FILES = \
module-hal-detect-symdef.h \
module-udev-detect-symdef.h \
module-systemd-login-symdef.h \
module-bluetooth-proximity-symdef.h \
module-bluetooth-policy-symdef.h \
module-bluez4-discover-symdef.h \
module-bluez4-device-symdef.h \
......@@ -2017,17 +2012,6 @@ gconf_helper_LDADD = $(AM_LDADD) libpulsecore-@PA_MAJORMINOR@.la libpulsecommon-
gconf_helper_CFLAGS = $(AM_CFLAGS) $(GCONF_CFLAGS)
gconf_helper_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
# Bluetooth proximity
module_bluetooth_proximity_la_SOURCES = modules/bluetooth/module-bluetooth-proximity.c
module_bluetooth_proximity_la_LDFLAGS = $(MODULE_LDFLAGS)
module_bluetooth_proximity_la_LIBADD = $(MODULE_LIBADD) $(DBUS_LIBS)
module_bluetooth_proximity_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) -DPA_BT_PROXIMITY_HELPER=\"$(pulselibexecdir)/proximity-helper\"
proximity_helper_SOURCES = modules/bluetooth/proximity-helper.c
proximity_helper_LDADD = $(AM_LDADD) $(BLUEZ_LIBS)
proximity_helper_CFLAGS = $(AM_CFLAGS) $(BLUEZ_CFLAGS)
proximity_helper_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
# Bluetooth BlueZ 4 sink / source
module_bluez4_discover_la_SOURCES = modules/bluetooth/module-bluez4-discover.c
module_bluez4_discover_la_LDFLAGS = $(MODULE_LDFLAGS)
......@@ -2082,10 +2066,6 @@ else
SYMLINK_PROGRAM=ln -sf
endif
install-exec-hook:
if HAVE_BLUEZ
-chown root $(DESTDIR)$(pulselibexecdir)/proximity-helper
-chmod u+s $(DESTDIR)$(pulselibexecdir)/proximity-helper
endif
$(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/parec$(EXEEXT)
$(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/pamon$(EXEEXT)
$(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/paplay$(EXEEXT)
......
This diff is collapsed.
/*
* Small SUID helper that allows us to ping a BT device. Borrows
* heavily from bluez-utils' l2ping, which is licensed as GPL2+
* and comes with a copyright like this:
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2007 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#undef NDEBUG
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/select.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/l2cap.h>
#define PING_STRING "PulseAudio"
#define IDENT 200
#define TIMEOUT 4
#define INTERVAL 2
static void update_status(int found) {
static int status = -1;
if (!found && status != 0)
printf("-");
if (found && status <= 0)
printf("+");
fflush(stdout);
status = !!found;
}
int main(int argc, char *argv[]) {
struct sockaddr_l2 addr;
union {
l2cap_cmd_hdr hdr;
uint8_t buf[L2CAP_CMD_HDR_SIZE + sizeof(PING_STRING)];
} packet;
int fd = -1;
uint8_t id = IDENT;
int connected = 0;
assert(argc == 2);
for (;;) {
fd_set fds;
struct timeval end;
ssize_t r;
if (!connected) {
if (fd >= 0)
close(fd);
if ((fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP)) < 0) {
fprintf(stderr, "socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP) failed: %s", strerror(errno));
goto finish;
}
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
bacpy(&addr.l2_bdaddr, BDADDR_ANY);
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
fprintf(stderr, "bind() failed: %s", strerror(errno));
goto finish;
}
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
str2ba(argv[1], &addr.l2_bdaddr);
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
if (errno == EHOSTDOWN || errno == ECONNRESET || errno == ETIMEDOUT) {
update_status(0);
sleep(INTERVAL);
continue;
}
fprintf(stderr, "connect() failed: %s", strerror(errno));
goto finish;
}
connected = 1;
}
assert(connected);
memset(&packet, 0, sizeof(packet));
strcpy((char*) packet.buf + L2CAP_CMD_HDR_SIZE, PING_STRING);
packet.hdr.ident = id;
packet.hdr.len = htobs(sizeof(PING_STRING));
packet.hdr.code = L2CAP_ECHO_REQ;
if ((r = send(fd, &packet, sizeof(packet), 0)) < 0) {
if (errno == EHOSTDOWN || errno == ECONNRESET || errno == ETIMEDOUT) {
update_status(0);
connected = 0;
sleep(INTERVAL);
continue;
}
fprintf(stderr, "send() failed: %s", strerror(errno));
goto finish;
}
assert(r == sizeof(packet));
gettimeofday(&end, NULL);
end.tv_sec += TIMEOUT;
for (;;) {
struct timeval now, delta;
gettimeofday(&now, NULL);
if (timercmp(&end, &now, <=)) {
update_status(0);
connected = 0;
sleep(INTERVAL);
break;
}
timersub(&end, &now, &delta);
FD_ZERO(&fds);
FD_SET(fd, &fds);
if (select(fd+1, &fds, NULL, NULL, &delta) < 0) {
fprintf(stderr, "select() failed: %s", strerror(errno));
goto finish;
}
if ((r = recv(fd, &packet, sizeof(packet), 0)) <= 0) {
if (errno == EHOSTDOWN || errno == ECONNRESET || errno == ETIMEDOUT) {
update_status(0);
connected = 0;
sleep(INTERVAL);
break;
}
fprintf(stderr, "send() failed: %s", r == 0 ? "EOF" : strerror(errno));
goto finish;
}
assert(r >= L2CAP_CMD_HDR_SIZE);
if (packet.hdr.ident != id)
continue;
if (packet.hdr.code == L2CAP_ECHO_RSP || packet.hdr.code == L2CAP_COMMAND_REJ) {
if (++id >= 0xFF)
id = IDENT;
update_status(1);
sleep(INTERVAL);
break;
}
}
}
finish:
if (fd >= 0)
close(fd);
return 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment