Commit Graph

582 Commits

Author SHA1 Message Date
Szymon Janc
48823282b0 android/main: Use common exit path in core service functions
This makes functions exit path simpler.
2013-12-02 16:24:02 +02:00
Szymon Janc
5e6cf77c22 android/main: Use generic IPC message handling for core service
Handlers are registered on daemon start and unregistered on shutdown.
2013-12-02 16:24:02 +02:00
Szymon Janc
454cdd7a72 android: 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-12-02 16:24:01 +02:00
Luiz Augusto von Dentz
d48132c844 android/pan: Fix sending uninitialised bytes
name field of struct hal_ev_pan_ctrl_state is 17 bytes longs so memcpy of
the interface name does not field all the those bytes leaving the last
uninitialised:
Syscall param sendmsg(msg.msg_iov[1]) points to uninitialised byte(s)
   at 0x3600EF6E20: __sendmsg_nocancel (in /usr/lib64/libc-2.17.so)
   by 0x40DC06: ipc_send (ipc.c:93)
   by 0x4149AC: bnep_conn_cb (pan.c:120)
   by 0x4192B8: bnep_setup_cb (bnep.c:324)
   by 0x31D1647DF5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x31D1648147: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x31D1648549: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40338B: main (main.c:629)
 Address 0x7ff0003d3 is on thread 1's stack
2013-11-29 17:10:19 +02:00
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
Ravi kumar Veeramally
cd57b8b7e0 android/pan: Implement the get local role method in daemon
Returns local role of the device (NONE, PANU or NAP).
2013-11-29 17:10:19 +02:00
Ravi kumar Veeramally
ba10ece248 android/pan: Implement pan disconnect method in daemon
Disconnect ongoing PANU role connection betweek devices, free
the device and notify the connection state.
2013-11-29 17:10:19 +02:00
Ravi kumar Veeramally
64b76dd6ae android/pan: Implement pan connect method in daemon
Implements the PAN connect method in android daemon with PANU role
only. Setting up the bnep environment, adds connection and makes
bnep interface up are part of bnep_connect call. Notifies bnep
interface on control state call back and connection status on
connection state call back.
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
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
Andrei Emeltchenko
aef22eab9f android/socket: Remove unneeded code
The flag is already set in bt_io_listen.
2013-11-29 10:30:16 +02:00
Andrei Emeltchenko
4675a7412d android/socket: Avoid double close of file descriptor
Since we close all file descriptors in cleanup_rfsock do not close it also
during iochannel cleaning up. The flag was setup in bt_io_listen and
bt_io_connect calls.
2013-11-29 10:30:11 +02:00
Andrei Emeltchenko
4df38bd9ed android/socket: Strip extra log messages
Remove debug messages when sending data, debug still exist for connection
establishment. Do not print error when connection hang up, print debug
instead.
2013-11-29 10:30: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
Andrei Emeltchenko
0ba58ed345 android/socket: Fix rfsock lists
This fixes several places where rfsock structure were not removed
from the list due to connection errors.
2013-11-29 10:29:51 +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
9ed863baef android/bluetooth: Remove not needed notification_sk checks
This is now checked inside ipc_send_notif helper.
2013-11-28 18:02:27 +02:00
Szymon Janc
3b7b97bb5f android: Make ipc_send static
It should not longer be used from outside of IPC code.
2013-11-28 18:02:27 +02:00
Szymon Janc
22d3f4499b android/socket: Use ipc_send_rsp_full IPC helper
Use command reply helper for sending reply with file descriptor.
2013-11-28 18:02:27 +02:00
Szymon Janc
d4199a012d android: Add ipc_send_rsp_full IPC helper
This will be used to send non-empty reply using command socket.
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
066eac37ad android: Add IPC helper for sending notifications
This will use notification socket passed on IPC init.
2013-11-28 18:02:26 +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
Jakub Tyszkowski
f5899e36a4 android/pics: Add PIXIT setup info to PICS files
Some profiles like DID, requires specific PIXIT setup to pass some tests
cases. Other profiles works well with defaults. Thus appropriate
information at the end of PICS file should be provided.
2013-11-28 16:47:05 +02:00
Jakub Tyszkowski
d6cd131128 android/pics: Add PTS PICS for PBAP
PTS PICS for PBAP, targeting Android 4.4.
2013-11-28 16:47:03 +02:00
Jakub Tyszkowski
3244fc249d android/pics: Add PTS PICS for OPP
PTS PICS for OPP, targeting Android 4.4.
2013-11-28 11:44:08 +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
63681815bd android/bluetooth: Change discoverable mode only if connectable
There is no need to sending set_discoverable command if new settings
are not connectable as clearing connectable also clear discoverable.
Sending set_discoverable when not connectable result in 'rejected'
mgmt response.
2013-11-27 12:57:04 +02:00
Johan Hedberg
c95d6263f5 android/socket: Remove useless dst variable 2013-11-27 12:56:41 +02:00
Andrei Emeltchenko
41631e8b46 android/socket: Check create_rfsock returns valid structure 2013-11-27 12:54:37 +02:00
Andrei Emeltchenko
7c48f46ed1 android/hal-sock: Check uuid before dereference
uuid might be NULL and channel might be specified which makes it
valid case for Android. This adds check for uuid and service name.
2013-11-27 12:53:41 +02:00
Johan Hedberg
cc38f090de android: Fix pointless eir debug log 2013-11-27 12:52:29 +02:00
Andrei Emeltchenko
bb712ac791 android/socket: Use security level for connect / listen
Use MEDIUM security level for connections without profile and default
sec_level for others. rfsock now has pointer to profile info.
2013-11-26 17:44:05 +02:00
Andrei Emeltchenko
b3c8fbbb66 android/socket: Make profile struct const
We are not supposed to change profile structure, make it const.
2013-11-26 17:43:27 +02:00
Andrei Emeltchenko
3cc6ed2d30 android/haltest: Add uuid autocompletions 2013-11-26 17:42:36 +02:00
Andrei Emeltchenko
7eac27334f android/haltest: trivial: Fix typo channle -> channel 2013-11-26 17:42:25 +02:00
Luiz Augusto von Dentz
21b1bd698b android/AVDTP: Strip dependencies
This strips AVDTP code of any dependency of core and btio to make it
transport agnostic.
2013-11-25 16:50:31 +02:00
Luiz Augusto von Dentz
e40bfde22e android: Add copy of current AVDTP implemention
These files are not added to any makefile on purpose because they still
have external dependencies.
2013-11-25 15:59:28 +02:00
Andrei Emeltchenko
a7f01b2e1b android/socket: Add error printing possible close() failure 2013-11-25 15:37:17 +02:00
Andrei Emeltchenko
407789abea android/socket: Use default sec_level for listen
Set default security level low for OPP and SPP and medium for PBAP and MAS.
Default security level would be low for listening without profile.
2013-11-25 15:36:25 +02:00
Andrei Emeltchenko
1c2efb5093 android/hal-utils: Fix possible NULL pointer dereference 2013-11-25 15:34:15 +02:00
Andrei Emeltchenko
ed7452fbbf android/socket: Refactor socket send_fd function
Make code cleaner and initialize local cmsg buffer to zeroes.
2013-11-25 15:32:31 +02:00
Andrei Emeltchenko
b975a903fb android/hal-sock: Print bdaddr on connect 2013-11-25 15:32:14 +02:00