linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emil Lenngren <emil.lenngren@gmail.com>
To: "Peter Höller" <drmedvet.hoeller@gmail.com>,
	"Bluez mailing list" <linux-bluetooth@vger.kernel.org>
Subject: Re: Instable BLE connection - MTU Request, Attribute not found - wireshark findings
Date: Mon, 26 Jul 2021 22:17:27 +0200	[thread overview]
Message-ID: <CAO1O6seL0QJwHB6CRq56UitWUxQk4PaMC1a-22ggk6KjoD1F1Q@mail.gmail.com> (raw)
In-Reply-To: <CAJgPF1+BJFyryVWzVYGp=qDHjruJWYq-eAHzm+QeR=BGNct+iw@mail.gmail.com>

Den mån 26 juli 2021 kl 22:00 skrev Peter Höller <drmedvet.hoeller@gmail.com>:
>
> However, I installed wireshark ( I used the wireshark version instead
> of tshark, because I am not familiar with the shell commands in
> tshark. However, unfortunately I cannot copy any sniffed protocols for
> now)
>
> my connection status out of bluetoothctl is:
> paired, trusted and connected
>
>
> 1.) paired and connected I go to
> >menu gatt
> >select attribute b5f90074-aa8d-11e3-9046-0002a5d5c51b  (as I always do)
> this leads me to:
> GoPro8639:/service002d/char0033]#
> no I:
> write "0x03 0x01 0x01 0x01"  (which always started the shutter on
> peripheral, when we used btusb 0.6 (now we are using btusb 0.7!)
>
> but nothing happens at peripheral.
> on wireshark there is no error but I get on Write response packet:
> Bluetooth Attribute Protocol
> -->Opcode: Write Response (0x13)
> -->0... .... = Authentication Signature: False
> .0.. .... = Command: False
> ..01 0011 = Method: Write Respone (0x13)
>
> Can you debug this? Was there any change in syntax due to write <data
> = xx xx xx xx xx> [offset] [type] ?
>
> Hoever,
> sudo gatttool -t random -b xx:xx:xx:xx:xx:xx -I
> connect
> char-write-req 2f 03010101
>
> still works (!) and goes through to the peripheral !, unless there
> occurs no is no file descriptor Error
>
>
> 2.) due to the disconnect problem after longer connection ~15 min:
> there where no further findings:
> wireshark delivers an HCI event  - Disconnect Complete with
> Reason: Connection Timeout (0x08)
>
> 3.) due to the immediate disconnect problem (~1 - 10 sec after
> connection): there seems to be an encryption problem and /or
> Encryption change takes too long?:
> (I type for you...)
>
> from host to controller:          HCI_CMD           length: 29
> SENT           LE Create Connection
>
> from controller to host:          HCI_EVT            length: 7
>  Rcvd            Command Status (LE Create Connection)
>
> from controller to host:          HCI_EVT            lenght: 22
> Rcvd              LE Meta (LE Connection Complete)
>
> from host to controller:          HCI_CMD           length: 32
> Sent             LE Start Encryption
>
> from controller to host:          HCI_EVT            lenght: 7
> Rcvd             Command Status (LE Start Encryption)
>
> from controller to host:          HCI_EVT            lenght: 7
> Rcvd             Encryption Change
> ----->containg under BluetoothHCI Event:  Status: Connection timeout (0x08) and
>
> Encrytion Enable: Link Level Encryption is OFF (0x00)
>
> from host to controller:          HCI_CMD           length: 7
> Sent              Disconnect
> ----->containg under BluetoothHCI Command:   Reason: Authentication
> Failure (0x05)
>
> from controller to host:          HCI_EVT            lenght: 7
> Sent             Disconnect Complete
> ----->containg under BluetoothHCI Event:   Reason Connection Timeout(0x08)

If you have one method that works and one that fails, you should use
btmon to compare the exact write payloads. I don't know about GoPro so
can't help what kind of messages it expects.

You can see that it's the controller that first notifies of the
disconnection with the reason "Connection Timeout" (in a start
encryption result, as indicated by the result code). So likely it's
due to one of the reasons I wrote about earlier. Another reason for
connection timeout is if the firmware is buggy or just drops the
connection for example when you suddenly power off the device. What
also could happen is, during encryption setup, is if both devices
believe they share the same encryption key, but in fact they for some
reason have two different keys stored, then the peripheral will drop
the connection with the reason "Connection terminated due to MIC
failure" while the central will eventually get a "Connection Timeout".

/Emil

  parent reply	other threads:[~2021-07-26 20:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJgPF1JLw40nRXyoXyuGd9hNLWCDeD4ONVM7S_CSE9wQg3gvyA@mail.gmail.com>
2021-07-26 10:56 ` Instable BLE connection - MTU Request, Attribute not found Peter Höller
2021-07-26 15:34   ` Emil Lenngren
     [not found]     ` <CAJgPF1LG32ShzPsaPWC64VGRC+odvHYrUYXBiDkTdcZHH78sbQ@mail.gmail.com>
2021-07-26 19:56       ` Emil Lenngren
     [not found]       ` <CAJgPF1+BJFyryVWzVYGp=qDHjruJWYq-eAHzm+QeR=BGNct+iw@mail.gmail.com>
2021-07-26 20:17         ` Emil Lenngren [this message]
     [not found]           ` <CAJgPF1KytH81jjezgfOVxrLZzgONqfC4tdTKUy+xPFmP=5f+cw@mail.gmail.com>
2021-10-02 23:57             ` Fwd: Instable BLE connection - MTU Request, Attribute not found - wireshark findings Peter Höller

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=CAO1O6seL0QJwHB6CRq56UitWUxQk4PaMC1a-22ggk6KjoD1F1Q@mail.gmail.com \
    --to=emil.lenngren@gmail.com \
    --cc=drmedvet.hoeller@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --subject='Re: Instable BLE connection - MTU Request, Attribute not found - wireshark findings' \
    /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

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).