linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Andrey Voropaev <voropaev.andrey@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: Authentication Rejected when pairing stereo headset
Date: Thu, 20 Dec 2012 11:38:45 +0200	[thread overview]
Message-ID: <20121220093840.GA21122@aemeltch-MOBL1> (raw)
In-Reply-To: <CAFOXTdf9qrtXD0GPDBFLhLX66QGQCgF_VzyS8WWz5xTAH8+0zQ@mail.gmail.com>

Hi Andrey,

On Thu, Dec 20, 2012 at 10:27:15AM +0100, Andrey Voropaev wrote:
> On Thu, Dec 20, 2012 at 10:19 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> > First of all, please don't do top posting. It messes up the thread,
> > especially when mixed with inline quoting.
> 
> Sorry. First time replying to list from gmail. Didn't pay attention to
> that little mark at the bottom of the editor :)
> 
> > Actually the hcidump helped a lot. It shows an issue on the kernel side:
> >
> >  < HCI Command: IO Capability Request Reply (0x01|0x002b) plen 9
> >      bdaddr 00:1A:7D:25:2C:A4 capability 0x04 oob 0x00 auth 0x03
> >      Capability: Reserved (OOB data not present)
> >      Authentication: Dedicated Bonding (MITM Protection)
> >  > HCI Event: Command Complete (0x0e) plen 10
> >      IO Capability Request Reply (0x01|0x002b) ncmd 1
> >      status 0x12 bdaddr 00:1A:7D:25:2C:A4
> >      Error: Invalid HCI Command Parameters
> >
> > The IO capability value 0x04 that the kernel is responding with is
> > invalid and shouldn't be sent to the controller. This was already fixed
> > quite long time ago (about 1 year ago) by the following patch from
> > Hemant Gupta: "Bluetooth: Send correct response to IO Capability Request"
> >
> > It adds the following code to the IO capability handling to avoid 0x04
> > from being sent:
> >
> >         /* Change the IO capability from KeyboardDisplay
> >          * to DisplayYesNo as it is not supported by BT spec. */
> >         cp.capability = (conn->io_capability == 0x04) ?
> >                                         0x01 : conn->io_capability;
> >
> > It seems however that your kernel is missing this patch and the right
> > way forward would be to include it.
> 
> I'm using Gentoo with "stable" version 3.5.7. Can you please tell me
> which file shall contain this patch? I'll try to find "development"
> version of kernel that contains it.

The patch is below:

commit 7a7f1e7c857959f5298020969741e389f21edbae
Author: Hemant Gupta <hemant.gupta@stericsson.com>
Date:   Mon Jan 16 13:34:29 2012 +0530

    Bluetooth: Send correct response to IO Capability Request
    
    This patch sends correct IO Capability response to remote device
    in case Local Device supports KeyBoardDisplay IO Capability as
    this capability is not valid as per BT spec for IO capability
    Request Reply Command.
    This capability is mapped to DisplayYesNo which is in accordance
    with BT spec.
    
    Signed-off-by: Hemant Gupta <hemant.gupta@stericsson.com>
    Acked-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6fb9016..041a35e 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2965,7 +2965,10 @@ static inline void hci_io_capa_request_evt(struct
hci_dev *hdev, struct sk_buff
                struct hci_cp_io_capability_reply cp;
 
                bacpy(&cp.bdaddr, &ev->bdaddr);
-               cp.capability = conn->io_capability;
+               /* Change the IO capability from KeyboardDisplay
+                * to DisplayYesNo as it is not supported by BT spec. */
+               cp.capability = (conn->io_capability == 0x04) ?
+                                               0x01 :
conn->io_capability;
                conn->auth_type = hci_get_auth_req(conn);
                cp.authentication = conn->auth_type;


Best regards 
Andrei Emeltchenko 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-12-20  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20  7:41 Authentication Rejected when pairing stereo headset Andrey Voropaev
2012-12-20  8:04 ` Johan Hedberg
2012-12-20  9:02   ` Andrey Voropaev
2012-12-20  9:19     ` Johan Hedberg
2012-12-20  9:27       ` Andrey Voropaev
2012-12-20  9:37         ` Johan Hedberg
2012-12-20 10:22           ` Andrey Voropaev
2012-12-20 11:06             ` Andrey Voropaev
2012-12-20  9:38         ` Andrei Emeltchenko [this message]
2012-12-20 10:51           ` Andrey Voropaev

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=20121220093840.GA21122@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=voropaev.andrey@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).