public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Seyfried <seife@suse.de>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Should hcid wait for dbus daemon?
Date: Fri, 12 Jan 2007 16:25:10 +0100	[thread overview]
Message-ID: <20070112152510.GB18535@suse.de> (raw)
In-Reply-To: <200701090041.54299.dgollub@suse.de>

Ping! :-)

Any opinions on that approach? This fixes the hotplug issue for our users,
but i want to stay as close to upstream as possible :-)

On Tue, Jan 09, 2007 at 12:41:53AM +0100, Daniel Gollub wrote:
> On Monday 08 January 2007 19:47, Johan Hedberg wrote:
> > Sounds like a useful feature. It should be quite simple to implement too
> > since most of the required code already exists due to the dbus restart
> > detection support. Feel free to provide a patch for it :)
> How often should the daemons try to connect? Or infinitely?
> If not infinitely, then configurable by command line parameter or fixed?
> =

> Attachted is a _simple_ proof of concept patch which . It retries every 5 =

> seconds. After #12 unsuccessfully dbus connect, it gives up and abort (as =

> before).
> =

> Daniel

> Index: common/dbus.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/bluez/utils/common/dbus.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 dbus.c
> --- common/dbus.c	13 Nov 2006 07:58:40 -0000	1.2
> +++ common/dbus.c	8 Jan 2007 22:52:18 -0000
> @@ -39,6 +39,7 @@
>  #include "list.h"
>  =

>  #define DISPATCH_TIMEOUT	0
> +#define MAX_DBUS_RETRY		12
>  =

>  static int name_listener_initialized =3D 0;
>  =

> @@ -485,13 +486,27 @@ static void dispatch_status_cb(DBusConne
>  =

>  DBusConnection *init_dbus(const char *name, void (*disconnect_cb)(void *=
), void *user_data)
>  {
> +	int retry =3D 0;
>  	struct disconnect_data *dc_data;
>  	DBusConnection *conn;
>  	DBusError err;
>  =

>  	dbus_error_init(&err);
>  =

> -	conn =3D dbus_bus_get(DBUS_BUS_SYSTEM, &err);
> +	do {
> +		if (dbus_error_is_set(&err))
> +			dbus_error_free(&err);
> +
> +		conn =3D dbus_bus_get(DBUS_BUS_SYSTEM, &err);
> +		if (conn)
> +			break;
> +
> +		if (!retry)
> +			info("Can't connect to DBUS. Will retry %i times.", MAX_DBUS_RETRY);
> +
> +		usleep(5000000);

here, a
		sleep(5);
might be easier to read :-)

> +		retry++;
> +	} while (!conn && retry < MAX_DBUS_RETRY);
>  =

>  	if (dbus_error_is_set(&err)) {
>  		error("Can't connect to system message bus: %s", err.message);
-- =

Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, N=FCrnberg  | "Well, surrounding them's out." =


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-01-12 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-08 17:37 [Bluez-devel] Should hcid wait for dbus daemon? Daniel Gollub
2007-01-08 18:47 ` Johan Hedberg
2007-01-08 23:31   ` Luca Capello
2007-01-09  0:01     ` Daniel Gollub
2007-01-09  8:27     ` Stefan Seyfried
2007-01-08 23:41   ` Daniel Gollub
2007-01-12 15:25     ` Stefan Seyfried [this message]
2007-01-13 17:39 ` Andrey Rahmatullin
2007-01-15 13:30 ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070112152510.GB18535@suse.de \
    --to=seife@suse.de \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox