HCI Bluetooth Log Not Generated

I am running Android 4.4.2 and I have enabled the “HCI Bluetooth Tracking Log” as described here Sniffing / logging your own Bluetooth traffic for Android

After turning Bluetooth on and off, I rebooted the phone. I could not find the log file in the expected location:

$ adb pull /sdcard/btsnoop_hci.log remote object '/sdcard/btsnoop_hci.log' does not exist 

How can I get to btsnoop_hci.log?

+23
android bluetooth android-4.4-kitkat android-bluetooth s5
Feb 11 '15 at 2:25
source share
10 answers

In my experience, the Bluetooth HCI Tracking feature requires your device to be deployed. On my rooted Samsung Galaxy S GT-I9000, it works great when on my undisturbed Galaxy S3 Neo this feature doesn't work.

In addition, you must make sure that you do not accidentally delete the file. Whenever I delete a file, I have to turn on the Bluetooth tracking feature again so that the system re-creates the log file.

-9
Mar 26 '15 at 9:41
source share

UPDATE: The btsnoop hci log seems to be gradually being removed from user accessible areas on many phones. If you enable hci logging, you may get an error report

 adb bugreport anewbugreportfolder 

Then unzip the folder. If you're lucky, there is a 'FS' folder that contains the btsnoop_hci.log log several layers down (I don't know why some phones have this and some don't). If you don’t have one, take the text of the error message. file that looks like this

 bugreport-2018-08-01-15-08-01.txt 

Run btsnooz.py against it. According to Google’s instructions,

 To extract snoop logs from the bug report, use the btsnooz script. Get btsnooz.py. Extract the text version of the bug report. Run btsnooz.py on the text version of the bug report: btsnooz.py BUG_REPORT.txt > BTSNOOP.log 

As of 01.08.118, the link to btsnooz is located here: https://android.googlesource.com/platform/system/bt/+/master/tools/scripts/btsnooz.py

NO RESPONSIBILITY:

You can see where your phone stores the hci log by reading the bt_stack.conf file. Try

 adb shell cat /etc/bluetooth/bt_stack.conf 

You will see a line that looks like

 # BtSnoop log output file BtSnoopFileName =/sdcard/btsnoop_hci.log <--your file location 

Usually, but not always (depending on the phone), the root of the SDCard. There is also a line in this configuration file that can reflect if hci logging is enabled

 # EnableBtSnoop logging function # valid value : true , false BtSnoopLogOutput=false 

Switching the Enable Bluetooth HCI Bluetooth Tracking Log option in developer options should change it to

 # EnableBtSnoop logging function # valid value : true , false BtSnoopLogOutput=true 

I say "must" because for some phones this does not update this file. You should:

  1. Read the bt_stack.conf file. See where the HCI log should be and if bt snoop logging is really enabled
  2. If the developer’s options indicate that btsnoop_hci logging is turned on and the bt_stack.conf file indicates that it is turned off, try turning the power of the Bluetooth and / or phone on and off.
  3. If your phone is rutted, manually set BtSnoopLogOutput=true

If none of the 3 options work, you're out of luck. BT Snoop hci logging is a bit incompatible on different phones. I saw several phones on which I simply could not get it to work, no matter what, but in most cases you should be able to run it. A phone with a root is optional.

+75
May 20 '15 at
source share

In Nexus 5X and Pixel C Android O, you need to enable Bluetooth, enable HCI tracking in the developer’s settings, disable and re-enable Bluetooth and restart.

After that, you can get the log by going to the developer’s settings and “get a bug report” and get the full log.

The bt_stack.conf file does not change and there is no new file on / sdcard, as on other devices

+13
Oct 10 '17 at 19:28
source share

For the custom version of Pixel / Nexus, you may not have permission to extract /data/misc/bluetooth/logs/btsnoop_hci.log. You can get the hci log as follows:

 adb shell dumpsys bluetooth_manager adb bugreport > BUG_REPORT.txt 

You will receive a BUG_REPORT.txt file and a zip file. The HCI log will be found in the FS \ data \ misc \ bluetooth \ logs zip file section.

+4
Feb 28 '18 at 7:03
source share

On mine, bt_stack.conf shows / sdcard / Android / data / btsnoop_hci.log

+3
Dec 02 '15 at 2:41
source share

For Samsung s8, the magic location is / data / log / bt /
and you need root access to get it

+2
Jun 02 '18 at
source share

Here is what solved this for me:

1) adb shell cat/etc/bluetooth/bt_stack.conf

to see what the log file name is for me this is:

 /data/log/bt/btsnoop_hci.log 

The difficulty is that the files are generated with a timestamp in their names, so you cannot get them (this), just using

 adb pull /data/log/bt/btsnoop_hci.log 

2) Use adb pull/data/log/bt/ instead, and you will get the whole folder with all the logs

+2
Jan 27 '19 at 8:40
source share

On the OnePlus 6 phone (A6003, Android 9) (and, it seems to me, on other OnePlus phones), the location:

/sdcard/oem_log/btsnoop

This location does not require root or adb access. The log will have the extension .cfa and is in binary pcap format suitable for analysis, for example. Wireshark

+2
Mar 09 '19 at 17:08
source share

@TwinPrimesAreEz is excellent, but there is a fourth option; at least when your device is rooted. Call:

 /system/bin/btsnoop 

Somewhere this tool has been removed, but it still exists on my device. Whatismore seems to be called when bluetooth is turned on. In logcat I see: "btsnoop_dump :: snoop_log_open: Unable to open Dir entry". Not sure why he cannot open this dir (by the way, this is /data/media/0 ). But I suspect that this tool is somehow obstructing the new HCI tracking option integrated into Android. But if you call this tool directly (for example, through an adb shell or terminal emulator ), it works. For me, he created the file /data/media/0/hci_snoop20180203164422.cfa .

0
Feb 03 '18 at 16:01
source share

what lucas said here in the branch above: https://stackoverflow.com/a/165188/2158 correctly for Samsung Android Phone (A7) running 8.0.0.

adb: error: could not determine the remote object '/data/log/bt/btsnoop_hci.log': Permission denied - this is the error we get if I do not have root permission. Bots and inexperienced people commenting, downgrading these days, spoil the stack overflow!

0
Jul 19 '19 at 9:22
source share



All Articles