Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 拉斯比安酒店_Linux_Raspberry Pi_Bluetooth Lowenergy_Raspbian_Bluez - Fatal编程技术网

Linux 拉斯比安酒店

Linux 拉斯比安酒店,linux,raspberry-pi,bluetooth-lowenergy,raspbian,bluez,Linux,Raspberry Pi,Bluetooth Lowenergy,Raspbian,Bluez,我使用以下配置从源代码处安装了bluez-5.15: $ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc \ --localstatedir=/var --libexecdir=/lib --disable-systemd 然后我必须手动将gattool复制到/usr/local/bin目录中 $ sudo cp attrib/gatttool /usr/local/bin/ 我重新启动了Raspberr

我使用以下配置从源代码处安装了bluez-5.15:

$ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc \
--localstatedir=/var --libexecdir=/lib --disable-systemd
然后我必须手动将gattool复制到/usr/local/bin目录中

$ sudo cp attrib/gatttool /usr/local/bin/
我重新启动了Raspberry Pi,并尝试以下方法连接到我的BLE设备:

$ sudo hciconfig hci0 up

$ sudo hcitool lescan
LE Scan ...  
EA:FB:B5:CE:B0:13 DfuTarg

$ sudo hcitool lewladd EA:FB:B5:CE:B0:13

$ sudo hcitool lecc EA:FB:B5:CE:B0:13
Could not create connection: Input/output error
然后我试着联系gatttool:

$ gatttool -b EA:FB:B5:CE:B0:13 --interactive
[EA:FB:B5:CE:B0:13][LE]> connect
Attempting to connect to EA:FB:B5:CE:B0:13
Error: connect error: Device or resource busy (16)
[EA:FB:B5:CE:B0:13][LE]>

我在这里遗漏了什么-这是配置问题吗?这些错误意味着什么

根据我使用Bluez 5.15的经验

  • 确保您没有连接到BLE设备(请咨询hcitool con)
  • 不要运行hcitool lecc
  • 像你的问题中那样开始
  • 在gatttool中运行connect命令。如果命令挂起,则按下设备上的按钮(即连接到SensorTag时有时需要)
    我相信早期版本的Bluez需要hcitool lecc步骤,但现在已经不是这样了。

    首先,我和一位同事谈了我的配置,对于Raspbian(或者更具体地说,Debian),他建议以下配置设置:

    ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-library --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
    
    之后,经过进一步检查,以下是我如何成功连接的。所以发生的事情是,我试图连接的设备(基于NRF的BLE设备)要求将LE地址标志设置为“随机”。见下文:

    gatttool -t random -b EA:FB:B5:CE:B0:13 -I
    
    结果是:

    [EA:FB:B5:CE:B0:13][LE]> connect
    Attempting to connect to EA:FB:B5:CE:B0:13
    Connection successful
    [EA:FB:B5:CE:B0:13][LE]> characteristics
    handle: 0x0002, char properties: 0x0a, char value handle: 0x0003, uuid: 00002a00
    -0000-1000-8000-00805f9b34fb
    
    胡萨!此外,可能需要将安全级别设置为低于高级别:

    [EA:FB:B5:CE:B0:13][LE]> sec-level medium
    

    这是USB加密狗吗?如果您尝试拔下插头并重新插入,是否可以修复?谢谢您的帮助,但我相信我已解决了连接问题。我终于能够使用gatttool中的随机地址标志进行连接。此外,我的设备没有按钮(我没有起诉SensorTag)。当我尝试使用
    -t
    参数:
    未知选项-t
    时,我不断收到错误。这可能是什么原因?检查bluez的版本。我在Debian.nevermind上使用了5.15,我用最新版本重新安装了bluez,现在运行得很好。无论如何谢谢你!有同样的问题,我想-t随机数是关键