Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v3 5/5] Bluetooth: Fallback transparent SCO from T2 to T1
Date: Tue, 19 Feb 2013 00:22:01 +0100	[thread overview]
Message-ID: <1361229721.1583.53.camel@aeonflux> (raw)
In-Reply-To: <1359986188-24432-5-git-send-email-frederic.dalleau@linux.intel.com>

Hi Fred,

> When initiating a transparent eSCO connection, make use of T2 settings at
> first try. T2 is the recommended settings from HFP 1.6 WideBand Speech. Upon
> connection failure, try T1 settings.
> To know which of T2 or T1 should be used, the connection attempt index is used.
> T2 failure is detected if Synchronous Connection Complete Event fails with
> error 0x0d. This error code has been found experimentally by sending a T2
> request to a T1 only SCO listener. It means "Connection Rejected due to
> Limited resource".
> 
> Signed-off-by: Frédéric Dalleau <frederic.dalleau@linux.intel.com>
> ---
>  net/bluetooth/hci_conn.c  |   11 ++++++++++-
>  net/bluetooth/hci_event.c |    1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 504367e..a3f4e29 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -179,12 +179,21 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle)
>  	cp.tx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
>  	cp.rx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
>  
> -	if (test_and_clear_bit(HCI_CONN_SCO_TRANSPARENT, &conn->flags)) {
> +	if (conn->attempt == 1 &&
> +	    test_bit(HCI_CONN_SCO_TRANSPARENT, &conn->flags)) {
>  		cp.pkt_type       = __constant_cpu_to_le16(EDR_ESCO_MASK &
>  							   ~ESCO_2EV3);
>  		cp.max_latency    = __constant_cpu_to_le16(0x000d);
>  		cp.voice_setting  = __constant_cpu_to_le16(0x0003);
>  		cp.retrans_effort = 0x02;
> +	} else if (conn->attempt == 2 &&
> +		   test_bit(HCI_CONN_SCO_TRANSPARENT, &conn->flags)) {

I do not really like abusing a simple counter as a state machine. We
should do something more explicit with tracking if T2 vs T1 sco_flags or
something.

> +		cp.pkt_type       = __constant_cpu_to_le16(EDR_ESCO_MASK |
> +							   ESCO_EV3);
> +		cp.max_latency    = __constant_cpu_to_le16(0x0007);
> +		cp.voice_setting  = __constant_cpu_to_le16(0x0003);
> +		cp.retrans_effort = 0x02;
> +		clear_bit(HCI_CONN_SCO_TRANSPARENT, &conn->flags);

If we clear this here, does it mean we end up creating a CVSD link. That
can not be correct. I think we need to fail the connection procedure in
that case. We can not magically turn a transparent link into a CVSD
link. That would confuse the hell out of HFP.

>  	} else {
>  		cp.pkt_type       = cpu_to_le16(conn->pkt_type);
>  		cp.max_latency    = __constant_cpu_to_le16(0xffff);
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 3fd0212..6c1aec9 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -3330,6 +3330,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
>  		hci_conn_add_sysfs(conn);
>  		break;
>  
> +	case 0x0d:	/* No resource available */
>  	case 0x11:	/* Unsupported Feature or Parameter Value */
>  	case 0x1c:	/* SCO interval rejected */
>  	case 0x1a:	/* Unsupported Remote Feature */

Regards

Marcel



  reply	other threads:[~2013-02-18 23:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 13:56 [PATCH v3 1/5] Bluetooth: Move and rename hci_conn_accept Frédéric Dalleau
2013-02-04 13:56 ` [PATCH v3 2/5] Bluetooth: Add option for SCO socket mode Frédéric Dalleau
2013-02-18 23:14   ` Marcel Holtmann
2013-03-13 13:24     ` Dalleau, Frederic
2013-03-13 16:26       ` Marcel Holtmann
2013-03-13 17:02         ` Dalleau, Frederic
2013-02-04 13:56 ` [PATCH v3 3/5] Bluetooth: Use mode to create SCO connection Frédéric Dalleau
2013-02-04 13:56 ` [PATCH v3 4/5] Bluetooth: Parameters for outgoing SCO connections Frédéric Dalleau
2013-02-18 23:18   ` Marcel Holtmann
2013-02-04 13:56 ` [PATCH v3 5/5] Bluetooth: Fallback transparent SCO from T2 to T1 Frédéric Dalleau
2013-02-18 23:22   ` Marcel Holtmann [this message]
2013-02-18 22:58 ` [PATCH v3 1/5] Bluetooth: Move and rename hci_conn_accept Marcel Holtmann

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=1361229721.1583.53.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=frederic.dalleau@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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