All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Understanding connecting to BLE keyboard
@ 2015-09-13  5:58 Elliot Saba
  2015-09-14 12:25 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 9+ messages in thread
From: Elliot Saba @ 2015-09-13  5:58 UTC (permalink / raw)
  To: linux-bluetooth

Hello there, I recently obtained a Microsoft Designer BLE
keyboard/mouse, and I thought I would attempt to connect it up to my
Linux box for fun.  Needless to say, I've met with some problems,
primarily with the authentication mechanisms I believe.

First off, I am using bluez 5.23 on SteamOS (A debian derivative) with
a Broadcom BCM4352 controller.

When attempting to connect to the bluetooth keyboard using my OSX
machine, it prompts me to enter a PIN, and after doing so, things are
fine and dandy.  When using gnome-bluetooth to attempt to connect, it
thinks about it for a little bit, and then reverts to its previous
status ("Not Set Up") rather than prompting me for a PIN or anything
like that.

When attempting to connect via the command line using bluetoothctl,
(First I start a KeyboardOnly agent, then scan for the device, then
"trust" it, then "pair" it) bluetoothctl initially reports the
connection has succeeded, but then immediately disconnects and prints
out the error "org.bluez.Error.AuthenticationCanceled".

When attempting to connect via the command line using gatttool in
interactive mode, I run into similar issues; I can type "connect" and
it initially reports success, but any command I then type to query the
device immediately reports "Command Failed: Disconnected".

Is there some way I can increase the amount of debugging information
available to me in order to try and track down exactly what's going
wrong here?  I admit that my knowledge of the proper way to connect
this device in linux is shaky at best, and I would "Read The Manual"
if I knew where to look for it.  Pointers on where to go to read up on
this whole process are definitely welcome.

Thank you for your time,
-E

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-13  5:58 Understanding connecting to BLE keyboard Elliot Saba
@ 2015-09-14 12:25 ` Luiz Augusto von Dentz
  2015-09-14 12:46   ` Szymon Janc
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2015-09-14 12:25 UTC (permalink / raw)
  To: Elliot Saba; +Cc: linux-bluetooth@vger.kernel.org

Hi Elliot,

On Sun, Sep 13, 2015 at 8:58 AM, Elliot Saba <staticfloat@gmail.com> wrote:
> Hello there, I recently obtained a Microsoft Designer BLE
> keyboard/mouse, and I thought I would attempt to connect it up to my
> Linux box for fun.  Needless to say, I've met with some problems,
> primarily with the authentication mechanisms I believe.
>
> First off, I am using bluez 5.23 on SteamOS (A debian derivative) with
> a Broadcom BCM4352 controller.
>
> When attempting to connect to the bluetooth keyboard using my OSX
> machine, it prompts me to enter a PIN, and after doing so, things are
> fine and dandy.  When using gnome-bluetooth to attempt to connect, it
> thinks about it for a little bit, and then reverts to its previous
> status ("Not Set Up") rather than prompting me for a PIN or anything
> like that.
>
> When attempting to connect via the command line using bluetoothctl,
> (First I start a KeyboardOnly agent, then scan for the device, then
> "trust" it, then "pair" it) bluetoothctl initially reports the
> connection has succeeded, but then immediately disconnects and prints
> out the error "org.bluez.Error.AuthenticationCanceled".

Try using btmon to get a trace of what is going on, from the error it
sounds like the remote is canceling the pairing so perhaps it times
out or something. Btw, have you checked the manual how the pairing is
suppose to be done? Did you enter the pincode in the keyboard itself?

> When attempting to connect via the command line using gatttool in
> interactive mode, I run into similar issues; I can type "connect" and
> it initially reports success, but any command I then type to query the
> device immediately reports "Command Failed: Disconnected".
>
> Is there some way I can increase the amount of debugging information
> available to me in order to try and track down exactly what's going
> wrong here?  I admit that my knowledge of the proper way to connect
> this device in linux is shaky at best, and I would "Read The Manual"
> if I knew where to look for it.  Pointers on where to go to read up on
> this whole process are definitely welcome.

