If remote device has name but it is empty (0 bytes) just ignore it and
continue using address as name. This will avoid sending remote device
property notification with empty name.
If loading key file from file failed free key file. This fix following:
490 (40 direct, 450 indirect) bytes in 1 blocks are definitely lost in
loss record 122 of 126
at 0x4028B4C: malloc (vg_replace_malloc.c:291)
by 0x40A25B2: g_malloc (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40B8DB1: g_slice_alloc (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40B92DC: g_slice_alloc0 (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x40946BB: g_key_file_new (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
by 0x8054A84: new_link_key_callback (bluetooth.c:563)
by 0x804FB44: notify_handler (mgmt.c:278)
by 0x804F357: queue_foreach (queue.c:186)
by 0x804FE6C: can_read_data (mgmt.c:290)
by 0x804ED12: read_callback (io-glib.c:168)
by 0x40E0CF4: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3800.2)
by 0x409CAED: g_main_context_dispatch (in /lib/i386-linux-gnu/
libglib-2.0.so.0.3800.2)
With this patch, deamon will not ask kernel to resolve name of remote
device during inquiry in case device name is already in the local cache.
Instead Android will be updated with already known device name.
This patch fix an issue when Android disables BT during ongoing
paring. In this case mgmt did not accept any commands and BT gets
in some unknown state.
Since Android turns off BT anyway, it is ok to just cancel all
the mgmt requests before send power off command.
It's now possible to add record with 128-bit UUID Service Class which
are used for custom applications. To simplify implementation adapter
uuids list stores now full UUID in uuid_t structure instead of uint16_t
short UUID.
Info is now stored for all devices and bond state depends on file.
Based on that devices loaded from storage are put either to cache
or to bonded_devices list.
Bonded devices are permament until unbondedn. Non-bonded devices will
be held in (size limited) cache based on timestamp property so split
list to ease separation.
Elements on list are struct device not bdaddr_t so make comparing
function use proper types. This was working so far only due to
bdaddr_t being first element in struct device.
JNI code in Android is mapping returned code to boolean value. Only
SUCCESS status is mapped to true and that value is returned to Java
code. This could result in faultyly triggering error path in Java
when returning DONE in command reply.
Print command opcode in handle_le_test_mode_cmd and
handle_dut_mode_send_cmd. This is valuable information on what kind
of HCI command the Java layer tries to send.
This allows to enable and disable DUT mode. This is special mode so
adding more info from related kernel commit:
"The Device Under Test (DUT) mode is useful for doing certification
testing and so expose this as debugfs option.
This mode is actually special since you can only enter it. Restoring
normal operation means that a HCI Reset is required. The current mode
value gets tracked as a new device flag and when disabling it, the
correct command to reset the controller is sent."
Groups and key file were not free on function return. This fix
following valgrind reports:
34 (16 direct, 18 indirect) bytes in 1 blocks are definitely lost in
loss record 33 of 77
at 0x4C2A2DB: malloc (in /usr/lib/valgrind/vgpreload_memcheck-
amd64-linux.so)
by 0x4E81DD0: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so
.0.3800.1)
by 0x4E74BF1: g_key_file_get_groups (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x40CDFA: read_info_complete (bluetooth.c:1672)
by 0x40827C: request_complete (mgmt.c:221)
by 0x4085E9: received_data (mgmt.c:319)
by 0x4E7C3B5: g_main_context_dispatch (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x4E7C707: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1)
by 0x4E7CB09: g_main_loop_run (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x403B15: main (main.c:439)
1,633 (72 direct, 1,561 indirect) bytes in 1 blocks are definitely lost
in loss record 75 of 77
at 0x4C2A2DB: malloc (in /usr/lib/valgrind/
vgpreload_memcheck-amd64-linux.so)
by 0x4E81DD0: g_malloc (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x4E9796D: g_slice_alloc (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x4E97EAD: g_slice_alloc0 (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x4E746DA: g_key_file_new (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x40CDD4: read_info_complete (bluetooth.c:1667)
by 0x40827C: request_complete (mgmt.c:221)
by 0x4085E9: received_data (mgmt.c:319)
by 0x4E7C3B5: g_main_context_dispatch (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x4E7C707: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1)
by 0x4E7CB09: g_main_loop_run (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x403B15: main (main.c:439)