OSDN Git Service

android-x86/external-bluetooth-bluez.git
11 years agogdbus: Implement DBus.Properties.Set method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:30 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Set method

Contrary to Get() and GetAll(), Set() is asynchronous so we pass an id
to the setter so later it can declare the Set() as successful or
otherwise.

11 years agogdbus: Implement DBus.Properties.GetAll method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:29 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.GetAll method

11 years agogdbus: Implement DBus.Properties.Get method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:28 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Get method

11 years agogdbus: Add skeleton of DBus.Properties interface
Lucas De Marchi [Thu, 4 Oct 2012 07:26:27 +0000 (04:26 -0300)]
gdbus: Add skeleton of DBus.Properties interface

This interface is responsible for handling properties of all objects in
a given path. Right now it only registers itself, doing nothing useful.
A conversion to this new layout will be done by subsequent patches.

org.freedesktop.org.DBus.Properties spec can be found at
http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

11 years agogdbus: Use macros to add annotations
Lucas De Marchi [Thu, 4 Oct 2012 07:26:26 +0000 (04:26 -0300)]
gdbus: Use macros to add annotations

Besides being more readable this way it avoids going over 80 chars.

11 years agogdbus: Move typedefs up
Lucas De Marchi [Thu, 4 Oct 2012 07:26:25 +0000 (04:26 -0300)]
gdbus: Move typedefs up

Move the typedefs up so they can be used by functions and callbacks.

11 years agobuild-sys: Don't use deprecated INCLUDES variable
Lucas De Marchi [Thu, 4 Oct 2012 06:37:10 +0000 (03:37 -0300)]
build-sys: Don't use deprecated INCLUDES variable

Makefile.am:410: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

11 years agobuild-sys: Don't use deprecated AM_PROG_MKDIR_P
Lucas De Marchi [Thu, 4 Oct 2012 06:37:09 +0000 (03:37 -0300)]
build-sys: Don't use deprecated AM_PROG_MKDIR_P

AM_PROG_MKDIR_P is deprecated since:

configure.ac:23: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and will soon be removed.
configure.ac:23: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
configure.ac:23: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.

We are already using $(MKDIR_P) so we just need to call the right macro.

11 years agoAVDTP: Remove hand-written function name from log
Lucas De Marchi [Thu, 4 Oct 2012 05:14:34 +0000 (02:14 -0300)]
AVDTP: Remove hand-written function name from log

11 years agoAVCTP: Remove hand-written function name from log
Lucas De Marchi [Thu, 4 Oct 2012 05:14:33 +0000 (02:14 -0300)]
AVCTP: Remove hand-written function name from log

Besides being hand-written, it was wrong which leads to confusion with
the AVDTP.

11 years agocore: Add GoepL2capPsm lookup for external OBEX profiles
Johan Hedberg [Thu, 4 Oct 2012 08:19:04 +0000 (11:19 +0300)]
core: Add GoepL2capPsm lookup for external OBEX profiles

11 years agolib: Add GoepL2capPsm SDP attribute define
Johan Hedberg [Wed, 3 Oct 2012 20:14:03 +0000 (23:14 +0300)]
lib: Add GoepL2capPsm SDP attribute define

11 years agoneard: Implement RequestOOB function
Szymon Janc [Wed, 3 Oct 2012 13:18:31 +0000 (15:18 +0200)]
neard: Implement RequestOOB function

This function is used by neard to request data to be transmitted over
OOB channel. It also allows neard to provide data to be used in OOB
pairing without initializing pairing it self.

11 years agoneard: Implement PushOOB function
Szymon Janc [Wed, 3 Oct 2012 13:18:30 +0000 (15:18 +0200)]
neard: Implement PushOOB function

This implements PushOOB function which allows neard to pass data used
for discovery and pairing. Only EIR data type is supported.

11 years agoAdd initial neard plugin implementation
Szymon Janc [Wed, 3 Oct 2012 13:18:29 +0000 (15:18 +0200)]
Add initial neard plugin implementation

Initial implementation. Only register and unregister support.

11 years agooob: Refactor oob callback handling and move it to adapter code
Szymon Janc [Wed, 3 Oct 2012 13:18:28 +0000 (15:18 +0200)]
oob: Refactor oob callback handling and move it to adapter code

