OSDN Git Service

android-x86/external-bluetooth-bluez.git
11 years agoshared: Add functions for btsnoop file handling
Marcel Holtmann [Sun, 25 Aug 2013 18:17:04 +0000 (11:17 -0700)]
shared: Add functions for btsnoop file handling

11 years agomonitor: Overwrite existing link layer access addresses
Marcel Holtmann [Sun, 25 Aug 2013 18:11:46 +0000 (11:11 -0700)]
monitor: Overwrite existing link layer access addresses

11 years agomonitor: Add support for LMP decoding
Marcel Holtmann [Sat, 24 Aug 2013 03:43:01 +0000 (20:43 -0700)]
monitor: Add support for LMP decoding

11 years agomonitor: Add support for decoding link layer packets
Marcel Holtmann [Sat, 24 Aug 2013 03:35:15 +0000 (20:35 -0700)]
monitor: Add support for decoding link layer packets

11 years agomonitor: Fix printing of physical packet from simulation
Marcel Holtmann [Sat, 24 Aug 2013 03:33:57 +0000 (20:33 -0700)]
monitor: Fix printing of physical packet from simulation

11 years agomonitor: Add label parameter to address printing function
Marcel Holtmann [Sat, 24 Aug 2013 03:33:01 +0000 (20:33 -0700)]
monitor: Add label parameter to address printing function

11 years agomonitor: Move btsnoop file creating into control handling
Marcel Holtmann [Fri, 23 Aug 2013 17:58:52 +0000 (10:58 -0700)]
monitor: Move btsnoop file creating into control handling

11 years agotools: Use btsnoop constants in conversion utility
Marcel Holtmann [Fri, 23 Aug 2013 16:52:49 +0000 (09:52 -0700)]
tools: Use btsnoop constants in conversion utility

11 years agomonitor: Export function for printing LE addresses
Marcel Holtmann [Fri, 23 Aug 2013 08:05:49 +0000 (01:05 -0700)]
monitor: Export function for printing LE addresses

11 years agomonitor: Export function for print advertising data
Marcel Holtmann [Fri, 23 Aug 2013 07:54:51 +0000 (00:54 -0700)]
monitor: Export function for print advertising data

11 years agounit: Add test case for link layer CRC functions
Marcel Holtmann [Thu, 22 Aug 2013 06:06:02 +0000 (23:06 -0700)]
unit: Add test case for link layer CRC functions

11 years agomonitor: Add functions for link layer CRC calculations
Marcel Holtmann [Thu, 22 Aug 2013 06:04:59 +0000 (23:04 -0700)]
monitor: Add functions for link layer CRC calculations

11 years agotest/test-nap: Fix interface name
Luiz Augusto von Dentz [Wed, 21 Aug 2013 10:49:09 +0000 (13:49 +0300)]
test/test-nap: Fix interface name

11 years agonetwork: Fix crash after removing adapter
Luiz Augusto von Dentz [Wed, 21 Aug 2013 10:43:56 +0000 (13:43 +0300)]
network: Fix crash after removing adapter

The service watch is not removed so once the client disconnects the
callback is called using the data already freed:
Invalid read of size 8
   at 0x428CFE: server_remove_sessions.isra.0 (server.c:605)
   by 0x428D80: server_disconnect (server.c:626)
   by 0x475426: service_filter (watch.c:486)
   by 0x47569A: message_filter (watch.c:554)
   by 0x32F840F9E5: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
   by 0x474347: message_dispatch (mainloop.c:76)
   by 0x3383648962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3383647E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3383648157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3383648559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40A2CF: main (main.c:583)
 Address 0x4eb5f00 is 32 bytes inside a block of size 56 free'd
   at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x338364D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x429663: server_unregister (server.c:848)
   by 0x33836648F7: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x454180: adapter_remove (adapter.c:2886)
   by 0x45C940: index_removed (adapter.c:5651)
   by 0x467FDF: received_data (mgmt.c:252)
   by 0x3383647E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3383648157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3383648559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40A2CF: main (main.c:583)

