hcitool lescan在蓝牙5版本上无法工作

3

我发现 hcitool 不能在 Bluetooth v5.X 硬件上运行 lescan。运行 sudo hcitool lescan 会导致以下错误:Set scan parameters failed: Input/output error

社区建议使用 bluetoothctl 替代它(例如这里),但是 gatttool 依赖于 hcitool 扫描 ble 设备。虽然 gatttool 在许多应用程序中作为 ble 后端,但仍未提供解决上述输入/输出错误的解决方案。有人知道如何解决上述错误吗?

我已经在 Windows 10 上测试了我的 BLE 的全部功能,但在 Ubuntu 上失败了。我的笔记本电脑具有以下蓝牙硬件:

$ hciconfig -a
hci0:   Type: Primary  Bus: USB
    BD Address: 4C:1D:96:30:83:6E  ACL MTU: 1021:4  SCO MTU: 96:6
    UP RUNNING 
    RX bytes:8099 acl:34 sco:0 events:591 errors:0
    TX bytes:11990 acl:34 sco:0 commands:452 errors:0
    Features: 0xbf 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
    Link policy: RSWITCH SNIFF 
    Link mode: SLAVE ACCEPT 
    Name: 'xxxx'
    Class: 0x0c010c
    Service Classes: Rendering, Capturing
    Device Class: Computer, Laptop
    HCI Version: 5.1 (0xa)  Revision: 0x100
    LMP Version: 5.1 (0xa)  Subversion: 0x100
    Manufacturer: Intel Corp. (2)

我使用的是蓝牙版本为5.53的Ubuntu 20.04操作系统。


1
你应该使用dbus API。hcitool已经过时了。 - Emil
1
Gatttool和Hcitool在2017年已经被弃用D-Bus API的文档可在以下链接中找到: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc,同时还有一些示例可供参考:https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test。 - ukBaz
@ukBaz,您能把您的评论作为答案提供吗,这样我就可以接受它了吗? - mhr
1个回答

2

您能详细解释一下吗?现在,在简单的测试/调试中,我们应该使用什么来代替 hcitool - dalanmiller
1
已更新答案,包括命令行工具名称。我认为你感兴趣的是使用BLE 5.0提供的PHY增强功能。这似乎最好通过命令行上的btmgmt完成。 - ukBaz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接