service bluetooth start ubt0 fails every other time

Dirk Engling erdgeist at erdgeist.org
Mon Sep 21 00:40:28 UTC 2015


On 21.09.15 01:30, Dirk Engling wrote:

> Maybe the rc script should check if the stack is already set up and exit
> with a more verbose error and then not shut down the interface?

I think the attached patch does what is needed. Looking forward to your
comments.

  erdgeist
-------------- next part --------------
--- /etc/rc.d/bluetooth	2015-08-12 16:21:53.000000000 +0200
+++ bluetooth	2015-09-21 02:29:52.113993498 +0200
@@ -95,6 +95,10 @@
 	hook=$1
 	shift
 
+	# Check if stack is already set up for device
+	ngctl status ${dev}hci: 2> /dev/null > /dev/null &&
+		err 0 "Stack already set up for ${dev}" && return 0
+
 	# Setup HCI
 	ngctl mkpeer ${dev}: hci ${hook} drv \
 		> /dev/null 2>&1 || return 1


More information about the freebsd-bluetooth mailing list