[flatfish]Support bluez in jb 4.2

RESOLVED FIXED

Status

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: shawnjohnjr, Assigned: shawnjohnjr)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Need to support bluez bluetooth stack in jb 4.2 for FXOS v1.2.
Add repo git repo in flatfish.xml

 <!-- bluez -->
  <project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="refs/tags/android-4.1.2_r2.1"/>
  <project name="platform/external/bluetooth/glib" path="external/bluetooth/glib" revision="refs/tags/android-4.1.2_r2.1"/>
  <project name="platform/external/bluetooth/hcidump" path="external/bluetooth/hcidump" revision="refs/tags/android-4.1.2_r2.1"/>


Build breaks:
1. build breaks in glib
bionic/libc/include/string.h:105:33: error: call to '__memcpy_dest_size_error' declared with attribute error: memcpy called with size bigger than destination
bionic/libc/include/string.h:109:32: error: call to '__memcpy_src_size_error' declared with attribute error: memcpy called with size bigger than source

hacky solution:
modify external/bluetooth/glib/glibconfig.h
typedef signed long long gint64;
typedef unsigned long long guint64;


2. break breaks in
make: Entering directory `/home/shawnjohnjr/workspace1/flatfish/a31-b2g'
target thumb C: audio <= external/bluetooth/bluez/audio/a2dp.c
external/bluetooth/bluez/audio/a2dp.c:33:18: fatal error: glib.h: No such file or directory
Because external/bluetooth/bluez/audio/Android.mk, include-path-for, glib is missing in build/core/pathmap.mk

Add pathmap_INCL
glib:external/bluetooth/glib \

3. Remove external/bluetooth/bluedroid (should also remove bluedroid from base-jb.xml)
4. Remove folder device/common/libbt to fix dependecy of bluedroid
After installing necessary files, just try this test steps, BT stack is working on flatfish.
echo 1 > /sys/class/rfkill/rfkill0/state
brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram /system/vendor/modules/bcm40183b2.hcd /dev/ttyS2 &
hciconfig hci0 up
hcitool scan
Since flatfish is based on platform 17 instead of platform 18. We need add configuration for platform 17 and set MOZ_B2G_BT=1.
After enabling MOZ_B2G_BT=1, build breaks in
In file included from /home/shawnjohnjr/workspace1/flatfish/a31-b2g/gecko/ipc/ril/Ril.h:11:0,
                 from /home/shawnjohnjr/workspace1/flatfish/a31-b2g/gecko/ipc/ril/Ril.cpp:22:
../../dist/include/mozilla/ipc/UnixSocket.h:16:33: fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated.
It looks like we need to add the line here in gecko/configure.in
    17)
        GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
        if test -d "$gonkdir/external/bluetooth/bluez"; then
            GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
            MOZ_B2G_BT=1
        fi
        ;;
In order to build brcm_patchram_plus, we need to add BOARD_HAVE_BLUETOOTH_BCM flag.
Add repo status for better understanding overall changes
Update b2g-manifest:
a31-b2g-manifest/commits/a00e7393430824a720a80c56ab45231e69d0eb2b
in glib/glib/gtestutils.c:1852

net_double (const gchar **ipointer)
{
...
  guint64 aligned_int64;
  memcpy (&aligned_int64, *ipointer, 8);
  *ipointer += 8;
...
This shall change to sizeof(guint64)
Just found caf glib jb-mr1 version had fixed this problem, so I will change manifest and use caf glib.
Update manifest:
commits/4b5f60e3f425e89fab252581d5b28c0f20a91015
demo version is working now. Close this bug.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.