The problem seems to be at pairing which is mandatory if the device
implements HoG profile, so I guess no command will succeed until
pairing is done properly.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-14 12:25 ` Luiz Augusto von Dentz
@ 2015-09-14 12:46   ` Szymon Janc
       [not found]     ` <CAGGi21ZDsS0__YnzWqWfcmk=jSAEZYQwUD8Dx2c8fi25bWn5SA@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Szymon Janc @ 2015-09-14 12:46 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Elliot Saba, linux-bluetooth@vger.kernel.org

Hi,

On Monday 14 of September 2015 15:25:58 Luiz Augusto von Dentz wrote:
> Hi Elliot,
> 
> On Sun, Sep 13, 2015 at 8:58 AM, Elliot Saba <staticfloat@gmail.com> wrote:
> > Hello there, I recently obtained a Microsoft Designer BLE
> > keyboard/mouse, and I thought I would attempt to connect it up to my
> > Linux box for fun.  Needless to say, I've met with some problems,
> > primarily with the authentication mechanisms I believe.
> > 
> > First off, I am using bluez 5.23 on SteamOS (A debian derivative) with
> > a Broadcom BCM4352 controller.
> > 
> > When attempting to connect to the bluetooth keyboard using my OSX
> > machine, it prompts me to enter a PIN, and after doing so, things are
> > fine and dandy.  When using gnome-bluetooth to attempt to connect, it
> > thinks about it for a little bit, and then reverts to its previous
> > status ("Not Set Up") rather than prompting me for a PIN or anything
> > like that.
> > 
> > When attempting to connect via the command line using bluetoothctl,
> > (First I start a KeyboardOnly agent, then scan for the device, then
> > "trust" it, then "pair" it) bluetoothctl initially reports the
> > connection has succeeded, but then immediately disconnects and prints
> > out the error "org.bluez.Error.AuthenticationCanceled".
> 
> Try using btmon to get a trace of what is going on, from the error it
> sounds like the remote is canceling the pairing so perhaps it times
> out or something. Btw, have you checked the manual how the pairing is
> suppose to be done? Did you enter the pincode in the keyboard itself?

I think the problem is use of KeyboardOnly which in LE legacy pairing results 
in JustWorks pairing if both sides have this IO capa. If there is requirement 
for authenticated link then this will fail. I'd suggest first checking with
proper IO capa ie. KeyboardDisplay.

> > When attempting to connect via the command line using gatttool in
> > interactive mode, I run into similar issues; I can type "connect" and
> > it initially reports success, but any command I then type to query the
> > device immediately reports "Command Failed: Disconnected".
> > 
> > Is there some way I can increase the amount of debugging information
> > available to me in order to try and track down exactly what's going
> > wrong here?  I admit that my knowledge of the proper way to connect
> > this device in linux is shaky at best, and I would "Read The Manual"
> > if I knew where to look for it.  Pointers on where to go to read up on
> > this whole process are definitely welcome.
> 
> The problem seems to be at pairing which is mandatory if the device
> implements HoG profile, so I guess no command will succeed until
> pairing is done properly.

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
       [not found]     ` <CAGGi21ZDsS0__YnzWqWfcmk=jSAEZYQwUD8Dx2c8fi25bWn5SA@mail.gmail.com>
@ 2015-09-15  3:32       ` Elliot Saba
  2015-09-15  6:49         ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 9+ messages in thread
From: Elliot Saba @ 2015-09-15  3:32 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

Hello all, thank you for your responses so far.

First off, I had not tried entering the PIN, because nothing had
prompted me to do so.  I have intermittently managed to get a PIN
prompt to show up in bluetoothctl now that I am using "agent
KeyboardDisplay" instead of "agent KeyboardOnly", thanks to Szymon's
advice.  However, although it now sometimes prompts me for a PIN code,
other times it doesn't, and I still get "authentication canceled"
errors extremely quickly (less than a second) after attempting to
pair.  Here is an example session, with both bluetoothctl and btmon
output: https://gist.github.com/staticfloat/bbc016376ba5a8ab4451

Secondly, what manual do you refer to?  I am having a difficult time
finding bluez documentation, so if there is a bluez manual somewhere,
I'd love to read it.  If you refer to the manual for my keyboard,
sadly its manual says nothing about Linux.  I can pair it on other
operating systems such as OSX without difficulty (and yes, it requires
entry of a PIN) so I am confident I know the proper method to pair it
with a device.

Thanks!
-E

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-15  3:32       ` Elliot Saba
@ 2015-09-15  6:49         ` Luiz Augusto von Dentz
  2015-09-15  7:37           ` Elliot Saba
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2015-09-15  6:49 UTC (permalink / raw)
  To: Elliot Saba; +Cc: linux-bluetooth@vger.kernel.org

