Skip to content

Commit

Permalink
Bluetooth: Check for SCO type before setting retransmission effort
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Bernhard Thaler authored and Marcel Holtmann committed Sep 23, 2014
1 parent 5eb596f commit 48e68ff
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ struct sco_param {
u16 max_latency;
};

static const struct sco_param sco_param_cvsd[] = {
static const struct sco_param esco_param_cvsd[] = {
{ EDR_ESCO_MASK & ~ESCO_2EV3, 0x000a }, /* S3 */
{ EDR_ESCO_MASK & ~ESCO_2EV3, 0x0007 }, /* S2 */
{ EDR_ESCO_MASK | ESCO_EV3, 0x0007 }, /* S1 */
{ EDR_ESCO_MASK | ESCO_HV3, 0xffff }, /* D1 */
{ EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */
};

static const struct sco_param sco_param_cvsd[] = {
{ EDR_ESCO_MASK | ESCO_HV3, 0xffff }, /* D1 */
{ EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */
};

static const struct sco_param sco_param_wideband[] = {
{ EDR_ESCO_MASK & ~ESCO_2EV3, 0x000d }, /* T2 */
{ EDR_ESCO_MASK | ESCO_EV3, 0x0008 }, /* T1 */
Expand Down Expand Up @@ -207,10 +212,17 @@ 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)) {
if (conn->attempt > ARRAY_SIZE(esco_param_cvsd))
return false;
cp.retrans_effort = 0x01;
param = &esco_param_cvsd[conn->attempt - 1];
} else {
if (conn->attempt > ARRAY_SIZE(sco_param_cvsd))
return false;
cp.retrans_effort = 0xff;
param = &sco_param_cvsd[conn->attempt - 1];
}
break;
default:
return false;
Expand Down

0 comments on commit 48e68ff

Please sign in to comment.