Commit Graph

32 Commits

Author SHA1 Message Date
Szymon Janc
893b030795 android/hal-ipc: Increase bluetoothd connect timeout
Current timeout is not enough when running bluetoothd under valgrind.
2014-04-10 16:14:22 +02:00
Jakub Tyszkowski
3d8d9fef7e android/hal-ipc: Make opcode debug print more readable 2014-03-17 10:55:00 +01:00
Szymon Janc
30806e2eb9 android/hal-ipc: Fix double include of errno.h 2014-03-01 17:22:23 +01:00
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
93c12a9281 android/hal-ipc: Fix race condition when closing IPC
Protect command socket cleanup with mutex to avoid bogus exit when
stopping notification thread.
2014-02-24 20:28:41 +01:00
Szymon Janc
89008b789f android/hal: Update property used for start/stop services 2014-01-17 20:41:45 +01:00
Lukasz Rymanowski
d0df2eddd0 android: Fix error check from pthread_create
pthread_create() returns 0 on success or errno code which is non negative
number
2014-01-10 17:45:17 +02:00
Szymon Janc
d00e259514 android/hal: Check if command socket was shutdown by peer
This will allow to print proper error before exiting.
2013-11-19 16:42:02 +02:00
Szymon Janc
d7f2a7916f android/hal: Add initial code for IPC message handlers
This will allow to register and unregister handlers for IPC messages
Basic sanity check will be done in common code. Commands with variable
length will be verified against minimum size only.
2013-11-19 16:42:01 +02:00
Szymon Janc
5a8313a473 android/hal: Verify command status response before processing
This makes HAL IPC code verify error reply before processing it. It
also verify if success status was reported according to IPC spec.
2013-11-18 15:17:24 +02:00
Ravi kumar Veeramally
32776f33d2 android/hal-ipc: Add pan notification call to hal-ipc dispatch handler 2013-11-15 12:02:39 +02:00
Szymon Janc
bdbe86efab android/hal: Use hidhost instead of hh in hidhost HAL
Match functions names to HAL name. Where not needed hh prefix is
removed.
2013-11-07 18:45:06 +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
Andrei Emeltchenko
14924cd24b android/ipc: Fix receiving file descriptors
It does make sense iterate over !NULL controll headers. This fixes
the bug that file descriptors cannot be send over IPC.
2013-11-07 17:14:15 +02:00
Luiz Augusto von Dentz
6a92a05be3 android/hal-hidhost: Add implementation of .connection_state_cb 2013-10-31 15:00:10 +02:00
Grzegorz Kolodziejczyk
9b67ebb0e6 android/hal: Add skeleton for handling av notifications
Only default case is handled in skeleton
2013-10-28 11:24:12 +02:00
Andrei Emeltchenko
39bf745e92 android/hal: Associate thread to Java
Without thread assiciation callbacks are not received by Java.
They are blocked by JNI:
E/BluetoothServiceJni( 2844): Callback env check fail: env: 0x0, callback: 0x0
E/BluetoothServiceJni( 2844): Callback: 'adapter_state_change_callback' is not
called on the correct thread
2013-10-25 16:08:04 +03:00
Luiz Augusto von Dentz
1610f70cd6 android: Rename ERROR enum and command to STATUS
This is more consistent with HAL interface which does name the enum as
bt_status_t and does use BT_STATUS prefix.
2013-10-25 15:13:48 +03:00
Luiz Augusto von Dentz
55a25cb83c android/hal-msg: Reduce length of defines and struct names
The current defines and struct names are way too big and sometimes
incosistent.
2013-10-24 10:46:24 +03:00
Szymon Janc
3dbfab4372 android/hal: Verify if command response service ID match
Received response service ID should match command service ID in
command, abort if it doesn't.
2013-10-23 19:33:03 +03:00
Szymon Janc
f94baef84e android/hal: Fix crash while receiving notification
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
2013-10-23 19:32:16 +03:00
Andrei Emeltchenko
e3e957e068 android: Fix compilation error
The patch fixes errors with undefined symbols EXIT_FAILURE on Android.
2013-10-23 16:06:32 +03:00
Andrei Emeltchenko
3adac8d715 android: Check that service is started
Add check that we are able to start Bluetooth service in
Android. If service is not started we should not try to connect to it.
2013-10-23 14:02:07 +03:00
Johan Hedberg
039369d809 android: Make hal_ipc_command return directly the status 2013-10-22 17:18:02 +03:00
Johan Hedberg
bcaba49c04 android: Simply exit if hal_ipc_cmd gets an invalid fd 2013-10-22 17:01:55 +03:00
Szymon Janc
85556b7d32 android/hal: Use notification socket for daemon lifetime tracking
If daemon exited unexpectedly HAL should be stop. With cleanup
procedure command socket is closed as first so use that to distinguish
correct action.
2013-10-22 16:58:35 +03:00
Szymon Janc
5258fa30a4 android/hal: Add initial support for handling adapter notifications
Only adapter state callback is handled for now.
2013-10-22 16:17:26 +03:00
Szymon Janc
5f4a871d84 android/hal: Add initial code for notification handling
This adds a dedicated thread that will read from notification sockets
and dispatch it to appropriate service notification function.
2013-10-22 16:17:26 +03:00
Szymon Janc
ffd32c71e4 android/hal: Fix receiving of commands with no response parameter
This fix receiving of error response in case command has no reply
parameters.
2013-10-22 15:10:15 +03:00
Szymon Janc
385e1e4f25 android: Improve hal_ipc_cmd helper
Handle error response inside helper so that users don't expecting any
response don't need to provide dummy buffer only for error (which is
already return value of helper).
2013-10-22 10:32:41 +03:00
Szymon Janc
e1debdf2d4 android/hal: Add initial code for sending commands
This will be used by all HAL modules to send commands and get response
from daemon. In case of any protocol error abort.

If non-null fd pointer is passed auxiliary data with passed FD will be
received as part of response.
2013-10-21 22:46:01 +03:00
Szymon Janc
2b9988f3f7 android/hal: Move IPC and sockets related code to separate file
hal-ipc will provide functionality related to IPC initialization and
sockets handling (including upcoming callbacks thread).

This allow to remove code from bluetooth HAL not related to adapter.
2013-10-21 22:45:28 +03:00