This allows oob plugin to register for callback after executing
certain action on adapter. Currently reading local OOB data and
pairing is supported. It should be easy to support more callbacks
in future if needed e.g. powering on.

Thanks to this plugin is not required to duplicate code that would
validate adapter/device when callback is received as callback condition
is check in adapter.

It also allows to pass user data which will be provided back when cb
is called further reducing plugin code.

11 years agoadapter: Add btd_adapter_get_class function
Szymon Janc [Wed, 3 Oct 2012 13:18:27 +0000 (15:18 +0200)]
adapter: Add btd_adapter_get_class function

This is a simple getter to get current Class Of Device of adapter.

11 years agoadapter: Rename btd_adapter_get_class to btd_adapter_read_class
Szymon Janc [Wed, 3 Oct 2012 13:18:26 +0000 (15:18 +0200)]
adapter: Rename btd_adapter_get_class to btd_adapter_read_class

It better suits what this function really does.

11 years agoadapter: Add btd_adapter_get_services function
Szymon Janc [Wed, 3 Oct 2012 13:18:25 +0000 (15:18 +0200)]
adapter: Add btd_adapter_get_services function

Services will be used to create EIR to be send over OOB.

11 years agoeir: Add support for creating proper OOB EIR
Szymon Janc [Wed, 3 Oct 2012 13:18:24 +0000 (15:18 +0200)]
eir: Add support for creating proper OOB EIR

Address and total length field are mandatory part of OOB EIR.

11 years agoeir: Remove struct uuid_info
Szymon Janc [Wed, 3 Oct 2012 13:18:23 +0000 (15:18 +0200)]
eir: Remove struct uuid_info

Remove struct uuid_info and convert functions to use sdp_record_t
list instead. This will allow to easily use services list from
struct btd_adapter to create EIR.

11 years agoeir: Return number of bytes written by eir_create_oob
Szymon Janc [Wed, 3 Oct 2012 13:18:22 +0000 (15:18 +0200)]
eir: Return number of bytes written by eir_create_oob

In OOB EIR is not zero padded.

11 years agoeir: Remove support for creating EIR with tx_power fields
Szymon Janc [Wed, 3 Oct 2012 13:18:21 +0000 (15:18 +0200)]
eir: Remove support for creating EIR with tx_power fields

This field is not used for OOB EIR.

11 years agoeir: Rename eir_create to eir_create_oob
Szymon Janc [Wed, 3 Oct 2012 13:18:20 +0000 (15:18 +0200)]
eir: Rename eir_create to eir_create_oob

With mgmt interface EIR is created by kernel. Renaming this function
makes it clear what is a purpose of it in userspace. It also contains
support for EIR data types that shall be transmitted only over OOB
channel.

11 years agoeir: Add support for creating EIR with CoD field
Szymon Janc [Wed, 3 Oct 2012 13:18:19 +0000 (15:18 +0200)]
eir: Add support for creating EIR with CoD field

This will be used to create EIR to be send over OOB channel.

11 years agoeir: Add support creating EIR with hash and randomizer fields
Szymon Janc [Wed, 3 Oct 2012 13:18:18 +0000 (15:18 +0200)]
eir: Add support creating EIR with hash and randomizer fields

This will be used to create EIR to be send over OOB channel.

11 years agoeir: Add eir_parse_oob function
Szymon Janc [Wed, 3 Oct 2012 13:18:17 +0000 (15:18 +0200)]
eir: Add eir_parse_oob function

This will parse EIR received over OOB. Such EIR contains mandatory
and optional part.

11 years agoeir: Store class in struct eir_data as uint32_t
Szymon Janc [Wed, 3 Oct 2012 13:18:16 +0000 (15:18 +0200)]
eir: Store class in struct eir_data as uint32_t

This simplify code as class is stored on storage as uint32_t and
had to be converted to it in few places.

11 years agoeir: Add support for parsing SSP hash and randomizer
Szymon Janc [Wed, 3 Oct 2012 13:18:15 +0000 (15:18 +0200)]
eir: Add support for parsing SSP hash and randomizer

This will be used over OOB mechanism.

11 years agomgmt: Handle missing randomizer in mgmt_add_remote_oob_data
Szymon Janc [Wed, 3 Oct 2012 13:18:14 +0000 (15:18 +0200)]
mgmt: Handle missing randomizer in mgmt_add_remote_oob_data

