Skip to content

BLE device not discoverable with wble-clone and NRF52840 #257

Description

@Krakoer

Setup

  • Whad v1.2.9
  • Butterfly v1.0.1
  • NRF52840 Nordic dongle

Misbehavior

The device can successfully connect to a BLE device, and subscribe to a characteristic.
However, when trying to spawn a BLE device using wble-clone, the device is not discoverable:

profile.json
{
  "services": [
    {
      "uuid": "1801",
      "type_uuid": "2800",
      "start_handle": 1,
      "end_handle": 5,
      "characteristics": [
        {
          "handle": 2,
          "uuid": "2803",
          "properties": 32,
          "security": 0,
          "value": {
            "handle": 3,
            "uuid": "2A05",
            "data": ""
          },
          "descriptors": [
            {
              "handle": 4,
              "uuid": "2902",
              "value": "0000"
            }
          ]
        }
      ]
    },
    {
      "uuid": "1800",
      "type_uuid": "2800",
      "start_handle": 20,
      "end_handle": 28,
      "characteristics": [
        {
          "handle": 21,
          "uuid": "2803",
          "properties": 2,
          "security": 0,
          "value": {
            "handle": 22,
            "uuid": "2A00",
            "data": "50726f67726573736f72"
          },
          "descriptors": []
        },
        {
          "handle": 23,
          "uuid": "2803",
          "properties": 2,
          "security": 0,
          "value": {
            "handle": 24,
            "uuid": "2A01",
            "data": "0000"
          },
          "descriptors": []
        },
        {
          "handle": 25,
          "uuid": "2803",
          "properties": 2,
          "security": 0,
          "value": {
            "handle": 26,
            "uuid": "2AA6",
            "data": "00"
          },
          "descriptors": []
        }
      ]
    },
    {
      "uuid": "7e4e1701-1ea6-40c9-9dcc-13d34ffead57",
      "type_uuid": "2800",
      "start_handle": 40,
      "end_handle": 65535,
      "characteristics": [
        {
          "handle": 41,
          "uuid": "2803",
          "properties": 10,
          "security": 0,
          "value": {
            "handle": 42,
            "uuid": "7e4e1703-1ea6-40c9-9dcc-13d34ffead57",
            "data": ""
          },
          "descriptors": []
        },
        {
          "handle": 43,
          "uuid": "2803",
          "properties": 50,
          "security": 0,
          "value": {
            "handle": 44,
            "uuid": "7e4e1702-1ea6-40c9-9dcc-13d34ffead57",
            "data": "0108cba58fbdfe360000"
          },
          "descriptors": [
            {
              "handle": 45,
              "uuid": "2902",
              "value": "0000"
            }
          ]
        }
      ]
    }
  ],
  "devinfo": {
    "adv_data": "0201060b0950726f67726573736f72020a09",
    "bd_addr": "24:ec:4a:80:9e:e6",
    "addr_type": 0,
    "scan_rsp": ""
  }
}

Debug logs: https://pastebin.com/RN5fEbas
The dongle LED blinks green, but the no scan methods such as nrfConnect or even WHAD with the other hci interface can see the device.

I also tried with the documentation python script:

from whad.ble import Peripheral
from whad.ble.profile.advdata import AdvCompleteLocalName, AdvDataFieldList, AdvFlagsField
from whad.ble.profile.attribute import UUID
from whad.ble.profile import PrimaryService, Characteristic, GenericProfile
from whad.device.uart import WhadDevice

class CustomProfile(GenericProfile):
    """Custom GATT profile"""

    # Define a generic access service (GAS) with UUID 0x1800
    gas = PrimaryService(
        uuid=UUID(0x1800),

        # Define a DeviceName characteristic with read/write permissions
        device_name = Characteristic(
            uuid=UUID(0x2A00),

            # Read/write permissions
            permissions=['read', 'write'],

            # Characteristic supports notifications with a
            # ClientCharacteristicConfiguration descriptor (CCCD)
            notify=True,

            # Default value for this characteristic
            value=b"TestDevice"
        )
    )

# Create an instance of Peripheral class using HCI device hci0 and a custom
# profile defined in CustomProfile
profile = CustomProfile()
peripheral = Peripheral(
    WhadDevice.create("uart0"),
    profile=profile,
    adv_data=AdvDataFieldList(
        AdvFlagsField(), # Defines a default Flags record
        AdvCompleteLocalName(b"TestDevice") # Adds a CompleteLocalName record
    )
)

peripheral.start()

input()

but got the same results, I cannot find my device while scanning.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BLEBluetooth Low EnergybugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions