rpms/bluez/devel bluetooth-check, NONE, 1.1 bluez, NONE, 1.1 bluetooth.conf, 1.2, 1.3 bluetooth.init, 1.3, 1.4 bluez.spec, 1.70, 1.71 97-bluetooth-ondemand.rules, 1.1, NONE

Bastien Nocera hadess at fedoraproject.org
Fri Jun 12 17:40:48 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/bluez/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9884

Modified Files:
	bluetooth.conf bluetooth.init bluez.spec 
Added Files:
	bluetooth-check bluez 
Removed Files:
	97-bluetooth-ondemand.rules 
Log Message:
* Thu Jun 11 2009 Bastien Nocera <bnocera at redhat.com> 4.41-2
- Switch to on-demand start/stop using udev


--- NEW FILE bluetooth-check ---
#!/bin/sh

# Run "initctl log-priority info" to get debug from
# upstart about events being processed, or pass
# --debug to your kernel arguments

emit_event()
{
	/sbin/initctl emit --no-wait $1
}

# If any of those paths are read-only, bail
if `mount | grep "on / type" | grep -q ro` ; then
	return 1;
fi

# If the action is add, we always have an adapter
if test "x$ACTION" = "xadd" ; then
	emit_event fedora.bluetooth-adapter-available
	exit 0
fi

# Check whether any devices are available
if `udevadm info --export-db | grep -q -e '/devices/.*/bluetooth/.*'` ; then
	emit_event fedora.bluetooth-adapter-available
else
	emit_event fedora.bluetooth-adapter-not-available
fi

exit 0


--- NEW FILE bluez ---
# Automatically start bluetoothd when an adapter is plugged in
#

start on fedora.bluetooth-adapter-available

stop on runlevel [016]
stop on fedora.bluetooth-adapter-not-available

exec /usr/sbin/bluetoothd --nodaemon



Index: bluetooth.conf
===================================================================
RCS file: /cvs/pkgs/rpms/bluez/devel/bluetooth.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- bluetooth.conf	6 May 2009 11:24:51 -0000	1.2
+++ bluetooth.conf	12 Jun 2009 17:40:17 -0000	1.3
@@ -4,7 +4,4 @@
 
 # Enable this to switch capable devices back to HID mode on Bluetooth shutdown
 #HID2HCI_UNDO=true
-#
-#Enable this to allow automatic start or stop when bluetooth
-#inserted or removed
-#BLUETOOTH_ONDEMAND=true
+


Index: bluetooth.init
===================================================================
RCS file: /cvs/pkgs/rpms/bluez/devel/bluetooth.init,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- bluetooth.init	6 May 2009 11:24:51 -0000	1.3
+++ bluetooth.init	12 Jun 2009 17:40:17 -0000	1.4
@@ -1,14 +1,11 @@
 #!/bin/sh
 #
 # chkconfig: 345 50 83
-# description: Bluetooth services for service discovery, authentication, \
-#	       Human Interface Devices, etc.
+# description: Turn HID adapters into Bluetooth ones
 #
 ### BEGIN INIT INFO
-# Required-Start: $syslog messagebus
-# Short-Description: Bluetooth services
-# Description: Bluetooth services for service discovery, authentication, 
-#  Human Interface Devices, etc.
+# Short-Description: Turn HID adapters into Bluetooth ones
+# Description: Turn HID adapters into Bluetooth ones
 ### END INIT INFO
 
 # Source function library.
@@ -16,54 +13,11 @@
 
 [ -e /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
 
-is_enabled_in_runlevel() 
-{
-	level=`runlevel | awk '{print $2;}'`
-
-	#check file in runlevel
-	[ -f /etc/rc$level.d/S??bluetooth ] 
-	return $?
-}
-
-has_bt_devices()
-{
-	#Look for Bluetooth adapters:
-	udevadm info --export-db | grep -q -e '/devices/.*/bluetooth/.*'
-
-	return $?
-}
-
-check_condstart()
-{
-	is_enabled_in_runlevel || return $?
-
-	/sbin/service bluetooth status && return 1
-
-	#Look for Bluetooth adapters:
-	has_bt_devices && return 0
-	return 1
-}
-
-condstart()
-{
-	if [ "$BLUETOOTH_ONDEMAND" = "true" ]; then
-		start
-		return $?
-	fi
-	return 1
-}
-
 start()
 {
-	if [ "$BLUETOOTH_ONDEMAND" = "true" ]; then
-		check_condstart || return 1
-	fi
-
-	echo -n $"Starting Bluetooth services:"
-	daemon /usr/sbin/bluetoothd
-	RETVAL=$?
-	[ $RETVAL = 0 ] && touch /var/lock/subsys/bluetoothd
+	echo -n $"Starting hid2hci:"
 	[ "$HID2HCI_ENABLE" = "true" ] && hid2hci --tohci > /dev/null 2>&1 || :
+	RETVAL=$?
 	touch /var/lock/subsys/bluetooth
 	echo ""
 	return $RETVAL
@@ -73,64 +27,23 @@ stop()
 {
 	echo -n "Stopping Bluetooth services:"
 	[ "$HID2HCI_UNDO" = "true" ] && hid2hci --tohid > /dev/null 2>&1 || :
-	killproc bluetoothd
 	RETVAL=$?
-	rm -f /var/lock/subsys/bluetooth
-	rm -f /var/lock/subsys/bluetoothd
 	echo ""
 	return $RETVAL
 }
 
-check_condstop()
-{
-	is_enabled_in_runlevel || return $?
-
-	/sbin/service bluetooth status || return $?
-
-	#Look for Bluetooth adapters:
-	has_bt_devices && return 1
-	return 0
-}
-
-condstop()
-{
-	if [ "$BLUETOOTH_ONDEMAND" = "true" ]; then
-		check_condstop || return 1
-	else
-		return 2
-	fi
-
-	stop
-	return $?
-}
-
-
 case "$1" in
   start)
 	start
 	;;
-  condstart)
-	condstart
-	;;
   stop)
 	stop
 	;;
