SePröbläm
SePröbläm

Reputation: 5729

How to enable / disable Bluetooth hardware initialization logging on Android?

The short question is: Is there a way to enable / disable logging of the Bluetooth hardware initialization on Android? If so, how?

I'm having two "Samsung Galaxy Tab A 10.5" devices and a BLE app I'm currently working on. The app is working flawlessly on one device. The second device, however, does not find any Bluetooth devices when scanning.

The issue was discovered about a month ago. Those days a quick look at logcat revealed plenty of HIDL related error messages. Now, a few weeks later, the HIDL messages no longer appear in logcat. However, scanning still doesn't work. Oddly enough, there's not even a single Bluetooth related message in logcat, which makes debugging this issue a little difficult.

EDIT: Enabling HCI snoop log just revealed a single error message:

*** command 'lshal debug -E [email protected]::IBluetoothHci/default' failed: exit code 128

It is obvious that one of the tablets is damaged. Interesting is why the HIDL error messages all out of a sudden stopped showing up, and how to get them back?

The actual problem is that Bluetooth, although initialization finishes without errors, isn't working. The question is, how can an app detect it and warn the user about it?

I thought about detecting malfunctioning Bluetooth by reading the logs: If scanning for Bluetooth devices does not yield any results and if there are some HIDL error messages logged, than the user should be warned that there is something wrong with the device running the app. Now with the HIDL error messages gone, a different approach is needed. Do you have a better idea how to detect if Bluetooth is functioning?

Upvotes: 2

Views: 1518

Answers (1)

Anatolii Chub
Anatolii Chub

Reputation: 1300

You can enable bluetooth HCI snoop log in developer options:

device settings -> developer options -> enable bluetooth HCI snoop log.

Detailed instruction - how to enable HCI log.

Upvotes: 3

Related Questions