From owner-freebsd-bluetooth@freebsd.org Mon Sep 21 00:40:28 2015 Return-Path: Delivered-To: freebsd-bluetooth@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB12BA061CB for ; Mon, 21 Sep 2015 00:40:28 +0000 (UTC) (envelope-from erdgeist@erdgeist.org) Received: from elektropost.org (elektropost.org [217.115.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F156E1D3E for ; Mon, 21 Sep 2015 00:40:27 +0000 (UTC) (envelope-from erdgeist@erdgeist.org) Received: (qmail 91727 invoked from network); 21 Sep 2015 00:40:23 -0000 Received: from elektropost.org (HELO elektropost.org) (erdgeist@erdgeist.org) by elektropost.org with ESMTPS (DHE-RSA-AES128-SHA encrypted); 21 Sep 2015 00:40:23 -0000 Subject: Re: service bluetooth start ubt0 fails every other time To: freebsd-bluetooth@freebsd.org References: <55FF418D.10806@erdgeist.org> From: Dirk Engling Message-ID: <55FF51F7.8030404@erdgeist.org> Date: Mon, 21 Sep 2015 02:40:23 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55FF418D.10806@erdgeist.org> Content-Type: multipart/mixed; boundary="------------030805040205080708010907" X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2015 00:40:28 -0000 This is a multi-part message in MIME format. --------------030805040205080708010907 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 --------------030805040205080708010907 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="rc.d-bluetooth.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rc.d-bluetooth.patch" --- /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 --------------030805040205080708010907--