Hi,

I have successfully ported hcidump into android so that we are able to
monitor data send by bluetooth interface.I would love to write a blog post
on it explaining how to compile it at umit blog.

I have compiled it on Ubuntu 11.04 64 bit for Android 1.6 . I'll provide
the instruction for 32 bit in blog post.

Here are the basic instructions:

APP_ROOT represent application root folder.

We need to download following things:

1- Bluez code:
from: https://android.googlesource.com/platform/external/bluez.git
into: folder named "bluez" at APP_ROOT/jni/

2- Frash code:
from: 
https://github.com/comex/frash/<https://github.com/comex/frash/tree/master/utils/cutils>
into: folder named "frash" at APP_ROOT/jni/bluez/libs/

3- Bluez-repositories:
from: git://git.kernel.org/pub/scm/bluetooth/bluez.git
into: folder named "bluez-repos" at APP_ROOT/jni/

edit Android.mk at APP_ROOT/jni/bluez/libs/ to :


LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
 src/bluetooth.c \
src/sdp.c \
 src/hci.c

LOCAL_C_INCLUDES+= \
 $(LOCAL_PATH)/include \
 $(LOCAL_PATH)/frash/utils

LOCAL_MODULE:=libbluetooth

LOCAL_CFLAGS+=-O3

include $(BUILD_SHARED_LIBRARY)


copy all files from APP_ROOT/jni/bluez/hcidump/ into APP_ROOT/jni/

then edit APP_ROOT/jni/Android.mk to:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_C_INCLUDES:= \
 $(call include-path-for,bluez-libs) \
$(LOCAL_PATH)/bluez-repos/lib

LOCAL_CFLAGS:= \
-DVERSION=\"1.41\" \
 -lbluetooth

LOCAL_MODULE_TAGS := debug
LOCAL_MODULE:=hcidump

LOCAL_SRC_FILES:= \
src/hcidump.c \
 parser/avctp.c \
parser/avdtp.c \
 parser/bnep.c \
parser/bpa.c \
 parser/capi.c \
parser/cmtp.c \
 parser/csr.c \
parser/ericsson.c \
 parser/hci.c \
parser/hcrp.c \
 parser/hidp.c \
parser/l2cap.c \
 parser/lmp.c \
parser/obex.c \
 parser/parser.c \
parser/ppp.c \
 parser/rfcomm.c \
parser/sdp.c \
 parser/tcpip.c

LOCAL_SHARED_LIBRARIES := \
libbluetooth



include $(BUILD_EXECUTABLE)
include $(LOCAL_PATH)/bluez/libs/Android.mk


Running ndk-build at APP_ROOT will build binary into libs/armeabi.

Source code of my application can be found here:
https://github.com/d34th4ck3r/Hcidump-in-Android


Here is sample output:

# ./hcidump
HCI sniffer - Bluetooth packet analyzer ver 1.41
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
> HCI Event: Command Status (0x0f) plen 4
> HCI Event: Connect Complete (0x03) plen 11
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
> ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2


Thanks,
Gautam Bajaj
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Umit-devel mailing list
Umit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/umit-devel

Reply via email to