Commit a27ee27a authored by pali's avatar pali
Browse files

bluetooth: Remove ofono backend

It is incompatible with upcoming hsphfpd implementation.
parent dfb75610
......@@ -1099,14 +1099,6 @@ AM_CONDITIONAL([HAVE_BLUEZ], [test "x$HAVE_BLUEZ" = x1])
## Bluetooth Headset profiles backend ##
AC_ARG_ENABLE([bluez5-ofono-headset],
AS_HELP_STRING([--disable-bluez5-ofono-headset],[Disable optional ofono headset backend support (Bluez 5)]))
AS_IF([test "x$HAVE_BLUEZ_5" = "x1" && test "x$enable_bluez5_ofono_headset" != "xno"], HAVE_BLUEZ_5_OFONO_HEADSET=1,
HAVE_BLUEZ_5_OFONO_HEADSET=0)
AC_SUBST(HAVE_BLUEZ_5_OFONO_HEADSET)
AM_CONDITIONAL([HAVE_BLUEZ_5_OFONO_HEADSET], [test "x$HAVE_BLUEZ_5_OFONO_HEADSET" = x1])
AS_IF([test "x$HAVE_BLUEZ_5_OFONO_HEADSET" = "x1"], AC_DEFINE([HAVE_BLUEZ_5_OFONO_HEADSET], 1, [Bluez 5 ofono headset backend enabled]))
AC_ARG_ENABLE([bluez5-native-headset],
AS_HELP_STRING([--disable-bluez5-native-headset],[Disable optional native headset backend support (Bluez 5)]))
AS_IF([test "x$HAVE_BLUEZ_5" = "x1" && test "x$enable_bluez5_native_headset" != "xno"],
......@@ -1651,7 +1643,6 @@ AS_IF([test "x$HAVE_SYSTEMD_DAEMON" = "x1"], ENABLE_SYSTEMD_DAEMON=yes, ENABLE_S
AS_IF([test "x$HAVE_SYSTEMD_LOGIN" = "x1"], ENABLE_SYSTEMD_LOGIN=yes, ENABLE_SYSTEMD_LOGIN=no)
AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" = "x1"], ENABLE_SYSTEMD_JOURNAL=yes, ENABLE_SYSTEMD_JOURNAL=no)
AS_IF([test "x$HAVE_BLUEZ_5" = "x1"], ENABLE_BLUEZ_5=yes, ENABLE_BLUEZ_5=no)
AS_IF([test "x$HAVE_BLUEZ_5_OFONO_HEADSET" = "x1"], ENABLE_BLUEZ_5_OFONO_HEADSET=yes, ENABLE_BLUEZ_5_OFONO_HEADSET=no)
AS_IF([test "x$HAVE_BLUEZ_5_NATIVE_HEADSET" = "x1"], ENABLE_BLUEZ_5_NATIVE_HEADSET=yes, ENABLE_BLUEZ_5_NATIVE_HEADSET=no)
AS_IF([test "x$HAVE_OPENAPTX" = "x1"], ENABLE_APTX=yes, ENABLE_APTX=no)
AS_IF([test "x$HAVE_HAL_COMPAT" = "x1"], ENABLE_HAL_COMPAT=yes, ENABLE_HAL_COMPAT=no)
......@@ -1711,7 +1702,6 @@ echo "
Enable LIRC: ${ENABLE_LIRC}
Enable D-Bus: ${ENABLE_DBUS}
Enable BlueZ 5: ${ENABLE_BLUEZ_5}
Enable ofono headsets: ${ENABLE_BLUEZ_5_OFONO_HEADSET}
Enable native headsets: ${ENABLE_BLUEZ_5_NATIVE_HEADSET}
Enable aptX+aptXHD codecs: ${ENABLE_APTX}
Enable udev: ${ENABLE_UDEV}
......
......@@ -629,9 +629,6 @@ if get_option('bluez5')
if get_option('bluez5-native-headset')
cdata.set('HAVE_BLUEZ_5_NATIVE_HEADSET', 1)
endif
if get_option('bluez5-ofono-headset')
cdata.set('HAVE_BLUEZ_5_OFONO_HEADSET', 1)
endif
endif
bluez5_aptx_feature = get_option('bluez5-aptx')
......@@ -822,7 +819,6 @@ summary = [
'Enable D-Bus: @0@'.format(dbus_dep.found()),
' Enable BlueZ 5: @0@'.format(get_option('bluez5')),
' Enable native headsets: @0@'.format(get_option('bluez5-native-headset')),
' Enable ofono headsets: @0@'.format(get_option('bluez5-ofono-headset')),
' Enable aptX+aptXHD codecs: @0@'.format(bluez5_aptx),
'Enable udev: @0@'.format(udev_dep.found()),
' Enable HAL->udev compat: @0@'.format(get_option('hal-compat')),
......
......@@ -81,9 +81,6 @@ option('bluez5-aptx',
option('bluez5-native-headset',
type : 'boolean',
description : 'Optional native headset backend support (BlueZ 5)')
option('bluez5-ofono-headset',
type : 'boolean',
description : 'Optional oFono headset backend support (BlueZ 5)')
option('dbus',
type : 'feature', value : 'auto',
description : 'Optional D-Bus support')
......
......@@ -2154,10 +2154,6 @@ libbluez5_util_la_SOURCES = \
modules/bluetooth/a2dp-codec-util.h \
modules/bluetooth/a2dp-codecs.h \
modules/bluetooth/rtp.h
if HAVE_BLUEZ_5_OFONO_HEADSET
libbluez5_util_la_SOURCES += \
modules/bluetooth/backend-ofono.c
endif
if HAVE_BLUEZ_5_NATIVE_HEADSET
libbluez5_util_la_SOURCES += \
modules/bluetooth/backend-native.c
......
This diff is collapsed.
......@@ -118,7 +118,7 @@ struct pa_bluetooth_discovery {
pa_hashmap *transports;
int headset_backend;
pa_bluetooth_backend *ofono_backend, *native_backend;
pa_bluetooth_backend *native_backend;
PA_LLIST_HEAD(pa_dbus_pending, pending);
};
......@@ -1336,34 +1336,6 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
return;
}
void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is_running) {
pa_assert(y);
pa_log_debug("oFono is running: %s", pa_yes_no(is_running));
if (y->headset_backend != HEADSET_BACKEND_AUTO)
return;
/* If ofono starts running, all devices that might be connected to the HS role
* need to be disconnected, so that the devices can be handled by ofono */
if (is_running) {
void *state;
pa_bluetooth_device *d;
PA_HASHMAP_FOREACH(d, y->devices, state) {
if (device_supports_profile(d, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY)) {
DBusMessage *m;
pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, d->path, "org.bluez.Device1", "Disconnect"));
dbus_message_set_no_reply(m, true);
pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL));
dbus_message_unref(m);
}
}
}
pa_bluetooth_native_backend_enable_hs_role(y->native_backend, !is_running);
}
static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata) {
pa_dbus_pending *p;
pa_bluetooth_discovery *y;
......@@ -1402,10 +1374,8 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata)
y->objects_listed = true;
if (!y->native_backend && y->headset_backend != HEADSET_BACKEND_OFONO)
if (!y->native_backend && (y->headset_backend == HEADSET_BACKEND_AUTO || y->headset_backend == HEADSET_BACKEND_NATIVE))
y->native_backend = pa_bluetooth_native_backend_new(y->core, y, (y->headset_backend == HEADSET_BACKEND_NATIVE));
if (!y->ofono_backend && y->headset_backend != HEADSET_BACKEND_NATIVE)
y->ofono_backend = pa_bluetooth_ofono_backend_new(y->core, y);
finish:
dbus_message_unref(r);
......@@ -1459,10 +1429,6 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_hashmap_remove_all(y->devices);
pa_hashmap_remove_all(y->adapters);
y->objects_listed = false;
if (y->ofono_backend) {
pa_bluetooth_ofono_backend_free(y->ofono_backend);
y->ofono_backend = NULL;
}
if (y->native_backend) {
pa_bluetooth_native_backend_free(y->native_backend);
y->native_backend = NULL;
......@@ -2432,8 +2398,6 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
pa_dbus_free_pending_list(&y->pending);
if (y->ofono_backend)
pa_bluetooth_ofono_backend_free(y->ofono_backend);
if (y->native_backend)
pa_bluetooth_native_backend_free(y->native_backend);
......
......@@ -82,7 +82,6 @@ struct pa_bluetooth_transport {
char *path;
pa_bluetooth_profile_t profile;
uint8_t codec;
uint8_t *config;
size_t config_size;
......@@ -133,16 +132,6 @@ struct pa_bluetooth_adapter {
bool media_application_registered;
};
#ifdef HAVE_BLUEZ_5_OFONO_HEADSET
pa_bluetooth_backend *pa_bluetooth_ofono_backend_new(pa_core *c, pa_bluetooth_discovery *y);
void pa_bluetooth_ofono_backend_free(pa_bluetooth_backend *b);
#else
static inline pa_bluetooth_backend *pa_bluetooth_ofono_backend_new(pa_core *c, pa_bluetooth_discovery *y) {
return NULL;
}
static inline void pa_bluetooth_ofono_backend_free(pa_bluetooth_backend *b) {}
#endif
#ifdef HAVE_BLUEZ_5_NATIVE_HEADSET
pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role);
void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b);
......@@ -192,12 +181,10 @@ static inline bool pa_bluetooth_uuid_is_hsp_hs(const char *uuid) {
return pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS_ALT);
}
#define HEADSET_BACKEND_OFONO 0
#define HEADSET_BACKEND_NATIVE 1
#define HEADSET_BACKEND_AUTO 2
pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core, int headset_backend);
pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is_running);
#endif
......@@ -17,10 +17,6 @@ if get_option('bluez5-native-headset')
libbluez5_util_sources += [ 'backend-native.c' ]
endif
if get_option('bluez5-ofono-headset')
libbluez5_util_sources += [ 'backend-ofono.c' ]
endif
if bluez5_aptx
libbluez5_util_sources += [ 'a2dp-codec-aptx.c' ]
endif
......
......@@ -30,7 +30,7 @@ PA_MODULE_DESCRIPTION("Detect available Bluetooth daemon and load the correspond
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE(
"headset=ofono|native|auto"
"headset=native|auto"
"autodetect_mtu=<boolean>"
);
......
......@@ -35,7 +35,7 @@ PA_MODULE_DESCRIPTION("Detect available BlueZ 5 Bluetooth audio devices and load
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE(
"headset=ofono|native|auto"
"headset=native|auto"
"autodetect_mtu=<boolean>"
);
......@@ -92,11 +92,7 @@ static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y,
return PA_HOOK_OK;
}
#ifdef HAVE_BLUEZ_5_NATIVE_HEADSET
const char *default_headset_backend = "auto";
#else
const char *default_headset_backend = "ofono";
#endif
int pa__init(pa_module *m) {
struct userdata *u;
......@@ -113,14 +109,12 @@ int pa__init(pa_module *m) {
}
pa_assert_se(headset_str = pa_modargs_get_value(ma, "headset", default_headset_backend));
if (pa_streq(headset_str, "ofono"))
headset_backend = HEADSET_BACKEND_OFONO;
else if (pa_streq(headset_str, "native"))
if (pa_streq(headset_str, "native"))
headset_backend = HEADSET_BACKEND_NATIVE;
else if (pa_streq(headset_str, "auto"))
headset_backend = HEADSET_BACKEND_AUTO;
else {
pa_log("headset parameter must be either ofono, native or auto (found %s)", headset_str);
pa_log("headset parameter must be either native or auto (found %s)", headset_str);
goto fail;
}
......
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