Android HAL defines some properties as adapter specific, some as
device specific and some as common. We split those to separate
adapter and device properties hence overlaping or holes in codes.
This patch allows tool to read commands from .haltestrc.
So it is possible to call some functions that are typically used.
So user can have:
adapter init
adapter get_profile_interface socket
adapter get_profile_interface pan
adapter get_profile_interface hidhost
adapter get_profile_interface a2dp
pan init
av init
Mostly indentation of arguments in functions and calls.
Prefix p remove from puser/penum_func.
Some empty lines added after closing } when needed.
Magic number for string length changed to preprocessor define.
Added spaces after casts.
The patch makes haltest and bluetoothd depend on bluetooth.default target
which is already defined. glib dependency Android resolves itself.
Fixes issue that for the fresh build only bluetooth.default.so is built.
Current Android log backed dones't enable debug logs. Instead of coping
code from src/log.c, just use it on Android as well.
No functionality is lost as currently Android log backed only prints
to standard output.
Instead of hardcoding index 0 use real index of adapter. This fix
using invalid index if adapter ID happens to be different than 0.
This should not happen on Android but is possible while testing on
Linux PC.
There is no need to pass pointer to adapter between function as there
is only one adapter in android daemon. Also default_adapter is renamed
to adapter.
There is no need to pass adapter pointer as user data since there is
only one adapter present.
Make bt_adapter_init return void and use ready callback for error
reporting. This also fix returning incorrect status and invalid
mgmt_if unref (mgmt_send return 0 on error or >0 on success).
This fix following crash:
Invalid read of size 8
at 0x408B33: notification_handler (hal-ipc.c:122)
by 0x4E39E99: start_thread (pthread_create.c:308)
Address 0x8 is not stack'd, malloc'd or (recently) free'd
Using helper function allows us to overcome possible location
change in future Android releases. This was inspired by
Szymon Janc's comment to my previous patch.
Android uses functions and defines from sys/capability.h which
requires additional include. However file capability.h shows up
in bionic in version Android 4.3, therefore we do check
PLATFORM_SDK_VERSION to no break builds of previous Android versions.
In previous Android version unistd.h contain this functionality.
Since the headers were copied to android/ folder Android build started
to use those instead of original Android system headers. The patch
puts Android system headers first.