11 years agomonitor: Add stub for link layer decoding
Marcel Holtmann [Wed, 21 Aug 2013 02:56:21 +0000 (19:56 -0700)]
monitor: Add stub for link layer decoding

11 years agomonitor: Add support for reading physical simulation traces
Marcel Holtmann [Wed, 21 Aug 2013 02:44:35 +0000 (19:44 -0700)]
monitor: Add support for reading physical simulation traces

11 years agomonitor: Add btsnoop functions physical datalink type
Marcel Holtmann [Wed, 21 Aug 2013 02:43:25 +0000 (19:43 -0700)]
monitor: Add btsnoop functions physical datalink type

11 years agomonitor: Add decoding stub for simulator packets
Marcel Holtmann [Wed, 21 Aug 2013 02:42:40 +0000 (19:42 -0700)]
monitor: Add decoding stub for simulator packets

11 years agomonitor: Remove datalink check when creating btsnoop files
Marcel Holtmann [Wed, 21 Aug 2013 00:25:21 +0000 (17:25 -0700)]
monitor: Remove datalink check when creating btsnoop files

11 years agomonitor: Add include for stdint.h header
Marcel Holtmann [Tue, 20 Aug 2013 23:53:18 +0000 (16:53 -0700)]
monitor: Add include for stdint.h header

11 years agomonitor: Use btsnoop constants for different packet types
Marcel Holtmann [Tue, 20 Aug 2013 23:41:45 +0000 (16:41 -0700)]
monitor: Use btsnoop constants for different packet types

11 years agomonitor: Add stub for handling vendor events
Marcel Holtmann [Tue, 20 Aug 2013 23:37:41 +0000 (16:37 -0700)]
monitor: Add stub for handling vendor events

11 years agomonitor: Remove unused functions for btsnoop flag conversion
Marcel Holtmann [Tue, 20 Aug 2013 23:32:37 +0000 (16:32 -0700)]
monitor: Remove unused functions for btsnoop flag conversion

11 years agomonitor: Specify and use btsnoop opcode constants
Marcel Holtmann [Tue, 20 Aug 2013 23:31:54 +0000 (16:31 -0700)]
monitor: Specify and use btsnoop opcode constants

11 years agomonitor: Provide function for generic btsnoop write operation
Marcel Holtmann [Tue, 20 Aug 2013 23:17:08 +0000 (16:17 -0700)]
monitor: Provide function for generic btsnoop write operation

11 years agomonitor: Use explicit functionnames for btsnoop packet operations
Marcel Holtmann [Tue, 20 Aug 2013 23:10:17 +0000 (16:10 -0700)]
monitor: Use explicit functionnames for btsnoop packet operations

11 years agomonitor: Allow specifying type of btsnoop file to create
Marcel Holtmann [Tue, 20 Aug 2013 22:58:53 +0000 (15:58 -0700)]
monitor: Allow specifying type of btsnoop file to create

11 years agomonitor: Set default index filter in control handler
Marcel Holtmann [Tue, 20 Aug 2013 22:52:20 +0000 (15:52 -0700)]
monitor: Set default index filter in control handler

11 years agomonitor: Use constants for btsnoop datalink types
Marcel Holtmann [Tue, 20 Aug 2013 22:45:49 +0000 (15:45 -0700)]
monitor: Use constants for btsnoop datalink types

11 years agobuild: Fix not checking readline.h for bluetooth-player
Luiz Augusto von Dentz [Mon, 12 Aug 2013 11:57:33 +0000 (14:57 +0300)]
build: Fix not checking readline.h for bluetooth-player

If --disable-client is passed to configure script is possible to build
BlueZ without readline which would cause the following error:

tools/bluetooth-player.c:36:31: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
                               ^

