Re: Heads up: bluetoothd on-demand startup

2009-06-20 Thread Rahul Sundaram
On 06/13/2009 12:43 AM, Bastien Nocera wrote:
 On Fri, 2009-06-12 at 23:59 +0530, Rahul Sundaram wrote:
 On 06/12/2009 11:35 PM, Bastien Nocera wrote:
 Heya,

 I've added a patch to bluetoothd in F-12 to support being started via
 udev, on-demand. bluetoothd will now only start up when you have a
 Bluetooth adapter plugged, and will exit 30 seconds after the last one
 went away.

 Can you add these details to

 https://fedoraproject.org/wiki/Fedora_12_Beta_release_notes
 
 Will do.

Are you still planning on doing this? Do you need help?

Rahul

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Kyle McMartin
On Fri, Jun 12, 2009 at 07:05:39PM +0100, Bastien Nocera wrote:
 I've added a patch to bluetoothd in F-12 to support being started via
 udev, on-demand. bluetoothd will now only start up when you have a
 Bluetooth adapter plugged, and will exit 30 seconds after the last one
 went away.
 
 The only purpose of the bluetooth initscript is now to switch HID proxy
 adapters into Bluetooth mode (on Macs, and some Logitech and Dell
 keyboard/mouse combos). That'll probably go away as well, and into udev.
 
 File bugs against bluez if you encounter any problems with bluetoothd
 being in the wrong state (ie. started with no Bluetooth hardware, and
 not running when you have Bluetooth hardware).
 

I've been hoping to find some time to do a big review of system startup
for F-12, but haven't as yet found the time...

How does this actually work? At what stage of boot does udev attempt to
start bluetoothd?

One of my ideas(I guess?) for F-12 is to filter modules loaded at boot
by udev, and defer things that aren't needed for startup until either
idle, or they are needed. (Why do we need sound modules loaded before we
mount root rw? :) I've got a couple hacks from LPC last year I need to
polish and submit for cups to make it somewhat more sensible...

Pardon my curiosity, this is a big step towards better boot up. Thanks
for doing this!

cheers, Kyle

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread drago01
On Fri, Jun 12, 2009 at 8:11 PM, Kyle McMartink...@mcmartin.ca wrote:
 On Fri, Jun 12, 2009 at 07:05:39PM +0100, Bastien Nocera wrote:
 I've added a patch to bluetoothd in F-12 to support being started via
 udev, on-demand. bluetoothd will now only start up when you have a
 Bluetooth adapter plugged, and will exit 30 seconds after the last one
 went away.

 The only purpose of the bluetooth initscript is now to switch HID proxy
 adapters into Bluetooth mode (on Macs, and some Logitech and Dell
 keyboard/mouse combos). That'll probably go away as well, and into udev.

 File bugs against bluez if you encounter any problems with bluetoothd
 being in the wrong state (ie. started with no Bluetooth hardware, and
 not running when you have Bluetooth hardware).


 I've been hoping to find some time to do a big review of system startup
 for F-12, but haven't as yet found the time...

 How does this actually work? At what stage of boot does udev attempt to
 start bluetoothd?

 One of my ideas(I guess?) for F-12 is to filter modules loaded at boot
 by udev, and defer things that aren't needed for startup until either
 idle, or they are needed. (Why do we need sound modules loaded before we
 mount root rw? :) I've got a couple hacks from LPC last year I need to
 polish and submit for cups to make it somewhat more sensible...

 Pardon my curiosity, this is a big step towards better boot up. Thanks
 for doing this!

 cheers, Kyle

https://bugzilla.redhat.com/show_bug.cgi?id=484345

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Bastien Nocera
On Fri, 2009-06-12 at 20:20 +0200, drago01 wrote:
 On Fri, Jun 12, 2009 at 8:11 PM, Kyle McMartink...@mcmartin.ca wrote:
  On Fri, Jun 12, 2009 at 07:05:39PM +0100, Bastien Nocera wrote:
  I've added a patch to bluetoothd in F-12 to support being started via
  udev, on-demand. bluetoothd will now only start up when you have a
  Bluetooth adapter plugged, and will exit 30 seconds after the last one
  went away.
 
  The only purpose of the bluetooth initscript is now to switch HID proxy
  adapters into Bluetooth mode (on Macs, and some Logitech and Dell
  keyboard/mouse combos). That'll probably go away as well, and into udev.
 
  File bugs against bluez if you encounter any problems with bluetoothd
  being in the wrong state (ie. started with no Bluetooth hardware, and
  not running when you have Bluetooth hardware).
 
 
  I've been hoping to find some time to do a big review of system startup
  for F-12, but haven't as yet found the time...
 
  How does this actually work? At what stage of boot does udev attempt to
  start bluetoothd?
 
  One of my ideas(I guess?) for F-12 is to filter modules loaded at boot
  by udev, and defer things that aren't needed for startup until either
  idle, or they are needed. (Why do we need sound modules loaded before we
  mount root rw? :) I've got a couple hacks from LPC last year I need to
  polish and submit for cups to make it somewhat more sensible...
 
  Pardon my curiosity, this is a big step towards better boot up. Thanks
  for doing this!
 
  cheers, Kyle
 
 https://bugzilla.redhat.com/show_bug.cgi?id=484345

Nope, that was the code that was in F-12 up until now, which I removed,
and replace with a better way. There's no initscripts needed anymore.