Randomizer is optional. Handling missing randomizer in
mgmt_add_remote_oob_data is easy and will simplify caller code.

11 years agoalert: Fix various coding style issues
Johan Hedberg [Wed, 3 Oct 2012 19:37:13 +0000 (22:37 +0300)]
alert: Fix various coding style issues

11 years agoalert: Add org.bluez.AlertAgent to D-Bus policy file
Anderson Lizardo [Tue, 2 Oct 2012 20:24:50 +0000 (16:24 -0400)]
alert: Add org.bluez.AlertAgent to D-Bus policy file

This allows BlueZ to call the methods on the org.bluez.AlertAgent
interface.

11 years agoalert: Implement Release() agent method
Anderson Lizardo [Tue, 2 Oct 2012 20:24:49 +0000 (16:24 -0400)]
alert: Implement Release() agent method

This method allows BlueZ to notify the agent that it will not be used
anymore, and can thus cleanup itself (e.g. deallocate D-Bus object, or
exit).

11 years agoalert: Add support for unread alert notification
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:48 +0000 (16:24 -0400)]
alert: Add support for unread alert notification

When UnreadAlert D-Bus method is called for a registered category
from Alert Notification Profile, The unread alert characteristic value
is notified.

11 years agoalert: Add support for new alert notification
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:47 +0000 (16:24 -0400)]
alert: Add support for new alert notification

When NewAlert D-Bus method is called for one category from Alert
Notification Profile, the new alert characteristic value is notified.

11 years agoalert: Add support for alert status notification
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:46 +0000 (16:24 -0400)]
alert: Add support for alert status notification

The notification is sent (to peer devices that have it enabled on the
CCC descriptor) every time the alert status characteristic value
changes.

11 years agoalert: Add support for ringer setting notification
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:45 +0000 (16:24 -0400)]
alert: Add support for ringer setting notification

When the agent reports a ringer setting change, a ringer setting
notification is sent to the peer device (if notification is enabled).

11 years agoalert: Update Alert Status and Ringer Setting characteristic values
Anderson Lizardo [Tue, 2 Oct 2012 20:24:44 +0000 (16:24 -0400)]
alert: Update Alert Status and Ringer Setting characteristic values

Now these characteristic values are updated when the agent changes any
PASP alert state or setting.

11 years agoalert: Add test-alert script
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:43 +0000 (16:24 -0400)]
alert: Add test-alert script

This script is useful for testing the Alert API and testing the
implementation with PTS.

11 years agoalert: Add support for calling SetRinger()
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:42 +0000 (16:24 -0400)]
alert: Add support for calling SetRinger()

When BlueZ wants to call SetRinger() method from org.bluez.AlertAgent
interface for a registered agent, the function agent_ringer_set_ringer()
must be called.

11 years agoalert: Add support for calling MuteOnce()
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:41 +0000 (16:24 -0400)]
alert: Add support for calling MuteOnce()

When BlueZ wants to call MuteOnce() method from org.bluez.AlertAgent
interface for a registered agent, the function agent_ringer_mute_once()
must be called.

11 years agoalert: Implement MuteOnce command
Anderson Lizardo [Tue, 2 Oct 2012 20:24:40 +0000 (16:24 -0400)]
alert: Implement MuteOnce command

MuteOnce() is called by BlueZ to instruct the agent to mute the ringer
during a incoming call.

11 years agoalert: Update unread alert characteristic value
Anderson Lizardo [Tue, 2 Oct 2012 20:24:39 +0000 (16:24 -0400)]
alert: Update unread alert characteristic value

Update the attribute value when the unread alert count is changed.

11 years agoalert: Update new alert characteristic value
Anderson Lizardo [Tue, 2 Oct 2012 20:24:38 +0000 (16:24 -0400)]
alert: Update new alert characteristic value

Update the attribute value when a new alert is reported to BlueZ.

11 years agoalert: Update Supported New/Unread Category characteristic values
Anderson Lizardo [Tue, 2 Oct 2012 20:24:37 +0000 (16:24 -0400)]
alert: Update Supported New/Unread Category characteristic values

The value is now kept up-to-date when new/unread alerts arrive. This
value is not notified yet.

