Commit Graph

55 Commits

Author SHA1 Message Date
Szymon Janc
7a2d604673 android: Make multi-line comments style consistent
Use common style for multi-line comments consistent with rest of
codebase.
2014-04-29 13:31:00 +02:00
Szymon Janc
ff17170acd android/hidhost: Remove not needed local variable
Source address is always known since daemon supports only single
adapter. No need to read it from btio.
2014-04-23 14:17:48 +02:00
Szymon Janc
3576214b5b android/hidhost: Improve error messages 2014-04-23 14:17:48 +02:00
Szymon Janc
40f7f261d2 android/hidhost: Check if hex2buf succeed
Fail if received string contains illegal characters.
2014-04-23 10:03:36 +02:00
Szymon Janc
c803cf88eb android/hidhost: Don't use sscanf in hex2buf
Add cheaper version (based on similar code in oFono) that doesn't
require sscanf.
2014-04-23 10:03:36 +02:00
Szymon Janc
35cd7eddbf android/hidhost: Cleanup handle_uhid_output 2014-04-23 10:03:36 +02:00
Szymon Janc
4a0ac907ca android/hidhost: Fix handle_uhid_output
Data from kernel is not in form of hex string. Just copy it instead of
converting from hex string.
2014-04-23 10:03:35 +02:00
Szymon Janc
ee1c0375ff android/hidhost: Fix hex string to buffer convertion
Due to missing limit specifier buffer was always filled with last hex
value in string.
2014-04-09 20:03:07 +02:00
Claudio Takahasi
7899d71215 Replace bt_put_le16() by put_le16() 2014-03-14 15:29:35 +02:00
Szymon Janc
14fc3c5403 android: Pass mode parameter to registered services 2014-03-04 10:18:27 +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
dd1e44fce1 android: Refactor IPC init
This allows to pass socket path and max service ID while initializaing
IPC. This is first step to allow use it both for BT and Audio HALs.
2014-02-28 15:22:45 +01:00
Anderson Lizardo
cdbede8514 android/hidhost: Trivial coding style fix
Fix two lines over 80 columns.
2014-02-12 11:26:56 +02:00
Anderson Lizardo
9b00e93b11 android: Use 16-bit UUID for SDP search
These UUIDs are assigned by BT-SIG and therefore there is no need to
use full 128-bit UUIDs. This also avoids unnecessary conversion from
string representation.
2014-02-12 11:26:56 +02:00
Marcel Holtmann
cde69653e0 android: Update copyright and license details 2014-02-11 10:42:56 -08:00
Luiz Augusto von Dentz
1d1fc983e4 android/hidhost: Use g_slist_free_full to free devices list
Calling g_slist_remove within the callback of g_slist_foreach is very
inefficient as it has to iterate twice in the list to figure which
element to remove.
2014-02-06 15:23:00 +02:00
Anderson Lizardo
c8886711d4 android: Trivial replacement of tabs where spaces are expected 2014-01-27 21:48:02 +01:00
Marcel Holtmann
c1add0ff9f android: Use src/log.h include instead of just log.h 2014-01-26 00:23:15 -08:00
Szymon Janc
f1c4969ff8 android/hidhost: Verify set info command correctness
Although it is not implemented verify command correctness for IPC
completeness.
2014-01-24 00:05:37 +01:00
Andrzej Kaczmarek
c95e067c3e android/hidhost: Fix vid and pid information
For HID device vendor, product and version numbers should be retrieved
using Device ID profile which is mandatory for devices implementing
HIDP.
2014-01-22 23:50:58 +01:00
Ravi kumar Veeramally
9d30a5a539 android/hidhost: Fix miscalculation of get report event notification length
Event length is size of struct + data len (if any). It is miscalulated.
2014-01-21 16:18:03 +01:00
Johan Hedberg
1a9051e9ee Rename glib-helper to uuid-helper 2014-01-21 14:12:47 +02:00
Ravi kumar Veeramally
a2d6586eff android/hidhost: Remove unnecessary check
HID device will return unsupported or invalid response for unsupported
or invalid get/set protocol request. Need not to check prior to that.
2014-01-20 16:23:38 +01:00
Ravi kumar Veeramally
3abb6d368d android/hidhost: Fix connection state notification on profile unregister
Issue found while writing end2end tests. Usually profile unregister is
called when final cleanup of bluetoothd. Freeing connected hid devices
through g_slist_foreach is a asynchronous call. Profile is cleaned up
and and ipc also complete cleanup. But free_hid_devices tries to notify
hal which doesn't exist that time. So behaviour is unexpected.
2014-01-20 16:23:06 +01:00
Szymon Janc
cada0c0896 core: Add flags parameter to bt_search_service
This allows to pass custom SDP flags to sdp_connect.
2014-01-20 15:19:25 +02:00
Szymon Janc
47e30d43c5 android/hidhost: Move set_report parameter check to daemon
HAL library is to be as simple as possible and parameters values should
be verified by daemon for robustness anyway. Move this check to daemon.
2013-12-31 11:34:32 +02:00
Szymon Janc
33c2a480a8 android/hidhost: Move get_report parameter check to daemon
HAL library is to be as simple as possible and parameters values should
be verified by daemon for robustness anyway. Move this check to daemon.
2013-12-31 11:34:30 +02:00
Szymon Janc
af6b7bef23 android/hidhost: Move set_protocol parameter check to daemon
HAL library is to be as simple as possible and parameters values should
be verified by daemon for robustness anyway. Move this check to daemon.
2013-12-31 11:34:28 +02:00
Szymon Janc
81617ffdfc android/hidhost: Move get_protocol parameter check to daemon
HAL library is to be as simple as possible and parameters values should
be verified by daemon for robustness anyway. Move this check to daemon.
2013-12-31 11:34:05 +02:00
Szymon Janc
9a706710e4 bluetooth/hidhost: Fix using feature event as output event
Rename handle_uhid_event to handle_uhid_output and make it handle only
output events.
2013-12-18 10:01:30 +02:00
Szymon Janc
ffb856322c android: Use G_N_ELEMENTS macro for table elements calculation
It is more common in codebase to use this macro instead of opencoded
(sizeof(foo)/sizeof(foo[0])).
2013-12-03 13:44:04 +02:00
Szymon Janc
24c9fb1e12 android/hidhost: Use generic IPC message handling for commands
Handlers are registered on service register and unregistered on
unregister.
2013-12-02 16:24:02 +02:00
Andrei Emeltchenko
995d19a8d4 android/hidhost: Shutdown ctrl_io channel if intr_io fails
This fix possible memory leak.
2013-11-29 10:29:55 +02:00
Szymon Janc
7624ea2d42 android: Don't pass notification socket on services register
It is no longer needed as proper socket is use by IPC helpers.
2013-11-28 18:02:27 +02:00
Szymon Janc
daf1186c38 android: Use ipc_send_notif for sending notifications 2013-11-28 18:02:26 +02:00
Szymon Janc
6456e15664 android: Remove socket parameter from ipc_send_rsp
Use command socket provided to IPC on init.
2013-11-28 18:02:26 +02:00
Johan Hedberg
497bbf94d0 android/hidhost: Fix misuse of errno 2013-11-19 18:20:13 +02:00
Ravi kumar Veeramally
a3d66e91fa android/hidhost: Handle error case properly in interrupt_connect_cb
In case of conn_err in interrupt_connect_cb, device is freed but
connection status is not notified. Declared a local variable and
handled error case properly in case of conn_err and uhid failures.
Now connection status notified before freeing device.
2013-11-19 18:18:39 +02:00
Ravi kumar Veeramally
b3132fe966 android/hidhost: Free all connected devices in profile cleanup call
This can be easily verified with haltest tool.
2013-11-19 18:15:37 +02:00
Ravi kumar Veeramally
b32461d42d android: Handle multiple init(register) and cleanup(unregister) calls properly
This can be tested with haltest.
2013-11-19 18:15:37 +02:00
Szymon Janc
fc10c55498 android: Improve IPC helper to not send invalid status response
This fix issue with sending invalid success response from several
places where ipc_send_rsp was used for reporting success. Instead of
using using ipc_send for success response, make helper handle that.
2013-11-18 15:17:22 +02:00
Szymon Janc
a332daeba9 android/hidhost: Use adapter address provided on register
There is no need to use bt_adapter_get_address every time local address
is needed.
2013-11-14 14:55:30 +02:00
Andrei Emeltchenko
b17fdd8adb android/hidhost: Use correct error structure 2013-11-13 16:47:39 +02:00
Andrei Emeltchenko
04a1fc903b android/hidhost: Fix memory leak 2013-11-13 16:47:38 +02:00
Ravi kumar Veeramally
d95bae6d86 android/hidhost: Set info request from HAL is not supported
Data from hal_cmd_hidhost_set_info is usefull only when we create
UHID device. Once device is created all the transactions will be
done through the fd. There is no way to use this information
once device is created with HID internals.
2013-11-13 11:26:38 +02:00
Ravi kumar Veeramally
d69ce902b7 android/hidhost: Handle uhid output and feature events
Data read on uhid events output and feature has to be send through
SET_REPORT request to HID device.
2013-11-13 11:26:33 +02:00
Ravi kumar Veeramally
fa0ce2cbb4 android/hidhost: Fix error handling issue incase of G_IO_HUP
Incase of G_IO_HUP on GIOCondtion when hid device disconnected,
GIOCondition is combination of G_IO_IN and G_IO_HUP. Current code
tries to read as soon as it finds G_IO_IN in condition.
Apparently there is no data to read and loop continues.
2013-11-12 15:26:52 +02:00
Ravi kumar Veeramally
ff9e27b9de android/hidhost: Fix uhid create failure case
If uhid open or create fails then notify state and free the device.
Otherwise it replies bogus success return value on connect request.
2013-11-12 15:26:52 +02:00
Ravi kumar Veeramally
651522716f android/hid: Handle virtual unplug event from hid device
If hid host receives the virtual unplug event from hid device
recipient shall destroy or invalidate all bluetooth bonding and
virtual cable information
2013-11-11 10:30:37 +02:00
Johan Hedberg
97a5801394 android/hidhost: Fix up error logs to contain exact error 2013-11-08 15:46:31 +02:00