Cheers

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread drago01
On Fri, Jun 12, 2009 at 8:27 PM, Bastien Nocerabnoc...@redhat.com wrote:
 On Fri, 2009-06-12 at 20:20 +0200, drago01 wrote:
 On Fri, Jun 12, 2009 at 8:11 PM, Kyle McMartink...@mcmartin.ca wrote:
  On Fri, Jun 12, 2009 at 07:05:39PM +0100, Bastien Nocera wrote:
  I've added a patch to bluetoothd in F-12 to support being started via
  udev, on-demand. bluetoothd will now only start up when you have a
  Bluetooth adapter plugged, and will exit 30 seconds after the last one
  went away.
 
  The only purpose of the bluetooth initscript is now to switch HID proxy
  adapters into Bluetooth mode (on Macs, and some Logitech and Dell
  keyboard/mouse combos). That'll probably go away as well, and into udev.
 
  File bugs against bluez if you encounter any problems with bluetoothd
  being in the wrong state (ie. started with no Bluetooth hardware, and
  not running when you have Bluetooth hardware).
 
 
  I've been hoping to find some time to do a big review of system startup
  for F-12, but haven't as yet found the time...
 
  How does this actually work? At what stage of boot does udev attempt to
  start bluetoothd?
 
  One of my ideas(I guess?) for F-12 is to filter modules loaded at boot
  by udev, and defer things that aren't needed for startup until either
  idle, or they are needed. (Why do we need sound modules loaded before we
  mount root rw? :) I've got a couple hacks from LPC last year I need to
  polish and submit for cups to make it somewhat more sensible...
 
  Pardon my curiosity, this is a big step towards better boot up. Thanks
  for doing this!
 
  cheers, Kyle

 https://bugzilla.redhat.com/show_bug.cgi?id=484345

 Nope, that was the code that was in F-12 up until now, which I removed,
 and replace with a better way. There's no initscripts needed anymore.

Oh, nice.

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Rahul Sundaram
On 06/12/2009 11:35 PM, Bastien Nocera wrote:
 Heya,
 
 I've added a patch to bluetoothd in F-12 to support being started via
 udev, on-demand. bluetoothd will now only start up when you have a
 Bluetooth adapter plugged, and will exit 30 seconds after the last one
 went away.

Can you add these details to

https://fedoraproject.org/wiki/Fedora_12_Beta_release_notes

Rahul

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Lennart Poettering
On Fri, 12.06.09 19:26, Bastien Nocera (bnoc...@redhat.com) wrote:

 Every time there's an add action for a Bluetooth device, udev will run
 bluetoothd --udev.
 
 bluetoothd will fail with an error if D-Bus isn't started (on bootup),
 and the udev coldplug (done in udev-post) will run the rule again.
 
 bluetoothd will silently fail when it's already running.
 
 bluetoothd will exit itself after 30 seconds when no adapters are
 present. There's a potential race if the udev add event happens in
 between the time the time the running bluetoothd reliquinshes its D-Bus
 service, and the new one starts up.

This could be fixed by first releasing the service name synchronously,
then processing all queued requests and only then closing/exiting.

Hmm, will bluetoothd also be started via bus activation? If so, it
wuld probably make sense to issue a StartByName D-Bus request from the
udev rule and let dbus handle all the ordering/synchronization issues
with starting up bluetoothd.

I know at least one application (PA) that wouldn't reconnect to coming
and going bluetoothd's, that's why I am asking.

Lennart

-- 
Lennart PoetteringRed Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/   GnuPG 0x1A015CC4

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Bastien Nocera
On Fri, 2009-06-12 at 14:39 -0400, Colin Walters wrote:
 On Fri, Jun 12, 2009 at 2:26 PM, Bastien Nocerabnoc...@redhat.com wrote:
 
  bluetoothd will exit itself after 30 seconds when no adapters are
  present. There's a potential race if the udev add event happens in
  between the time the time the running bluetoothd reliquinshes its D-Bus
  service, and the new one starts up.
 
 We should support this I think.  I've added a bug here:
 
 https://bugs.freedesktop.org/show_bug.cgi?id=22258

We don't use D-Bus for that in-flight message.

The message is in-flight between the kernel and bluetoothd via netlink.

   1. running bluetoothd   2. adapter insertion

- last bt adapter gets removed
- timeout kicks in
   30 sec...
- we start processing shutdown
   - udev gets event from the kernel
   - udev rule is processed
   - bluetoothd is run with --udev
   - bluetoothd exits because the
 service is already running
- relinquish the D-Bus service
- bluetoothd exits

Something like that.

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: Heads up: bluetoothd on-demand startup

2009-06-12 Thread Lennart Poettering
On Fri, 12.06.09 20:10, Bastien Nocera (bnoc...@redhat.com) wrote:

  This could be fixed by first releasing the service name synchronously,
  then processing all queued requests and only then closing/exiting.
  
  Hmm, will bluetoothd also be started via bus activation? If so, it
  wuld probably make sense to issue a StartByName D-Bus request from the
  udev rule and let dbus handle all the ordering/synchronization issues
  with starting up bluetoothd.
 
 No, there's no service activation support. Would it be useful?

I think it would. Seems to me as if some of the BT functionality
(org.bluez.Manager, ...) might be useful even without having hw
plugged in.

Lennart

-- 
Lennart PoetteringRed Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/   GnuPG 0x1A015CC4

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list