11 years agoalert: Add per adapter attribute handle information
Anderson Lizardo [Tue, 2 Oct 2012 20:24:36 +0000 (16:24 -0400)]
alert: Add per adapter attribute handle information

Each adapter may have different GATT services running, therefore any
attribute handles (e.g. for updating characteristic values) need to be
saved per adapter.

11 years agoalert: Automatically unregister alert when agent leaves D-Bus
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:35 +0000 (16:24 -0400)]
alert: Automatically unregister alert when agent leaves D-Bus

11 years agoalert: Add initial support for UnreadAlert D-Bus method
Anderson Lizardo [Tue, 2 Oct 2012 20:24:34 +0000 (16:24 -0400)]
alert: Add initial support for UnreadAlert D-Bus method

This method is used for updating the "unread" counter for categories
that support it.

11 years agoalert: Add initial support for NewAlert D-Bus method
Eder Ruiz Maria [Tue, 2 Oct 2012 20:24:33 +0000 (16:24 -0400)]
alert: Add initial support for NewAlert D-Bus method

NewAlert() is used for notifying BlueZ of new alert(s) for the given
category.

11 years agoalert: Implement category registration in RegisterAlert()
Eder Ruiz Maria [Wed, 3 Oct 2012 12:49:15 +0000 (08:49 -0400)]
alert: Implement category registration in RegisterAlert()

The given alert category is now validated and registered.

11 years agoalert: Initial Alert Notification
Anderson Lizardo [Tue, 2 Oct 2012 20:24:31 +0000 (16:24 -0400)]
alert: Initial Alert Notification

Initial implementation for Alert Notification Profile (ANP).

11 years agoalert: Add Alert Status characteristic
Bruna Moreira [Tue, 2 Oct 2012 20:24:30 +0000 (16:24 -0400)]
alert: Add Alert Status characteristic

This characteristic allows to read/notify the status of the ringer,
display and vibration motor.

11 years agoalert: Add Ringer Setting characteristic
Bruna Moreira [Tue, 2 Oct 2012 20:24:29 +0000 (16:24 -0400)]
alert: Add Ringer Setting characteristic

This characteristic allows to read or notify the ringer mode (silent or
normal).

11 years agoalert: Add Ringer Control Point characteristic
Bruna Moreira [Tue, 2 Oct 2012 20:24:28 +0000 (16:24 -0400)]
alert: Add Ringer Control Point characteristic

Ringer CP characteristic is used for configuring "silent mode" or muting
the ringer once.

11 years agoalert: Add Phone Alert Status Service
Bruna Moreira [Tue, 2 Oct 2012 20:24:27 +0000 (16:24 -0400)]
alert: Add Phone Alert Status Service

Add Phone Alert Status service for PASP.

11 years agoalert: Initial profile registration
Anderson Lizardo [Tue, 2 Oct 2012 20:24:26 +0000 (16:24 -0400)]
alert: Initial profile registration

11 years agoalert: Introduce manager abstraction layer
Anderson Lizardo [Tue, 2 Oct 2012 20:24:25 +0000 (16:24 -0400)]
alert: Introduce manager abstraction layer

This abstraction layer makes the GATT Phone Alert Status and Alert
Notification implementation consistent with other GATT profiles.

11 years agodoc: Introduce Alert API
Anderson Lizardo [Wed, 3 Oct 2012 12:46:38 +0000 (08:46 -0400)]
doc: Introduce Alert API

This API will be implemented and initially used by Phone Alert Status
and Alert Notification GATT profiles (server role).

11 years agocore: Fix return value for external profile SDP function
Johan Hedberg [Wed, 3 Oct 2012 19:18:36 +0000 (22:18 +0300)]
core: Fix return value for external profile SDP function

11 years agocore: Fix using correct address values for profile connecting
Johan Hedberg [Wed, 3 Oct 2012 19:17:52 +0000 (22:17 +0300)]
core: Fix using correct address values for profile connecting

11 years agocore: Add specific error to profile connect log
Johan Hedberg [Wed, 3 Oct 2012 19:17:15 +0000 (22:17 +0300)]
core: Add specific error to profile connect log

11 years agocore: Add SDP resolving callback for external profiles
Johan Hedberg [Wed, 3 Oct 2012 15:29:14 +0000 (18:29 +0300)]
core: Add SDP resolving callback for external profiles

11 years agocore: Add skeleton for initiating remote profile connections
Johan Hedberg [Wed, 3 Oct 2012 14:58:09 +0000 (17:58 +0300)]
core: Add skeleton for initiating remote profile connections

11 years agoAVRCP: Fix not freeing session list on exit
Luiz Augusto von Dentz [Tue, 2 Oct 2012 14:01:39 +0000 (17:01 +0300)]
AVRCP: Fix not freeing session list on exit

96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 261 of 338
   at 0x4A0884D: malloc (vg_replace_malloc.c:263)
   by 0x4C803FE: g_malloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C94801: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C95B42: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x12FDAD: state_changed (avrcp.c:1401)
   by 0x12D3B1: avctp_set_state (avctp.c:406)
   by 0x12E5C4: avctp_confirm_cb (avctp.c:896)
   by 0x1607D3: server_cb (btio.c:254)
   by 0x4C7A824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C7AB57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C7AF51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x120EB1: main (main.c:551)

11 years agoAVRCP: Fix not removing session from player upon disconnect
Luiz Augusto von Dentz [Mon, 1 Oct 2012 11:26:04 +0000 (14:26 +0300)]
AVRCP: Fix not removing session from player upon disconnect

Invalid read of size 8
   at 0x1310E3: avrcp_unregister_player (avrcp.c:1604)
   by 0x13EB57: path_free (media.c:1834)
   by 0x123208: remove_interface.isra.1 (object.c:558)
   by 0x1238DD: g_dbus_unregister_interface (object.c:705)
   by 0x124BB8: media_server_remove (manager.c:1077)
   by 0x4E91C5C: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x17B349: adapter_remove (adapter.c:2309)
   by 0x176F39: manager_cleanup (manager.c:290)
   by 0x120E65: main (main.c:555)
 Address 0x6685058 is 24 bytes inside a block of size 80 free'd
   at 0x4C279AE: free (vg_replace_malloc.c:427)
   by 0x4E7C50E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x12FC97: state_changed (avrcp.c:1380)
   by 0x12D351: avctp_set_state (avctp.c:396)
   by 0x12D7B4: session_cb (avctp.c:601)
   by 0x4E76824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4E76B57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4E76F51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x120E51: main (main.c:551)

11 years agoAVRCP: Fix not freeing player session list on exit
Luiz Augusto von Dentz [Sun, 30 Sep 2012 11:21:32 +0000 (14:21 +0300)]
AVRCP: Fix not freeing player session list on exit

16 bytes in 1 blocks are definitely lost in loss record 111 of 359
   at 0x4A0884D: malloc (vg_replace_malloc.c:263)
   by 0x4C8026E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C94671: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C959B2: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x130FCC: avrcp_register_player (avrcp.c:1584)
   by 0x13FA1F: register_player (media.c:1689)
   by 0x123100: process_message.isra.0 (object.c:197)
   by 0x4F70684: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F6290C: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x121747: message_dispatch (mainloop.c:76)
   by 0x4C7B22A: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C7A694: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)

11 years agogdbus: Fix not freeing list node by using g_slist_delete_link
Luiz Augusto von Dentz [Mon, 1 Oct 2012 17:45:38 +0000 (20:45 +0300)]
gdbus: Fix not freeing list node by using g_slist_delete_link

g_slist_remove_link does not free the node which can cause leaks so
replace that with g_slist_delete_link which does free memory properly.

11 years agocore: Fix freeing external profile record
Johan Hedberg [Wed, 3 Oct 2012 09:04:02 +0000 (12:04 +0300)]
core: Fix freeing external profile record

The add_record_to_server function takes ownership of the service record
so it only needs to be freed if the function fails.

11 years agocore: Suspend scanning before connect on pairing
João Paulo Rechi Vita [Tue, 2 Oct 2012 17:22:58 +0000 (14:22 -0300)]
core: Suspend scanning before connect on pairing

If there is a disconnected bonded device there will be a scanning
procedure active due to the General Connection Establishment Procedure.
This scan have to be suspended before trying to connect to the remote
device for pairing.

11 years agomgmt: Add address type to bonding debug message
João Paulo Rechi Vita [Tue, 2 Oct 2012 17:22:57 +0000 (14:22 -0300)]
mgmt: Add address type to bonding debug message

11 years agocore: Re-connect for ECONNRESET or ECONNABORTED
Claudio Takahasi [Tue, 2 Oct 2012 17:22:56 +0000 (14:22 -0300)]
core: Re-connect for ECONNRESET or ECONNABORTED

This patch keeps scanning and re-connections active if the disconnection
reason is ECONNRESET(Remote Initiated Disconnection).

Re-connection is a behaviour determined by Profiles or by the upper
layer(user actions). For instance, HoG requires re-connection always
active, no matter if the previous disconnection reason was page timeout
or remote initiated disconnection (ECONNRESET). Some devices disconnects
after some idle time, connectable advertises are sent by the peripheral
when commanded by the user(eg: key pressed). Disconnection can be also
triggered by the local host (ECONNABORTED) using command line tools or
Disconnect method in the Device interface.

The peripheral dictates the re-connection controlling the connectable
advertises, BlueZ(central) needs to keep the scanning always active to
able to detect the advertises and trigger the connection.

11 years agocore: Disable unnecessary auto connections
Paulo Alcantara [Tue, 2 Oct 2012 17:22:55 +0000 (14:22 -0300)]
core: Disable unnecessary auto connections

BlueZ host disconnects the link when encryption fails. ECONNABORTED
error is returned by the kernel when the connection is terminated by the
local host. This scenario commonly happens when authentication fails due
PIN or Key Missing.

11 years agocore: Start LE scanning when a device requests
Claudio Takahasi [Tue, 2 Oct 2012 17:22:54 +0000 (14:22 -0300)]
core: Start LE scanning when a device requests

This patch enables the LE scanning when a device requires connection and
there isn't discovery sessions, triggering the General Connection
Establishment Procedure.

11 years agocore: Replace interleaved by LE scanning
Claudio Takahasi [Tue, 2 Oct 2012 17:22:53 +0000 (14:22 -0300)]
core: Replace interleaved by LE scanning

This patches replaces the interleaved discovery by LE scanning when LE
re-connection is required.

11 years agomgmt: Add LE scanning callback
Claudio Takahasi [Tue, 2 Oct 2012 17:22:52 +0000 (14:22 -0300)]
mgmt: Add LE scanning callback

This patch adds a new callback to allow the adapter to control LE
scanning. The current approach uses the active scanning with default
windows and intervals defined by the core spec without any filtering.

11 years agocore: Mutually exclude concurrent connections
João Paulo Rechi Vita [Tue, 2 Oct 2012 17:22:51 +0000 (14:22 -0300)]
core: Mutually exclude concurrent connections

Since controllers don't support more than one ongoing connection
procedure at the same time, new connection attempts needs to yield if
there is an ongoing connection procedure already.

11 years agoaudio: Fix missing gateway state check on Connect
Mikel Astiz [Tue, 2 Oct 2012 17:46:40 +0000 (19:46 +0200)]
audio: Fix missing gateway state check on Connect

If the gateway is already connected (or connecting) when Connect() is
called, an error should be returned, exactly as other interfaces do.

11 years agoattrib: Get address type using gatt_get_address()
Anderson Lizardo [Tue, 2 Oct 2012 12:50:20 +0000 (08:50 -0400)]
attrib: Get address type using gatt_get_address()

This avoids a separate call to device_get_addr_type().

11 years agocore: Add support for ServiceRecord option for exteral profiles
Johan Hedberg [Tue, 2 Oct 2012 12:46:28 +0000 (15:46 +0300)]
core: Add support for ServiceRecord option for exteral profiles

11 years agocore: Move sdp_xml_parse_record from service plugin to sdp-xml.c
Johan Hedberg [Tue, 2 Oct 2012 12:45:29 +0000 (15:45 +0300)]
core: Move sdp_xml_parse_record from service plugin to sdp-xml.c

11 years agodevice: Remove not used variables from search_cb
Szymon Janc [Tue, 2 Oct 2012 11:39:55 +0000 (13:39 +0200)]
device: Remove not used variables from search_cb

sda and dba are not used in function code.

11 years agocore: Add variables to track client/server enabling for external profiles
Johan Hedberg [Tue, 2 Oct 2012 12:05:36 +0000 (15:05 +0300)]
core: Add variables to track client/server enabling for external profiles

