public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: Stefan Seyfried <seife@suse.de>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Add on demand functionality to bluetooth init script
Date: Mon, 08 Jun 2009 14:17:06 +0200	[thread overview]
Message-ID: <4A2D0142.8070100@redhat.com> (raw)
In-Reply-To: <4A2CFD04.7020606@suse.de>

On 06/08/2009 01:59 PM, Stefan Seyfried wrote:
> Petr Lautrbach wrote:
>
>> but there is running boot (changing runlevel) process, so sometime after starting dbus is started
>> bluetooth again, this time successfully
>
> Triggered by what? A init script that is always enabled? Is it checking if
> there is an adapter present? If not, it's unconditionally always starting
> bluetoothd (and thus the ondemand functionality is not strictly needed ;)
>

triggered by this code:

+has_bt_devices()
+{
+	#Look for Bluetooth adapters:
+	udevadm info --export-db | grep -q -e '/devices/.*/bluetooth/.*'
+
+	return $?
+}
+
  case "$1" in
    start)
  	echo -n "Starting $DESC:"
  	if $DAEMON_ENABLE && [ -x "$DAEMON_EXEC" ]; then
-		$DAEMON_EXEC
-		echo -n " $DAEMON_NAME"
+		if [ -z $DAEMON_ONDEMAND ] || has_bt_devices; then
+			$DAEMON_EXEC
+			echo -n " $DAEMON_NAME"
+		fi


It starts if $DAEMON_ONDEMAND is not set or if there are some bluetooth adapters.
In case that $DAEMON_ONDEMAND is set and has_bt_devices() has returned non-zero, it won't start.

Petr
-- 
Petr Lautrbach, Red Hat, Inc.

  reply	other threads:[~2009-06-08 12:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 14:52 [PATCH] Add on demand functionality to bluetooth init script Petr Lautrbach
2009-06-05 14:51 ` Stefan Seyfried
2009-06-08 11:31   ` Petr Lautrbach
2009-06-08 11:59     ` Stefan Seyfried
2009-06-08 12:17       ` Petr Lautrbach [this message]
2009-06-05 15:38 ` Johan Hedberg
2009-06-05 15:48   ` Marcel Holtmann
2009-06-05 16:42     ` Stefan Seyfried
2009-06-05 16:53       ` Stefan Seyfried

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=4A2D0142.8070100@redhat.com \
    --to=plautrba@redhat.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=seife@suse.de \
    /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