Hi,

On Tue, Sep 15, 2015 at 6:32 AM, Elliot Saba <staticfloat@gmail.com> wrote:
> Hello all, thank you for your responses so far.
>
> First off, I had not tried entering the PIN, because nothing had
> prompted me to do so.  I have intermittently managed to get a PIN
> prompt to show up in bluetoothctl now that I am using "agent
> KeyboardDisplay" instead of "agent KeyboardOnly", thanks to Szymon's
> advice.  However, although it now sometimes prompts me for a PIN code,
> other times it doesn't, and I still get "authentication canceled"
> errors extremely quickly (less than a second) after attempting to
> pair.  Here is an example session, with both bluetoothctl and btmon
> output: https://gist.github.com/staticfloat/bbc016376ba5a8ab4451
>
> Secondly, what manual do you refer to?  I am having a difficult time
> finding bluez documentation, so if there is a bluez manual somewhere,
> I'd love to read it.  If you refer to the manual for my keyboard,
> sadly its manual says nothing about Linux.  I can pair it on other
> operating systems such as OSX without difficulty (and yes, it requires
> entry of a PIN) so I am confident I know the proper method to pair it
> with a device.


Looks like the remote it disconnecting very early:

> HCI Event: Disconnect Complete (0x05) plen 4                 [hci0] 30.737028
        Status: Success (0x00)
        Handle: 64
        Reason: Connection Failed to be Established (0x3e)

Btw, make sure it is not connecting to any other system since it start
advertising perhaps you have to remove any existing link key from
other system you have been testing, also you said sometimes it does
prompt a pin code but by the logs this was not one of these.



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-15  6:49         ` Luiz Augusto von Dentz
@ 2015-09-15  7:37           ` Elliot Saba
  2015-09-15  8:00             ` Luiz Augusto von Dentz
  2015-09-15  8:05             ` Szymon Janc
  0 siblings, 2 replies; 9+ messages in thread
From: Elliot Saba @ 2015-09-15  7:37 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org

I cannot seem to make it prompt me for a PIN anymore; the only thing
it does is fail immediately with the error code given above.  I have
successfully connected it and disconnected it from my OSX and Windows
laptops, so I do not believe it is an issue of having another device
paired with it; no matter what combination of agents or command
sequences I use, I am always just getting AuthenticationCanceled
errors immediately after my machine attempts to pair.  I'm not sure
how I got the PIN entry code earlier, I'm guessing it was some kind of
race condition, especially considering that even though I managed to
get a PIN code entry prompt I got an authentication failure less than
a second after that prompt came up.

Is there any other kind of debugging that I could perform for you guys?
-E

