Enabling bluez user space logs

2,803 views
Skip to first unread message

Anil

unread,
Nov 30, 2011, 10:22:11 AM11/30/11
to android-platform
Hi,

I am working on android bluetooth stack ported for a handset.It
involves android framework connected to bluez stack connected thru JNI
and d-bus.

I have found some debug messages,some of which use DBG,SDPDBG, printf,
sprintf etc.. and files with no debug logs. I want to enable these
logs and add more logs(also in files with no debug logs present) to
understand the code flow for particular test cases in HFP,HID ,A2DP
etc.

Can anyone explain how to enable debug logs in the bluez user space
code(LINUX/android/external/bluetooth/bluez) and in JNI and where to
look for these logs?


Thanks,
Anil

Alexander Petrov

unread,
Nov 30, 2011, 1:46:45 PM11/30/11
to android-...@googlegroups.com
I think for debug you must start bluetoothd with option -d
in init.rc instead of simple start of bluetoothd you should write
something like /system/bin/logwrapper -x /system/bin/bluetoothd -d

Anil Kurian

unread,
Dec 1, 2011, 7:47:18 AM12/1/11
to android-...@googlegroups.com
Hi Alexander,
 
I tried this option.ie., modified LINUX/android/system/core/rootdir/init.rc as given below:

service bluetoothd /system/bin/bluetoothd -n 

is changed to

service bluetoothd  /system/bin/logwrapper -x /system/bin/bluetoothd -d

Then build it and tested. But I am not able to turn on bluetooth.

Is there any other steps I need to do?

Best Regards,

Anil


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Alexander Petrov

unread,
Dec 1, 2011, 8:41:07 AM12/1/11
to android-...@googlegroups.com

I think you should use -n too
ie 
service bluetoothd /system/bin/logwrapper -x /system/bin/bluetoothd -d -n

2011/12/1 Anil Kurian <anil...@gmail.com>
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Jaikumar Ganesh

unread,
Dec 1, 2011, 9:55:32 PM12/1/11
to android-...@googlegroups.com
-service bluetoothd /system/bin/bluetoothd -n
+service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd -d -n

in system/core/rootdir

Anil Kurian

unread,
Dec 2, 2011, 3:23:31 AM12/2/11
to android-...@googlegroups.com
I tried service bluetoothd /system/bin/logwrapper -x /system/bin/bluetoothd -d -n
 
But still not able to turn on bluetooth.
 
When I tried service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd -d -n
 
turning on bluetooth,but did not get any log messages from bluez userspace code(external/bluetooth/bluez)( looked into adb log taken from adb_logcatViewer tool)
 
Is there any other procedure to take the log or do I have to look for logs in any other place after modifiying init.rc?

ramakrishna k

unread,
Dec 2, 2011, 11:58:12 PM12/2/11
to android-...@googlegroups.com
Hi Anil,

You can enable the logs using LOGD. Just follow the liba2dp.c for enabling logs. You need to do the below things.

1.include util/log.h
2.#define the existing DBG to LOGD.
3.Include the libcutils in Android.mk file.

you have to modify all the plugins wherever u required the logs. refer the liba2dp.c in Audio plugin.

thanks
ramakrishna

Anil Kurian

unread,
Jan 12, 2012, 7:24:30 AM1/12/12
to android-...@googlegroups.com

Hi Ramakrishna,

Please guide me to enabe bluez logs. I am not sure whether I have done the modifications correctly as you mentioned. find below the changes I have done.

I tried to enable logs in a2dp.c which is in the same location(external\bluetooth\bluez\audio) as liba2dp.c by doing the below steps.

In a2dp.c,

for step 1 you mentioned: there is already an #include "log.h". I commeneted this and added  #include util/log.h.

for step 2: Added the below statements

#define ENABLE_DEBUG
#ifdef ENABLE_DEBUG
#define DBG LOGD
#else
#define DBG(fmt, arg...)
#endif


for step3: In the location external\bluetooth\bluez\audio, there is an Android.mk file. In this file, I found libcutils in the section


