BAESLab / Python-BLE

6 stars 6 forks source link

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

Open zhengyangtongxie opened 8 years ago

zhengyangtongxie commented 8 years ago

hello,I have followed your guide and successfully install gattlib. However,when i type it on terminate: sudo python ble-scan.py I received that:

Traceback (most recent call last): File "scan.py", line 4, in devices = service.discover(2) RuntimeError: Set scan parameters failed (are you root?)

My operate system is ubuntu 15.04 which work on vmware workstation, Do you know how to solve it ? Thank you.

aytekno commented 8 years ago

Hello. Also I have the same problem. Do you have any solution. Thank you.

zhengyangtongxie commented 8 years ago

@aytekno hi,aytekno. The virtual machine can't work well.You must install gattlib on your original operate system.Hope it will help you.

pariwat commented 8 years ago

@aytekno @zhengyangtongxie I have same problem.

image

You may have Bluetooth USB one more. you try command: hciconfig
image

In code you change line 20: service = BeaconService("hci0") // to hci1

it will help you. ^^

aytekno commented 8 years ago

Thank you very much.

2016-06-03 10:30 GMT+03:00 Pariwat Leamsumran notifications@github.com:

I have same problem.

[image: image] https://cloud.githubusercontent.com/assets/2516987/15771656/7a0794b0-2996-11e6-9e42-e96cdd7b24ed.png

You may have Bluetooth USB one more. you try command: hciconfig

[image: image] https://cloud.githubusercontent.com/assets/2516987/15771787/3a2e5076-2997-11e6-8497-e7197f15a385.png

In code you charge line 20: service = BeaconService("hci0") // to hci1

it will help you. ^^

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BAESLab/Python-BLE/issues/1#issuecomment-223510430, or mute the thread https://github.com/notifications/unsubscribe/ASz69RM5LP_679jGR_XpgQrNSfodB0Reks5qH9f7gaJpZM4G-i52 .

Saygılarımla, Ayşenur Hatipoğlu

jularboolean commented 7 years ago

I get the same error on Raspberry 3, "hci0" should be correct. Still "RuntimeError: Set scan parameters failed (are you root?)". Any ideas?

pariwat commented 7 years ago

@PugSQL You should turn off any bluetooth devices and run python script. ^^

b23prodtm commented 4 years ago

Hi, I found original library from BLE at pygattlib/discover.py that fixed this issue in my discovery.py. There you must import from gattlib not bluetooth.ble and import DiscoveryService

aytekno commented 4 years ago

Thank you Tiana.

12 Nis 2020 Paz, saat 16:18 tarihinde Tiana Rakoto Arimanana < notifications@github.com> şunu yazdı:

Hi, I found original library from BLE at pygattlib/discover.py https://bitbucket.org/OscarAcena/pygattlib/src/default/examples/discover.py that fixed this issue in my discovery.py. There you must import from gattlib not bluetooth.ble and import DiscoveryService

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BAESLab/Python-BLE/issues/1#issuecomment-612613085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPV5OSRIMQ6WBQM2KPIW3RMG5TZANCNFSM4BX2FZ3A .

-- Saygılarımla, Ayşenur Hatipoğlu

autostock commented 1 year ago

This worked for me. From https://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root

sudo apt-get install libcap2-bin # was already installed
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which python3` # problem: python3 was a symlink to python3.7
ls -l /usr/bin/python3 # where is the symlink going
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which python3.7`
python3 scanBLE.py