gpt4 book ai didi

bluetooth - rfcomm 蓝牙权限被拒绝错误树莓派

转载 作者:行者123 更新时间:2023-12-04 10:36:08 26 4
gpt4 key购买 nike

我正在使用蓝牙加密狗尝试将信息从 ubuntu 15.04 发送到运行最新的 debian jessie 镜像的 raspberry pi b+。我只是关注http://people.csail.mit.edu/albert/bluez-intro/教程。我得到了简单的 RFCOMM 和 L2CAP 协议(protocol)工作。我在运行 SDP 协议(protocol)时遇到问题。服务器代码是 -

from bluetooth import *

server_sock = BluetoothSocket(RFCOMM)
server_sock.bind(("", PORT_ANY))
server_sock.listen(1)

advertise_service(server_sock, "SampleServer",service_classes=[SERIAL_PORT_CLASS], profiles=[SERIAL_PORT_PROFILE])

client_sock, client_info = server_sock.accept()

print "connection from: ", client_info

client_sock.send("PyBluez server says Hello!")
data = client_sock.recv(1024)
print "received: ", data

client_sock.close()
server_sock.close()

我得到的错误是 -
Traceback (most recent call last):
File "rfcomm-server.py", line 7, in <module>
advertise_service(server_sock, "SampleServer",service_classes=[SERIAL_PORT_CLASS], profiles=[SERIAL_PORT_PROFILE])
File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 176, in advertise_service
raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (13, 'Permission denied')

这是我采取的一些步骤-
Add the user 'pi' to lp group
run piscan on hciconfig hci0
Add --compat option to bluetoothd in bluetooth.service

任何帮助,将不胜感激。谢谢!

最佳答案

这个解决方案对我有用:

sudo chmod o+rw /var/run/sdp
谢谢@eigenfield

关于bluetooth - rfcomm 蓝牙权限被拒绝错误树莓派,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34599703/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com