LOCAL_SHARED_LIBRARIES := \
 libbt-aptx-2.3 \
 libcutils

So I did not modify this file.

But after doing these changes, build failed.

Could you please explain in detail how to do the below steps in all the files in external\bluetooth\ to get bluez userspace logs.


I tried to enable logs in the following way also.

In most of the bluez files, DBG macro is used for logging. I have changed the value of the macro BTD_DEBUG_FLAG_DEFAULT to 1 from 0 so as to make the if condition in the DBG definition to be true and execute btd_debug("%s:%s() " fmt,  __FILE__, __FUNCTION__ , ## arg).

But still logs are not getting printed to the adb log. How to get logs printed by vsyslog(DBG calls btd_debug which calls vsyslog)?

In the Vsyslog,LOG_DEBUG macro is used and I found from syslog.h that there are different log levels(LOG_EMERG,LOG_ALERT etc..). Is this the reason for not getting the logs? Do I need to change to the log level with higher priority?

Thanks,
Anil

anil....@nykkostech.com

unread,
Jan 18, 2012, 7:03:39 AM1/18/12
to android-platform
Hi,

Can someone explain in detail how to enable bluez userspace logs.

Thanks,
Anil
> > On Fri, Dec 2, 2011 at 1:53 PM, Anil Kurian <anilku...@gmail.com> wrote:
>
> >> I tried service bluetoothd /system/bin/logwrapper -x
> >> /system/bin/bluetoothd -d -n
>
> >> But still not able to turn on bluetooth.
>
> >> When I tried service bluetoothd /system/bin/logwrapper
> >> /system/bin/bluetoothd -d -n
>
> >> turning on bluetooth,but did not get any log messages from bluez
> >> userspace code(external/bluetooth/bluez)( looked into adb log taken from
> >> adb_logcatViewer tool)
>
> >> Is there any other procedure to take the log or do I have to look for
> >> logs in any other place after modifiying init.rc?
>
> >>  On Fri, Dec 2, 2011 at 8:25 AM, Jaikumar Ganesh <jaikum...@gmail.com>wrote:
>
> >>> -service bluetoothd /system/bin/bluetoothd -n
> >>> +service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd -d -n
>
> >>> in system/core/rootdir
>
> >>> On Thu, Dec 1, 2011 at 5:41 AM, Alexander Petrov <alexx...@gmail.com>wrote:
>
> >>>> I think you should use -n too
> >>>> ie
> >>>> service bluetoothd /system/bin/logwrapper -x /system/bin/bluetoothd -d
> >>>> -n
>
> >>>> 2011/12/1 Anil Kurian <anilku...@gmail.com>
>
> >>>>> Hi Alexander,
>
> >>>>> I tried this option.ie.,
> >>>>> modified LINUX/android/system/core/rootdir/init.rc as given below:
>
> >>>>> service bluetoothd /system/bin/bluetoothd -n
>
> >>>>> is changed to
>
> >>>>> service bluetoothd  /system/bin/logwrapper -x /system/bin/bluetoothd
> >>>>> -d
>
> >>>>> Then build it and tested. But I am not able to turn on bluetooth.
>
> >>>>> Is there any other steps I need to do?
>
> >>>>> Best Regards,
>
> >>>>> Anil
>
> >>>>>  On Thu, Dec 1, 2011 at 12:16 AM, Alexander Petrov <alexx...@gmail.com
> >>>>> > wrote:
>
> >>>>>>  I think for debug you must start bluetoothd with option -d
> >>>>>> in init.rc instead of simple start of bluetoothd you should write
> >>>>>> something like /system/bin/logwrapper -x /system/bin/bluetoothd -d
>
> >http://groups.google.com/group/android-platform?hl=en.- Hide quoted text -
>
> - Show quoted text -

ramakrishna k

unread,
Jan 21, 2012, 12:53:13 PM1/21/12
to android-...@googlegroups.com
Hi Anil,

liba2dp.c will be built seperately from the audio plugin. so there are two make files. I am not sure whether you are looking at the correct android.mk file. So please recheck.

thanks
ramakrishna
Reply all
Reply to author
Forward
0 new messages