Commit Graph

689 Commits

Author SHA1 Message Date
Szymon Janc
566bae35fc android: Move sockets handling from main to IPC code
This moves IO handling to IPC code making it fully responsible for
creating and veryfing IPC messages exchange.
2013-12-03 13:44:04 +02:00
Szymon Janc
a35d7765a9 android/socket: 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
Szymon Janc
e457ba2989 android/a2dp: 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
Szymon Janc
ea9af4bc3f android/pan: Use generic IPC message handling for commands
Handlers are registered on service register and unregistered on
unregister.

This also fix sending two IPC responses for get pan role command.
2013-12-02 16:24:02 +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
Szymon Janc
d64785addb android/bluetooth: Make property handling function return HAL status
This makes funtions follow have similar style and makes properties
dispatch function much simpler.
2013-12-02 16:24:02 +02:00
Szymon Janc
a29d4b3212 android/bluetooth: Use generic IPC msg handling for commands
Handlers are registered on service register and unregistered on
unregister.
2013-12-02 16:24:02 +02:00
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
Andrei Emeltchenko
d84ffb05e3 android/socket: Support listen() with supplied chan number
No profile is assigned in this case. There is a possibility to use
Serial Port Profile.
2013-11-25 15:32:07 +02:00
Andrei Emeltchenko
27d036281a android/socket: Add SPP SDP record 2013-11-25 15:30:42 +02:00
Andrei Emeltchenko
980ffed8d7 android/socket: Add PBAP SDP record
This adds SDP service record like shown below:

Service Name: OBEX Phonebook Access Server
Service RecHandle: 0x10002
Service Class ID List:
  "Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
  "RFCOMM" (0x0003)
    Channel: 15
  "OBEX" (0x0008)
Profile Descriptor List:
  "Phonebook Access" (0x1130)
    Version: 0x0100
2013-11-25 15:30:33 +02:00
Andrei Emeltchenko
58ab9edb8a android/socket: Add SPP uuid to profile table 2013-11-25 15:30:24 +02:00
Andrei Emeltchenko
b1e23ebd37 android/socket: Add MAS uuid to profile table 2013-11-25 15:30:13 +02:00
Andrei Emeltchenko
30d49b2b3a android/socket: Add OPP SDP record
This adds SDP record for OPP shown below:

Service Name: OBEX Object Push
Service RecHandle: 0x10002
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "RFCOMM" (0x0003)
    Channel: 9
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100
2013-11-25 15:29:58 +02:00
Andrei Emeltchenko
181158d8e6 android/socket: Add general service create/remove function
create_record function from profile is used to create SDP service record.
The record is removed from rfsock cleanup function.
2013-11-25 15:29:15 +02:00
Andrei Emeltchenko
cb2fdb2f53 android/socket: Close file descriptor after sending 2013-11-25 15:28:29 +02:00
Andrei Emeltchenko
7a9c4622e4 android/socket: Send connect signal to Android framework
Android framework expects connect signal to be sent when
remote device is connected.
2013-11-25 15:28:01 +02:00
Andrei Emeltchenko
c8226366a8 android/socket: Send RFCOMM channel to framework
Framework expects channel to be send.
2013-11-25 15:27:00 +02:00
Andrei Emeltchenko
a1deeaf589 android/socket: Implement HAL connect call
HAL connect uses similar event handlers like listen call.
2013-11-25 15:26:03 +02:00
Andrei Emeltchenko
9b33ebad23 android/socket: Parse SDP response and connect
Parse SDP response, find RFCOMM channel and connect.
2013-11-25 15:25:52 +02:00
Andrei Emeltchenko
044baf78ef android/bluetooth: Fix memory leak 2013-11-25 14:51:08 +02:00
Jakub Tyszkowski
47536a57a9 android/pics: Add PTS PICS for DID
PTS PICS for DID, targeting Android 4.4.
2013-11-25 14:47:40 +02:00
Jakub Tyszkowski
9942252e00 android/pics: Add PTS PICS for PAN
PTS PICS for PAN, targeting Android 4.4.
2013-11-25 14:47:40 +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
Andrei Emeltchenko
71e455c8b9 android/haltest: Zero initialize cmsg buffer 2013-11-21 16:43:40 +02:00
Andrei Emeltchenko
e73bd888be android/ipc: Zero initialize cmsg buffer
This fixes valgrind warnings:
...
Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
...
2013-11-21 16:43:38 +02:00
Luiz Augusto von Dentz
ee750796da android/a2dp: Cleanup devices on unregister
This cleanup any existing devices in bt_a2dp_unregister
2013-11-21 10:15:51 +02:00
Andrei Emeltchenko
7ee3686348 android/socket: Implement socket connect HAL method
First step is to query remote device for RFCOMM channel.
2013-11-20 15:10:53 +02:00
Andrei Emeltchenko
002a64f595 android/socket: Notify channel to Android framework
Android framework expects to receive channel number as int.
2013-11-20 15:10:45 +02:00
Andrei Emeltchenko
34c4ae9ad8 android/socket: Send accept signal to Android framework
Android expects to get accept signal over file descriptor which was
set during listen HAL call.
2013-11-20 15:10:17 +02:00
Andrei Emeltchenko
cfc5e2ae33 android/socket: Implement RFCOMM events
Copy data from RFCOMM socket to Android framework. Consider splice
in the future.
2013-11-20 15:10:03 +02:00
Andrei Emeltchenko
601cfc775e android/socket: Implement Android RFCOMM stack events
Handle events from Android framework. Write everything to real RFCOMM
socket. Consider splice() in the future.
2013-11-20 15:09:02 +02:00
Andrei Emeltchenko
1698ccf997 android/socket: Implement socket accepted event
When we get accepted event we create rfcomm slot and start listening
for events from Android framework and from RFCOMM real socket.
2013-11-20 15:08:03 +02:00
Andrei Emeltchenko
9795183df9 android/socket: Implement listen on RFCOMM socket
Handle HAL socket listen call. Create RFCOMM socket and wait for events.
2013-11-20 15:07:35 +02:00
Andrei Emeltchenko
7c44d6a7c7 android/socket: Add get RFCOMM default channel
RFCOMM default channel is the same like in other BlueZ code, it is
defined in src/profile.c
2013-11-20 15:03:36 +02:00
Ravi kumar Veeramally
52ce60f4c9 android/hal-pan: Fix order of event handler registration
IPC message handler determines handler offset with
opcode = msg->opcode - HAL_MINIMUM_EVENT. But here order is misplaced.
2013-11-20 09:41:38 +02:00
Ravi kumar Veeramally
eb53ab4746 android/hal-a2dp: Fix expected size of A2DP events 2013-11-20 09:40:23 +02:00
Johan Hedberg
23200acf0a android: Fix expected size of hal_ev_ssp_request 2013-11-19 22:35:47 +02:00
Johan Hedberg
356d103644 android/build: Add PICS files to EXTRA_DIST 2013-11-19 18:34:19 +02:00
Johan Hedberg
031bd3f56e android/pics: Fix line lengths 2013-11-19 18:33:10 +02:00
Jakub Tyszkowski
4c67683a34 android: Add PTS PICS for HID
PTS PICS for HID, targeting Android 4.4.
2013-11-19 18:30:49 +02:00
Jakub Tyszkowski
64e07b2233 android: Add PTS PICS for GAP
PTS PICS for GAP, targeting Android 4.4.
2013-11-19 18:30: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
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
Ravi kumar Veeramally
699c946daf android/hal-pan: Return error in case of unsupported PAN roles 2013-11-19 18:15:37 +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
bf8c55f3de android/hal-a2dp: Use generic IPC message handling for events
Register handlers on service init and unregister on cleanup.
2013-11-19 16:42:02 +02:00
Szymon Janc
8fd569476b android/hal-pan: Use generic IPC message handling for events
Register handlers on service init and unregister on cleanup.
2013-11-19 16:42:02 +02:00
Szymon Janc
a54c1e9259 android/hal-hidhost: Use generic IPC message handling for events
Register handlers on service init and unregister on cleanup.
2013-11-19 16:42:01 +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
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
Andrei Emeltchenko
07ff7758fd android/hal-sock: Print bdaddr string instead of pointer 2013-11-19 16:06:13 +02:00
Ravi kumar Veeramally
0a5ae04d8e android/pan: Fix wrong struct parameter in disconnect function call 2013-11-19 15:23:20 +02:00
Andrei Emeltchenko
e818990935 android/A2DP: Use sdp_data_free for freeing sdp data types 2013-11-19 12:15:51 +02:00
Andrei Emeltchenko
fafd7c20b1 android/A2DP: trivial: Use NULL for zero pointer 2013-11-19 12:15:19 +02:00
Andrei Emeltchenko
2022b92090 android: trivial: Add comment making code consistent 2013-11-19 11:16:11 +02:00
Andrei Emeltchenko
bde65270e3 android/socket: Add connect signal to socket
Connect signal is used to pass information to framework that socket
is accepted.
2013-11-19 11:15:49 +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
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
Andrei Emeltchenko
f9d15c95af android/a2dp: Use NULL for zero pointer 2013-11-18 13:04:22 +02:00
Andrei Emeltchenko
7d777eda20 android/socket: Use static local adapter address 2013-11-18 10:42:37 +02:00
Andrei Emeltchenko
e94a667739 android/hal-sock: Add debug flag printing 2013-11-18 10:42:18 +02:00
Szymon Janc
2e86eac876 android: Refactor update_found_device function
This makes function flow easier to follow and understand. Besides that
it also fix issue with sending to many bytes if some prop were not
present in EIR.
2013-11-16 20:22:03 +02:00
Szymon Janc
51012a0104 android: Fix sending invalid remote device property event
Remote device property event has variable length, pass whole event
length to ipc_send, not only header.
2013-11-16 20:22:01 +02:00
Szymon Janc
ff7246fb8f android: Fix sending remote device property if name is not present
This fix missing bdaddr to string convertion if name was NULL. This
was resulting in using undefined dst value.
2013-11-16 20:21:59 +02:00
Lukasz Rymanowski
ba310d7f90 android: Change TODO with explaining comment 2013-11-15 20:23:38 +02:00
Lukasz Rymanowski
e623075212 android: Update bond state on auth and connect failed 2013-11-15 20:22:23 +02:00
Lukasz Rymanowski
818d532ba3 android: Cache device name on device list. 2013-11-15 20:20:51 +02:00
Lukasz Rymanowski
e9d43a87fa android: Update bond state on incoming bonding
Before sending any ssp request or pin code request up to HAL library we
need to send bond state change with bonding state. Otherwise incoming
bonding is not correctly handled by Bluetooth.apk.
In this patch also device list has been added in order to e.g track
bonding state.