-  condstop)
-	condstop
-	;;
-  force-reload|restart|reload)
-	stop
-	start
-	;;
-  try-restart|condrestart)
-	[ -e /var/lock/subsys/bluetooth ] && (stop; start)
-	;;
   status)
-	status bluetoothd
-	RETVAL=$?
+	RETVAL=0
 	;;
   *)
-	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|condstart|condstop}"
+	echo $"Usage: $0 {start|stop|status}"
 	exit 3
 	;;
 esac


Index: bluez.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bluez/devel/bluez.spec,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -p -r1.70 -r1.71
--- bluez.spec	9 Jun 2009 00:45:22 -0000	1.70
+++ bluez.spec	12 Jun 2009 17:40:17 -0000	1.71
@@ -1,7 +1,7 @@
 Summary: Bluetooth utilities
 Name: bluez
 Version: 4.41
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 Group: Applications/System
 Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
@@ -13,7 +13,8 @@ Source5: pand.init
 Source6: pand.conf
 Source7: rfcomm.init
 Source8: bluez-uinput.modules
-Source9: 97-bluetooth-ondemand.rules
+Source9: 96-bluez.rules
+
 Patch1: bluez-utils-oui-usage.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=450081
 # http://thread.gmane.org/gmane.linux.bluez.kernel/1687
@@ -24,6 +25,8 @@ Patch3: bluez-activate-wacom-mode2.patch
 Patch4: bluez-socket-mobile-cf-connection-kit.patch
 # http://thread.gmane.org/gmane.linux.bluez.kernel/2396
 Patch5: 0001-Add-sixaxis-cable-pairing-plugin.patch
+# http://thread.gmane.org/gmane.linux.bluez.kernel/2474
+Patch6: 0001-Add-udev-mode-to-bluetoothd.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 URL: http://www.bluez.org/
@@ -129,6 +132,7 @@ This includes hidd, dund and pand.
 %patch3 -p1 -b .wacom
 %patch4 -p1 -b .socket-mobile
 %patch5 -p1 -b .cable-pairing
+%patch6 -p1 -b .udev
 
 %build
 libtoolize -f -c
@@ -161,8 +165,8 @@ fi
 
 rm -f ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/*.rules
 install -D -m0644 scripts/bluetooth-serial.rules ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/rules.d/97-bluetooth-serial.rules
-install -D -m0644 %{SOURCE9} ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/rules.d/97-bluetooth-ondemand.rules
 install -D -m0755 scripts/bluetooth_serial ${RPM_BUILD_ROOT}/lib/udev/bluetooth_serial
+install -D -m0644 %{SOURCE9} ${RPM_BUILD_ROOT}/lib/udev/rules.d/96-bluez.rules
 
 install -D -m0755 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/modules/bluez-uinput.modules
 
@@ -227,8 +231,8 @@ fi
 %config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf
 %{_libdir}/bluetooth/
 /lib/udev/bluetooth_serial
+/lib/udev/rules.d/96-bluez.rules
 %{_sysconfdir}/udev/rules.d/97-bluetooth-serial.rules
-%{_sysconfdir}/udev/rules.d/97-bluetooth-ondemand.rules
 %{_sysconfdir}/rc.d/init.d/bluetooth
 %{_localstatedir}/lib/bluetooth
 
@@ -269,6 +273,9 @@ fi
 %config(noreplace) %{_sysconfdir}/sysconfig/pand
 
 %changelog
+* Thu Jun 11 2009 Bastien Nocera <bnocera at redhat.com> 4.41-2
+- Switch to on-demand start/stop using udev
+
 * Mon Jun 08 2009 Bastien Nocera <bnocera at redhat.com> 4.41-1
 - Update to 4.41
 


--- 97-bluetooth-ondemand.rules DELETED ---




More information about the fedora-extras-commits mailing list