11 years agomonitor: Return btsnoop type when opening files
Marcel Holtmann [Tue, 20 Aug 2013 06:11:16 +0000 (23:11 -0700)]
monitor: Return btsnoop type when opening files

11 years agomonitor: Use separate btsnoop write routine
Marcel Holtmann [Tue, 20 Aug 2013 05:33:07 +0000 (22:33 -0700)]
monitor: Use separate btsnoop write routine

11 years agomonitor: Add error constant for memory capacity exceeded
Marcel Holtmann [Mon, 19 Aug 2013 18:05:06 +0000 (11:05 -0700)]
monitor: Add error constant for memory capacity exceeded

11 years agobuild: Add sco-tester to .gitignore list
Marcel Holtmann [Sun, 18 Aug 2013 17:43:55 +0000 (10:43 -0700)]
build: Add sco-tester to .gitignore list

11 years agomonitor: Fix spelling for LE supported states
Marcel Holtmann [Sat, 17 Aug 2013 19:19:36 +0000 (12:19 -0700)]
monitor: Fix spelling for LE supported states

11 years agomonitor: Fix structure for LE Set Scan Response Data command
Marcel Holtmann [Thu, 15 Aug 2013 09:45:26 +0000 (02:45 -0700)]
monitor: Fix structure for LE Set Scan Response Data command

11 years agomonitor: Fix decoding for LE Test End responses
Marcel Holtmann [Thu, 15 Aug 2013 07:07:57 +0000 (00:07 -0700)]
monitor: Fix decoding for LE Test End responses

11 years agomonitor: Add two more HCI error code constants
Marcel Holtmann [Thu, 15 Aug 2013 07:06:15 +0000 (00:06 -0700)]
monitor: Add two more HCI error code constants

11 years agomonitor: Fix size in LE Test End fields
Marcel Holtmann [Thu, 15 Aug 2013 07:05:19 +0000 (00:05 -0700)]
monitor: Fix size in LE Test End fields

11 years agomonitor: Add missing number of completed packets event mask
Marcel Holtmann [Tue, 13 Aug 2013 16:28:51 +0000 (09:28 -0700)]
monitor: Add missing number of completed packets event mask

11 years agomonitor: Add decoding of LE test commands
Marcel Holtmann [Tue, 13 Aug 2013 03:50:44 +0000 (20:50 -0700)]
monitor: Add decoding of LE test commands

11 years agomonitor: Remove pointless empty lines
Marcel Holtmann [Tue, 13 Aug 2013 03:39:01 +0000 (20:39 -0700)]
monitor: Remove pointless empty lines

11 years agomonitor: Fix function names for some LE security commands
Marcel Holtmann [Tue, 13 Aug 2013 03:34:18 +0000 (20:34 -0700)]
monitor: Fix function names for some LE security commands

11 years agomonitor: Fix structures for LE long term key request commands
Marcel Holtmann [Tue, 13 Aug 2013 03:30:19 +0000 (20:30 -0700)]
monitor: Fix structures for LE long term key request commands

11 years agomonitor: Add definitions for LE test commands
Marcel Holtmann [Tue, 13 Aug 2013 03:26:47 +0000 (20:26 -0700)]
monitor: Add definitions for LE test commands

11 years agoclient/transfer: Add proper message to errors
Luiz Augusto von Dentz [Thu, 8 Aug 2013 13:41:14 +0000 (16:41 +0300)]
client/transfer: Add proper message to errors

This improve the error message when a transfer fails by using
g_obex_strerror to decode the response code to a human readable string.

11 years agogobex: Add proper message to transfer errors
Luiz Augusto von Dentz [Thu, 8 Aug 2013 13:08:16 +0000 (16:08 +0300)]
gobex: Add proper message to transfer errors

This improve the error message when a transfer fails by using
g_obex_strerror to decode the response code to a human readable string.

