Commit Graph

79 Commits

Author SHA1 Message Date
Szymon Janc
7d95d027b1 android: Create comon header for IPC
This header contains IPC specific structures and code not related to
BT and audio HAL protocols. This allows to fully decouple IPC from
HAL messages.

This is first step to make HAL part of IPC unit-testable and reusable
between BT HAL and audio HAL.
2014-02-28 15:22:45 +01:00
Szymon Janc
aa887bf05a android: Update socket service id name to match service name 2014-02-24 13:45:09 +01:00
Szymon Janc
4d28eb85b7 android/hal-bluetooth: Use fixed size buffers for commands
This make code follow same conventions for all commands.
2014-02-21 11:18:37 +01:00
Szymon Janc
c3b4322d18 android/hal-socket: Match functions names with HAL name 2014-02-19 18:37:03 +01:00
Szymon Janc
db17fbe467 android/handsfree: Add initial files
This adds initial HAL and daemon code for Handsfree profile.
2014-02-05 09:53:53 +01:00
Luiz Augusto von Dentz
44ef6f0c4c android: Add initial skeleton for AVRCP in the HAL 2014-01-26 16:19:24 -08:00
Szymon Janc
89008b789f android/hal: Update property used for start/stop services 2014-01-17 20:41:45 +01:00
Szymon Janc
8622810347 android: Remove support for old Android versions
This removes compatibility with Android 4.3 and older. Android 4.4 is
current target. Due to bug in Audio HAL in 4.2 build was failing on
that version anyway.
2014-01-14 12:57:18 +01:00
Szymon Janc
c927bb6db3 android/hal-bluetooth: Add debug print to config_hci_snoop_log
Improves debugs and make it consistent with other methods.
2014-01-01 18:28:50 +02:00
Szymon Janc
4758660275 android/hal-bluetooth: Update snoop service name
Match service name with android snoop binary name. It is more common
to use '-' instead of '_' in the code for binaries name.
2014-01-01 18:27:58 +02:00
Szymon Janc
c192841088 android/bluetooth: Remove not needed local variable
Both manufacturer and sub_version already have correct type and struct
is marked as packed so there is no need to memcpy to temp variable.
2013-12-20 15:23:54 +02:00
Szymon Janc
b6b3ff89c9 android/bluetooth-hal: Fix using wrong struct for buffer size
Buffer is for hal_cmd_le_test_mode command.
2013-12-20 15:23:43 +02:00
Andrei Emeltchenko
40cef67567 android/hal-bluetooth: Free device on close() 2013-12-20 14:20:25 +02:00
Szymon Janc
2ce7e74bbb android/hal-bluetooth: Add support for device service record property
This allows to correctly handle device service record property.
2013-12-20 12:57:26 +02:00
Szymon Janc
9690e662ce android/hal-bluetooth: Add support for remote version info property
This allows to correctly handle remote version info property. Although
this property is marked as get/set in HAL only get is implemented as
I fail to see how this property could be settable.
2013-12-20 12:57:24 +02:00
Szymon Janc
88e025c862 android/hal-bluetooth: Add support for enabling HCI snoop dump
This allows to enable HCI SNOOP dump from HAL. This requires that
service named 'bluetoothd_snoop' be available in Android system.
2013-12-20 12:57:21 +02:00
Szymon Janc
77ef450f2d android/hal-bluetooth: Add support for sending LE_TEST_MODE command
This allows to send LE_TEST_MODE command introduced in Android 4.3.
2013-12-20 12:57:12 +02:00
Jakub Tyszkowski
e57b702e8c android: Fix sending status on bluetooth init if already initialized
We should be sending BT_STATUS_DONE when calling init on already
initialized interface like Bluedroid does. This indicates that previosly
registered callbacks are still registered, not those passed with second
init call.
2013-12-08 17:47:42 +02:00
Szymon Janc
85512df86d android/hal-bluetooth: Fix sending invalid adapter property
If property to be set is of enum type it should be first converted to
byte value as size of enum might varry depending on architecture.

