-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to execute mgmt cmd 'le on' #190
Comments
If I run bluepy-helper directly and with sudo, I am able to execute 'le on' and 'scan' $ sudo ./bluepy-helper 1
le on
rsp=$mgmt code=$success
scan
rsp=$mgmt code=$success
rsp=$stat state=$scan dst='(null) mtu=h0 sec='low
rsp=$scan addr=b43221686C114 type=h2 rssi=h3B flag=h0 d=b02010613FF4C000C0E08D97FFED6EEE0B8CB242ECAE0AB
rsp=$scan addr=b54E18ED171AF type=h2 rssi=h3B flag=h0 d=b02010613FF4C000C0E00965954BF988565E47E8EBAD0D3
rsp=$scan addr=bACBC329E198E type=h1 rssi=h3B flag=h0 d=b02010607FF4C0010020B00
rsp=$scan addr=bA47733FC1DED type=h1 rssi=h43 flag=h0 d=b0201060303A0FE1016A0FE03FA8FCA960EF6612020203EFF06096F43617374 Digging in a little deeper.. it looks like the error message I received was because bluepy-helper didn't have the interface number specified. If I added the interface argument in blescan and everything is groovy. $ sudo /usr/local/bin/blescan -i=1
Scanning for devices...
Device (new): ac:bc:32:9e:19:8e (public), -59 dBm
Flags: <06>
Manufacturer: <4c0010020b00>
Device (new): 67:69:76:85:59:87 (random), -95 dBm
Flags: <1a>
Manufacturer: <4c0010020b00>
Device (new): 78:4f:43:6f:e0:19 (public), -59 dBm
Flags: <06>
Manufacturer: <4c0010020b00> Is this expected behavior? If a user only has one interface, should bluepy detect that automatically, without explicitly passing the interface number? $ hcitool dev
Devices:
hci1 5C:F3:70:60:03:7E |
@raykamp I actually got this to work without needing sudo, using the link you provided on a Fedora server: sudo setcap 'cap_net_raw,cap_net_admin+eip' PATH/TO/LIB/python3.5/site-packages/bluepy/bluepy-helper Make sure it's the right version of the executable. Now I can run blescan without sudo (and use it in my python code without running as a superuser) |
The issue is that this line in blte.py in the Scanner Class has the interface hard coded to 1. Run hciconfig and see what interfaces you have, and change the 0 to the number of the interface you are trying to use. def init(self, iface=0): |
Hello, I've implemented the solution proposed, Traceback (most recent call last): what can I do? |
Hey Cesarec88, Does Anything Scan?Can you quickly confirm that you are finding bluetooth devices at all? One of the below should work: pi@raspberrypi:~ $ sudo /usr/local/bin/blescan -i=0 If none of them do, you can try: $cd ~ If none of those work, you can try: My number is actually different with the two different ways to scan. I'm just trying to scan in as many different ways as possible to make sure your linux can read anything. Can I confirm, also, that you implemented djnotus' comment by using: Are You Running in Sudo?The file 'main.py' in your traceback tells me you are running a python script. Can I confirm that you are indeed running python from terminal using sudo? It is an often-overlooked problem in general. To make sure nothing in your script is throwing an error, can you go back to basics with me? I use Ian Harvey's code, http://ianharvey.github.io/bluepy-doc/scanner.html . My test file is as follows: pi@raspberrypi:~ $ cat Desktop/sample.py class ScanDelegate(DefaultDelegate):
scanner = Scanner().withDelegate(ScanDelegate()) for dev in devices: I run it by: Nothing Seems to Work!If you are still getting the error, could you modify btle.py? Then post your (now hopefully much more detailed) traceback to this forum, please. Sorry if the incredibly detailed walk-thru seems like it is babying you. Often, I get tangled in linux by omitting very small details. |
Great! I want to keep bluepy in my projects local virtualenv. I added capabilities to that file anyway and it works. But I wonder about delivering to others. I can't see any other way than asking users to run an install script that creates the venv, pip installs the requirements.txt, then run the command above and prompt for superuser password. Do you? |
Hey Ian, I'm getting the following error when running the "blescan" utility. It's a similar issue to #94, but I am using sudo.
I'm running Ubuntu 16.04.2 on an x86-64 machine.
Is there something I'm doing wrong here?
I did try using this method to give "capabilities" to the bluepy-helper program. It didn't work.
https://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root
The text was updated successfully, but these errors were encountered: