Commit Graph

77 Commits

Author SHA1 Message Date
Ravi kumar Veeramally
3fa4e17b2e android: Add reasons for adding capabilites to process
CAP_NET_ADMIN: Allow use of MGMT interface
CAP_NET_BIND_SERVICE: Allow use of privileged PSM
CAP_NET_RAW: Allow use of bnep ioctl calls
2013-11-29 17:10:19 +02:00
Andrei Emeltchenko
13d5e9c49b android/main: Call unregister for all registered services on exit 2013-11-29 10:33:13 +02:00
Andrei Emeltchenko
ab159fbbdd android/main: Free enabled string on exit 2013-11-29 10:29:15 +02:00
Andrei Emeltchenko
d9e44bb22c android/main: Remove signal source on exit
Remove signal source on exit and move check capability function in order
to avoid extra check.
2013-11-29 10:29:08 +02:00
Andrei Emeltchenko
058b7badd5 android/main: Remove timeout source on exit
This fixes memory leak types of warnings from some tools.
2013-11-29 10:29:00 +02:00
Andrei Emeltchenko
98ecece5f6 android: Avoid memory leak warnings for event_loop
Move creation of event_loop closer to g_main_loop_run. This avoids
calling g_main_loop_unref too many times in initialization error paths.
This is safe since g_main_loop_quit eval to NOOP if parameter == NULL.
2013-11-29 10:28:49 +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
a50edbf560 android: Use ipc_send_rsp helper for replying success
Where applicable use helper as this make code easier to understand.
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
Szymon Janc
4f1d080aa7 android: Initialize IPC with command and notification sockets
Pass sockets after succesfully connected to HAL. This will allow
to improve IPC helpers API.
2013-11-28 18:02:26 +02:00
Ravi kumar Veeramally
99fcb3fc01 android: Add CAP_NET_RAW capability
CAP_NET_RAW capability is required to up the bnep interfaces
in android environment.
2013-11-27 13:06:44 +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
9ad9540f7d android: Rename bluetooth service functions to match service name
Make public functions match service name.
2013-11-14 14:58:16 +02:00
Szymon Janc
c060fc6976 android: Rename adapter.c to bluetooth.c
Match service name that is implemened in that file. This will also
keep convention of foo.c and hal-foo.c implementing remote parts of
same service.
2013-11-14 14:57:56 +02:00
Szymon Janc
3be6d4a82f android: Report adapter address in adapter_ready callback
Adapter is not going to change while daemon is running so its address
can be stored after init is complete.
2013-11-14 14:55:30 +02:00
Szymon Janc
e809154eba android: Move adapter initialization to adapter.c
There is no need to handle that in main.c. Also this removes mgmt
interface dependency from adapter API as all mgmt commands are handled
from adapter code.

Startup and shutdown timeouts handling is left in main.c.
2013-11-14 14:55:30 +02:00
Szymon Janc
7d699101e2 android: Core service should be always registered
Core service is used to register other services and shall be always
consider registered.
2013-11-13 19:46:01 +02:00
Szymon Janc
33d823d2ee android: Shutdown if IPC command for unregistered service is received
Sending commands to not registered services is violation of IPC spec
and should result in daemon shutdown.
2013-11-13 19:43:21 +02:00
Szymon Janc
0d45c38c00 android: Fix error handling in adapter_ready
On error negative value is passed to adapter_ready callback. This fix
passing negative error code to strerror.
2013-11-08 16:15:06 +02:00
Marcin Kraglak
d5932ba1e6 android: Fix PAN service registration
A2DP service was registered instead of PAN.
2013-11-08 12:46:03 +02:00
Szymon Janc
a54747586e android: Rename hid.c to hidhost.c
Name of daemon implementation will match Android HAL name. This will
make code navigation easier as daemon part and HAL library implementation
will be in foo.c and hal-foo.c respectively.
2013-11-07 18:44:57 +02:00
Szymon Janc
fd02ec9d91 android: Use payload member to access message data
This make it similar to other places in code.
2013-11-07 17:06:05 +02:00
Szymon Janc
052e481adc android: Pass notification socket fd to service handlers
IPC helpers were converted to accept socket, not GIOChannel so there
is no need of passing former to handlers.
2013-11-07 17:05:47 +02:00
Szymon Janc
32f29761bf android: Make IPC helpers accept file descriptor
There is no need to pass GIOChannel as writes are done immediately.
2013-11-07 17:05:07 +02:00
Johan Hedberg
80a2ea61f2 android: Use more common 'failed' label instead of 'error' 2013-11-06 10:12:13 +02:00
Szymon Janc
40fb9b2032 android: Add option to specify controller index to use
This will be usefull while testing on Linux where more controllers
can be present.
2013-11-06 10:10:14 +02:00
Szymon Janc
6dc9321e2e android: Stop mainloop if reading index list failed
If reading index list failed mainloop should be stopped since adapter
init guard timer is not yet running.
2013-11-06 10:08:15 +02:00
Szymon Janc
8a98e083b8 android: Stop mainloop if reading version failed
If reading mgmt version failed or kernel supported version is to old
mainloop should be stopped.
2013-11-06 10:07:54 +02:00
Szymon Janc
81c0c34ef6 android: Remove mgmt_version and mgmt_revision static variables
There is no need to keep those as Android daemon is expecting new
enough kernel to operate.
2013-11-06 10:07:47 +02:00
Szymon Janc
9d89bb121b android: Require at least 1.3 version of mgmt interface
Android daemon is not providing old kernels compatibility features.
2013-11-06 10:07:37 +02:00
Luiz Augusto von Dentz
1ca4c658d9 android/pan: Add initial code for handling commands 2013-11-04 21:13:05 +02:00
Luiz Augusto von Dentz
8e955dfd82 android: Add initial skeleton for pan in the daemon 2013-11-04 21:12:40 +02:00
Luiz Augusto von Dentz
00e69a7570 android/a2dp: Add initial code for handling commands 2013-11-04 21:12:25 +02:00
Luiz Augusto von Dentz
5daffcb642 android: Add initial skeleton for a2dp in the daemon 2013-11-04 21:12:23 +02:00
Marcel Holtmann
47142caf95 android: Switch controller off when shutting the daemon down 2013-10-31 12:42:22 -07:00
Marcel Holtmann
aab3d0a838 android: Power off controller when daemon gets killed 2013-10-31 12:36:09 -07:00
Marcel Holtmann
86267e88a5 android: Don't use abort() for exit 2013-10-31 12:36:09 -07:00
Marcel Holtmann
8dadd1165d android: No need for volatile sig_atomic_t when using signalfd 2013-10-31 12:14:16 -07:00
Marcel Holtmann
ff153bce22 android: Exit daemon if no controller is found within 5 seconds 2013-10-31 12:06:18 -07:00
Marcin Kraglak
a56aeec37d android: Initial implementation of socket interface
Add stub implementation of socket interace on daemon side.
2013-10-31 10:30:00 +02:00
Luiz Augusto von Dentz
d52939fde9 android: Rename ipc_send_error to ipc_send_rsp 2013-10-25 15:22:24 +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
Szymon Janc
e4db4fdd60 android: Remove not needed local variable in connect_hal
err variable was set but never read.
2013-10-25 14:28:16 +03:00
Szymon Janc
78761a80af android: Remove not needed adapter parameter from bt_adapter_ready
There is no need to pass adapter pointer in bt_adapter_ready callback
as there is only one present.
2013-10-24 18:31:41 +03:00
Szymon Janc
f9c5137dfd android: Start command watch after notify channel is connected
Daemon should start processing commands only after both communication
channels were connected.
2013-10-24 18:23:08 +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
Lukasz Rymanowski
5619f854f9 android: Fix build error for Android
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.
2013-10-23 15:58:29 +03:00
Johan Hedberg
16102bea3d android: Add convenience variable for adapter bdaddr 2013-10-23 14:32:03 +03:00
Szymon Janc
46467fd5d1 android: Add support for registering and unregistering hid service 2013-10-23 14:26:40 +03:00
Szymon Janc
9f696ad971 android: Add initial code for socket service
Only handle register/unregister for now.
2013-10-23 14:26:40 +03:00