To keep code simple command buffer uses len received from framework
as this is more or equal to HAL property size.
2013-11-29 10:32:00 +02:00
Szymon Janc
364018d243 android/hal-bluetooth: Rename create_enum_prop to enum_prop_to_hal
This better describes purpose of this macro.
2013-11-29 10:31:14 +02:00
Szymon Janc
034e30e642 android/hal-bluetooth: Use static memory for enum convertion
There is no need to use dynamic allocation for enum properties
convertion. Each property type can be present only once in properties
callback so using static allocation is safe. This also remove need
for cleanup properties after HAL callback is called making code
simpler.
2013-11-25 14:45:59 +02:00
Johan Hedberg
23200acf0a android: Fix expected size of hal_ev_ssp_request 2013-11-19 22:35:47 +02:00
Szymon Janc
3e0b74007b android/hal-bluetooth: Remove not needed check in get_adapter_property
Properties types are verified on daemon side and proper error is
returned on wrong type. No need to double check that on HAL side.
2013-11-19 18:26:46 +02:00
Szymon Janc
2399cd19e6 android/hal-bluetooth: Remove not needed check in set_adapter_property
Properties types are verified on daemon side and proper error is
returned on wrong type. No need to double check that on HAL side.
2013-11-19 18:24:49 +02:00
Szymon Janc
d090b7b8e5 android/hal-bluetooth: Handle dut mode receive event
Pass received data to callback if it is present.
2013-11-19 18:24:34 +02:00
Szymon Janc
a293f0e8f4 android/hal-bluetooth: Remove not needed __func__ from debug print
DBG macro already adds function name to print output.
2013-11-19 18:24:12 +02:00
Szymon Janc
697405ef01 android/hal-bluetooth: Add support for dut mode send command
This is used to send test HCI commands when DUT mode is enabled.
2013-11-19 18:22:43 +02:00
Szymon Janc
2fcb0e3903 android/hal-bluetooth: Add support for dut mode configure command
This command is used to enter or exit DUT mode.
2013-11-19 18:22:33 +02:00
Szymon Janc
b43aac26d2 android/hal-bluetooth: Add support for get remote service record cmd 2013-11-19 18:21:57 +02:00
Szymon Janc
d99a0d216f android/hal-bluetooth: Add support for set remote device property cmd
This command is used to set remote device property of specified type.
2013-11-19 18:21:22 +02:00
Szymon Janc
598f60cbd3 android/hal-bluetooth: Add support for get remote device properties cmd
This command is used to get all properties of remote device.
2013-11-19 18:21:11 +02:00
Szymon Janc
c916ed5ff2 android/hal-bluetooth: Add support for get remote device property cmd
This command is used to get remote device property of specifided type.
2013-11-19 18:20:48 +02:00
Szymon Janc
c58070eb1e android/hal-bluetooth: Register IPC message handlers
Register handlers on service init. Since this requires all handlers to
be registered (unknown opcode is considered IPC error) missing handlers
stubs are provided.
2013-11-19 16:42:01 +02:00
Andrei Emeltchenko
d39e947a1f android/debug: Move debug functions to hal-utils.c
Debug functions will be used by HALs and haltest.
2013-11-14 10:27:15 +02:00
Ravi kumar Veeramally
ab8a2ab554 android: Fix opcode parameter type from uint16_t to uint8_t 2013-11-13 11:27:46 +02:00
Szymon Janc
931eb9f16d android/hal: Use a2dp instead of av in a2dp HAL
Match functions names to HAL name. Where not needed av prefix is
removed.
2013-11-07 17:59:01 +02:00
Marcin Kraglak
5658fadf26 android/hal: Send get_remote_services cmd 2013-11-04 10:20:07 +02:00
Andrei Emeltchenko
be06afd877 android/hal: Add extra logs to HAL
Use exported functions from hal test tool to print properties.
2013-11-04 09:29:09 +02:00
Andrei Emeltchenko
c70142b3f4 android/hal: Add debug prints for every HAL callback
This allows us to trace callbacks to Java.
2013-11-01 16:39:07 +02:00
Andrei Emeltchenko
981b04355e android/hal: Handle acl_state_changed event 2013-11-01 16:39:07 +02:00
Szymon Janc
08e6aadd83 android/hal: Add support for repacking received IPC data to HAL data
Some HAL defined types that are passed as type-len-value in properties
callback needs to be repacked at runtime to match defined types.

This is due to HAL using data types without strict refined sizes like
enums or unpacked structures. This is needed only if data is passed as
TLV. With data passed to callbacks as parameters compiler will handle
types convertion.

Currently only enum types are supported.
2013-10-31 10:55:43 +02:00
Jakub Tyszkowski
ccfc207b4f android/hal: Add device state changed event handler
This is used to report property change of already reported remote
device.
2013-10-30 12:11:55 +02:00
Jakub Tyszkowski
56f12d1a33 android/hal: Add device found event handler
This is called when new remote device is found.
2013-10-30 12:11:46 +02:00
Jakub Tyszkowski
66f9de59f3 android/hal: Extract bt property repacking code for further reuse
This extracted part of code can be reused for repacking remote device
properties.
2013-10-30 12:11:33 +02:00
Jakub Tyszkowski
2cbbb5bbb6 android/hal: Add support for handling discovery state change event 2013-10-30 12:11:24 +02:00
Jakub Tyszkowski
98f4e39831 android/hal: Add support for start/cancel device discovery commands 2013-10-30 12:11:13 +02:00
Szymon Janc
556507b49d android/hal: Add support for handling SSP request event 2013-10-29 15:06:08 +02:00
Szymon Janc
10e7618ca5 android/hal: Add support for handling pin request event 2013-10-29 15:05:15 +02:00
Szymon Janc
b201633af3 android/hal: Add support for handling bond state change event 2013-10-29 14:11:42 +02:00
Szymon Janc
2abdd0364c android/hal: Set callbacks before initializing IPC
Notification thread is started on IPC init and it can be scheduled
before main thread.

Fix following crash on HAL init:

pid: 3392, tid: 3492, name: droid.bluetooth  >>> com.android.bluetooth <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000028
    eax 00000000  ebx ce047f64  ecx ce0405d0  edx f7763724
    esi cdf3af00  edi f837fb90
    xcs 00000023  xds 0000002b  xes 0000002b  xfs 00000000  xss 0000002b
    eip ce042289  ebp cdf3a9f8  esp cdf3a9e0  flags 00010292

backtrace:
    #00  pc 00003289  /system/lib/hw/bluetooth.default.so (bt_thread_associate+25)
    #01  pc 000015f8  /system/lib/hw/bluetooth.default.so (notification_handler+40)
    #02  pc 0000f804  /system/lib/libc.so (__thread_entry+276)
    #03  pc 0002999d  /system/lib/libc.so
    #04  pc 00082ae7  /system/lib/libdvm.so (dvmThreadSelf()+39)
    #05  pc 00010db9  /system/lib/libc.so (pthread_mutex_unlock+25)
2013-10-29 14:03:39 +02:00