aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorBernhard Thaler <bernhard.thaler@r-it.at>2014-09-23 05:01:07 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-09-23 05:30:04 -0400
commit48e68ff5e55af6907d3f90233e5c4d5601a628a6 (patch)
tree097a24a5cee1a5cb7fcb65f651c1afac0406a28c /net/bluetooth
parent5eb596f55cacc2389554a8d7572d90d5e9d4269d (diff)
Bluetooth: Check for SCO type before setting retransmission effort
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>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_conn.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index e3d7ae9e2edd..22b253750f78 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -38,7 +38,7 @@ struct sco_param {
38 u16 max_latency; 38 u16 max_latency;
39}; 39};
40 40
41static const struct sco_param sco_param_cvsd[] = { 41static const struct sco_param esco_param_cvsd[] = {
42 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000a }, /* S3 */ 42 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000a }, /* S3 */
43 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x0007 }, /* S2 */ 43 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x0007 }, /* S2 */
44 { EDR_ESCO_MASK | ESCO_EV3, 0x0007 }, /* S1 */ 44 { EDR_ESCO_MASK | ESCO_EV3, 0x0007 }, /* S1 */
@@ -46,6 +46,11 @@ static const struct sco_param sco_param_cvsd[] = {
46 { EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */ 46 { EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */
47}; 47};
48 48
49static const struct sco_param sco_param_cvsd[] = {
50 { EDR_ESCO_MASK | ESCO_HV3, 0xffff }, /* D1 */
51 { EDR_ESCO_MASK | ESCO_HV1, 0xffff }, /* D0 */
52};
53
49static const struct sco_param sco_param_wideband[] = { 54static const struct sco_param sco_param_wideband[] = {
50 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000d }, /* T2 */ 55 { EDR_ESCO_MASK & ~ESCO_2EV3, 0x000d }, /* T2 */
51 { EDR_ESCO_MASK | ESCO_EV3, 0x0008 }, /* T1 */ 56 { EDR_ESCO_MASK | ESCO_EV3, 0x0008 }, /* T1 */
@@ -207,10 +212,17 @@ bool hci_setup_sync(struct hci_conn *conn, __u16 handle)
207 param = &sco_param_wideband[conn->attempt - 1]; 212 param = &sco_param_wideband[conn->attempt - 1];
208 break; 213 break;
209 case SCO_AIRMODE_CVSD: 214 case SCO_AIRMODE_CVSD:
210 if (conn->attempt > ARRAY_SIZE(sco_param_cvsd)) 215 if (lmp_esco_capable(conn->link)) {
211 return false; 216 if (conn->attempt > ARRAY_SIZE(esco_param_cvsd))
212 cp.retrans_effort = 0x01; 217 return false;
213 param = &sco_param_cvsd[conn->attempt - 1]; 218 cp.retrans_effort = 0x01;
219 param = &esco_param_cvsd[conn->attempt - 1];
220 } else {
221 if (conn->attempt > ARRAY_SIZE(sco_param_cvsd))
222 return false;
223 cp.retrans_effort = 0xff;
224 param = &sco_param_cvsd[conn->attempt - 1];
225 }
214 break; 226 break;
215 default: 227 default:
216 return false; 228 return false;