On Mon, Sep 14, 2015 at 11:49 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi,
>
> On Tue, Sep 15, 2015 at 6:32 AM, Elliot Saba <staticfloat@gmail.com> wrote:
>> Hello all, thank you for your responses so far.
>>
>> First off, I had not tried entering the PIN, because nothing had
>> prompted me to do so.  I have intermittently managed to get a PIN
>> prompt to show up in bluetoothctl now that I am using "agent
>> KeyboardDisplay" instead of "agent KeyboardOnly", thanks to Szymon's
>> advice.  However, although it now sometimes prompts me for a PIN code,
>> other times it doesn't, and I still get "authentication canceled"
>> errors extremely quickly (less than a second) after attempting to
>> pair.  Here is an example session, with both bluetoothctl and btmon
>> output: https://gist.github.com/staticfloat/bbc016376ba5a8ab4451
>>
>> Secondly, what manual do you refer to?  I am having a difficult time
>> finding bluez documentation, so if there is a bluez manual somewhere,
>> I'd love to read it.  If you refer to the manual for my keyboard,
>> sadly its manual says nothing about Linux.  I can pair it on other
>> operating systems such as OSX without difficulty (and yes, it requires
>> entry of a PIN) so I am confident I know the proper method to pair it
>> with a device.
>
>
> Looks like the remote it disconnecting very early:
>
>> HCI Event: Disconnect Complete (0x05) plen 4                 [hci0] 30.737028
>         Status: Success (0x00)
>         Handle: 64
>         Reason: Connection Failed to be Established (0x3e)
>
> Btw, make sure it is not connecting to any other system since it start
> advertising perhaps you have to remove any existing link key from
> other system you have been testing, also you said sometimes it does
> prompt a pin code but by the logs this was not one of these.
>
>
>
> --
> Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-15  7:37           ` Elliot Saba
@ 2015-09-15  8:00             ` Luiz Augusto von Dentz
  2015-09-15  8:05             ` Szymon Janc
  1 sibling, 0 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2015-09-15  8:00 UTC (permalink / raw)
  To: Elliot Saba; +Cc: linux-bluetooth@vger.kernel.org

Hi Elliot,

On Tue, Sep 15, 2015 at 10:37 AM, Elliot Saba <staticfloat@gmail.com> wrote:
> I cannot seem to make it prompt me for a PIN anymore; the only thing
> it does is fail immediately with the error code given above.  I have
> successfully connected it and disconnected it from my OSX and Windows
> laptops, so I do not believe it is an issue of having another device
> paired with it; no matter what combination of agents or command
> sequences I use, I am always just getting AuthenticationCanceled
> errors immediately after my machine attempts to pair.  I'm not sure
> how I got the PIN entry code earlier, I'm guessing it was some kind of
> race condition, especially considering that even though I managed to
> get a PIN code entry prompt I got an authentication failure less than
> a second after that prompt came up.
>
> Is there any other kind of debugging that I could perform for you guys?
> -E

No top posting in the list please.

The error Connection Failed to be Established indicate that the
connection has never been completed, so perhaps there is something
wrong with your local adapter, have you tried plugging another
controller?

> On Mon, Sep 14, 2015 at 11:49 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi,
>>
>> On Tue, Sep 15, 2015 at 6:32 AM, Elliot Saba <staticfloat@gmail.com> wrote:
>>> Hello all, thank you for your responses so far.
>>>
>>> First off, I had not tried entering the PIN, because nothing had
>>> prompted me to do so.  I have intermittently managed to get a PIN
>>> prompt to show up in bluetoothctl now that I am using "agent
>>> KeyboardDisplay" instead of "agent KeyboardOnly", thanks to Szymon's
>>> advice.  However, although it now sometimes prompts me for a PIN code,
>>> other times it doesn't, and I still get "authentication canceled"
>>> errors extremely quickly (less than a second) after attempting to
>>> pair.  Here is an example session, with both bluetoothctl and btmon
>>> output: https://gist.github.com/staticfloat/bbc016376ba5a8ab4451
>>>
>>> Secondly, what manual do you refer to?  I am having a difficult time
>>> finding bluez documentation, so if there is a bluez manual somewhere,
>>> I'd love to read it.  If you refer to the manual for my keyboard,
>>> sadly its manual says nothing about Linux.  I can pair it on other
>>> operating systems such as OSX without difficulty (and yes, it requires
>>> entry of a PIN) so I am confident I know the proper method to pair it
>>> with a device.
>>
>>
>> Looks like the remote it disconnecting very early:
>>
>>> HCI Event: Disconnect Complete (0x05) plen 4                 [hci0] 30.737028
>>         Status: Success (0x00)
>>         Handle: 64
>>         Reason: Connection Failed to be Established (0x3e)
>>
>> Btw, make sure it is not connecting to any other system since it start
>> advertising perhaps you have to remove any existing link key from
>> other system you have been testing, also you said sometimes it does
>> prompt a pin code but by the logs this was not one of these.
>>
>>
>>
>> --
>> Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-15  7:37           ` Elliot Saba
  2015-09-15  8:00             ` Luiz Augusto von Dentz
@ 2015-09-15  8:05             ` Szymon Janc
  2015-09-21 18:26               ` Elliot Saba
  1 sibling, 1 reply; 9+ messages in thread
From: Szymon Janc @ 2015-09-15  8:05 UTC (permalink / raw)
  To: Elliot Saba; +Cc: Luiz Augusto von Dentz, linux-bluetooth@vger.kernel.org

Hi,

On Tuesday 15 of September 2015 00:37:04 Elliot Saba wrote:
> I cannot seem to make it prompt me for a PIN anymore; the only thing
> it does is fail immediately with the error code given above.  I have
> successfully connected it and disconnected it from my OSX and Windows
> laptops, so I do not believe it is an issue of having another device
> paired with it; no matter what combination of agents or command
> sequences I use, I am always just getting AuthenticationCanceled
> errors immediately after my machine attempts to pair.  I'm not sure
> how I got the PIN entry code earlier, I'm guessing it was some kind of
> race condition, especially considering that even though I managed to
> get a PIN code entry prompt I got an authentication failure less than
> a second after that prompt came up.
> 
> Is there any other kind of debugging that I could perform for you guys?
> -E

This looks like Link Layer issue not host issue. From spec:
"2.59 CONNECTION FAILED TO BE ESTABLISHED (0x3E)
The Connection Failed to be Established error code indicates that the LL
initiated a connection but the connection has failed to be established."

Could you check if this issue exists with different BT adapter? You could also 
check if there is updated firmware available for you BT chip.


> On Mon, Sep 14, 2015 at 11:49 PM, Luiz Augusto von Dentz
> 
> <luiz.dentz@gmail.com> wrote:
> > Hi,
> > 
> > On Tue, Sep 15, 2015 at 6:32 AM, Elliot Saba <staticfloat@gmail.com> 
wrote:
> >> Hello all, thank you for your responses so far.
> >> 
> >> First off, I had not tried entering the PIN, because nothing had
> >> prompted me to do so.  I have intermittently managed to get a PIN
> >> prompt to show up in bluetoothctl now that I am using "agent
> >> KeyboardDisplay" instead of "agent KeyboardOnly", thanks to Szymon's
> >> advice.  However, although it now sometimes prompts me for a PIN code,
> >> other times it doesn't, and I still get "authentication canceled"
> >> errors extremely quickly (less than a second) after attempting to
> >> pair.  Here is an example session, with both bluetoothctl and btmon
> >> output: https://gist.github.com/staticfloat/bbc016376ba5a8ab4451
> >> 
> >> Secondly, what manual do you refer to?  I am having a difficult time
> >> finding bluez documentation, so if there is a bluez manual somewhere,
> >> I'd love to read it.  If you refer to the manual for my keyboard,
> >> sadly its manual says nothing about Linux.  I can pair it on other
> >> operating systems such as OSX without difficulty (and yes, it requires
> >> entry of a PIN) so I am confident I know the proper method to pair it
> >> with a device.
> > 
> > Looks like the remote it disconnecting very early:
> >> HCI Event: Disconnect Complete (0x05) plen 4                 [hci0]
> >> 30.737028>> 
> >         Status: Success (0x00)
> >         Handle: 64
> >         Reason: Connection Failed to be Established (0x3e)
> > 
> > Btw, make sure it is not connecting to any other system since it start
> > advertising perhaps you have to remove any existing link key from
> > other system you have been testing, also you said sometimes it does
> > prompt a pin code but by the logs this was not one of these.
> > 
> > 
> > 
> > --
> > Luiz Augusto von Dentz
> 
> --
> 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

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Understanding connecting to BLE keyboard
  2015-09-15  8:05             ` Szymon Janc
@ 2015-09-21 18:26               ` Elliot Saba
  0 siblings, 0 replies; 9+ messages in thread
From: Elliot Saba @ 2015-09-21 18:26 UTC (permalink / raw)
  To: Szymon Janc; +Cc: Luiz Augusto von Dentz, linux-bluetooth@vger.kernel.org

Hey guys, just wanted to follow up with this and state that I bought a
Kinivo BTD-400 adapter, and things are now working excellently.  Thank
you all for your help.
-E

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-21 18:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-13  5:58 Understanding connecting to BLE keyboard Elliot Saba
2015-09-14 12:25 ` Luiz Augusto von Dentz
2015-09-14 12:46   ` Szymon Janc
     [not found]     ` <CAGGi21ZDsS0__YnzWqWfcmk=jSAEZYQwUD8Dx2c8fi25bWn5SA@mail.gmail.com>
2015-09-15  3:32       ` Elliot Saba
2015-09-15  6:49         ` Luiz Augusto von Dentz
2015-09-15  7:37           ` Elliot Saba
2015-09-15  8:00             ` Luiz Augusto von Dentz
2015-09-15  8:05             ` Szymon Janc
2015-09-21 18:26               ` Elliot Saba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.