diff -pruN 0.56-3/debian/changelog 0.56-4/debian/changelog
--- 0.56-3/debian/changelog	2009-12-23 12:50:00.000000000 +0000
+++ 0.56-4/debian/changelog	2013-08-11 13:03:14.000000000 +0000
@@ -1,3 +1,11 @@
+gpe-bluetooth (0.56-4) unstable; urgency=low
+
+  * Rename GSList * devices to avoid strange compiler bug
+    being unable to resolvable R_X86_64_PC32 relocation
+    (Closes: #713607)
+
+ -- Neil Williams <codehelp@debian.org>  Sun, 11 Aug 2013 14:03:12 +0100
+
 gpe-bluetooth (0.56-3) unstable; urgency=low
 
   * Add vcs tags for collab-maint
diff -pruN 0.56-3/debian/control 0.56-4/debian/control
--- 0.56-3/debian/control	2009-12-07 23:57:23.000000000 +0000
+++ 0.56-4/debian/control	2013-06-28 20:13:36.000000000 +0000
@@ -12,7 +12,7 @@ Build-Depends: cdbs, debhelper (>= 5), a
  libgtk2.0-dev (>= 2.2), libgpewidget-dev, libgpevtype-dev,
  libmimedir-gnome-dev, libopenobex1-dev, libsqlite0-dev
 Homepage: http://gpe.linuxtogo.org/projects/gpe-bluetooth.shtml
-Standards-Version: 3.8.3
+Standards-Version: 3.9.4
 Vcs-SVN: svn://svn.debian.org/pkg-gpe/trunk/gpe-bluetooth/trunk/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-gpe/trunk/gpe-bluetooth/trunk/
 
diff -pruN 0.56-3/debian/patches/rename-devices-list 0.56-4/debian/patches/rename-devices-list
--- 0.56-3/debian/patches/rename-devices-list	1970-01-01 00:00:00.000000000 +0000
+++ 0.56-4/debian/patches/rename-devices-list	2013-06-28 19:12:57.000000000 +0000
@@ -0,0 +1,62 @@
+Description: Give the devices list a less common variable name
+Author: Neil Williams <codehelp@debian.org>
+Bug-Debian: http://bugs.debian.org/713607
+
+--- gpe-bluetooth-0.56.orig/main.c
++++ gpe-bluetooth-0.56/main.c
+@@ -86,7 +86,7 @@ static GtkWidget *devices_window;
+ static GtkWidget *iconlist;
+ static GtkWidget *radio_on_progress;
+ 
+-GSList *devices;
++GSList *gb_devices;
+ 
+ gboolean radio_is_on;
+ GdkWindow *dock_window;
+@@ -464,7 +464,7 @@ run_scan (gpointer data)
+ 
+       baswap (&bdaddr, &(info+i)->bdaddr);
+ 
+-      for (iter = devices; iter; iter = iter->next)
++      for (iter = gb_devices; iter; iter = iter->next)
+ 	{
+ 	  struct bt_device *d = (struct bt_device *)iter->data;
+ 	  if (memcmp (&d->bdaddr, &bdaddr, sizeof (bdaddr)) == 0)
+@@ -491,7 +491,7 @@ run_scan (gpointer data)
+ 
+       gdk_pixbuf_ref (bd->pixbuf);
+ 
+-      devices = g_slist_append (devices, bd);
++      gb_devices = g_slist_append (gb_devices, bd);
+     }
+   
+   close (dd);
+@@ -504,7 +504,7 @@ run_scan (gpointer data)
+   bt_progress_dialog_update (w, _("Retrieving service information"));
+   gdk_flush ();
+ 
+-  for (iter = devices; iter; iter = iter->next)
++  for (iter = gb_devices; iter; iter = iter->next)
+     {
+       struct bt_device *bd = iter->data;
+       GObject *item;
+--- gpe-bluetooth-0.56.orig/pin-dbus.c
++++ gpe-bluetooth-0.56/pin-dbus.c
+@@ -33,7 +33,7 @@
+ 
+ #define _(x) gettext (x)
+ 
+-extern GSList *devices;
++extern GSList *gb_devices;
+ 
+ 
+ struct pin_request_context
+@@ -84,7 +84,7 @@ get_name (bdaddr_t addr)
+   GSList *iter;
+   gboolean found = FALSE;
+ 
+-  for (iter = devices; iter; iter = iter->next)
++  for (iter = gb_devices; iter; iter = iter->next)
+     {
+       struct bt_device *d = (struct bt_device *)iter->data;
+       if (memcmp (&d->bdaddr, &addr, sizeof (addr)) == 0)
diff -pruN 0.56-3/debian/patches/series 0.56-4/debian/patches/series
--- 0.56-3/debian/patches/series	2009-12-20 11:04:01.000000000 +0000
+++ 0.56-4/debian/patches/series	2013-06-28 19:13:09.000000000 +0000
@@ -1,2 +1,3 @@
 desktop-validity
 hciconfig-path
+rename-devices-list
diff -pruN 0.56-3/debian/rules 0.56-4/debian/rules
--- 0.56-3/debian/rules	2009-12-20 11:04:01.000000000 +0000
+++ 0.56-4/debian/rules	2013-06-28 20:10:03.000000000 +0000
@@ -2,6 +2,12 @@
   
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/autotools.mk
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
 
-# binutils-gold test
-DEB_CONFIGURE_SCRIPT_ENV=LDFLAGS="-Wl,-z,defs -Wl,--as-needed -Wl,--no-add-needed"
+DEB_CONFIGURE_SCRIPT_ENV=
+
+CFLAGS+=$(CPPFLAGS)
+CXXFLAGS+=$(CPPFLAGS)
+
+DEB_CONFIGURE_EXTRA_FLAGS=CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS) -Wl,-z,defs -Wl,--as-needed -Wl,--no-add-needed"
diff -pruN 0.56-3/main.c 0.56-4/main.c
--- 0.56-3/main.c	2013-08-11 15:49:02.000000000 +0000
+++ 0.56-4/main.c	2013-08-11 15:49:03.000000000 +0000
@@ -86,7 +86,7 @@ static GtkWidget *devices_window;
 static GtkWidget *iconlist;
 static GtkWidget *radio_on_progress;
 
-GSList *devices;
+GSList *gb_devices;
 
 gboolean radio_is_on;
 GdkWindow *dock_window;
@@ -464,7 +464,7 @@ run_scan (gpointer data)
 
       baswap (&bdaddr, &(info+i)->bdaddr);
 
-      for (iter = devices; iter; iter = iter->next)
+      for (iter = gb_devices; iter; iter = iter->next)
 	{
 	  struct bt_device *d = (struct bt_device *)iter->data;
 	  if (memcmp (&d->bdaddr, &bdaddr, sizeof (bdaddr)) == 0)
@@ -491,7 +491,7 @@ run_scan (gpointer data)
 
       gdk_pixbuf_ref (bd->pixbuf);
 
-      devices = g_slist_append (devices, bd);
+      gb_devices = g_slist_append (gb_devices, bd);
     }
   
   close (dd);
@@ -504,7 +504,7 @@ run_scan (gpointer data)
   bt_progress_dialog_update (w, _("Retrieving service information"));
   gdk_flush ();
 
-  for (iter = devices; iter; iter = iter->next)
+  for (iter = gb_devices; iter; iter = iter->next)
     {
       struct bt_device *bd = iter->data;
       GObject *item;
diff -pruN 0.56-3/.pc/applied-patches 0.56-4/.pc/applied-patches
--- 0.56-3/.pc/applied-patches	2013-08-11 15:49:02.998590097 +0000
+++ 0.56-4/.pc/applied-patches	2013-08-11 15:49:03.218595865 +0000
@@ -1,2 +1,3 @@
 desktop-validity
 hciconfig-path
+rename-devices-list
diff -pruN 0.56-3/.pc/rename-devices-list/main.c 0.56-4/.pc/rename-devices-list/main.c
--- 0.56-3/.pc/rename-devices-list/main.c	1970-01-01 00:00:00.000000000 +0000
+++ 0.56-4/.pc/rename-devices-list/main.c	2013-08-11 15:49:03.000000000 +0000
@@ -0,0 +1,792 @@
+/*
+ * Copyright (C) 2002, 2003, 2006 Philip Blundell <philb@gnu.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.
+ */
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <time.h>
+#include <libintl.h>
+#include <locale.h>
+#include <pty.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#include <gpe/init.h>
+#include <gpe/pixmaps.h>
+#include <gpe/errorbox.h>
+#include <gpe/spacing.h>
+#include <gpe/gpeiconlistview.h>
+#include <gpe/tray.h>
+#include <gpe/popup.h>
+
+#include <sys/socket.h>
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
+
+#include "main.h"
+#include "sdp.h"
+#include "dbus.h"
+#include "progress.h"
+
+#include "dun.h"
+#include "lap.h"
+#include "pan.h"
+#include "headset.h"
+
+#include "obexserver.h"
+#include "obexclient.h"
+
+#define _(x) gettext(x)
+
+#define HCIATTACH "/etc/bluetooth/hciattach"
+
+static GThread *scan_thread;
+
+bdaddr_t src_addr = *BDADDR_ANY;
+sdp_session_t *sdp_session;
+
+struct gpe_icon my_icons[] = {
+  { "bt-on", "bluetooth/bt-on" },
+  { "bt-off", "bluetooth/bt-off" },
+  { "cellphone", "bluetooth/cellphone" },
+  { "network", "bluetooth/network" },
+  { "computer", "bluetooth/Computer" },
+  { "printer", "bluetooth/Printer" },
+  { "bt-logo" },
+  { NULL }
+};
+
+static GtkWidget *icon;
+
+static pid_t hciattach_pid;
+
+static GtkWidget *window;
+static GtkWidget *menu;
+static GtkWidget *menu_radio_on, *menu_radio_off;
+static GtkWidget *menu_devices;
+static GtkWidget *devices_window;
+static GtkWidget *iconlist;
+static GtkWidget *radio_on_progress;
+
+GSList *devices;
+
+gboolean radio_is_on;
+GdkWindow *dock_window;
+GSList *service_desc_list;
+
+struct callback_record
+{
+  GCallback callback;
+  gpointer data;
+};
+
+typedef void (*radio_start_callback)(gpointer);
+static GSList *radio_start_callbacks;
+static gboolean radio_starting;
+static int radio_use_count;
+
+extern void bluez_pin_dbus_server_run (void);
+
+void
+set_image(int sx, int sy)
+{
+  GdkBitmap *bitmap;
+  GdkPixbuf *sbuf, *dbuf;
+  int size;
+	
+  if (!sx)
+    {
+      sy = gdk_pixbuf_get_height(gtk_image_get_pixbuf(GTK_IMAGE(icon)));
+      sx = gdk_pixbuf_get_width(gtk_image_get_pixbuf(GTK_IMAGE(icon)));
+    }
+	
+  size = (sx > sy) ? sy : sx;
+  sbuf = gpe_find_icon (radio_is_on ? "bt-on" : "bt-off");
+	
+  dbuf = gdk_pixbuf_scale_simple(sbuf, size, size, GDK_INTERP_HYPER);
+  gdk_pixbuf_render_pixmap_and_mask (dbuf, NULL, &bitmap, 60);
+  gtk_widget_shape_combine_mask (GTK_WIDGET(window), NULL, 0, 0);
+  gtk_widget_shape_combine_mask (GTK_WIDGET(window), bitmap, 0, 0);
+  gdk_bitmap_unref (bitmap);
+  gtk_image_set_from_pixbuf(GTK_IMAGE(icon), dbuf);
+}
+
+static pid_t
+fork_hciattach (void)
+{
+  if (access (HCIATTACH, X_OK) == 0)
+    {
+      pid_t p = vfork ();
+      if (p == 0)
+	{
+	  execl (HCIATTACH, HCIATTACH, NULL);
+	  perror (HCIATTACH);
+	  _exit (1);
+	}
+
+      return p;
+    }
+
+  return 0;
+}
+
+#define RADIO_ON_POLL_TIME	500
+
+gboolean
+check_radio_startup (guint id)
+{
+  int dd;
+
+  dd = hci_open_dev (0);
+  if (dd != -1)
+    {
+      GSList *l;
+
+      hci_close_dev (dd);
+
+      if (radio_on_progress)
+	{
+	  gtk_widget_destroy (radio_on_progress);
+	  radio_on_progress = NULL;
+	}
+
+      radio_is_on = TRUE;
+      radio_starting = FALSE;
+      set_image (0, 0);
+
+      if (radio_start_callbacks)
+	{
+	  for (l = radio_start_callbacks; l; l = l->next)
+	    {
+	      struct callback_record *c = l->data;
+	      ((radio_start_callback)c->callback) (c->data);
+	    }
+
+	  g_slist_free (radio_start_callbacks);
+
+	  radio_start_callbacks = NULL;
+	}
+
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+do_start_radio (void)
+{
+  sigset_t sigs;
+  int fd;
+
+  fd = socket (PF_BLUETOOTH, SOCK_DGRAM, BTPROTO_L2CAP);
+  if (fd < 0)
+    {
+      gpe_error_box (_("No kernel support for Bluetooth"));
+      return FALSE;
+    }
+  close (fd);
+
+  gtk_widget_hide (menu_radio_on);
+  gtk_widget_show (menu_radio_off);
+  gtk_widget_set_sensitive (menu_devices, TRUE);
+
+  sigemptyset (&sigs);
+  sigaddset (&sigs, SIGCHLD);
+  sigprocmask (SIG_BLOCK, &sigs, NULL);
+  hciattach_pid = fork_hciattach ();
+  sigprocmask (SIG_UNBLOCK, &sigs, NULL);
+
+  if (hciattach_pid == 0)
+    {
+      gpe_perror_box (_("Couldn't exec " HCIATTACH));
+      return FALSE;
+    }
+
+  radio_on_progress = bt_progress_dialog (_("Energising radio"), gpe_find_icon ("bt-logo"));
+  gtk_widget_show_all (radio_on_progress);
+  radio_starting = TRUE;
+
+  g_timeout_add (RADIO_ON_POLL_TIME, (GSourceFunc) check_radio_startup, NULL);
+  return TRUE;
+}
+
+static void
+do_stop_radio (void)
+{
+  radio_is_on = FALSE;
+  radio_starting = FALSE;
+
+  if (hciattach_pid)
+    {
+      kill (hciattach_pid, 15);
+      hciattach_pid = 0;
+    }
+
+  system ("/usr/sbin/hciconfig hci0 down");
+  set_image (0, 0);
+
+  gtk_widget_hide (menu_radio_off);
+  gtk_widget_show (menu_radio_on);
+  gtk_widget_set_sensitive (menu_devices, FALSE);
+}
+
+void
+radio_on (void)
+{
+  if (!radio_is_on)
+    do_start_radio ();
+  radio_use_count++;
+}
+
+void
+radio_off (void)
+{
+  radio_use_count--;
+
+  if (radio_use_count == 0)
+    do_stop_radio ();
+}
+
+gboolean
+radio_on_then (GCallback callback, gpointer data)
+{
+  struct callback_record *c;
+
+  radio_use_count++;
+
+  if (radio_is_on)
+    {
+      ((radio_start_callback)callback) (data);
+      return TRUE;
+    }
+
+  c = g_new (struct callback_record, 1);
+  c->callback = callback;
+  c->data = data;
+  radio_start_callbacks = g_slist_prepend (radio_start_callbacks, c);
+  if (!radio_starting)
+    {
+      if (!do_start_radio ())
+	{
+	  radio_start_callbacks = g_slist_remove (radio_start_callbacks, c);
+	  g_free (c);
+	  radio_use_count--;
+	  return FALSE;
+	}
+    }
+
+  return TRUE;
+}
+
+static void
+radio_on_menu (void)
+{
+  radio_on ();
+
+  gtk_widget_hide (menu_radio_on);
+  gtk_widget_show (menu_radio_off);
+  gtk_widget_set_sensitive (menu_devices, TRUE);
+}
+
+static void
+radio_off_menu (void)
+{
+  radio_off ();
+
+  gtk_widget_hide (menu_radio_off);
+  gtk_widget_show (menu_radio_on);
+  gtk_widget_set_sensitive (menu_devices, FALSE);
+}
+
+static gboolean
+devices_window_destroyed (void)
+{
+  devices_window = NULL;
+
+  return FALSE;
+}
+
+static void
+device_info (struct bt_device *bd)
+{
+  GtkWidget *window = gtk_dialog_new ();
+  GtkWidget *vbox1 = gtk_vbox_new (FALSE, 0);
+  GtkWidget *hbox1 = gtk_hbox_new (FALSE, 0);
+  GtkWidget *labelname = gtk_label_new (bd->name);
+  GtkWidget *labeladdr = gtk_label_new (batostr (&bd->bdaddr));
+  GtkWidget *image = gtk_image_new_from_pixbuf (bd->pixbuf);
+  GtkWidget *dismiss = gtk_button_new_from_stock (GTK_STOCK_OK);
+
+  gtk_window_set_title (GTK_WINDOW (window), _("Device information"));
+  gpe_set_window_icon (GTK_WIDGET (window), "bt-logo");
+
+  gtk_misc_set_alignment (GTK_MISC (labelname), 0.0, 0.5);
+  gtk_misc_set_alignment (GTK_MISC (labeladdr), 0.0, 0.5);
+      
+  gtk_box_pack_start (GTK_BOX (vbox1), labelname, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox1), labeladdr, TRUE, TRUE, 0);
+      
+  gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 8);
+  gtk_box_pack_start (GTK_BOX (hbox1), image, TRUE, TRUE, 8);
+      
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox1, FALSE, FALSE, 0);
+
+  gtk_box_pack_end (GTK_BOX (GTK_DIALOG (window)->action_area), dismiss, FALSE, FALSE, 0);
+  
+  gtk_widget_realize (window);
+  gdk_window_set_transient_for (window->window, devices_window->window);
+  
+  gtk_widget_show_all (window);
+  
+  g_signal_connect_swapped (G_OBJECT (dismiss), "clicked", G_CALLBACK (gtk_widget_destroy), window);
+}
+
+static void
+show_device_info (GtkWidget *w, struct bt_device *this_device)
+{
+  device_info (this_device);
+}
+
+static void
+device_clicked (GtkWidget *widget, GdkEventButton *e, gpointer data)
+{
+  GSList *iter;
+  GtkWidget *device_menu;
+  GtkWidget *details;
+  struct bt_device *bd = (struct bt_device *)data;
+
+  device_menu = gtk_menu_new ();
+
+  details = gtk_menu_item_new_with_label (_("Details..."));
+  g_signal_connect (G_OBJECT (details), "activate", G_CALLBACK (show_device_info), bd);
+  gtk_widget_show (details);
+  gtk_menu_append (GTK_MENU (device_menu), details);
+
+  for (iter = bd->services; iter; iter = iter->next)
+    {
+      struct bt_service *sv = iter->data;
+
+      if (sv->desc->popup_menu)
+	sv->desc->popup_menu (sv, device_menu);
+    }
+
+  gtk_menu_popup (GTK_MENU (device_menu), NULL, NULL, NULL, widget, 1, GDK_CURRENT_TIME);
+}
+
+const gchar *
+icon_name_for_class (int class)
+{
+  const gchar *pixbuf_name;
+
+  switch (class & 0x1f00)
+    {
+    case 0x100:
+      pixbuf_name = "computer";
+      break;
+    case 0x200:
+      pixbuf_name = "cellphone";
+      break;
+    case 0x300:
+      pixbuf_name = "network";
+      break;
+    case 0x600:
+      pixbuf_name = "printer";
+      break;
+    default:
+      pixbuf_name = "bt-logo";
+      break;
+    }
+
+  return pixbuf_name;
+}
+
+static gboolean
+run_scan (gpointer data)
+{
+  bdaddr_t bdaddr;
+  inquiry_info *info = NULL;
+  int dev_id = -1;
+  int num_rsp, length, flags;
+  char name[248];
+  int i, dd;
+  GtkWidget *w;
+  GSList *iter;
+  const char *text;
+
+  gdk_threads_enter ();
+  w = bt_progress_dialog (_("Scanning for devices"), gpe_find_icon ("bt-logo"));
+  gtk_widget_show_all (w);
+  gdk_threads_leave ();
+
+  length  = 4;  /* ~10 seconds */
+  num_rsp = 10;
+  flags = 0;
+
+  num_rsp = hci_inquiry (dev_id, length, num_rsp, NULL, &info, flags);
+  if (num_rsp < 0) 
+    {
+      text = _("Inquiry failed");
+      goto error;
+    }
+
+  dd = hci_open_dev (0/*dev_id*/);
+  if (dd < 0) 
+    {
+      free (info);
+      text = _("HCI device open failed");
+      goto error;
+    }
+
+  for (i = 0; i < num_rsp; i++) 
+    {
+      struct bt_device *bd;
+      GSList *iter;
+      gboolean found = FALSE;
+
+      baswap (&bdaddr, &(info+i)->bdaddr);
+
+      for (iter = devices; iter; iter = iter->next)
+	{
+	  struct bt_device *d = (struct bt_device *)iter->data;
+	  if (memcmp (&d->bdaddr, &bdaddr, sizeof (bdaddr)) == 0)
+	    {
+	      found = TRUE;
+	      break;
+	    }
+	}
+
+      if (found)
+	continue;
+
+      memset(name, 0, sizeof(name));
+      if (hci_read_remote_name (dd, &(info+i)->bdaddr, sizeof(name), name, 25000) < 0)
+	strcpy (name, _("unknown"));
+
+      bd = g_malloc (sizeof (struct bt_device));
+      memset (bd, 0, sizeof (*bd));
+      bd->name = g_strdup (name);
+      memcpy (&bd->bdaddr, &bdaddr, sizeof (bdaddr));
+      bd->class = ((info+i)->dev_class[2] << 16) | ((info+i)->dev_class[1] << 8) | (info+i)->dev_class[0];
+
+      bd->pixbuf = gpe_find_icon (icon_name_for_class (bd->class));
+
+      gdk_pixbuf_ref (bd->pixbuf);
+
+      devices = g_slist_append (devices, bd);
+    }
+  
+  close (dd);
+  free (info);
+
+  gdk_threads_enter ();
+
+  gtk_widget_show_all (devices_window);
+
+  bt_progress_dialog_update (w, _("Retrieving service information"));
+  gdk_flush ();
+
+  for (iter = devices; iter; iter = iter->next)
+    {
+      struct bt_device *bd = iter->data;
+      GObject *item;
+      item = gpe_icon_list_view_add_item_pixbuf (GPE_ICON_LIST_VIEW (iconlist), bd->name, bd->pixbuf, bd);
+      g_signal_connect (G_OBJECT (item), "button-release", G_CALLBACK (device_clicked), bd);
+      
+      if (bd->sdp == FALSE)
+	{
+	  gdk_flush ();
+	  gdk_threads_leave ();
+
+	  bd->sdp = sdp_browse_device (bd, PUBLIC_BROWSE_GROUP);
+
+	  gdk_threads_enter ();
+	}
+    }
+
+  gtk_widget_destroy (w);
+  gdk_flush ();
+
+  gdk_threads_leave ();
+
+  return TRUE;
+
+ error:
+  gdk_threads_enter ();
+  gtk_widget_destroy (w);
+  gpe_perror_box_nonblocking (text);
+  gtk_widget_show_all (devices_window);
+  gdk_threads_leave ();
+  return FALSE;
+}
+
+static void
+show_devices (void)
+{
+  if (devices_window == NULL)
+    {
+      GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL);
+        
+      devices_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+      gtk_window_set_title (GTK_WINDOW (devices_window), _("Bluetooth devices"));
+      gpe_set_window_icon (devices_window, "bt-logo");
+
+      gtk_window_set_default_size (GTK_WINDOW (devices_window), 240, 240);
+      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 
+                                      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);        
+        
+      iconlist = gpe_icon_list_view_new ();
+      gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), iconlist);
+      gtk_container_add (GTK_CONTAINER (devices_window), sw);
+      gpe_icon_list_view_set_embolden (GPE_ICON_LIST_VIEW (iconlist), FALSE);
+
+      g_signal_connect (G_OBJECT (devices_window), "destroy", 
+			G_CALLBACK (devices_window_destroyed), NULL);
+    }
+
+  gpe_icon_list_view_clear (GPE_ICON_LIST_VIEW (iconlist));
+
+  scan_thread = g_thread_create ((GThreadFunc) run_scan, NULL, FALSE, NULL);
+
+  if (scan_thread == NULL)
+    gpe_perror_box (_("Unable to scan for devices"));
+}
+
+static gboolean sigchld_signalled;
+
+static void 
+sigchld_handler (int signo)
+{
+  sigchld_signalled = TRUE;
+}
+
+static gboolean
+sigchld_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
+{
+  int status;
+  pid_t p;
+
+  sigchld_signalled = FALSE;
+  
+  do
+    {
+      p = waitpid (0, &status, WNOHANG);
+      if (p < 0)
+	perror ("waitpid");
+
+      if (p == hciattach_pid)
+	{
+	  if (WIFSIGNALED (status) && (WTERMSIG (status) == SIGHUP))
+	    {
+	      /* restart hciattach after hangup */
+	      hciattach_pid = fork_hciattach ();
+	    }
+	  else
+	    {
+	      hciattach_pid = 0;
+	      if (radio_is_on)
+		{
+		  gpe_error_box_nonblocking (_("hciattach died unexpectedly"));
+		  radio_off ();
+		}
+	      else
+		{
+		  if (radio_on_progress)
+		    {
+		      gtk_widget_destroy (radio_on_progress);
+		      radio_on_progress = NULL;
+		    }
+		  
+		  gpe_perror_box_nonblocking (_("Radio startup failed"));
+		  radio_starting = FALSE;
+		}
+	    }
+	}
+      else if (p > 0)
+	{
+	  fprintf (stderr, "unknown pid %d exited\n", p);
+	}
+    } while (p > 0);
+
+  return TRUE;
+}
+
+static gboolean
+sigchld_source_prepare (GSource *source, gint *timeout)
+{
+  *timeout = -1;
+  return sigchld_signalled;
+}
+
+static gboolean
+sigchld_source_check (GSource *source)
+{
+  return sigchld_signalled;
+}
+
+static GSourceFuncs
+sigchld_source_funcs = 
+  {
+    sigchld_source_prepare,
+    sigchld_source_check,
+    sigchld_source_dispatch,
+    NULL
+  };
+
+static void
+clicked (GtkWidget *w, GdkEventButton *ev)
+{
+  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gpe_popup_menu_position, w, ev->button, ev->time);
+}
+
+static void
+cancel_dock_message (guint id)
+{
+  gdk_threads_enter ();
+  gpe_system_tray_cancel_message (dock_window, id);
+  gdk_threads_leave ();
+}
+
+void
+schedule_message_delete (guint id, guint time)
+{
+  g_timeout_add (time, (GSourceFunc) cancel_dock_message, (gpointer)id);
+}
+
+gboolean 
+configure_event (GtkWidget *window, GdkEventConfigure *event, GdkBitmap *bitmap_)
+{
+  if (event->type == GDK_CONFIGURE)
+    set_image(event->width, event->height);
+	
+  return FALSE;
+}
+
+int
+main (int argc, char *argv[])
+{
+  GdkBitmap *bitmap;
+#ifdef REMOVE_FROM_PANEL
+  GtkWidget *menu_remove;
+#endif
+  GtkTooltips *tooltips;
+  int dd;
+  GSource *sigchld_source;
+  bdaddr_t interface;
+
+  g_thread_init (NULL);
+  gdk_threads_init ();
+
+  if (gpe_application_init (&argc, &argv) == FALSE)
+    exit (1);
+
+  setlocale (LC_ALL, "");
+
+  dd = hci_open_dev (0);
+  if (dd != -1)
+    {
+      radio_is_on = TRUE;
+      hci_close_dev (dd);
+    }
+
+  bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
+  bind_textdomain_codeset (PACKAGE, "UTF-8");
+  textdomain (PACKAGE);
+
+  gpe_bluetooth_init_dbus ();
+
+  window = gtk_plug_new (0);
+  gtk_widget_realize (window);
+
+  gtk_window_set_title (GTK_WINDOW (window), _("Bluetooth control"));
+
+  signal (SIGCHLD, sigchld_handler);
+  sigchld_source = g_source_new (&sigchld_source_funcs, sizeof (GSource));
+  g_source_attach (sigchld_source, NULL);
+
+  menu = gtk_menu_new ();
+  menu_radio_on = gtk_menu_item_new_with_label (_("Switch radio on"));
+  menu_radio_off = gtk_menu_item_new_with_label (_("Switch radio off"));
+  menu_devices = gtk_menu_item_new_with_label (_("Devices..."));
+
+  g_signal_connect (G_OBJECT (menu_radio_on), "activate", G_CALLBACK (radio_on_menu), NULL);
+  g_signal_connect (G_OBJECT (menu_radio_off), "activate", G_CALLBACK (radio_off_menu), NULL);
+  g_signal_connect (G_OBJECT (menu_devices), "activate", G_CALLBACK (show_devices), NULL);
+
+  if (! radio_is_on)
+    {
+      gtk_widget_set_sensitive (menu_devices, FALSE);
+      gtk_widget_show (menu_radio_on);
+    }
+
+  gtk_widget_show (menu_devices);
+
+  gtk_menu_append (GTK_MENU (menu), menu_radio_on);
+  gtk_menu_append (GTK_MENU (menu), menu_radio_off);
+  gtk_menu_append (GTK_MENU (menu), menu_devices);
+
+#ifdef REMOVE_FROM_PANEL  
+  menu_remove = gtk_menu_item_new_with_label (_("Remove from panel"));
+  g_signal_connect (G_OBJECT (menu_remove), "activate", G_CALLBACK (gtk_main_quit), NULL);
+  gtk_widget_show (menu_remove);
+  gtk_menu_append (GTK_MENU (menu), menu_remove);
+#endif
+
+  if (gpe_load_icons (my_icons) == FALSE)
+    exit (1);
+
+  icon = gtk_image_new_from_pixbuf (gpe_find_icon (radio_is_on ? "bt-on" : "bt-off"));
+  gtk_widget_show (icon);
+
+  gpe_set_window_icon (window, "bt-on");
+
+  tooltips = gtk_tooltips_new ();
+  gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), window, _("This is the Bluetooth control.\nTap here to turn the radio on and off, or to see a list of Bluetooth devices."), NULL);
+
+  g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (configure_event), bitmap);
+  g_signal_connect (G_OBJECT (window), "button-press-event", G_CALLBACK (clicked), NULL);
+  gtk_widget_add_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
+
+  gtk_container_add (GTK_CONTAINER (window), icon);
+
+  gtk_widget_show (window);
+
+  atexit (do_stop_radio);
+
+  sdp_session = sdp_connect (&interface, BDADDR_LOCAL, 0);
+
+  dun_init ();
+  lap_init ();
+  pan_init ();
+  headset_init ();
+  obex_init ();
+  obex_client_init ();
+
+  dock_window = window->window;
+  gpe_system_tray_dock (window->window);
+
+  gdk_threads_enter ();
+  gtk_main ();
+  gdk_threads_leave ();
+
+  exit (0);
+}
diff -pruN 0.56-3/.pc/rename-devices-list/pin-dbus.c 0.56-4/.pc/rename-devices-list/pin-dbus.c
--- 0.56-3/.pc/rename-devices-list/pin-dbus.c	1970-01-01 00:00:00.000000000 +0000
+++ 0.56-4/.pc/rename-devices-list/pin-dbus.c	2008-08-06 21:23:40.000000000 +0000
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2002, 2003, 2005 Philip Blundell <philb@gnu.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.
+ */
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <libintl.h>
+
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
+
+#include "pin-ui.h"
+#include "main.h"
+
+#define WRONG_ARGS_ERROR "org.bluez.Error.WrongArgs"
+
+#define _(x) gettext (x)
+
+extern GSList *devices;
+
+
+struct pin_request_context
+{
+  DBusConnection *connection;
+  DBusMessage *message;
+};
+
+extern void bluez_pin_request (struct pin_request_context *ctx, gboolean outgoing, const gchar *address, const gchar *name);
+
+static void
+bluez_pin_send_dbus_reply (DBusConnection *connection, DBusMessage *message, const char *pin)
+{
+#ifndef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+  DBusMessageIter iter;
+
+  dbus_message_append_iter_init (message, &iter);
+  if (pin)
+    dbus_message_iter_append_string (&iter, pin);
+#else
+  dbus_message_append_args(message,
+			DBUS_TYPE_STRING, &pin,
+			DBUS_TYPE_INVALID);
+#endif
+
+  dbus_connection_send (connection, message, NULL);
+
+  dbus_message_unref (message);
+}
+
+void
+dbus_pin_result (BluetoothPinRequest *req, gchar *result, void *user_data)
+{
+  struct pin_request_context *ctx = user_data;
+
+  bluez_pin_send_dbus_reply (ctx->connection, ctx->message, result);
+
+  g_free (ctx);
+
+  g_object_unref (req);
+}
+
+static const gchar *
+get_name (bdaddr_t addr)
+{
+  static gchar name[255];
+  struct bt_device *bd;
+  GSList *iter;
+  gboolean found = FALSE;
+
+  for (iter = devices; iter; iter = iter->next)
+    {
+      struct bt_device *d = (struct bt_device *)iter->data;
+      if (memcmp (&d->bdaddr, &addr, sizeof (addr)) == 0)
+        return d->name;
+    }
+  return name;
+}
+
+DBusHandlerResult
+bluez_pin_handle_dbus_request (DBusConnection *connection, DBusMessage *message)
+{
+  DBusMessageIter iter;
+  gboolean out;
+  bdaddr_t bdaddr, sbdaddr;
+  int type;
+  char *address;
+  DBusMessage *reply;
+  struct pin_request_context *ctx;
+  unsigned char *bytes;
+  int nbytes;
+  BluetoothPinRequest *req;
+
+  dbus_message_iter_init (message, &iter);
+ 
+  type = dbus_message_iter_get_arg_type (&iter);
+  if (type != DBUS_TYPE_BOOLEAN)
+  {
+    reply = dbus_message_new_error (message, WRONG_ARGS_ERROR,
+				    "Boolean expected, other type given");
+    goto error;
+  }
+
+#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+  dbus_message_iter_get_basic (&iter, &out);
+#else
+  out = dbus_message_iter_get_boolean (&iter);
+#endif
+
+  if (! dbus_message_iter_next (&iter))
+    {
+      reply = dbus_message_new_error (message, WRONG_ARGS_ERROR,
+				      "Byte array expected but missing");
+      goto error;
+    }
+
+  type = dbus_message_iter_get_arg_type (&iter);
+
+#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+  nbytes = 0;
+  if (type == DBUS_TYPE_ARRAY)
+    dbus_message_iter_get_fixed_array (&iter, &bytes, &nbytes);
+  if (nbytes != sizeof (bdaddr))
+#else
+  if (type != DBUS_TYPE_ARRAY
+      || ! dbus_message_iter_get_byte_array (&iter, &bytes, &nbytes)
+      || nbytes != sizeof (bdaddr))
+#endif
+  {
+    reply = dbus_message_new_error (message, WRONG_ARGS_ERROR,
+				    "Byte array expected, other type given");
+    goto error;
+  }
+
+  memcpy (&bdaddr, bytes, sizeof (bdaddr));
+
+  reply = dbus_message_new_method_return (message);
+  if (!reply)
+    return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+  ctx = g_malloc (sizeof (*ctx));
+  ctx->message = reply;
+  ctx->connection = connection;
+
+  baswap (&sbdaddr, &bdaddr);
+  address = batostr (&sbdaddr);
+
+  req = bluetooth_pin_request_new (out, address, get_name (sbdaddr));
+
+  g_signal_connect (G_OBJECT (req), "result", G_CALLBACK (dbus_pin_result), ctx);
+
+  return DBUS_HANDLER_RESULT_HANDLED;
+
+ error:
+  dbus_connection_send (connection, reply, NULL);
+
+  dbus_message_unref (reply);
+
+  return DBUS_HANDLER_RESULT_HANDLED;
+}
diff -pruN 0.56-3/pin-dbus.c 0.56-4/pin-dbus.c
--- 0.56-3/pin-dbus.c	2008-08-06 21:23:40.000000000 +0000
+++ 0.56-4/pin-dbus.c	2013-08-11 15:49:03.000000000 +0000
@@ -33,7 +33,7 @@
 
 #define _(x) gettext (x)
 
-extern GSList *devices;
+extern GSList *gb_devices;
 
 
 struct pin_request_context
@@ -84,7 +84,7 @@ get_name (bdaddr_t addr)
   GSList *iter;
   gboolean found = FALSE;
 
-  for (iter = devices; iter; iter = iter->next)
+  for (iter = gb_devices; iter; iter = iter->next)
     {
       struct bt_device *d = (struct bt_device *)iter->data;
       if (memcmp (&d->bdaddr, &addr, sizeof (addr)) == 0)
