0

I am a new contributor to this site so please cut me some slack if this question sounds too simple. I have been using to Pi devices as iBeacon readers for a few weeks and i was able to find my LE beacons with no problem using hcitool lescan and hcidump. The problem i am facing now is that for some reason when i run hcitool lescan i see my devices, but hcidump doesn't see to be working - it doesn't even seem to run.

Since hcitool lescan works i know that the devices are working and that my Pi can find them.. but i need the hcidump to work as my code pulls from this output for my programs to run properly.

Any thoughts on what could be causing this? What information can I provide to help you understand the situation better?

  • what happens when you type `hcidump` while running `hcitool lescan`? Paste the output of the command into your question so we can help. – davidgyoung Dec 12 '14 at 21:41
  • Since this is happening on two devices I think it must be something with the le beacons but I don't know what I could have done to them from... I'm unfortunately clueless here.. – Brian Koffler Dec 13 '14 at 14:46
  • 1
    Here is the log file when i run `hcidump -at` which used to give me all of the information i needed. [http://108.30.56.142/test1.log] – Brian Koffler Dec 13 '14 at 21:49
  • ..and here is `hcitool lescan` printout with the same devices in the same places as the script ran above [LE SCAN](http://108.30.56.142/test2.log) – Brian Koffler Dec 13 '14 at 22:02

1 Answers1

1

This is a known bug with bluez.

To rectify it you simply need to shut down the Bluetooth interface and re-enable it.

sudo hciconfig hci0 down

sudo hciconfig hci0 up

hci0 being the interface of your Bluetooth dongle.

You can then run the dump simultaneously with the scan:

sudo hcitool lescan --duplicates & sudo hcidump -w file.txt

Jonathan Davies
  • 882
  • 3
  • 12
  • 27
  • Thanks for the response. I actually run those commands in my script prior to running the lescan or the hcidump with the same result - lescan finds the beacons but hcidump doesn't show me anything coming from them. – Brian Koffler Dec 13 '14 at 15:28
  • I will respond later tonight after I look at my code, as I cannot remember the exact way I got my dump to work – Jonathan Davies Dec 13 '14 at 15:29
  • Great thanks a lot. My dump DID work just fine but then out of nowhere.. At least I think out of nowhere.. It just stopped! – Brian Koffler Dec 13 '14 at 15:30
  • `sudo hcitool lescan --duplicates & sudo hcidump -w file.txt`. It works after you enable the interface. Push the hcidump to a file and then read it with `sudo hcidump -r file.txt`. @BrianKoffler – Jonathan Davies Dec 14 '14 at 20:41
  • That does seem to do the trick! If its not too much trouble, can you help me understand why this works? And do you have and idea why i was able to see the beacons before with a simple `hcidump -at` and now I can't? I can move forward with my projct now that i can get this data again but i am curious as to what happend. – Brian Koffler Dec 14 '14 at 20:50
  • To get it running efficiently you need to have both commands running at the same time. The `--duplicates` doesn't filter duplicates and allows the `hcidump` to constantly scan and produce results. When you look in the `file.txt` manually you won't see anything. To overcome this you can simply add `file.txt> scan.txt` to the end of the read command to output all the scans to a readable format that you can the iterate through if need be. If you need anymore help, just shout. Don't forget to tick the answer and up it :) @BrianKoffler – Jonathan Davies Dec 14 '14 at 20:57
  • How do you suggest i add a timestamp to each reading? I used to use `-t` but with this new method i am not sure how to tie that in. Please let me know your thoughts whenever you have a chance! – Brian Koffler Dec 15 '14 at 18:30
  • After `hcidump -t -w......` and when you are reading it, you can also add the `-t` after the `hcidump -t -r....`. This should work. @BrianKoffler – Jonathan Davies Dec 15 '14 at 18:38