11 years agocore: Support friendly names in profile registration
Johan Hedberg [Tue, 2 Oct 2012 10:51:01 +0000 (13:51 +0300)]
core: Support friendly names in profile registration

11 years agocore: Use proper defines for SPP profile detection
Johan Hedberg [Tue, 2 Oct 2012 10:50:26 +0000 (13:50 +0300)]
core: Use proper defines for SPP profile detection

11 years agocore: Add missing profile "friendly names" to glib-helper.c
Johan Hedberg [Tue, 2 Oct 2012 10:49:03 +0000 (13:49 +0300)]
core: Add missing profile "friendly names" to glib-helper.c

11 years agolib: Add SPP UUID define
Johan Hedberg [Tue, 2 Oct 2012 10:43:07 +0000 (13:43 +0300)]
lib: Add SPP UUID define

11 years agolib: Add some missing svclass values
Johan Hedberg [Tue, 2 Oct 2012 10:42:43 +0000 (13:42 +0300)]
lib: Add some missing svclass values

11 years agoagent: Remote not used variables from pincode_reply
Szymon Janc [Tue, 2 Oct 2012 09:33:12 +0000 (11:33 +0200)]
agent: Remote not used variables from pincode_reply

adapter and sba are not used later in function code.

11 years agoservice: Remove extra memory copying from cancel_authorization
Szymon Janc [Tue, 2 Oct 2012 09:33:11 +0000 (11:33 +0200)]
service: Remove extra memory copying from cancel_authorization

src is never read before being overwritten few lines below.

11 years agoaudio: Fix crash on gateway close while connected
Mikel Astiz [Mon, 1 Oct 2012 15:24:06 +0000 (17:24 +0200)]
audio: Fix crash on gateway close while connected

RFCOMM and SCO watches need to be removed in gateway_close(), otherwise
the watch callbacks might get called later on, resulting in a second
call to gateway_close().

The issue can be easily reproduced if a device is removed (unpaired) a
device while HFP gateway is connected:

bluetoothd[26579]: audio/gateway.c:path_unregister() Unregistered interface org.bluez.HandsfreeGateway on path /org/bluez/26579/hci0/dev_90_84_0D_B2_C7_04
bluetoothd[26579]: audio/media.c:gateway_state_changed()
bluetoothd[26579]: audio/media.c:gateway_state_changed() Clear endpoint 0x555555822cb0
bluetoothd[26579]: audio/source.c:path_unregister() Unregistered interface org.bluez.AudioSource on path /org/bluez/26579/hci0/dev_90_84_0D_B2_C7_04
bluetoothd[26579]: audio/avdtp.c:avdtp_unref() 0x555555827980: ref=2
bluetoothd[26579]: src/device.c:btd_device_unref() 0x55555581a470: ref=1
bluetoothd[26579]: src/device.c:btd_device_unref() 0x55555581a470: ref=0
bluetoothd[26579]: src/device.c:device_free() 0x55555581a470

