Re: [PATCH] Add udev rules to start bluetooth on-demand

Bastien Nocera
2009-06-21T14:05:52Z

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

On Sun, 2009-06-21 at 15:50 +0200, Marcel Holtmann wrote:
> Hi Bastien,
>
> > As discussed in previous mails.
>
> please name it bluetooth.rules. The daemon is also called bluetoothd and
> not bluezd.
>
> Also you need to have the EXTRA_DIST part in it since _DATA doesn't get
> added to the distribution automatically. For all this changes, you have
> to check with make distcheck.

Fixed version attached

[-- Attachment #2: 0001-Add-udev-rules-to-start-bluetooth-on-demand.patch --]
[-- Type: text/x-patch, Size: 1381 bytes --]

>From f723fb9f588a987bfaba94cfb2c1acb6c89c926c Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sun, 21 Jun 2009 14:37:32 +0100
Subject: [PATCH] Add udev rules to start bluetooth on-demand

Those rules call bluetoothd --udev when a new dongle is inserted.
---
scripts/Makefile.am | 4 +++-
scripts/bluetooth.rules | 5 +++++
2 files changed, 8 insertions(+), 1 deletions(-)
create mode 100644 scripts/bluetooth.rules

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 494a9c2..d06f95e 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -11,6 +11,8 @@ endif
if PCMCIARULES
rules_DATA += bluetooth-serial.rules
endif
+
+rules_DATA += bluetooth.rules
endif

if PCMCIARULES
@@ -20,7 +22,7 @@ udev_SCRIPTS = bluetooth_serial
endif

EXTRA_DIST = bluetooth.init bluetooth.default bluetooth-hid2hci.rules \
- bluetooth-serial.rules bluetooth_serial
+ bluetooth-serial.rules bluetooth_serial bluetooth.rules

MAINTAINERCLEANFILES = Makefile.in

diff --git a/scripts/bluetooth.rules b/scripts/bluetooth.rules
new file mode 100644
index 0000000..f3034b5
--- /dev/null
+++ b/scripts/bluetooth.rules
@@ -0,0 +1,5 @@
+# Run helper every time a Bluetooth device appears
+# On remove actions, bluetoothd should go away by itself
+
+ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="/usr/sbin/bluetoothd --udev"
+
--
1.6.2.2