11 years agomonitor: Fix fields for LE Set Advertising Parameters command
Marcel Holtmann [Mon, 12 Aug 2013 04:29:08 +0000 (21:29 -0700)]
monitor: Fix fields for LE Set Advertising Parameters command

11 years agomonitor: Add support for LE Set Advertising Parameters command
Marcel Holtmann [Mon, 12 Aug 2013 04:28:03 +0000 (21:28 -0700)]
monitor: Add support for LE Set Advertising Parameters command

11 years agomonitor: Fix whitespace issue
Marcel Holtmann [Mon, 12 Aug 2013 04:09:52 +0000 (21:09 -0700)]
monitor: Fix whitespace issue

11 years agomonitor: Print proper LE address labels
Marcel Holtmann [Mon, 12 Aug 2013 04:07:53 +0000 (21:07 -0700)]
monitor: Print proper LE address labels

11 years agotools/scotest: Fix supporting hex voice setting values
Johan Hedberg [Thu, 8 Aug 2013 11:05:45 +0000 (14:05 +0300)]
tools/scotest: Fix supporting hex voice setting values

11 years agotools/scotest: Don't try BT_VOICE unless a non-zero voice setting was given
Johan Hedberg [Thu, 8 Aug 2013 11:00:46 +0000 (14:00 +0300)]
tools/scotest: Don't try BT_VOICE unless a non-zero voice setting was given

11 years agotools/btiotest: Fix applying voice setting for incoming connections
Johan Hedberg [Thu, 8 Aug 2013 09:48:37 +0000 (12:48 +0300)]
tools/btiotest: Fix applying voice setting for incoming connections

11 years agoRelease 5.8
Marcel Holtmann [Thu, 8 Aug 2013 05:32:56 +0000 (22:32 -0700)]
Release 5.8

11 years agobuild: Update library version
Marcel Holtmann [Wed, 7 Aug 2013 19:35:24 +0000 (12:35 -0700)]
build: Update library version

11 years agolib: Update company identifiers
Marcel Holtmann [Wed, 7 Aug 2013 19:21:46 +0000 (12:21 -0700)]
lib: Update company identifiers

11 years agotools: Fix path for bluetooth.org assigned numbers table
Marcel Holtmann [Wed, 7 Aug 2013 19:20:35 +0000 (12:20 -0700)]
tools: Fix path for bluetooth.org assigned numbers table

11 years agocore: Fix error message in profile ext_auth function
Frederic Danis [Thu, 1 Aug 2013 14:12:58 +0000 (16:12 +0200)]
core: Fix error message in profile ext_auth function

11 years agotools/btiotest: Print voice setting
Johan Hedberg [Thu, 1 Aug 2013 12:43:38 +0000 (15:43 +0300)]
tools/btiotest: Print voice setting

11 years agotools/sco-tester: Add more connection test cases
Frédéric Dalleau [Thu, 1 Aug 2013 09:54:18 +0000 (12:54 +0300)]
tools/sco-tester: Add more connection test cases

11 years agoshared/hciemu: Add hciemu_get_features API (needed for SCO tests)
Frédéric Dalleau [Thu, 1 Aug 2013 09:53:45 +0000 (12:53 +0300)]
shared/hciemu: Add hciemu_get_features API (needed for SCO tests)

11 years agoemulator: Add btdev_get_features API (needed for SCO tests)
Frédéric Dalleau [Thu, 1 Aug 2013 09:52:40 +0000 (12:52 +0300)]
emulator: Add btdev_get_features API (needed for SCO tests)

11 years agotools/sco-tester: Add new SCO test tool
Frédéric Dalleau [Thu, 1 Aug 2013 09:47:24 +0000 (12:47 +0300)]
tools/sco-tester: Add new SCO test tool

11 years agoemulator: Add SCO connection creation support
Frédéric Dalleau [Thu, 1 Aug 2013 09:46:49 +0000 (12:46 +0300)]
emulator: Add SCO connection creation support

11 years agoscotest: Add option for SCO voice setting
Frédéric Dalleau [Fri, 5 Jul 2013 15:46:45 +0000 (17:46 +0200)]
scotest: Add option for SCO voice setting

11 years agobtiotest: Add option for SCO voice setting
Frédéric Dalleau [Fri, 5 Jul 2013 15:46:44 +0000 (17:46 +0200)]
btiotest: Add option for SCO voice setting

11 years agobtio: Add option for SCO voice setting
Frédéric Dalleau [Fri, 5 Jul 2013 15:46:43 +0000 (17:46 +0200)]
btio: Add option for SCO voice setting

11 years agolib: SCO voice setting support header
Frédéric Dalleau [Wed, 26 Jun 2013 17:32:08 +0000 (19:32 +0200)]
lib: SCO voice setting support header

Modify headers to enable support for changing SCO voice setting.
Corresponding commit implements functionality on kernel side.

11 years agomonitor: Opencode strndupa in print_string
Szymon Janc [Wed, 31 Jul 2013 08:51:39 +0000 (10:51 +0200)]
monitor: Opencode strndupa in print_string

Strndupa is GNU extension. print_string is simple and opencoding
strndupa is not a big loss.

This fix linkage error with bionic library which doesn't provide
strndupa.

target Executable: btmon (out/target/product/grouper/obj/EXECUTABLES/
    btmon_intermediates/LINKED/btmon)
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/
    arm-linux-androideabi/4.6.x-google/../../../../
    arm-linux-androideabi/bin/ld: out/target/product/grouper/obj/
    EXECUTABLES/btmon_intermediates/monitor/sdp.o: in function
    print_string:external/bluetooth/bluez/monitor/sdp.c:146: error:
    undefined reference to 'strndupa'
collect2: ld returned 1 exit status
make: *** [out/target/product/grouper/obj/EXECUTABLES/
    btmon_intermediates/LINKED/btmon] Error

11 years agoaudio/player: Fix overflowing position
Luiz Augusto von Dentz [Wed, 31 Jul 2013 11:27:52 +0000 (14:27 +0300)]
audio/player: Fix overflowing position

The position should stop at UINT32_MAX after that the progress can no
longer be calculated, this should also prevent the position to change
when the remote stack doesn't support it which is also indicated with
UINT32_MAX which apparently is the case of Spotify on Android 4.3:

[CHG] Player /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/player0 Position: 0xffffffff
[CHG] Player /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/player0 Status: playing
[CHG] Player /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/player0 Position: 0x000000

11 years agoattrib: Add support for 128-bit characteristic UUIDs in gatt_service_add
Dirk-Jan C. Binnema [Mon, 29 Jul 2013 18:42:50 +0000 (11:42 -0700)]
attrib: Add support for 128-bit characteristic UUIDs in gatt_service_add

Custom GATT services typically use 128-bits UUIDs; this patch allows for
using gatt_service_add to define such services by adding a new option
GATT_OPT_CHR_UUID, which allows for passing bt_uuid_t* values. Note, a
previous patch renamed the old GATT_OPT_CHR_UUID into
GATT_OPT_CHR_UUID16.

11 years agoattrib: Rename GATT_OPT_CHR_UUID into GATT_OPT_CHR_UUID16
Dirk-Jan C. Binnema [Mon, 29 Jul 2013 18:42:49 +0000 (11:42 -0700)]
attrib: Rename GATT_OPT_CHR_UUID into GATT_OPT_CHR_UUID16

Rename the option for all in-tree users. This frees up GATT_OPT_CHR_UUID to be used
for UUIDs of type bt_uuid_t* (in a next patch).

11 years agoattrib: Update gatt_service_add size assert for dealing with 128-bit UUIDs
Dirk-Jan C. Binnema [Mon, 29 Jul 2013 18:42:48 +0000 (11:42 -0700)]
attrib: Update gatt_service_add size assert for dealing with 128-bit UUIDs

