mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Bernhard Thaler <bernhard.thaler@r-it.at>
Cc: "Gustavo F. Padovan" <gustavo@padovan.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	BlueZ development <linux-bluetooth@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/1] bluetooth: Check for SCO type before setting retransmission effort
Date: Thu, 18 Sep 2014 08:43:40 -0700	[thread overview]
Message-ID: <AE7A1F22-766E-4C9B-A748-ACA5426B7DBD@holtmann.org> (raw)
In-Reply-To: <1411035321-10215-1-git-send-email-bernhard.thaler@r-it.at>

Hi Bernhard,

> SCO connection cannot be setup to devices that do not support retransmission.
> Patch based on http://permalink.gmane.org/gmane.linux.bluez.kernel/7779 and
> adapted for this kernel version.
> Code changed to check SCO/eSCO type before setting retransmission effort
> and max. latency. The purpose of the patch is to support older devices not
> capable of eSCO.
> 
> Tested on Blackberry 655+ headset which does not support retransmission.
> Credits go to Alexander Sommerhuber.
> 
> Signed-off-by: Bernhard Thaler <bernhard.thaler@r-it.at>
> ---
> net/bluetooth/hci_conn.c |   16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index faff624..f6e3183 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -194,10 +194,18 @@ bool hci_setup_sync(struct hci_conn *conn, __u16 handle)
> 		param = &sco_param_wideband[conn->attempt - 1];
> 		break;
> 	case SCO_AIRMODE_CVSD:
> -		if (conn->attempt > ARRAY_SIZE(sco_param_cvsd))
> -			return false;
> -		cp.retrans_effort = 0x01;
> -		param = &sco_param_cvsd[conn->attempt - 1];
> +		if (!lmp_esco_capable(conn->link)) {
> +			/* sco_param_cvsd contains SCO in last two elements */
> +			if ((conn->attempt + 3) > ARRAY_SIZE(sco_param_cvsd))
> +				return false;
> +			cp.retrans_effort = 0xff;
> +			param = &sco_param_cvsd[(conn->attempt + 2)];

so if anybody creates a new mode and forgets to update this code, we are hitting a nice crash and/or wrong behavior.

I would prefer that we create separate parameter arrays here. It might means that we have to rename the current ones to esco_param_* and the introduce sco_param_cvsd.

> +		} else {
> +			if (conn->attempt > ARRAY_SIZE(sco_param_cvsd))
> +				return false;
> +			cp.retrans_effort = 0x01;
> +			param = &sco_param_cvsd[conn->attempt - 1];
> +		}
> 		break;
> 	default:
> 		return false;

Regards

Marcel


  reply	other threads:[~2014-09-18 15:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17  7:13 [PATCH " Bernhard Thaler
2014-09-17 13:55 ` Marcel Holtmann
2014-09-18 10:15   ` [PATCHv2 " Bernhard Thaler
2014-09-18 15:43     ` Marcel Holtmann [this message]
2014-09-18 15:48     ` Marcel Holtmann
2014-09-23  5:59     ` [PATCHv3 " Bernhard Thaler
2014-09-23  7:44       ` Marcel Holtmann
2014-09-23  9:01     ` [PATCHv4 " Bernhard Thaler
2014-09-23  9:32       ` 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=AE7A1F22-766E-4C9B-A748-ACA5426B7DBD@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=bernhard.thaler@r-it.at \
    --cc=davem@davemloft.net \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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

all inboxes | Powered by JetHome®