OSDN Git Service

android-x86/external-bluetooth-bluez.git
11 years agogdbus: Refactor filter_data_find()
Lucas De Marchi [Wed, 26 Sep 2012 13:39:47 +0000 (10:39 -0300)]
gdbus: Refactor filter_data_find()

Now this function is only used for searching the listeners of a
connection and the other parameters are not needed anymore.

11 years agogdbus: Fix wrong signal handler match
Lucas De Marchi [Wed, 26 Sep 2012 13:39:46 +0000 (10:39 -0300)]
gdbus: Fix wrong signal handler match

When we add a signal handler with g_dbus_add_signal_watch(), this
function tries to multiplex the matches added in libdbus by checking
if there's a previous filter_data with the same fields. However, if the
field is NULL it accepts as being the same. The result is that the
following watches will use the same filter data:

watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

The result is that when a signal arrives with path == "/path2", all 3
callbacks above will be called, with the same signal delivered to all of
them.

Another problem is that, if we invert the calls like below, only signals
to cb1 will never be trigerred, nonetheless it used path == NULL.

watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

This is fixed by not multiplexing the matchs with filter data if any of
the fields are different, including being NULL. When a signal arrives,
if a field is NULL we accept it as a match, but not when adding the
signal handler.

11 years agogdbus: Fix crash when getting disconnected from the bus
Johan Hedberg [Wed, 26 Sep 2012 18:45:05 +0000 (21:45 +0300)]
gdbus: Fix crash when getting disconnected from the bus

When getting disconnected from the bus sometimes (maybe always?)
dbus_watch_handle() can cause the "info" context to be free'd meaning
that we should not try to access it after the call. The only member we
need access to is the connection pointer and as the code already has a
ref() call for it it's only natural to solve the issue by adding a local
variable not dependent on "info".

The backtrace of the crash fixed looks as follows:

 Invalid read of size 8
   at 0x121085: watch_func (mainloop.c:105)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)
 Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd
   at 0x4A079AE: free (vg_replace_malloc.c:427)
   by 0x4C7837E: g_free (gmem.c:252)
   by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614)
   by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132)
   by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884)
   by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497)
   by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683)
   by 0x121084: watch_func (mainloop.c:103)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)

11 years agobuild: Fix make distcheck for src/profile.c
Anderson Lizardo [Wed, 26 Sep 2012 18:22:42 +0000 (14:22 -0400)]
build: Fix make distcheck for src/profile.c

Fix this "make distcheck" error:

../src/profile.c:39:18: fatal error: uuid.h: No such file or directory

11 years agoAVRCP: Store version and features of the remote in the session
Luiz Augusto von Dentz [Wed, 26 Sep 2012 13:45:53 +0000 (16:45 +0300)]
AVRCP: Store version and features of the remote in the session

11 years agoAVRCP: Fix using struct avrcp_player as session abstraction
Luiz Augusto von Dentz [Wed, 26 Sep 2012 13:07:59 +0000 (16:07 +0300)]
AVRCP: Fix using struct avrcp_player as session abstraction

This fixes several limitations with the current design including not
being able to connect multiple devices at same time and not being able
to register players on the fly while a connection was already
established.

11 years agoAVRCP: Automatically connect browsing channel if supported
Luiz Augusto von Dentz [Tue, 25 Sep 2012 11:45:38 +0000 (14:45 +0300)]
AVRCP: Automatically connect browsing channel if supported

Once control channel is connected check if the device support browsing
channel and connect to it.

11 years agoAVRCP: Add handler for browsing PDUs
Vani Patel [Mon, 24 Sep 2012 11:12:03 +0000 (14:12 +0300)]
AVRCP: Add handler for browsing PDUs

Implement generic handling of browsing PDU ids

11 years agoAVCTP: Add functions to register and unregister Browsing handler
Joohi Rastogi [Fri, 21 Sep 2012 04:56:42 +0000 (10:26 +0530)]
AVCTP: Add functions to register and unregister Browsing handler

11 years agoAVRCP: Add browsing channel support
Vani Patel [Mon, 24 Sep 2012 10:20:56 +0000 (13:20 +0300)]
AVRCP: Add browsing channel support

Implements browsing channel creation and release.

11 years agoAVRCP: Rename variables used for control channel
Vani Patel [Mon, 24 Sep 2012 09:07:40 +0000 (12:07 +0300)]
AVRCP: Rename variables used for control channel

11 years agoAVRCP: Adds SDP record to support browsing channel
Vani Patel [Thu, 20 Sep 2012 08:51:37 +0000 (14:21 +0530)]
AVRCP: Adds SDP record to support browsing channel

11 years agoAVRCP: Fix handler lookup for undefined control PDU ids
Luiz Augusto von Dentz [Tue, 25 Sep 2012 07:58:40 +0000 (10:58 +0300)]
AVRCP: Fix handler lookup for undefined control PDU ids

The lookup table of handlers is not NULL terminated which in case of an
undefined id may lead to read invalid memory out of the table area.

To fix this the id 0x00 is now used as delimiter.

11 years agocore: Add support for Profile.NewConnection
Johan Hedberg [Wed, 26 Sep 2012 10:41:02 +0000 (13:41 +0300)]
core: Add support for Profile.NewConnection

11 years agodbus: Add org.bluez.Profile to D-Bus policy
Johan Hedberg [Wed, 26 Sep 2012 13:28:51 +0000 (16:28 +0300)]
dbus: Add org.bluez.Profile to D-Bus policy

11 years agotest: Fix signature of Profile.NewConnection in test-profile
Johan Hedberg [Wed, 26 Sep 2012 13:27:48 +0000 (16:27 +0300)]
test: Fix signature of Profile.NewConnection in test-profile

11 years agocore: Fix sending Profile.Cancel before Profile.Release
Johan Hedberg [Wed, 26 Sep 2012 12:21:14 +0000 (15:21 +0300)]
core: Fix sending Profile.Cancel before Profile.Release

11 years agotest: Add PSM and Channel options to test-profile
Johan Hedberg [Wed, 26 Sep 2012 12:12:45 +0000 (15:12 +0300)]
test: Add PSM and Channel options to test-profile

11 years agocore: Add basic defaults lookup to external profiles
Johan Hedberg [Wed, 26 Sep 2012 11:47:39 +0000 (14:47 +0300)]
core: Add basic defaults lookup to external profiles

11 years agotest: Improve test-profile functionality
Johan Hedberg [Wed, 26 Sep 2012 11:46:27 +0000 (14:46 +0300)]
test: Improve test-profile functionality

11 years agocore: Add support for Role option for RegisterProfile
Johan Hedberg [Wed, 26 Sep 2012 11:47:08 +0000 (14:47 +0300)]
core: Add support for Role option for RegisterProfile

11 years agocore: Fix order of calling Profile.Release
Johan Hedberg [Wed, 26 Sep 2012 10:40:43 +0000 (13:40 +0300)]
core: Fix order of calling Profile.Release

11 years agocore: Initialize profile security level to a sane default
Johan Hedberg [Wed, 26 Sep 2012 07:52:17 +0000 (10:52 +0300)]
core: Initialize profile security level to a sane default

11 years agocore: Fix minor coding style issue (long line)
Johan Hedberg [Wed, 26 Sep 2012 10:03:27 +0000 (13:03 +0300)]
core: Fix minor coding style issue (long line)

11 years agomgmt: Fix parsing read_index_list response
Johan Hedberg [Wed, 26 Sep 2012 11:46:00 +0000 (14:46 +0300)]
mgmt: Fix parsing read_index_list response

11 years agocore: Add skeleton for handling server sockets for external profiles
Johan Hedberg [Tue, 25 Sep 2012 17:14:04 +0000 (20:14 +0300)]
core: Add skeleton for handling server sockets for external profiles

11 years agocore: Make profile debug logging a bit more readable
Johan Hedberg [Tue, 25 Sep 2012 16:27:13 +0000 (19:27 +0300)]
core: Make profile debug logging a bit more readable

11 years agocore: Add basic profile options parsing support
Johan Hedberg [Tue, 25 Sep 2012 16:17:22 +0000 (19:17 +0300)]
core: Add basic profile options parsing support

11 years agotest: Add some more options to test-profile registration
Johan Hedberg [Tue, 25 Sep 2012 16:17:00 +0000 (19:17 +0300)]
test: Add some more options to test-profile registration

11 years agocore: Add simple adapter probe function to external profiles
Johan Hedberg [Tue, 25 Sep 2012 15:45:12 +0000 (18:45 +0300)]
core: Add simple adapter probe function to external profiles

11 years agocore: Add dynamic adapter and device probe support
Johan Hedberg [Tue, 25 Sep 2012 15:42:05 +0000 (18:42 +0300)]
core: Add dynamic adapter and device probe support

Particularly With the introduction of external profiles the probe
functions must be possible to be triggered at any point during runtime.

11 years agocore: Add debug logs for external profile registration
Johan Hedberg [Tue, 25 Sep 2012 15:10:53 +0000 (18:10 +0300)]
core: Add debug logs for external profile registration

11 years agodoc: Add profile API documentation
Johan Hedberg [Tue, 25 Sep 2012 14:26:16 +0000 (17:26 +0300)]
doc: Add profile API documentation

11 years agoaudio: Fix attempting to create a device on driver .remove
Luiz Augusto von Dentz [Tue, 25 Sep 2012 12:56:44 +0000 (15:56 +0300)]
audio: Fix attempting to create a device on driver .remove

audio_remove calls get_audio_dev which may attempt to create the device
if it doesn't exist.

11 years agocore: Monitor external profile processes
Johan Hedberg [Tue, 25 Sep 2012 12:35:33 +0000 (15:35 +0300)]
core: Monitor external profile processes

11 years agotest: Add test-profile test script
Johan Hedberg [Tue, 25 Sep 2012 12:11:48 +0000 (15:11 +0300)]
test: Add test-profile test script

11 years agocore: Add cleanup function for external profiles
Johan Hedberg [Tue, 25 Sep 2012 11:39:28 +0000 (14:39 +0300)]
core: Add cleanup function for external profiles

11 years agocore: Add profile parameter to adapter and device probe functions
Johan Hedberg [Tue, 25 Sep 2012 11:23:57 +0000 (14:23 +0300)]
core: Add profile parameter to adapter and device probe functions

This is necessary for the external profile implementation (which will
have the same callback functions for all external profiles).

11 years agocore: Add external profile registration callbacks
Johan Hedberg [Tue, 25 Sep 2012 10:25:28 +0000 (13:25 +0300)]
core: Add external profile registration callbacks

11 years agocore: Remove btd_get_profiles
Johan Hedberg [Tue, 25 Sep 2012 10:23:31 +0000 (13:23 +0300)]
core: Remove btd_get_profiles

11 years agocore: Use btd_profile_foreach for device probing
Johan Hedberg [Tue, 25 Sep 2012 10:22:42 +0000 (13:22 +0300)]
core: Use btd_profile_foreach for device probing

11 years agoinput: Add Device.Connect support
Johan Hedberg [Tue, 25 Sep 2012 09:49:26 +0000 (12:49 +0300)]
input: Add Device.Connect support

11 years agotest: Add command for Device.Connect()
Johan Hedberg [Tue, 25 Sep 2012 08:17:16 +0000 (11:17 +0300)]
test: Add command for Device.Connect()

11 years agocore: Add Device.Connect method
Johan Hedberg [Tue, 25 Sep 2012 08:12:38 +0000 (11:12 +0300)]
core: Add Device.Connect method

11 years agocore: Add error reporting to profile callbacks
Johan Hedberg [Tue, 25 Sep 2012 08:08:29 +0000 (11:08 +0300)]
core: Add error reporting to profile callbacks

11 years agowiimote: add Wii Balance Board detection
David Herrmann [Wed, 12 Sep 2012 21:32:53 +0000 (23:32 +0200)]
wiimote: add Wii Balance Board detection

Add the name of the Wii Balance Board so it can be paired with BlueZ like
any other Wii Remote. Reported by Florian Echtler.

11 years agomedia: Fix possible crash when endpoint exit
Luiz Augusto von Dentz [Fri, 21 Sep 2012 13:12:23 +0000 (16:12 +0300)]
media: Fix possible crash when endpoint exit

a2dp_sep_unlock may free the endpoint if it is not registered anymore
which leads to destroying all related transport causing the following:

Invalid read of size 1
   at 0x4A09F09: memcpy@GLIBC_2.2.5 (mc_replace_strmem.c:836)
   by 0x4F7C02D: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F7AAE5: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F7B10B: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F68DA0: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F66788: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F66B41: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4F6D64E: dbus_message_new_signal (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x180FC2: emit_property_changed (dbus-common.c:130)
   by 0x13FD15: transport_set_state (transport.c:206)
   by 0x140519: suspend_a2dp (transport.c:460)
   by 0x122436: service_filter (watch.c:476)
 Address 0x6546110 is 48 bytes inside a block of size 49 free'd
   at 0x4A079AE: free (vg_replace_malloc.c:427)
   by 0x4C8037E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x1409F9: media_transport_free (transport.c:1160)
   by 0x12282F: remove_interface (object.c:553)
   by 0x123699: g_dbus_unregister_interface (object.c:1231)
   by 0x141547: media_transport_destroy (transport.c:228)
   by 0x4C95ACC: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C95AEA: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x13E53D: media_endpoint_remove (media.c:162)
   by 0x133F62: a2dp_unregister_sep (a2dp.c:1247)
   by 0x1369D7: a2dp_sep_unlock (a2dp.c:1814)
   by 0x1404D3: suspend_a2dp (transport.c:455)

11 years agonetwork: Fix DBusMessage leaks
Johan Hedberg [Fri, 21 Sep 2012 12:08:03 +0000 (15:08 +0300)]
network: Fix DBusMessage leaks

11 years agocore: Fix Device.Disconnect() DBusMessage leak
Johan Hedberg [Fri, 21 Sep 2012 12:08:49 +0000 (15:08 +0300)]
core: Fix Device.Disconnect() DBusMessage leak

11 years agoservice: Fix DBusMessage leak
Johan Hedberg [Fri, 21 Sep 2012 12:06:34 +0000 (15:06 +0300)]
service: Fix DBusMessage leak

11 years agodbusoob: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:19 +0000 (12:22 +0200)]
dbusoob: Simplify DBusConnection object handling

This patch removes local reference to DBusConnection object and uses
btd_get_dbus_connection() call wherever such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoservice: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:18 +0000 (12:22 +0200)]
service: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agothermometer: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:17 +0000 (12:22 +0200)]
thermometer: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agosap: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:16 +0000 (12:22 +0200)]
sap: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agonetwork: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:15 +0000 (12:22 +0200)]
network: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoinput: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:14 +0000 (12:22 +0200)]
input: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agohealth: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:13 +0000 (12:22 +0200)]
health: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoaudio: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:12 +0000 (12:22 +0200)]
audio: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoattrib: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:11 +0000 (12:22 +0200)]
attrib: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoadapter: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:10 +0000 (12:22 +0200)]
adapter: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agodevice: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:09 +0000 (12:22 +0200)]
device: Simplify DBusConnection object handling

This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agoagent: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:08 +0000 (12:22 +0200)]
agent: Simplify DBusConnection object handling

This patch removes local reference to DBusConnection object and uses
btd_get_dbus_connection() call wherever such object is needed instead.

Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.

11 years agomanager: Simplify DBusConnection object handling
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:07 +0000 (12:22 +0200)]
manager: Simplify DBusConnection object handling

This patch removes local reference to DBusConnection object and uses
btd_get_dbus_connection() call wherever such object is needed instead.

11 years agodbus-common: Remove conn parameter from emit_array_property_changed
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:06 +0000 (12:22 +0200)]
dbus-common: Remove conn parameter from emit_array_property_changed

DBusConnection pointer is already stored in connection static variable
so it's redundant to pass it as function parameter.

11 years agodbus-common: Remove conn parameter from emit_property_changed
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:05 +0000 (12:22 +0200)]
dbus-common: Remove conn parameter from emit_property_changed

Valid DBusConnection pointer is available static variable 'connection'
so it's it's redundant to pass it as function parameter.

11 years agocore: Make D-Bus connection valid for entire bluetoothd lifetime
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:04 +0000 (12:22 +0200)]
core: Make D-Bus connection valid for entire bluetoothd lifetime

D-Bus is connected before any subsystem needs to use it and disconnected
only after nothing uses it (i.e. plugins). This is to guarantee that
every call to btd_get_dbus_connection() will return valid DBusConnection
object so various components and plugins do not need to store it
somewhere and care about ref counting.

11 years agoRename get_dbus_connection to btd_get_dbus_connection
Andrzej Kaczmarek [Wed, 19 Sep 2012 10:22:03 +0000 (12:22 +0200)]
Rename get_dbus_connection to btd_get_dbus_connection

get_dbus_connection is exported function which can be used by plugins thus
should be prefixed with "btd_"

11 years agomgmt: Add wrapper for Set LE
Andrzej Kaczmarek [Tue, 28 Aug 2012 12:38:34 +0000 (14:38 +0200)]
mgmt: Add wrapper for Set LE

Wrap mgmt_set_mode for Set LE into separate function to be consistent
with other calls and have debug printout.

11 years agomgmt: Add wrapper for Set SSP
Andrzej Kaczmarek [Tue, 28 Aug 2012 12:38:33 +0000 (14:38 +0200)]
mgmt: Add wrapper for Set SSP

Wrap mgmt_set_mode for Set SSP into separate function to be consistent
with other calls and have debug printout.

11 years agocore: Use adapter connect list for LE connections
João Paulo Rechi Vita [Tue, 11 Sep 2012 13:32:58 +0000 (10:32 -0300)]
core: Use adapter connect list for LE connections

When a connection is needed for a LE device it is added to the adapter
connect list instead of directly connecting the ATT io channel.

11 years agocore: Control connections based on adapter state
Claudio Takahasi [Tue, 11 Sep 2012 13:32:57 +0000 (10:32 -0300)]
core: Control connections based on adapter state

This patch disable automatic ATTIO connections when the adapter is
powered down and enable automatic connection when the adapter is powered
on.

11 years agohog: Fix segfault when discovering descriptors
João Paulo Rechi Vita [Fri, 14 Sep 2012 13:56:50 +0000 (10:56 -0300)]
hog: Fix segfault when discovering descriptors

Invalid memory was being accessed when discovering the External Report
Reference descriptor.

11 years agogatttool: Fix Characteristic descriptor discovery
Claudio Takahasi [Wed, 19 Sep 2012 19:37:56 +0000 (16:37 -0300)]
gatttool: Fix Characteristic descriptor discovery

This patch fixes end condition for Characteristic Descriptor Discovery.
This sub-procedure is complete when the Error Response is received and
the Error Code is set to Attribute Not Found or the Find Information
Response has an Attribute Handle that is equal to the Ending Handle of
the request.

11 years agocups: Free D-Bus error
Syam Sidhardhan [Fri, 14 Sep 2012 16:10:11 +0000 (21:40 +0530)]
cups: Free D-Bus error

If D-Bus error is set we should free it.

11 years agogstavdtpsink: Free the D-Bus error on reply failure
Syam Sidhardhan [Fri, 14 Sep 2012 16:10:10 +0000 (21:40 +0530)]
gstavdtpsink: Free the D-Bus error on reply failure

If D-Bus error is set we should free it.

11 years agoadapter: Remove dead code from adapter_emit_device_found()
Syam Sidhardhan [Fri, 14 Sep 2012 16:10:09 +0000 (21:40 +0530)]
adapter: Remove dead code from adapter_emit_device_found()

11 years agodevice: Remove dead code from get_properties()
Syam Sidhardhan [Fri, 14 Sep 2012 16:10:08 +0000 (21:40 +0530)]
device: Remove dead code from get_properties()

11 years agomedia: Fix infinite loop due to release_endpoint()
Mikel Astiz [Fri, 14 Sep 2012 11:18:40 +0000 (13:18 +0200)]
media: Fix infinite loop due to release_endpoint()

release_endpoint() cannot succeed unless all transports are released
first. For example a2dp_remove_sep() will ignore the call if the SEP is
locked, leading to an infinite loop in path_free(), which expects to
successfully release and remove the endpoint in each call to
release_endpoint().

This issue can easily be reproduced by shutting bluetoothd daemon
during A2DP streaming (tested in sink role).

11 years agomedia: Extend media API with optional acquire
Mikel Astiz [Fri, 14 Sep 2012 12:56:00 +0000 (14:56 +0200)]
media: Extend media API with optional acquire

Acquiring a transport is needed in two different situations: either
we are initiating the audio stream locally, or the remote side initiated
it and thus we are just reacting. In the second case, we would expect
the stream is already available, and otherwise the operation should
fail. This means the media API needs to be extended in order to make
this difference.

This issue is specially relevant in the case of SCO, because the current
approach is racy. With HFP, for example (say BlueZ has the HS role), the
following race condition could be met:

1. Phone has an incoming call and thus starts in-band ringing.
2. SCO connection is accepted and stablished by BlueZ.
3. Gateway interface state is changed to Playing.
4. Exactly afterwards, the user routes the audio to the phone, to have
   a private conversation. So the SCO link is closed.
5. In parallel, PulseAudio sees the transition to Playing, and acquires
   the transport.
6. BlueZ receives an Acquire() request, but SCO is down. So it tries to
   reconnect the SCO link.

The last step is an undesired behavior (the audio is routed back to the
car). BlueZ should be smart enough to know that the SCO connection
shouldn't be reestablished, but this is only possible if the endpoint
provides additional information in the media API.

Note that the API change introduced by this patch is backward
compatible, meaning that older versions of BlueZ will just ignore the
flag. So clients are encouraged to use it without necessarily adding a
dependency to newer versions of BlueZ.

11 years agomedia: Automatically release transport when HUP
Mikel Astiz [Fri, 14 Sep 2012 12:55:59 +0000 (14:55 +0200)]
media: Automatically release transport when HUP

When the remote end suspends the audio stream, release the transport
automatically without waiting until the clients call Release().

This affects the D-Bus API since clients will get an error when trying
to release the transport afterwards.

However, this should have no real impact, since most clients (i.e.
PulseAudio) would just log some error trace but otherwise ignore the
issue.

11 years agomedia: Expose transport state in D-Bus
Mikel Astiz [Fri, 14 Sep 2012 12:55:58 +0000 (14:55 +0200)]
media: Expose transport state in D-Bus

Extend the Media API to expose the transport state in D-Bus, as a
property of the transport. This way the clients do not have to find
out which is the corresponding profile-specific interface for the
transport.

Additionally, this state along with the automatic release of transports
will allow clients to avoid the "optional release" or "accept remote
release" race condition. For example, with HSP/HFP profiles, the problem
is the following:

1. User suspends SCO in the remote end.
2. BlueZ signals the Playing->Connected state change in D-Bus.
3. Exactly afterwards, the user resumes SCO in the remote end.
4. In parallel, PulseAudio sees the aforementioned transition to
   Connected, and thus releases the transport.
5. BlueZ receives a Release() request while SCO is up. So the audio
   stream will be suspended.

The last step is an undesired behavior since the user explicitly wanted
to route the audio stream through Bluetooth.

The issue is difficult to reproduce but it can easily be solved by
exposing the transport state in D-Bus.

11 years agomedia: Split transport state based on playing flag
Mikel Astiz [Fri, 14 Sep 2012 12:55:57 +0000 (14:55 +0200)]
media: Split transport state based on playing flag

Split the transport states (formerly in_use) into more specific states
where the stream state (playing or suspended) is explicitly represented,
along with the transitional states (locally initiated suspend and
resume).

TRANSPORT_STATE_ACTIVE is an exception since it also includes the state
where the transport is acquired, but the audio was later suspended (not
released yet though).

11 years agomedia: Watch interface state changes in transport
Mikel Astiz [Fri, 7 Sep 2012 15:20:29 +0000 (17:20 +0200)]
media: Watch interface state changes in transport

Install watches to keep track whether the audio is streaming or not.
This should be relevant if the transport needs to reflect this state.

11 years agomedia: Replace transport->in_use flag with state
Mikel Astiz [Fri, 7 Sep 2012 15:20:28 +0000 (17:20 +0200)]
media: Replace transport->in_use flag with state

Refactor the code to use a enum type to represent the transport state.
This should scale better when additional states need to be represented.

A helper function has been added to help track the mapping between the
enum type and the old in_use flag.

11 years agomedia: Add gateway_get_state() to internal API
Mikel Astiz [Fri, 7 Sep 2012 15:20:27 +0000 (17:20 +0200)]
media: Add gateway_get_state() to internal API

Expose the state of the gateway interface in the internal API.

11 years agomedia: Add a2dp_sep_is_playing() to internal API
Mikel Astiz [Fri, 7 Sep 2012 15:20:26 +0000 (17:20 +0200)]
media: Add a2dp_sep_is_playing() to internal API

Add this function to expose whether the local SEP is streaming or not.

