0

I'm trying to connect to a BLE device with BlueZ and standard tools like gatttool, and monitoring the results with btmon.

Everything worked until yesterday, when one device started to fail. During connection, btmon creates this log:

< HCI Command: LE Create Connection (0x08|0x000d) plen 25
...
> HCI Event: Command Status (0x0f) plen 4
      LE Create Connection (0x08|0x000d) ncmd 5
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
...
@ MGMT Event: Device Connected (0x000b) plen 20
        LE Address: AA:BB:CC:DD:EE:FF (XYZ)
        Flags: 0x00000008
          **Unknown device flag (0x00000008)**
        Data length: 7
        Flags: 0x06

What is that "Unknown device flag"?

Is it causing the device to be immediately disconnected?

Here is the complete btmon log with colors:

enter image description here

As you can see, in less than 1 second, the device is considered disconnected. It seems like something is really preventing this connection and I can't figure out what is it.

Daniel
  • 2,318
  • 2
  • 22
  • 53
  • `Unknown device flag` is printed when there is a flag that is not known by btmon https://github.com/bluez/bluez/blob/master/monitor/packet.c#L12719 . What version of BlueZ are you using? If I skip back a few versions then bit 3 (hex 08) doesn't have a setting. https://github.com/bluez/bluez/blob/808be93a11a54074aba901718d37aacaaa292356/monitor/packet.c#L12047-L12052. Not sure why you are suddenly getting the issue. Did the firmware get updated on the device? – ukBaz Mar 18 '23 at 07:21
  • gatttool were [deprecated by the BlueZ project](https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=b1eb2c4cd057624312e0412f6c4be000f7fc3617) in 2017. `bluetoothctl` is the supported command line tool for scanning and connecting to devices. – ukBaz Mar 18 '23 at 07:25
  • Don't focus too much on that flag, I would say. Instead try to focus on the issue "Connection failed to be established". See https://stackoverflow.com/a/63813446/556495 for a list of reasons for that error to occur. – Emil Mar 18 '23 at 15:44

1 Answers1

0

just wipe previous data first from emmulator by clicking on three dots then click on wipe data.