Re: [PATCH] network-manager-applet Add rules for BlueZ 5 support



On Wed, 2014-08-06 at 16:04 +0800, Cho, Yu-Chen wrote:
From BlueZ 5.0 , dbus API org.bluez.Serial has been removed and others have changed.
So add option "--disable-bluez5" for applet to get bluetooth DUN (Dial-Up Networking)
support on BlueZ 4.X and remove it when using BlueZ 5.x.(Default is disable Bluez 5)

Actually, I think we should just disable the bluetooth plugin when
Bluez5 is used.  This is because with bluez5, (a) NM doesn't support DUN
(yet, but it's being worked on) and (b) you don't need the bluetooth
plugin at all for PAN connections.

We made a change when the bluez5 support was added to automatically
create a PAN connection for PAN-capable devices.  So the bluetooth
plugin is useless in the PAN case for both bluez4 and bluez5.

And since NM doesn't yet support bluez5 with DUN, the bluetooth plugin
is useless in that case too.

Dan

Signed-off-by: Cho, Yu-Chen <acho suse com>
---
 configure.ac                        | 14 ++++++++++++++
 src/gnome-bluetooth/bt-widget.c     |  6 ++++++
 src/gnome-bluetooth/nma-bt-device.c |  8 ++++++++
 3 files changed, 28 insertions(+)

diff --git a/configure.ac b/configure.ac
index d6ca9e6..857f0ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,6 +128,20 @@ AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4"
 
+
+#### BlueZ 5 support ####
+
+AC_ARG_WITH([bluz5],
+            AS_HELP_STRING([--enable-bluez5|--disable-bluez5], [Enable Bluez 5 support]),
+            enable_bluez5="$withval")
+
+if (test "x$enable_bluez5" == "xyes");then
+    AC_DEFINE([HAVE_BLUEZ_5], 1, [Enable blueZ 5 support])
+else
+    AC_DEFINE([HAVE_BLUEZ_5], 0, [Disable blueZ 5 support])
+fi
+AC_SUBST(HAVE_BLUEZ5)
+
 dnl Check for gnome-bluetooth
 AC_ARG_WITH([bluetooth],
          AS_HELP_STRING([--with-bluetooth|--without-bluetooth], [Enable Bluetooth support]),
diff --git a/src/gnome-bluetooth/bt-widget.c b/src/gnome-bluetooth/bt-widget.c
index 3195d6f..1553582 100644
--- a/src/gnome-bluetooth/bt-widget.c
+++ b/src/gnome-bluetooth/bt-widget.c
@@ -108,8 +108,10 @@ get_capabilities (const char *bdaddr,
              g_message ("has_config_widget %s %s", bdaddr, uuids[i]);
              if (g_str_equal (uuids[i], "NAP"))
                      *pan = TRUE;
+#if HAVE_BLUEZ_5 == 0
              if (g_str_equal (uuids[i], "DialupNetworking"))
                      *dun = TRUE;
+#endif
      }
 }
 
@@ -170,6 +172,7 @@ pan_button_toggled (GtkToggleButton *button, WidgetInfo *info)
      nma_bt_device_set_pan_enabled (info->device, gtk_toggle_button_get_active (button));
 }
 
+#if HAVE_BLUEZ_5 == 0
 static void
 dun_button_toggled (GtkToggleButton *button, WidgetInfo *info)
 {
@@ -184,6 +187,7 @@ dun_button_toggled (GtkToggleButton *button, WidgetInfo *info)
 
      nma_bt_device_set_dun_enabled (info->device, gtk_toggle_button_get_active (button));
 }
+#endif
 
 static void
 widget_info_destroy (gpointer data)
@@ -446,6 +450,7 @@ get_config_widgets (const char *bdaddr, const char **uuids)
              gtk_widget_set_sensitive (info->pan_button, !busy);
      }
 
+#if HAVE_BLUEZ_5 == 0
      if (dun) {
              info->dun_button = gtk_check_button_new_with_label (_("Access the Internet using your mobile 
phone (DUN)"));
              gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->dun_button),
@@ -454,6 +459,7 @@ get_config_widgets (const char *bdaddr, const char **uuids)
              gtk_box_pack_start (GTK_BOX (vbox), info->dun_button, FALSE, TRUE, 6);
              set_dun_button_sensitive (info, !busy);
      }
+#endif
 
      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6);
diff --git a/src/gnome-bluetooth/nma-bt-device.c b/src/gnome-bluetooth/nma-bt-device.c
index 3a33dce..a42f066 100644
--- a/src/gnome-bluetooth/nma-bt-device.c
+++ b/src/gnome-bluetooth/nma-bt-device.c
@@ -108,11 +108,19 @@ static void _set_dun_enabled (NmaBtDevice *device, gboolean enabled);
 
 #define BLUEZ_SERVICE           "org.bluez"
 #define BLUEZ_MANAGER_PATH      "/"
+
+#if HAVE_BLUEZ_5 == 1
+#define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter1"
+#define BLUEZ_DEVICE_INTERFACE  "org.bluez.Device1"
+#define BLUEZ_NETWORK_INTERFACE "org.bluez.Network1"
+#define BLUEZ_SERIAL_INTERFACE  ""
+#else
 #define BLUEZ_MANAGER_INTERFACE "org.bluez.Manager"
 #define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter"
 #define BLUEZ_DEVICE_INTERFACE  "org.bluez.Device"
 #define BLUEZ_SERIAL_INTERFACE  "org.bluez.Serial"
 #define BLUEZ_NETWORK_INTERFACE "org.bluez.Network"
+#endif
 
 #define MM_SERVICE         "org.freedesktop.ModemManager"
 #define MM_PATH            "/org/freedesktop/ModemManager"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]