Program received signal SIGSEGV, Segmentation fault.
gateway_close (device=0x555555820390) at audio/gateway.c:585
585 if (gw->rfcomm) {

11 years agoaudio: Fix crash if gateway closed before reply
Mikel Astiz [Mon, 1 Oct 2012 15:24:05 +0000 (17:24 +0200)]
audio: Fix crash if gateway closed before reply

Any pending call to the agent needs to be cancelled in gateway_close(),
to make sure newconnection_reply() never gets called.

Otherwise, the audio gateway can be closed (dev->gateway == NULL) before
the reply from the agent has been received, resulting in the following
crash as reproduced while removing (unpairing) a device:

bluetoothd[2219]: src/mgmt.c:mgmt_unpair_device() index 0 addr 38:16:D1:C5:D1:A2
bluetoothd[2219]: audio/gateway.c:path_unregister() Unregistered interface org.bluez.HandsfreeGateway on path /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: audio/media.c:gateway_state_changed()
bluetoothd[2219]: audio/media.c:gateway_state_changed() Clear endpoint 0x555555820640
bluetoothd[2219]: audio/source.c:path_unregister() Unregistered interface org.bluez.AudioSource on path /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: src/device.c:btd_device_unref() 0x555555833e70: ref=1
bluetoothd[2219]: src/adapter.c:adapter_get_device() 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/adapter.c:adapter_create_device() 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/device.c:device_create() Creating device /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: src/device.c:device_free() 0x55555581f9c0
bluetoothd[2219]: Unable to get btd_device object for 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/device.c:btd_device_unref() 0x555555833e70: ref=0
bluetoothd[2219]: src/device.c:device_free() 0x555555833e70
bluetoothd[2219]: src/mgmt.c:mgmt_event() cond 1
bluetoothd[2219]: src/mgmt.c:mgmt_event() Received 16 bytes from management socket
bluetoothd[2219]: src/mgmt.c:mgmt_cmd_complete()
bluetoothd[2219]: src/mgmt.c:mgmt_cmd_complete() unpair_device complete

Program received signal SIGSEGV, Segmentation fault.
0x000055555556fa26 in newconnection_reply (call=<optimized out>, data=0x555555824dd0) at audio/gateway.c:285
285 if (!dev->gateway->rfcomm) {

Additionally, this patch makes it unnecessary to check if RFCOMM got
disconnected before newconnection_reply, since RFCOMM disconnection also
triggers gateway_close() and thus the agent's call will be cancelled.

11 years agoaudio: Drop audio-specific authorization mechanism
Mikel Astiz [Fri, 28 Sep 2012 16:32:25 +0000 (18:32 +0200)]
audio: Drop audio-specific authorization mechanism

Remove the audio-specific service authorization mechanism in favor of
using the conventional one.

The main difference is that audio profiles will be authorized
independently. Therefore a single connection might result in several
profile authorization requests to the agent (i.e. HFP, A2DP and AVRCP).

This removes any internal policy that would skip the authorization
procedure, making it simpler and more convenient for IVI use-cases.

Agents interested in simulating the old behavior are encouraged to
either set the device as trusted or just reply to the additional
authorization requests automatically without user intervention.

11 years agoadapter: Queue parallel authorization requests
Mikel Astiz [Fri, 28 Sep 2012 16:32:24 +0000 (18:32 +0200)]
adapter: Queue parallel authorization requests

Remote device could try to connect several profiles in parallel, or
several devices could be trying to connect services. Instead of
returning EBUSY, this patch adds a queue to each adapter such that the
authorization requests will be queued and processed sequentially.

11 years agoadapter: Use authorization id for cancelling
Mikel Astiz [Fri, 28 Sep 2012 16:32:23 +0000 (18:32 +0200)]
adapter: Use authorization id for cancelling

Return a request id in btd_request_authorization() in order to be used
when the request needs to be cancelled. This id alone will be enough to
use btd_cancel_authorization().

11 years agoadapter: Replace device authorizing flag
Mikel Astiz [Fri, 28 Sep 2012 16:32:22 +0000 (18:32 +0200)]
adapter: Replace device authorizing flag

Refactor code to drop the device authorizing flag by replacing it with a
private authorization pointer in btd_adapter. After all, no more than
one authorization can be ongoing, so the code is easier to follow if
this is made explicit.

11 years agobuild: Update glib dependency to 2.32
Mikel Astiz [Fri, 28 Sep 2012 16:32:21 +0000 (18:32 +0200)]
build: Update glib dependency to 2.32

This version of the library adds several convenient features such as
g_queue_free_full.

11 years agocore: Add skeleton for connecting external profiles
Johan Hedberg [Mon, 1 Oct 2012 12:17:46 +0000 (15:17 +0300)]
core: Add skeleton for connecting external profiles

11 years agocore: Fix profile cleanup when removing or disconnecting
Johan Hedberg [Mon, 1 Oct 2012 10:43:25 +0000 (13:43 +0300)]
core: Fix profile cleanup when removing or disconnecting

11 years agocore: Add btd_profile parameter to profile disconnect callback
Johan Hedberg [Mon, 1 Oct 2012 10:43:00 +0000 (13:43 +0300)]
core: Add btd_profile parameter to profile disconnect callback

11 years agocore: Add proper adapter_remove callback for external profiles
Johan Hedberg [Mon, 1 Oct 2012 10:12:10 +0000 (13:12 +0300)]
core: Add proper adapter_remove callback for external profiles