Andorid BlueZ Debug Enable

打开Android BlueZ Debug 开关:


Enable Bluetoothd debugging

Way1:

    In file external/bluetooth/bluez/src/log.h
    Redefine DBG as follow:

1)
#define DBG(fmt, arg...) __android_log_print(ANDROID_LOG_DEBUG, "BlueZ", fmt, ## arg)
2)
add file as header in log.h:
#include <android/log.h>
3)
void __btd_toggle_debug()                                                                                                                                    
{
    struct btd_debug_desc *desc;

//  for (desc = __start___debug; desc < __stop___debug; desc++)
//      desc->flags |= BTD_DEBUG_FLAG_PRINT;
}

void __btd_log_init(const char *debug, int detach)
{
    int option = LOG_NDELAY | LOG_PID;
    struct btd_debug_desc *desc;
    const char *name = NULL, *file = NULL;

    if (debug != NULL)
        enabled = g_strsplit_set(debug, ":, ", 0);
/*
    for (desc = __start___debug; desc < __stop___debug; desc++) {
        if (file != NULL || name != NULL) {
            if (g_strcmp0(desc->file, file) == 0) {
                if (desc->name == NULL)
                    desc->name = name;
            } else
                file = NULL;
        }

        if (is_enabled(desc))
            desc->flags |= BTD_DEBUG_FLAG_PRINT;
    }
*/


Way 2:
In file external/bluetooth/bluez/src/log.h:
1.
Add
#include <cutils/logd.h>

2.
Before:
#define BTD_DEBUG_FLAG_DEFAULT (0)
#define BTD_DEBUG_FLAG_PRINT (1 << 0)
After
#define BTD_DEBUG_FLAG_DEFAULT 1
#define BTD_DEBUG_FLAG_PRINT 1

3.
Before:
#define DBG(fmt, arg...) do { \
static struct btd_debug_desc __btd_debug_desc \
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
btd_debug("%s:%s() " fmt, __FILE__, __FUNCTION__ , ## arg); \
} while (0)
After:
#define DBG(fmt, arg...) do { \
static struct btd_debug_desc __btd_debug_desc \
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
__android_log_print(ANDROID_LOG_DEBUG, "BlueZ",fmt, ##arg); \
} while (0)

End.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值