To paraphrase Anderson Lizardo: "h" was overflowing for 128-bit services
because the handle is incremented after each attribute is added so at
the end we had: 0xffff + 1 == 0 (h is uint16_t).

As it seems more complex to try to remove the overflow without affecting
the logic too much, we update the assertion.

11 years agoaudio/AVCTP: Do not process browsing queue until connection completes
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:39 +0000 (17:04 +0300)]
audio/AVCTP: Do not process browsing queue until connection completes

Any request processed before the connection completes will likely fail
in avctp_browsing_send so instead delay the processing.

11 years agoaudio/AVCTP: Fix connecting browsing channel multiple times
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:38 +0000 (17:04 +0300)]
audio/AVCTP: Fix connecting browsing channel multiple times

While accepting the connection via DEFER_SETUP a second connection can
be created by using avctp_connect_browsing which will not detect one is
in course as the state has not yet changed, this can cause memory leaks
or crashes as the following:

profiles/audio/avctp.c:avctp_confirm_cb() AVCTP: incoming connect from XX:XX:XX:XX:XX:XX
profiles/audio/avctp.c:avctp_set_state() AVCTP Browsing Connecting
profiles/audio/avctp.c:avctp_connect_browsing_cb() AVCTP Browsing: connected to XX:XX:XX:XX:XX:XX
profiles/audio/avctp.c:avctp_set_state() AVCTP Browsing Connected
profiles/audio/avctp.c:avctp_connect_browsing_cb() AVCTP Browsing: connected to XX:XX:XX:XX:XX:XX
profiles/audio/avctp.c:avctp_set_state() AVCTP Browsing Connected
profiles/audio/avctp.c:session_browsing_cb() AVCTP Browsing: disconnected
profiles/audio/avctp.c:avctp_set_state() AVCTP Connected
Invalid read of size 8
   at 0x41EB28: session_browsing_cb (avctp.c:842)
   by 0x32F5447E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40A28F: main (main.c:583)
 Address 0x20 is not stack'd, malloc'd or (recently) free'd

11 years agoaudio/AVRCP: Connect browsing channel in case of GetCapabilities response
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:37 +0000 (17:04 +0300)]
audio/AVRCP: Connect browsing channel in case of GetCapabilities response

If the remote stack respond to GetCapabilities before connecting to
browsing channel connect it immediatelly as some events might depend on
it to work properly.

The spec actually recommends the browsing channel to be connected
immediatelly after the control channel:

AVRCP 1.5 - Page 23

"4.1.1 Connection establishment
...
If a browsing channel is supported by both devices it shall be
established after control channel establishment. It is recommended that
the browsing channel is established immediately after the control
channel is established and released immediately before the control
channel is released to avoid unsatisfactory latency when a browsing
command is sent."

11 years agoaudio/AVRCP: Connect browsing channel when accepting the connection
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:36 +0000 (17:04 +0300)]
audio/AVRCP: Connect browsing channel when accepting the connection

If remote stack for some reason don't connect the browsing channel
connect it after a timeout (1 sec.)

11 years agoaudio/AVRCP: Fix not setting browsing feature in CT record
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:35 +0000 (17:04 +0300)]
audio/AVRCP: Fix not setting browsing feature in CT record

The record already contain the additional protocol containing the
browsing channel but the feature is not set as it is supposed to.

11 years agoaudio/AVRCP: Fix not connecting Browsing channel when supported
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:34 +0000 (17:04 +0300)]
audio/AVRCP: Fix not connecting Browsing channel when supported

Both controller and target services can initiate the connection but
probably only one of the services will be in CONNECTING state which may
happen to not have browsing feature set.

Currently this happens when connecting BlueZ vs BlueZ where the CT record
does not have browsing feature set so if the corresponding service start
connecting it wont connect the browsing channel due to lack of feature.

11 years agoaudio/AVRCP: Fix memory leaks
Luiz Augusto von Dentz [Mon, 29 Jul 2013 14:04:33 +0000 (17:04 +0300)]
audio/AVRCP: Fix memory leaks

When the remote stack support both AVAILABLE_PLAYER_CHANGED and
ADDRESSED_PLAYER_CHANGED the player twice are inited twice leaking
the memory allocated in the first time:

16 bytes in 1 blocks are definitely lost in loss record 45 of 236
   at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x32F544D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5464BF7: g_memdup (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x4247CC: avrcp_get_media_player_list_rsp (avrcp.c:2432)
   by 0x41ECAB: session_browsing_cb (avctp.c:826)
   by 0x32F5447E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40A28F: main (main.c:583)

16 bytes in 1 blocks are definitely lost in loss record 46 of 236
   at 0x4A082F7: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x32F544D946: g_realloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5466D43: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5467032: g_string_insert_len (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5435287: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x421E62: avrcp_set_browsed_player_rsp (avrcp.c:2349)
   by 0x41ECAB: session_browsing_cb (avctp.c:826)
   by 0x32F5447E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x32F5448559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x40A28F: main (main.c:583)

11 years agoscanparam: Remove unneeded header include
Claudio Takahasi [Mon, 29 Jul 2013 13:59:32 +0000 (09:59 -0400)]
scanparam: Remove unneeded header include

11 years agoscanparam: Apply convention for "GSource id" like variable
Anderson Lizardo [Mon, 29 Jul 2013 13:59:31 +0000 (09:59 -0400)]
scanparam: Apply convention for "GSource id" like variable

By convention, BlueZ code checks for "Gsource id" like variables using:

if (source_id > 0)
...

Also fix the variable type to match that returned by
g_attrib_unregister().

11 years agoscanparam: Fix missing check for valid GAttrib when removing device
Anderson Lizardo [Mon, 29 Jul 2013 13:59:30 +0000 (09:59 -0400)]
scanparam: Fix missing check for valid GAttrib when removing device

If device is removed while there is no connection, scan->attrib will be
NULL, because its reference is managed by attio connect/disconnect
callbacks. This means that on disconnect any resources owned by GAttrib
will be properly destroyed.

11 years agoscanparam: Remove unnecessary assignment
Anderson Lizardo [Mon, 29 Jul 2013 13:59:29 +0000 (09:59 -0400)]
scanparam: Remove unnecessary assignment

"scan" will be g_free()'d on this same function, so no need to assign 0
to refresh_cb_id.

11 years agoscanparam: Fix handle range check on descriptor discovery
Anderson Lizardo [Mon, 29 Jul 2013 13:59:28 +0000 (09:59 -0400)]
scanparam: Fix handle range check on descriptor discovery

When discovering descriptors, if there is only a single descriptor, the
start handle will be equal to the end handle. It is valid to issue the
Find Information Request on this case.

Before this fix, notification for Scan Refresh characteristic was never
enabled.

11 years agoaudio/player: Fix not setting playlist items as playable
Luiz Augusto von Dentz [Fri, 26 Jul 2013 13:24:00 +0000 (16:24 +0300)]
audio/player: Fix not setting playlist items as playable

All items in the playlist should have playable flag set otherwise they
cannot be part of the playlist.

11 years agotest: Fix ProximityMonitor1 interface name typo in test-proximity
Anderson Lizardo [Thu, 25 Jul 2013 19:23:43 +0000 (15:23 -0400)]
test: Fix ProximityMonitor1 interface name typo in test-proximity

11 years agodoc/media-api: Add Metadata property to MediaItem
Luiz Augusto von Dentz [Fri, 26 Jul 2013 08:19:44 +0000 (11:19 +0300)]
doc/media-api: Add Metadata property to MediaItem

The implementation uses a single property to expose the item metadata
not multiple for every single metadata entry.

11 years agobuild: Fix make distcheck
Anderson Lizardo [Thu, 25 Jul 2013 18:25:46 +0000 (14:25 -0400)]
build: Fix make distcheck

Fix this error:

make[1]: *** No rule to make target `profiles/audio/audio.conf', needed
by `distdir'.  Stop.
make: *** [test_build] Error 2

11 years agotools/mpris-player: Fix leaking memory when unregistering a player
Luiz Augusto von Dentz [Thu, 25 Jul 2013 13:05:28 +0000 (16:05 +0300)]
tools/mpris-player: Fix leaking memory when unregistering a player

Any memory allocated for user_data passed to
dbus_connection_register_object_path should be freed once unregistered.

11 years agotool/mpris-player: Fix not unregister players when adapter is removed
Luiz Augusto von Dentz [Thu, 25 Jul 2013 13:01:11 +0000 (16:01 +0300)]
tool/mpris-player: Fix not unregister players when adapter is removed

This prevent the players to be registered again when an adapter appeared
again.

11 years agoaudio: Remove audio.conf
Luiz Augusto von Dentz [Wed, 24 Jul 2013 11:56:24 +0000 (14:56 +0300)]
audio: Remove audio.conf

With the audio plugin split there is no longer a need to have a .conf
file and anyway any configuration should be put in main.conf under
plugin name group.

11 years agoaudio: Remove audio plugin
Luiz Augusto von Dentz [Wed, 24 Jul 2013 11:56:23 +0000 (14:56 +0300)]
audio: Remove audio plugin

Audio plugin is now splitted in multiple plugins so it is no longer
necessary to have a manager to deal with many different drivers.

11 years agoaudio: Move A2DP code to its own plugin
Luiz Augusto von Dentz [Wed, 24 Jul 2013 11:56:22 +0000 (14:56 +0300)]
audio: Move A2DP code to its own plugin

This moves A2DP related code to a2dp plugin and making it possible to
disable by passing -P a2dp and increasing the modularity of the code.

11 years agoaudio: Move AVRCP related code to its own plugin
Luiz Augusto von Dentz [Wed, 24 Jul 2013 11:56:21 +0000 (14:56 +0300)]
audio: Move AVRCP related code to its own plugin

This moves AVRCP related code to avrcp plugin and making it possible to
disable by passing -P avrcp and increasing the modularity of the code.

11 years agotools/mgmt-tester: Add stop discovery for BR/EDR only
Bruna Moreira [Sun, 21 Jul 2013 00:17:20 +0000 (20:17 -0400)]
tools/mgmt-tester: Add stop discovery for BR/EDR only

Send stop command during inquiry. Check if inquiry cancel is sent and
discovering event is disabled.

11 years agoemulator: Add new function for running all hooks
Bruna Moreira [Sun, 21 Jul 2013 00:17:19 +0000 (20:17 -0400)]
emulator: Add new function for running all hooks

It was defined four hook types and they are run before/after the first
part of default command processing and send event. Note that hook return
will define if the emulator will process/send next events (calling the
default_cmd_completion() function or not).

11 years agoemulator: cmd_status() using send_packet() for run hooks easily
Eder Ruiz Maria [Sun, 21 Jul 2013 00:17:18 +0000 (20:17 -0400)]
emulator: cmd_status() using send_packet() for run hooks easily

Now like cmd_command(), cmd_status() directly uses send_packet() instead
of send_event(), consequently cmd_status() must build the hci packet
without help of send_event(). With this change the events sent by
default_cmd() no more use send_event(), who is a good place to run hooks
for BTDEV_HOOK_POST_EVT. And the functions cmd_command() and
cmd_status() can run hooks for BTDEV_HOOK_POST_CMD.

11 years agoemulator: Split default_cmd() for better command and event handler
Eder Ruiz Maria [Sun, 21 Jul 2013 00:17:17 +0000 (20:17 -0400)]
emulator: Split default_cmd() for better command and event handler

Now except for command complete event and command status event, all
other are handled by default_cmd_completion(). With this we can easily
add hooks in some points.