Re: [RFC v2] Bluetooth: mgmt: Add device disconnect reason

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux