システム: Bluez 5.38 を搭載した Ubuntu 15.10
BlueZ 4 を使用した PyBluez では、この問題は発生しませんでした。しかし、BlueZ 5 に移行し、Bluetooth コードを実行するために必要な調整を行って以来、sudo
. sudo
すべてを使用すると、期待どおりに機能します。ただし、sudo なしで実行すると、次のエラーがスローされます。
Traceback (most recent call last):
File "/home/sidmeister/mymodule/py34/lib/python3.4/site-packages/PyBluez-0.22-py3.4-linux-x86_64.egg/bluetooth/bluez.py", line 240, in advertise_service
protocols)
_bluetooth.error: (13, 'Permission denied')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/sidmeister/mymodule/mymodule/blue/receiver.py", line xxx, in some_function
profiles=[bluetooth.SERIAL_PORT_PROFILE]
File "/home/sidmeister/mymodule/py34/lib/python3.4/site-packages/PyBluez-0.22-py3.4-linux-x86_64.egg/bluetooth/bluez.py", line 242, in advertise_service
raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (13, 'Permission denied')
これは、新しい bluetooth ライブラリでセキュリティが強化されたことに起因することを理解していますsudo
。しかし、video
Bluetooth への固有のアクセス権を持つ特別なグループ (カメラにアクセスする場合など) があり、ユーザーをそのグループのメンバーにして、Bluetooth なしでアクセスできるようになりますsudo
か? 参考までに、私のユーザーはすでにdialout
グループのメンバーであり、役に立ちません。
この問題に対処できる他の方法があれば教えてください。