BAESLab / Python-BLE

6 stars 6 forks source link

RuntimeError: Set scan parameters failed (are you root?) #2

Open alborzs opened 4 years ago

alborzs commented 4 years ago

I am running the BLE example code on a Raspberry Pi 4 with no luck. It is complaining regardless if I run as sudo or not, see below:

$ python3 testBLE.py
Traceback (most recent call last):
  File "testBLE.py", line 5, in <module>
    devices = service.discover(2)
RuntimeError: Set scan parameters failed (are you root?)

$ sudo python3 testBLE.py
Traceback (most recent call last):
  File "testBLE.py", line 5, in <module>
    devices = service.discover(2)
RuntimeError: Set scan parameters failed (are you root?)

The device is working fine, so that is not the problem.

$ sudo hciconfig lescan
hci0:   Type: Primary  Bus: UART
        BD Address: DC:A6:32:2A:F6:A9  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:2517 acl:0 sco:0 events:105 errors:0
        TX bytes:2564 acl:0 sco:0 commands:58 errors:0
franciscojosej commented 4 years ago

I am running the BLE example code on a Raspberry Pi 4 with no luck. It is complaining regardless if I run as sudo or not, see below:

$ python3 testBLE.py
Traceback (most recent call last):
  File "testBLE.py", line 5, in <module>
    devices = service.discover(2)
RuntimeError: Set scan parameters failed (are you root?)

$ sudo python3 testBLE.py
Traceback (most recent call last):
  File "testBLE.py", line 5, in <module>
    devices = service.discover(2)
RuntimeError: Set scan parameters failed (are you root?)

The device is working fine, so that is not the problem.

$ sudo hciconfig lescan
hci0:   Type: Primary  Bus: UART
        BD Address: DC:A6:32:2A:F6:A9  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:2517 acl:0 sco:0 events:105 errors:0
        TX bytes:2564 acl:0 sco:0 commands:58 errors:0

https://www.home-assistant.io/integrations/bluetooth_le_tracker sudo apt-get install libcap2-bin sudo setcap 'cap_net_raw,cap_net_admin+eip' readlink -f \which python3` sudo setcap 'cap_net_raw+ep'readlink -f `which hcitool``