Note: For incoming paring (security mode 3) there is a  need to send
HAL_EVE_REMOTE_DEVICE_PROPS before HAL_EV_PIN_REQUEST.
It is because Android will crash due to bug in pinRequestCallback
function in java. Android checks if device is already in HashMap and if
not then creates  device, but forget to use that one, but instead do
operations on NULL. By sending HAL_BOND_STATE_BONDING event it works
better but we have race issue. It is because new device is added to
HashMap not in callback context but later after BONDING msg will be
received  by BondStateMachine. If it happens before pin_request_cb hits
java then we are fine, otherwise not. So for that reason we send
HAL_EV_REMOTE_DEVICE_PROPS so in the java handler class new device will
be added to HashMap in the  callback context.

In ssp case we don't have this problem as we send device found once acl
is created.
2013-11-15 20:19:50 +02:00
Szymon Janc
e30125fa92 android: Fix not storing adapter index in index added event
If controller was addded after daemon start its index was not stored
resulting in mgmt commands to be always send to MGMT_INDEX_NONE index.
2013-11-15 14:44:10 +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
Ravi kumar Veeramally
017aa01531 android/pan: Fix wrong HAL service id 2013-11-15 12:02:36 +02:00
Luiz Augusto von Dentz
711331d28f android/a2dp: Add implementation of SDP record
This adds the following record:

Service Name: Audio Source
Service RecHandle: 0x10001
Service Class ID List:
  "Audio Source" (0x110a)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 25
  "AVDTP" (0x0019)
    uint16: 0x103
Profile Descriptor List:
  "Advanced Audio" (0x110d)
    Version: 0x0103
2013-11-14 17:27:48 +02:00
Johan Hedberg
d311204d6d android/build: Remove unnecessary mentions of source files in EXTRA_DIST 2013-11-14 15:57:27 +02:00
Johan Hedberg
4fc1a0cfd1 android/build: Add missing header files to android_haltest_SOURCES 2013-11-14 15:57:03 +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
3419cd2118 android: Remove not needed bt_adapter_get_address function
All services receive adapter address on init so there is no need for
this function. Removing it will also help keeping services not depend
on adapter service.
2013-11-14 14:55:30 +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
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
Szymon Janc
cd1dd51f79 android: Don't use static pointer for storing adapter_ready callback
There is no need to keep ready callback for daemon lifetime as it is
not used after reporting adapter being ready. Use mgmt library feature
for passing user data so that static pointer is not needed.
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
73e110b5b0 android: Make adapter static
Only one controller is used so there is no need to keep it as allocable
structure. This will also make memory management simpler and more
correct eg. adapter was never free.

Elements not directly related to adapter are kept outside of adapter
structure.
2013-11-14 14:55:30 +02:00
Luiz Augusto von Dentz
41599b1d3b android/a2dp: Add initial implementation of HAL_OP_A2DP_DISCONNECT 2013-11-14 14:25:39 +02:00
Luiz Augusto von Dentz
9cb73c97f8 android/a2dp: Add initial implementation of HAL_OP_A2DP_CONNECT 2013-11-14 14:25:24 +02:00
Luiz Augusto von Dentz
46c8cd97fc android/a2dp: Add initial implementation of socket handling
This adds initial code to handle incoming connection and notifying
connection states.
2013-11-14 14:20:53 +02:00
Luiz Augusto von Dentz
230211cd25 android/hal-a2dp: Add defines for possible connection states 2013-11-14 14:19:11 +02:00
Luiz Augusto von Dentz
cfcbbf8f86 android/hal-a2dp: Add implemention of .cleanup 2013-11-14 14:19:02 +02:00
Luiz Augusto von Dentz
ad5813bcd5 android/hal-a2dp: Add implemention of .init 2013-11-14 14:18:59 +02:00