Commit Graph

10556 Commits

Author SHA1 Message Date
Johan Hedberg
f45ee9ff35 btmgmt: Add basic EIR parsing 2012-10-22 17:36:38 +03:00
Johan Hedberg
6386e2d2c9 core: Remove unnecessary include from glib-helper.c 2012-10-22 17:36:38 +03:00
Johan Hedberg
70a609bb3a sap: Fix connected property fetching when not connected 2012-10-19 19:49:00 +03:00
Ludek Finstrle
d24560cf46 attrib: Fix memory leak if att_data_list_alloc fails
Fix for memory leak which was introduced in commit
f8619bef34.
2012-10-19 10:41:25 +03:00
Lucas De Marchi
fc10fc4edb doc: Update Health to BlueZ 5
Adapt to the new DBus.Properties and cleanup the format used in this
documentation to be similar to the other profiles.
2012-10-19 10:38:15 +03:00
Lucas De Marchi
b9d9498e81 health: Convert HealthDevice to DBus.Properties 2012-10-19 10:38:01 +03:00
Lucas De Marchi
d9ecb9c64c health: Convert HealthChannel to DBus.Properties
Also remove a needless strdup to send type property.
2012-10-19 10:37:05 +03:00
Lucas De Marchi
aaa40311d0 sap: Convert to DBus.Properties 2012-10-19 10:36:46 +03:00
Lucas De Marchi
5b804fe6f9 sap: Fix usage of wrong struct in get_properties() 2012-10-19 10:35:38 +03:00
Lucas De Marchi
6b351f591f input: Fix not sending PropertiesChanged signal 2012-10-19 10:35:20 +03:00
Lucas De Marchi
ea534e0c8d core: Update gdbus function calls
Done by the following semantic patch, with manual tweaks afterwards due
to changes in 80-chars line breaks:

// <smpl>
@r1 @
expression E1;
@@
 g_dbus_pending_property_success(
-  E1,
   ...)

@r2 @
expression E1;
@@
 g_dbus_pending_property_error(
-  E1,
   ...)

@r3 @
expression E1;
@@
 g_dbus_pending_property_error_valist(
-  E1,
   ...)
// </smpl>
2012-10-19 10:33:42 +03:00
Lucas De Marchi
ef27c6c7fa gdbus: Remove connection from pending_property functions
The reply to a DBus.Properties.Set() method call should go through the
same D-Bus connection. Thus remove the DBusConnection parameter from the
following functions:

    - g_dbus_pending_property_success()
    - g_dbus_pending_property_error_valist()
    - g_dbus_pending_property_error()
2012-10-19 10:33:20 +03:00
Anderson Lizardo
8432085cfd adapter: Fix memory leak on discovery cleanup
During discovery cleanup, it was attempted to send a DevicesFound()
D-Bus signal for pending found devices, but adapter->discovery was set
to NULL before calling send_devices_found(), therefore it never sent any
signal (and there was a leak of discovery->pending list).

Fixes this memory leak when pairing two LE devices:

==1822== 8 bytes in 1 blocks are definitely lost in loss record 42 of
246
==1822==    at 0x482BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==1822==    by 0x48869AA: standard_malloc (gmem.c:85)
==1822==    by 0x4886E42: g_malloc (gmem.c:159)
==1822==    by 0x489B26D: g_slice_alloc (gslice.c:1003)
==1822==    by 0x489C10A: g_slist_prepend (gslist.c:265)
==1822==    by 0x1855AE: adapter_update_found_devices (adapter.c:2846)
==1822==    by 0x191431: btd_event_device_found (event.c:260)
==1822==    by 0xBC01001A: ???
==1822==
2012-10-18 10:32:49 +03:00
Johan Hedberg
01a2495a83 test: List only specified adapter's devices in list-devices 2012-10-17 17:38:38 +03:00
Mikel Astiz
340cdeb404 device: Fix modifying list while iterating
A list should not be modified while iterating on it, and in this case
the solution is trivial: the code is just trying to free the whole list
with a previous call to profile->device_remove() per list item.
2012-10-17 13:15:45 +03:00
Andrzej Kaczmarek
fd16f2cc64 heartrate: Always write measurement CCC on discovery
Measurement CCC is written during discovery only in case watcher is
registered and notifications shall be enabled. However, it may happen
that (e.g. during reconnection scenario) notifications are already
enabled on remote but watcher is no longer registered and we will
be receiving unwanted notifications.

This patch makes sure measurement CCC is written to proper value
every time it's discovered during connection.
2012-10-17 11:08:14 +03:00
Johan Hedberg
9b80a1f063 doc: Update to match latest BlueZ 5 API 2012-10-17 10:43:53 +03:00
Szymon Janc
03cd7b4b91 adapter: Remove not used defines
check_address and OFF_TIMER are not used anymore.
2012-10-16 13:36:03 +03:00
Szymon Janc
4b273e5d98 lib: Simplify str2ba function
Reverse loop iteration so that baswap call is not needed.
2012-10-16 13:35:18 +03:00
Szymon Janc
385a7bd5ac mgmt: Remove not used members from controller_info
notified, version, manufacturer and dev_class were not used for
anything usefull. For debug print reply can be used directly.
2012-10-16 13:33:02 +03:00
Szymon Janc
ef7452842d input: Remove not needed adapters list in manager
adapters list is not used for anything usefull.
2012-10-16 13:32:50 +03:00
Szymon Janc
c36d3d7dce network: Remove redundant struct network_peer members
struct network_peer holds reference to btd_device so path, src and dst
can be accessed from it.
2012-10-16 13:32:37 +03:00
Szymon Janc
b33477bd67 audio: Remove path from struct audio_device
struct audio_device is holding a reference to btd_device and path can
be easily taken from it when needed.
2012-10-16 13:32:10 +03:00
Szymon Janc
89b5903887 mgmt: Make mgmt_update_powered return void
mgmt_update_powered always returned 0 and this was never checked by
caller.
2012-10-16 13:32:03 +03:00
Szymon Janc
d9465e8297 audio: Move btd_device unref after last use in device_free
btd_device should not be used after local reference was dropped.
2012-10-16 13:31:57 +03:00
Johan Hedberg
4fff33278b device: Mark services as resolved also when loading from storage 2012-10-16 11:51:31 +03:00
Luiz Augusto von Dentz
03fdd8bc76 control: Add Control.Disconnect method
This method can be used to disconnect AVRCP.
2012-10-16 10:43:26 +03:00
Luiz Augusto von Dentz
31951cc6c0 control: Add Control.Connect API
This method can be used to manually connect AVRCP when acting as a
controller.
2012-10-16 10:42:05 +03:00
Luiz Augusto von Dentz
195fc945c5 control: Add basic support for AVRCP 1.0 controller 2012-10-16 10:41:17 +03:00
Luiz Augusto von Dentz
2d7af85163 AVRCP: Add proper role init procedure 2012-10-16 10:41:01 +03:00
Luiz Augusto von Dentz
e5a818b6af AVRCP: Fix handling TG PDUs as they were CT PDUs
PDU handling needs to different depending on the acting role.
2012-10-16 10:40:42 +03:00
Luiz Augusto von Dentz
23ad7c052c AVRCP: Fix reading wrong profile when acting as a controller
The role indicate which record should be read so we properly determine
the version and what features are supported.
2012-10-16 10:40:32 +03:00
Luiz Augusto von Dentz
a835942875 AVCTP: Add proper queueing for channels
Add a request queue to channels to avoid dispatching too many requests
at once as the number of transaction is quite limited (16).
2012-10-16 10:39:55 +03:00
Luiz Augusto von Dentz
e8fb58950f AVCTP: Add proper prefix to AVC passthrough codes 2012-10-16 10:39:37 +03:00
Luiz Augusto von Dentz
8f155c0c90 AVCTP: Wait confirmation to send button release 2012-10-16 10:39:27 +03:00
Luiz Augusto von Dentz
d9f9f2e26d AVCTP: Make use of allocate buffer to send data
There is no need to use the stack as the channel now have proper buffer
which can be used to store data to be send.

In addition to that make avctp_send_passthrough to use avctp_send.
2012-10-16 10:39:18 +03:00
Luiz Augusto von Dentz
b8bf7a40a2 AVRCP: Simplify state_changed callback
Move session creation and destroy to their own functions
2012-10-16 10:38:58 +03:00
Luiz Augusto von Dentz
0388fd57ca AVRCP: Fix crash on disconnect
In case of multiple session being active the code was registering one
PDU hanlder per AVRCP session and given the session pointer as user data
causing the following:

    24 bytes in 1 blocks are definitely lost in loss record 370 of 893
       at 0x4A0884D: malloc (vg_replace_malloc.c:263)
       by 0x4C803FE: g_malloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
       by 0x12EE9D: avctp_register_browsing_pdu_handler (avctp.c:1259)
       by 0x12FD7B: state_changed (avrcp.c:1402)
       by 0x12D391: avctp_set_state (avctp.c:403)
       by 0x12E6B4: avctp_confirm_cb (avctp.c:871)
       by 0x1606A3: 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 0x120EA1: main (main.c:551)

To fix this the PDU handlers are now per AVCTP session/channel so each
AVRCP session can register its own handler and pass itself as user
data.
2012-10-16 10:38:33 +03:00
Luiz Augusto von Dentz
ec2a1f2142 AVRCP: Register to AVCTP state changes without depending on player
It is not longer necessary to have a player to be able to register the
extra pdu handlers.
2012-10-16 10:36:59 +03:00
Luiz Augusto von Dentz
b5666a3747 AVCTP: Allocate memory to hold incoming/outgoing PDUs
This makes possible to the handler to respond asyncronous as the memory
remains valid after it returns.

In addition to that it uses the MTU to calculate the buffer size
necessary.
2012-10-16 10:36:26 +03:00
Luiz Augusto von Dentz
642c243c77 AVCTP: Simplify channel handling
Make both control and browsing channels to use the same structure to
store its channel information.
2012-10-16 10:36:12 +03:00
Johan Hedberg
f7fb5af2ac adapter: Use g_slist_free_full for cleaning up discovery->found 2012-10-15 23:03:11 +03:00
Johan Hedberg
8e1c008954 adapter: Use idle callbacks for forcing DevicesFound events
This way we ensure that we include all found devices from the current
mainloop iteration into the DevicesFound signal.
2012-10-15 15:55:57 +03:00
Johan Hedberg
58345dec54 test: Add timeout option to simple-agent 2012-10-15 15:03:06 +03:00
Johan Hedberg
28c1a74452 device: Implement Device.CancelPairing method 2012-10-15 15:02:30 +03:00
Johan Hedberg
582eafacfe adapter: Remove legacy CancelDeviceCreation method 2012-10-15 14:30:01 +03:00
Johan Hedberg
be9a675626 test: Update simple-agent to support the new Device.Pair API 2012-10-15 14:25:54 +03:00
Johan Hedberg
09b00329b0 TODO: Mark CreateDevice/CreatePairedDevice removal as done 2012-10-15 14:06:36 +03:00
Johan Hedberg
cabc76409c core: Add timer for removing temporary discovered device objects 2012-10-15 14:05:13 +03:00
Johan Hedberg
85f7f41819 gdbus: Fix invalid memory access during interface removal
If an interface is removed from the root path during the same mainloop
iteration that it was added we need to check for data->added before
doing the check for data->parent == NULL in the remove_interface()
function. Otherwise the added interface doesn't get removed from the
data->added list and will result in accessing freed memory:

==337== Invalid read of size 8
==337==    at 0x4F65AFA: dbus_message_iter_append_basic (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x1247B5: append_interface (object.c:556)
==337==    by 0x4C8DC5C: g_slist_foreach (gslist.c:840)
==337==    by 0x1261F7: process_changes (object.c:594)
==337==    by 0x126372: generic_unregister (object.c:997)
==337==    by 0x4F69669: ??? (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x4F5CE51: dbus_connection_unregister_object_path (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x125E81: object_path_unref (object.c:1236)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)
==337==  Address 0x5bc1550 is 0 bytes inside a block of size 56 free'd
==337==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==337==    by 0x4C7850E: g_free (gmem.c:252)
==337==    by 0x125DB0: remove_interface (object.c:671)
==337==    by 0x125E3B: object_path_unref (object.c:1230)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)
2012-10-15 13:21:11 +03:00