Bluez dbus API GATT对象丢失

时间:2019-04-12 07:46:26

标签: c dbus bluez

我当前在具有Linux内核4.4.35的嵌入式设备上使用blueZ 5.50。我将DBUS API与g_dbus结合使用,以控制具有HID主要服务(UUID 0x1812)的BLE遥控器。我需要阅读此服务的GATT特征HID信息(UUID 0x2A4A)。

当我将设备与device-api pair()方法配对时,设备将被连接。 DBus对象管理器列出了GATT对象,但没有列出与HID相关的GATT对象。

我使用的也是基于dbus API的bluetoothctl工具具有相同的行为,未列出与HID相关的gatt uuid:

[bluetooth]# pair F0:F8:F2:D4:44:EE
Attempting to pair with F0:F8:F2:D4:44:EE
[CHG] Device F0:F8:F2:D4:44:EE Connected: yes
[Notus UC]# Bluetooth: hci0 unexpected SMP command 0x0b from f0:f8:f2:d4:44:ee
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: 00001812-0000-1000-8000-00805f9b34fb
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: ab5e0001-5a21-4f05-bc7d-af01f617b664
[CHG] Device F0:F8:F2:D4:44:EE UUIDs: f000ffc0-0451-4000-b000-000000000000
[CHG] Device F0:F8:F2:D4:44:EE ServicesResolved: yes
[CHG] Device F0:F8:F2:D4:44:EE Paired: yes
[NEW] Primary Service
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0008
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Primary Service
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009
        0000180a-0000-1000-8000-00805f9b34fb
        Device Information
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char000a
        00002a23-0000-1000-8000-00805f9b34fb
        System ID
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char000c
        00002a24-0000-1000-8000-00805f9b34fb
        Model Number String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char000e
        00002a25-0000-1000-8000-00805f9b34fb
        Serial Number String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char0010
        00002a26-0000-1000-8000-00805f9b34fb
        Firmware Revision String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char0012
        00002a27-0000-1000-8000-00805f9b34fb
        Hardware Revision String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char0014
        00002a28-0000-1000-8000-00805f9b34fb
        Software Revision String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char0016
        00002a29-0000-1000-8000-00805f9b34fb
        Manufacturer Name String
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char0018
        00002a2a-0000-1000-8000-00805f9b34fb
        IEEE 11073-20601 Regulatory Cert. Data List
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0009/char001a
        00002a50-0000-1000-8000-00805f9b34fb
        PnP ID
[NEW] Primary Service
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022
        ab5e0001-5a21-4f05-bc7d-af01f617b664
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022/char0023
        ab5e0002-5a21-4f05-bc7d-af01f617b664
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022/char0025
        ab5e0003-5a21-4f05-bc7d-af01f617b664
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022/char0025/desc0027
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022/char0028
        ab5e0004-5a21-4f05-bc7d-af01f617b664
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0022/char0028/desc002a
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046
        f000ffc0-0451-4000-b000-000000000000
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0047
        f000ffc1-0451-4000-b000-000000000000
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0047/desc0049
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0047/desc004a
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char004b
        f000ffc2-0451-4000-b000-000000000000
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char004b/desc004d
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char004b/desc004e
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char004f
        f000ffc3-0451-4000-b000-000000000000
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char004f/desc0051
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[NEW] Characteristic
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0052
        f000ffc4-0451-4000-b000-000000000000
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0052/desc0054
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Descriptor
        /org/bluez/hci0/dev_F0_F8_F2_D4_44_EE/service0046/char0052/desc0055
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
Pairing successful
[CHG] Device F0:F8:F2:D4:44:EE Name: NOTUS UC
[CHG] Device F0:F8:F2:D4:44:EE Alias: NOTUS UC
[CHG] Device F0:F8:F2:D4:44:EE Modalias: bluetooth:v0217p0001d0100

在同一台设备上使用gatttool时,我可以读取该特征:

# gatttool -b F0:F8:F2:D4:44:EE -I
[F0:F8:F2:D4:44:EE][LE]> connect
Attempting to connect to F0:F8:F2:D4:44:EE
Connection successful
Notification handle = 0x0037 value: 00 00 00 00 00 00 00 00 
[F0:F8:F2:D4:44:EE][LE]> char-desc
…
handle: 0x002e, uuid: 00002a4a-0000-1000-8000-00805f9b34fb
…
 [F0:F8:F2:D4:44:EE][LE]> char-read-hnd 0x002e
Characteristic value/descriptor: 11 01 00 01

当我使用禁用的HID和Hog配置文件(--disable-hid --disable-hog)编译bluez时,gat对象在bluetoothctl和我的应用程序中可用。但我在/ dev / input /中不再有任何事件设备。

是否可以通过DBUS API访问HID特性?

0 个答案:

没有答案