OSDN Git Service

Use a udev rule to start bluetoothd on demand
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 30 Jun 2009 14:30:16 +0000 (07:30 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 30 Jun 2009 14:30:16 +0000 (07:30 -0700)
acinclude.m4
bootstrap-configure
scripts/Makefile.am
scripts/bluetooth.rules [new file with mode: 0644]

index e8626ff..9cbcfd2 100644 (file)
@@ -196,12 +196,12 @@ AC_DEFUN([AC_ARG_BLUEZ], [
        cups_enable=no
        test_enable=no
        bccmd_enable=no
+       pcmcia_enable=no
        hid2hci_enable=no
        dfutool_enable=no
        manpages_enable=yes
+       udevrules_enable=yes
        configfiles_enable=yes
-       initscripts_enable=no
-       pcmciarules_enable=no
        telephony_driver=dummy
 
        AC_ARG_ENABLE(fortify, AC_HELP_STRING([--disable-fortify], [disable compile time buffer checks]), [
@@ -256,6 +256,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
                bccmd_enable=${enableval}
        ])
 
+       AC_ARG_ENABLE(pcmcia, AC_HELP_STRING([--enable-pcmcia], [install PCMCIA script and udev rules]), [
+               pcmcia_enable=${enableval}
+       ])
+
        AC_ARG_ENABLE(hid2hci, AC_HELP_STRING([--enable-hid2hci], [install HID mode switching utility]), [
                hid2hci_enable=${enableval}
        ])
@@ -288,16 +292,12 @@ AC_DEFUN([AC_ARG_BLUEZ], [
                manpages_enable=${enableval}
        ])
 
-       AC_ARG_ENABLE(configfiles, AC_HELP_STRING([--enable-configfiles], [install Bluetooth config files]), [
-               configfiles_enable=${enableval}
-       ])
-
-       AC_ARG_ENABLE(initscripts, AC_HELP_STRING([--enable-initscripts], [install Bluetooth boot scripts]), [
-               initscripts_enable=${enableval}
+       AC_ARG_ENABLE(udevrules, AC_HELP_STRING([--enable-udevrules], [install Bluetooth on-demand udev rules]), [
+               udevrules_enable=${enableval}
        ])
 
-       AC_ARG_ENABLE(pcmciarules, AC_HELP_STRING([--enable-pcmciarules], [install PCMCIA udev rules]), [
-               pcmciarules_enable=${enableval}
+       AC_ARG_ENABLE(configfiles, AC_HELP_STRING([--enable-configfiles], [install Bluetooth configuration files]), [
+               configfiles_enable=${enableval}
        ])
 
        AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable compiling with debugging information]), [
@@ -354,10 +354,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
        AM_CONDITIONAL(TEST, test "${test_enable}" = "yes")
        AM_CONDITIONAL(TOOLS, test "${tools_enable}" = "yes")
        AM_CONDITIONAL(BCCMD, test "${bccmd_enable}" = "yes")
+       AM_CONDITIONAL(PCMCIA, test "${pcmcia_enable}" = "yes")
        AM_CONDITIONAL(HID2HCI, test "${hid2hci_enable}" = "yes" && test "${usb_found}" = "yes")
        AM_CONDITIONAL(DFUTOOL, test "${dfutool_enable}" = "yes" && test "${usb_found}" = "yes")
        AM_CONDITIONAL(MANPAGES, test "${manpages_enable}" = "yes")
+       AM_CONDITIONAL(UDEVRULES, test "${udevrules_enable}" = "yes")
        AM_CONDITIONAL(CONFIGFILES, test "${configfiles_enable}" = "yes")
-       AM_CONDITIONAL(INITSCRIPTS, test "${initscripts_enable}" = "yes")
-       AM_CONDITIONAL(PCMCIARULES, test "${pcmciarules_enable}" = "yes")
 ])
index 5ec8e4c..15b3ba7 100755 (executable)
@@ -26,7 +26,7 @@ fi
                --enable-dund \
                --enable-test \
                --enable-cups \
+               --disable-pcmcia \
                --disable-manpages \
-               --disable-configfiles \
-               --disable-initscripts \
-               --disable-pcmciarules $*
+               --disable-udevrules \
+               --disable-configfiles $*
index 494a9c2..df950f8 100644 (file)
@@ -8,30 +8,22 @@ if HID2HCI
 rules_DATA += bluetooth-hid2hci.rules
 endif
 
-if PCMCIARULES
+if PCMCIA
 rules_DATA += bluetooth-serial.rules
 endif
+
+if UDEVRULES
+rules_DATA += bluetooth.rules
+endif
 endif
 
-if PCMCIARULES
+if PCMCIA
 udevdir = $(libexecdir)/udev
 
 udev_SCRIPTS = bluetooth_serial
 endif
 
-EXTRA_DIST = bluetooth.init bluetooth.default bluetooth-hid2hci.rules \
-                               bluetooth-serial.rules bluetooth_serial
+EXTRA_DIST = bluetooth.init bluetooth.default bluetooth.rules \
+       bluetooth-hid2hci.rules bluetooth-serial.rules bluetooth_serial
 
 MAINTAINERCLEANFILES = Makefile.in
-
-if INITSCRIPTS
-install-data-local:
-       $(INSTALL) -D -m 755 $(srcdir)/bluetooth.init $(DESTDIR)$(sysconfdir)/init.d/bluetooth
-       $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/default
-       [ -f $(DESTDIR)$(sysconfdir)/default/bluetooth ] || \
-               $(INSTALL_DATA) $(srcdir)/bluetooth.default $(DESTDIR)$(sysconfdir)/default/bluetooth
-
-uninstall-local:
-       @rm -f $(DESTDIR)$(sysconfdir)/init.d/bluetooth
-       @rm -f $(DESTDIR)$(sysconfdir)/default/bluetooth
-endif
diff --git a/scripts/bluetooth.rules b/scripts/bluetooth.rules
new file mode 100644 (file)
index 0000000..2a83605
--- /dev/null
@@ -0,0 +1,3 @@
+# 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"