11 years agomedia: Fix accesstype comparison
Mikel Astiz [Fri, 7 Sep 2012 15:20:25 +0000 (17:20 +0200)]
media: Fix accesstype comparison

Replace the string representation of the accesstype with a conventional
binary representation. This makes the code simpler and more efficient.

This also fixes a minor bug in the Release() D-Bus method, where the
string comparison was used to see whether the owner should be removed. A
client acquiring with "rw" and releasing with "wr" would lead to the
inconsistent state of having a released transport with an owner with no
accesstype. Partial releases can also get affected by this bug since the
released character (partial accesstype) got replaced by a whitespace.

Additionally, this approach is more robust in case new flags are added
in the future.

11 years agoinput: Remove unnecessary struct input_conn
Johan Hedberg [Tue, 11 Sep 2012 10:29:01 +0000 (13:29 +0300)]
input: Remove unnecessary struct input_conn

There's no need to maintain the capability of multiple connections per
device, so just merge the connections list into the main input_device
struct.

11 years agoinput: Remove fakhid functionality
Johan Hedberg [Mon, 10 Sep 2012 12:51:23 +0000 (15:51 +0300)]
input: Remove fakhid functionality

The HSP code conflicts with a real HSP implementation and the PS3
support should be done through the kernel.

11 years agoprofile: Add asynchronous completion functions for connect/disconnect
Johan Hedberg [Mon, 10 Sep 2012 12:38:55 +0000 (15:38 +0300)]
profile: Add asynchronous completion functions for connect/disconnect

11 years agocore: Move profile code into profile.{c,h}
Johan Hedberg [Mon, 10 Sep 2012 12:32:22 +0000 (15:32 +0300)]
core: Move profile code into profile.{c,h}

11 years agoavctp: Fix reply for message with invalid PID
Par-Gunnar Hjalmdahl [Tue, 11 Sep 2012 06:16:26 +0000 (08:16 +0200)]
avctp: Fix reply for message with invalid PID

Reply for control message with invalid (not registered for reception
of messages) PID should not have message information field present.

This was affecting AVCTP qualification test case TP/NFR/BI-01-C.

11 years agonetwork: Fix minor whitespace issue
Johan Hedberg [Mon, 10 Sep 2012 07:38:01 +0000 (10:38 +0300)]
network: Fix minor whitespace issue

11 years agocore: Remove pattern matching when probing services
Johan Hedberg [Fri, 7 Sep 2012 13:09:52 +0000 (16:09 +0300)]
core: Remove pattern matching when probing services

This code was only needed for the Serial interface for matching all
RFCOMM-based records, and now that this interface is gone the code is
also no-longer needed.

11 years agofakehid: Add support for Logitech Harmony Adapter for PS3
David Dillow [Fri, 31 Aug 2012 02:06:00 +0000 (22:06 -0400)]
fakehid: Add support for Logitech Harmony Adapter for PS3

This emulates a Sony BD Remote for the Logitech Harmony series of
universal remotes.

11 years agofakehid: Disconnect from PS3 remote after 10 mins
Bastien Nocera [Fri, 7 Sep 2012 12:02:14 +0000 (13:02 +0100)]
fakehid: Disconnect from PS3 remote after 10 mins

After 10 minutes, disconnect the PS3 BD Remote to avoid draining its
battery. This is consistent with its behaviour on the PS3.

Original patch by Ruslan N. Marchenko <rufferson@gmail.com>

11 years agoinput: Add helper function to request disconnect
Bastien Nocera [Fri, 7 Sep 2012 12:01:58 +0000 (13:01 +0100)]
input: Add helper function to request disconnect

11 years agofakehid: Use the same constant as declared
Bastien Nocera [Fri, 7 Sep 2012 11:01:22 +0000 (12:01 +0100)]
fakehid: Use the same constant as declared

ps3remote_keymap[] uses 0xff as the max value, so should we.

11 years agotest: Add compact mode to test-discovery
Johan Hedberg [Fri, 7 Sep 2012 11:12:33 +0000 (14:12 +0300)]
test: Add compact mode to test-discovery

11 years agocore: Add a list of LE devices to connect
João Paulo Rechi Vita [Tue, 4 Sep 2012 19:04:32 +0000 (16:04 -0300)]
core: Add a list of LE devices to connect

This commit creates a per-adapter list of LE devices to connect when a
advertising from them is seen during a scan.