简体   繁体   English

如何启用/禁用 Android 上的蓝牙硬件初始化日志记录?

[英]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?简短的问题是:有没有办法在 Android 上启用/禁用蓝牙硬件初始化记录? If so, how?如果是这样,怎么做?

I'm having two "Samsung Galaxy Tab A 10.5" devices and a BLE app I'm currently working on.我有两个“Samsung Galaxy Tab A 10.5”设备和一个我目前正在开发的 BLE 应用程序。 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.那些日子里,快速浏览一下 logcat 就会发现大量与HIDL相关的错误消息。 Now, a few weeks later, the HIDL messages no longer appear in logcat.现在,几周后, HIDL消息不再出现在 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.奇怪的是,logcat 中甚至没有一条与蓝牙相关的消息,这使得调试这个问题有点困难。

EDIT: Enabling HCI snoop log just revealed a single error message:编辑:启用 HCI 监听日志只显示了一条错误消息:

*** command 'lshal debug -E android.hardware.bluetooth@1.0::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?有趣的是,为什么HIDL错误消息突然停止显示,以及如何恢复它们?

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.我考虑通过阅读日志来检测蓝牙故障:如果扫描蓝牙设备没有产生任何结果并且如果记录了一些HIDL错误消息,那么应该警告用户运行应用程序的设备有问题。 Now with the HIDL error messages gone, a different approach is needed.现在HIDL错误消息消失了,需要一种不同的方法。 Do you have a better idea how to detect if Bluetooth is functioning?您对如何检测蓝牙是否正常工作有更好的了解吗?

You can enable bluetooth HCI snoop log in developer options:您可以在开发人员选项中启用蓝牙 HCI 监听登录:

device settings -> developer options -> enable bluetooth HCI snoop log.设备设置 -> 开发者选项 -> 启用蓝牙 HCI 监听日志。

Detailed instruction - how to enable HCI log. 详细说明- 如何启用 HCI 日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM