Andorid BlueZ Debug Enable

Source: Internet
Author: User

Turn on the Android BlueZ Debug switch:

Enable incluthd 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) www.2cto.com
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.


By saturnbj

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.