linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Mikel Astiz <mikel.astiz.oss@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: Re: [RFC v2] Bluetooth: mgmt: Add device disconnect reason
Date: Mon, 30 Jul 2012 14:00:50 +0300	[thread overview]
Message-ID: <20120730110050.GA13789@x220.ger.corp.intel.com> (raw)
In-Reply-To: <1342790298-12193-1-git-send-email-mikel.astiz.oss@gmail.com>

Hi Mikel,

On Fri, Jul 20, 2012, Mikel Astiz wrote:
> During the BlueZ meeting in Brazil it was proposed to add two more
> values to this enum: "Connection terminated by local host" and
> "Connection terminated by remote host". However, after some testing,
> it seems the result can be quite misleading. Therefore and given that
> there are no known use-cases that need this information (local vs
> remote disconnection), these two values have been dropped.

I still think that it wouldn't hurt to include which side triggers the
HCI_Disconnect() command. We can always document that this identifies
accurately the ACL disconnection initiator but not necessarily the
higher-level profile(s) disconnection initiator.

>  	if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags) &&
>  	    (conn->type == ACL_LINK || conn->type == LE_LINK)) {
> -		if (ev->status != 0)
> +		if (ev->status != 0) {
>  			mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
>  					       conn->dst_type, ev->status);
> -		else
> +		} else {
> +			u8 reason = 0x00;
> +
> +			if (ev->reason == HCI_ERROR_CONNECTION_TIMEOUT)
> +				reason = 0x01;
> +
>  			mgmt_device_disconnected(hdev, &conn->dst, conn->type,
> -						 conn->dst_type);
> +						 conn->dst_type, reason);
> +		}
>  	}

Instead of using hard-coded 0x00 and 0x01 wouldn't it be better to have
proper MGMT_* defines for these?

Johan

  reply	other threads:[~2012-07-30 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 13:18 [RFC v2] Bluetooth: mgmt: Add device disconnect reason Mikel Astiz
2012-07-30 11:00 ` Johan Hedberg [this message]
2012-08-08  7:41   ` Mikel Astiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120730110050.GA13789@x220.ger.corp.intel.com \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz.oss@gmail.com \
    --cc=mikel.astiz@bmw-carit.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).