OSDN Git Service

android-x86/external-bluetooth-bluez.git
8 years agoemulator: Fix sending valid HCI_LE_Create_Connection parameters
Johan Hedberg [Thu, 12 Nov 2015 09:08:34 +0000 (11:08 +0200)]
emulator: Fix sending valid HCI_LE_Create_Connection parameters

8 years agomonitor: Update UUID strings to latest versions
Marcel Holtmann [Thu, 12 Nov 2015 08:14:44 +0000 (09:14 +0100)]
monitor: Update UUID strings to latest versions

8 years agotools/l2cap-tester: Don't treat unexpected L2CAP PDUs as failures
Johan Hedberg [Wed, 11 Nov 2015 18:41:00 +0000 (20:41 +0200)]
tools/l2cap-tester: Don't treat unexpected L2CAP PDUs as failures

8 years agocore: Use daemon specific GLib logging handling for backtraces
Marcel Holtmann [Wed, 11 Nov 2015 14:09:02 +0000 (15:09 +0100)]
core: Use daemon specific GLib logging handling for backtraces

8 years agocore: Add function for logging with priority information
Marcel Holtmann [Wed, 11 Nov 2015 14:08:19 +0000 (15:08 +0100)]
core: Add function for logging with priority information

8 years agotools/mgmt-tester: Fix Remove Device tests for LE
Johan Hedberg [Wed, 11 Nov 2015 08:52:15 +0000 (10:52 +0200)]
tools/mgmt-tester: Fix Remove Device tests for LE

The timing of Add/Remove device is different in recent kernels so that
if they are sent in rapid succession no HCI command will be sent at
all. Since the relevant thing is that LE scan is disabled after the
test add a timeout to verify this instead of waiting for a specific
HCI command.

8 years agodoc/test-coverage: Update l2cap-tester test count
Johan Hedberg [Wed, 11 Nov 2015 08:00:59 +0000 (10:00 +0200)]
doc/test-coverage: Update l2cap-tester test count

8 years agotools/l2cap-tester connect two sockets disconnect one test
Jakub Pawlowski [Wed, 11 Nov 2015 06:36:30 +0000 (22:36 -0800)]
tools/l2cap-tester connect two sockets disconnect one test

This test open two sockets to same client, then close first one and make
sure second one connect successfully.

8 years agotools/l2cap-tester: Two socket connect test
Jakub Pawlowski [Wed, 11 Nov 2015 06:36:29 +0000 (22:36 -0800)]
tools/l2cap-tester: Two socket connect test

This test tries to open two sockets to same address, to make sure
both would succeed.

8 years agotools/l2cap-tester: Disconnect during connect attempt test
Jakub Pawlowski [Wed, 11 Nov 2015 06:36:28 +0000 (22:36 -0800)]
tools/l2cap-tester: Disconnect during connect attempt test

This patch adds test that checks folowing:
1. Try to connect to existing BLE device that is not advertising.
2. Internally in kernel this adds this device to whitelist and enable scan.
3. Make the device advertise once. That would stop the scan, and trigger
   connect attempt to device.
4. Close socket. This should stop the connect attempt, by sending
   BT_HCI_CMD_LE_CREATE_CONN_CANCEL.

8 years agotools/l2cap-tester: add close socket test
Jakub Pawlowski [Wed, 11 Nov 2015 06:36:27 +0000 (22:36 -0800)]
tools/l2cap-tester: add close socket test

This patch adds test that checks folowing:
1. Try to connect to non-existing remote BLE device using socket.
2. Internally in kernel this adds this device to whitelist and enable scan.
3. At this moment test would try to close socket.
4. That should cause scan to be stopped.

8 years agoemulator: add support for checking le scan state
Jakub Pawlowski [Wed, 11 Nov 2015 06:36:26 +0000 (22:36 -0800)]
emulator: add support for checking le scan state

8 years agoshared/gatt-client: Don't reset database on service changed
Luiz Augusto von Dentz [Tue, 10 Nov 2015 13:13:15 +0000 (15:13 +0200)]
shared/gatt-client: Don't reset database on service changed

If the remote send a full reset, 0x0001 - 0xffff, just discovery the
attributes again as device may send this even though nothing has
changed.

8 years agoshared/mgmt: Fix crash when removing index
Luiz Augusto von Dentz [Tue, 10 Nov 2015 09:32:38 +0000 (11:32 +0200)]
shared/mgmt: Fix crash when removing index

Because queue entries are no longer protected by a reference it is
necessary to return the use of in_notify flag, etc, otherwise the
following crash can happen when removing an index:

Invalid read of size 8
   at 0x41AD6F: queue_foreach (queue.c:219)
   by 0x41CA6C: process_notify (mgmt.c:280)
   by 0x41CA6C: can_read_data (mgmt.c:338)
   by 0x422DCA: watch_callback (io-glib.c:170)
   by 0x4E7EA89: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4400.1)
   by 0x4E7EE1F: ??? (in /usr/lib64/libglib-2.0.so.0.4400.1)
   by 0x4E7F141: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4400.1)
   by 0x422A31: tester_run (tester.c:830)
   by 0x403013: main (l2cap-tester.c:1489)
 Address 0x5754b38 is 8 bytes inside a block of size 16 free'd
   at 0x4C29D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x41AFCF: queue_remove_if (queue.c:302)
   by 0x41B0BA: queue_remove_all (queue.c:331)
   by 0x41C6A2: mgmt_unregister_index (mgmt.c:737)
   by 0x405033: index_removed_callback (l2cap-tester.c:162)
   by 0x41B751: notify_handler (mgmt.c:270)
   by 0x41AD83: queue_foreach (queue.c:220)
   by 0x41CA6C: process_notify (mgmt.c:280)
   by 0x41CA6C: can_read_data (mgmt.c:338)
   by 0x422DCA: watch_callback (io-glib.c:170)
   by 0x4E7EA89: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4400.1)
   by 0x4E7EE1F: ??? (in /usr/lib64/libglib-2.0.so.0.4400.1)
   by 0x4E7F141: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4400.1)

8 years agolib: Fix missing error handling when SDP record is NULL
Marcel Holtmann [Tue, 10 Nov 2015 14:54:12 +0000 (15:54 +0100)]
lib: Fix missing error handling when SDP record is NULL

8 years agotools/mgmt-tester: Fix invalid settings for power off test case
Johan Hedberg [Tue, 10 Nov 2015 12:33:03 +0000 (14:33 +0200)]
tools/mgmt-tester: Fix invalid settings for power off test case

The test that's supposed to verify correct "power off" error response
shouldn't be powering on the adapter in the setup stage.

8 years agocore: Fix broken #ifdef around backtrace support
Marcel Holtmann [Mon, 9 Nov 2015 10:15:26 +0000 (11:15 +0100)]
core: Fix broken #ifdef around backtrace support

8 years agocore: Initialize the backtracer early on at start
Marcel Holtmann [Mon, 9 Nov 2015 00:15:34 +0000 (01:15 +0100)]
core: Initialize the backtracer early on at start

8 years agotools/valgrind: Add suppression for __btd_log_init
Luiz Augusto von Dentz [Sun, 8 Nov 2015 19:14:59 +0000 (21:14 +0200)]
tools/valgrind: Add suppression for __btd_log_init

valgrind seems to treat every bind to PF_BLUETOOTH as an RFCOMM socket
causing the following false positives:

Syscall param socketcall.bind(my_addr.rc_bdaddr) points to uninitialised byte(s)
   at 0x52728A7: bind (in /usr/lib64/libc-2.21.so)
   by 0x4045B1: logging_open (log.c:76)
   by 0x4045B1: __btd_log_init (log.c:298)
   by 0x402823: main (test-avctp.c:278)
 Address 0xffefffcb6 is on thread 1's stack
 in frame #1, created by __btd_log_init (log.c:290)
 Uninitialised value was created by a stack allocation
   at 0x404490: __btd_log_init (log.c:290)

Syscall param socketcall.bind(my_addr.rc_channel) points to uninitialised byte(s)
   at 0x52728A7: bind (in /usr/lib64/libc-2.21.so)
   by 0x4045B1: logging_open (log.c:76)
   by 0x4045B1: __btd_log_init (log.c:298)
   by 0x402823: main (test-avctp.c:278)
 Address 0xffefffcb8 is on thread 1's stack
 in frame #1, created by __btd_log_init (log.c:290)
 Uninitialised value was created by a stack allocation
   at 0x404490: __btd_log_init (log.c:290)

8 years agocore/profile: Fix possible crash when registering profiles
Luiz Augusto von Dentz [Thu, 5 Nov 2015 13:14:50 +0000 (15:14 +0200)]
core/profile: Fix possible crash when registering profiles

Profiles under ext_profiles are local and should no be mixed with other
external profiles since its type is different which can may cause invalid
memory when accessing member of ext_profile struct.

8 years agoshared/queue: Remove reference count from queue_entry
Luiz Augusto von Dentz [Wed, 4 Nov 2015 10:40:36 +0000 (12:40 +0200)]
shared/queue: Remove reference count from queue_entry

Since the queue itself has support for reference and queue_foreach
actually make use of it to prevent crashes when queue_destroy is
called from the callback.

Note: The intention of reference count was to protect the entry itself
in queue_foreach, it may still be possible to have a crash if the next
entry if freed but that should be considered an implementation bug.

8 years agoobexd/session: Fix crash when disconnecting
Luiz Augusto von Dentz [Tue, 3 Nov 2015 11:12:22 +0000 (13:12 +0200)]
obexd/session: Fix crash when disconnecting

If session owner disconnect from the bus while g_obex_connect is pending
it may lead to a crash since it is never canceled connected_cb may still
be called after callback_data is freed.

8 years agocore: Add missing HAVE_CONFIG_H for shared GATT code
Marcel Holtmann [Sun, 8 Nov 2015 13:59:05 +0000 (14:59 +0100)]
core: Add missing HAVE_CONFIG_H for shared GATT code

8 years agocore: Use local assert function where possible
Marcel Holtmann [Sun, 8 Nov 2015 13:57:40 +0000 (14:57 +0100)]
core: Use local assert function where possible

8 years agocore: Add support for basic stack backtrace helper
Marcel Holtmann [Sun, 8 Nov 2015 13:44:24 +0000 (14:44 +0100)]
core: Add support for basic stack backtrace helper

8 years agocore: Start SDP server only for BR/EDR or dual mode operation
Marcel Holtmann [Sun, 8 Nov 2015 07:53:35 +0000 (08:53 +0100)]
core: Start SDP server only for BR/EDR or dual mode operation

8 years agomonitor: Adjust colors for system note and user logging messages
Marcel Holtmann [Sun, 8 Nov 2015 07:10:44 +0000 (08:10 +0100)]
monitor: Adjust colors for system note and user logging messages

8 years agomonitor: Add support --priority option to getopt parsing
Marcel Holtmann [Sun, 8 Nov 2015 06:48:00 +0000 (07:48 +0100)]
monitor: Add support --priority option to getopt parsing

8 years agocore: Use constant for logging ident string and its length
Marcel Holtmann [Sun, 8 Nov 2015 06:37:02 +0000 (07:37 +0100)]
core: Use constant for logging ident string and its length

8 years agomonitor: Use btsnoop priority constants for user logging
Marcel Holtmann [Sun, 8 Nov 2015 06:23:27 +0000 (07:23 +0100)]
monitor: Use btsnoop priority constants for user logging

8 years agobtsnoop: Add constants for Bluetooth monitor fields
Marcel Holtmann [Sun, 8 Nov 2015 06:18:45 +0000 (07:18 +0100)]
btsnoop: Add constants for Bluetooth monitor fields

8 years agobtsnoop: Update file format identifiers for trace files
Marcel Holtmann [Sun, 8 Nov 2015 06:16:52 +0000 (07:16 +0100)]
btsnoop: Update file format identifiers for trace files

8 years agomonitor: Allow using "debug" string for setting priority level
Marcel Holtmann [Sun, 8 Nov 2015 02:54:54 +0000 (03:54 +0100)]
monitor: Allow using "debug" string for setting priority level

8 years agomonitor: Add support for user logging priority selection
Marcel Holtmann [Sun, 8 Nov 2015 02:48:21 +0000 (03:48 +0100)]
monitor: Add support for user logging priority selection

8 years agomonitor: Do not abort user logging for invalid index messages
Marcel Holtmann [Sun, 8 Nov 2015 02:38:00 +0000 (03:38 +0100)]
monitor: Do not abort user logging for invalid index messages

8 years agocore: Use adapter->dev_id for adapter specific logging
Marcel Holtmann [Sun, 8 Nov 2015 02:10:03 +0000 (03:10 +0100)]
core: Use adapter->dev_id for adapter specific logging

8 years agocore: Add logging functions for controller specific messages
Marcel Holtmann [Sun, 8 Nov 2015 01:33:22 +0000 (02:33 +0100)]
core: Add logging functions for controller specific messages

8 years agomonitor: Use cleaner decoding for system note and user logging packets
Marcel Holtmann [Sun, 8 Nov 2015 01:18:41 +0000 (02:18 +0100)]
monitor: Use cleaner decoding for system note and user logging packets

8 years agocore: Add support for user logging with ident information
Marcel Holtmann [Sun, 8 Nov 2015 01:03:10 +0000 (02:03 +0100)]
core: Add support for user logging with ident information

8 years agomonitor: Add support for handling user logging with ident
Marcel Holtmann [Sun, 8 Nov 2015 01:01:56 +0000 (02:01 +0100)]
monitor: Add support for handling user logging with ident

8 years agomonitor: Support obmission of label when printing packets
Marcel Holtmann [Sun, 8 Nov 2015 00:20:11 +0000 (01:20 +0100)]
monitor: Support obmission of label when printing packets

8 years agoobexd: Use common logging function for daemon version
Marcel Holtmann [Sat, 7 Nov 2015 23:44:48 +0000 (00:44 +0100)]
obexd: Use common logging function for daemon version

8 years agocore: Use common logging function for daemon version
Marcel Holtmann [Sat, 7 Nov 2015 23:44:07 +0000 (00:44 +0100)]
core: Use common logging function for daemon version

8 years agocore: Add support for logging output to HCI_CHANNEL_LOGGING
Marcel Holtmann [Sat, 7 Nov 2015 13:48:10 +0000 (14:48 +0100)]
core: Add support for logging output to HCI_CHANNEL_LOGGING

8 years agolib: Add definition for HCI_CHANNEL_LOGGING
Marcel Holtmann [Sat, 7 Nov 2015 13:46:18 +0000 (14:46 +0100)]
lib: Add definition for HCI_CHANNEL_LOGGING

8 years agomonitor: Add support for decoding user logging packets
Marcel Holtmann [Sat, 7 Nov 2015 13:37:22 +0000 (14:37 +0100)]
monitor: Add support for decoding user logging packets

8 years agomonitor: Add support for system note packet type
Marcel Holtmann [Sat, 7 Nov 2015 09:27:01 +0000 (10:27 +0100)]
monitor: Add support for system note packet type

8 years agoshared/gatt-client: Fix use after free
Luiz Augusto von Dentz [Fri, 6 Nov 2015 09:40:19 +0000 (11:40 +0200)]
shared/gatt-client: Fix use after free

This fixes the following crash which happens when a service changed
removes characteristics which have notification pending:

==42544== Invalid read of size 4
==42544==    at 0x4939FA: enable_ccc_callback (gatt-client.c:1163)
==42544==    by 0x490D37: handle_rsp (att.c:673)
==42544==    by 0x490D37: can_read_data (att.c:845)
==42544==    by 0x498ED4: watch_callback (io-glib.c:170)
==42544==    by 0x4E7EE39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x4E7F1CF: ??? (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x4E7F4F1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x40B12E: main (main.c:661)
==42544==  Address 0x7e4eaa8 is 8 bytes inside a block of size 32 free'd
==42544==    at 0x4C29D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==42544==    by 0x48C96D: queue_remove_all (queue.c:360)
==42544==    by 0x491AA2: gatt_client_remove_notify_chrcs_in_range (gatt-client.c:331)
==42544==    by 0x491AA2: process_service_changed (gatt-client.c:1398)
==42544==    by 0x48C74D: queue_foreach (queue.c:239)
==42544==    by 0x4936B2: notify_cb (gatt-client.c:1614)
==42544==    by 0x490BC6: handle_notify (att.c:800)
==42544==    by 0x490BC6: can_read_data (att.c:881)
==42544==    by 0x498ED4: watch_callback (io-glib.c:170)
==42544==    by 0x4E7EE39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x4E7F1CF: ??? (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x4E7F4F1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.1)
==42544==    by 0x40B12E: main (main.c:661)

8 years agobtsnoop: Identify pklg vendor diagnostic packets
Marcel Holtmann [Fri, 6 Nov 2015 05:03:17 +0000 (06:03 +0100)]
btsnoop: Identify pklg vendor diagnostic packets

8 years agodoc/test-coverage: Update mgmt-tester & l2cap-tester test counts
Johan Hedberg [Mon, 2 Nov 2015 12:33:37 +0000 (14:33 +0200)]
doc/test-coverage: Update mgmt-tester & l2cap-tester test counts

8 years agomonitor: Fix L2CAP connection response code decoding
Johan Hedberg [Mon, 2 Nov 2015 12:28:55 +0000 (14:28 +0200)]
monitor: Fix L2CAP connection response code decoding

The Connect Response, LE Connect Response and Create Channel Response
PDUs have to some extent similar, but still different response code
meanings. Add dedicated decoding functions for these depending on the
context.

8 years agotools/l2cap-tester: Add invalid LE SCID test case
Johan Hedberg [Mon, 2 Nov 2015 12:17:57 +0000 (14:17 +0200)]
tools/l2cap-tester: Add invalid LE SCID test case

8 years agocore/service: Fix failing to connect external profile
Luiz Augusto von Dentz [Fri, 30 Oct 2015 13:27:25 +0000 (15:27 +0200)]
core/service: Fix failing to connect external profile

When initiating a connection to a external profile btd_service_connect
will be called which will change the service state to
BTD_SERVICE_STATE_CONNECTING but then once the connection completes
service_accept is called but since it now checks the state it would
return -EALREADY to prevent driver accept to be called more than once.

8 years agotools/mgmt-tester: Remove unnecessary define
Johan Hedberg [Mon, 2 Nov 2015 09:28:51 +0000 (11:28 +0200)]
tools/mgmt-tester: Remove unnecessary define

There's no need to have a define for opcode 0 since all of the structs
needing this are declared static and will have the value set to 0 if
not explicitly mentioned.

8 years agocore: Remove dead code
Szymon Janc [Fri, 16 Oct 2015 16:57:40 +0000 (18:57 +0200)]
core: Remove dead code

This removes dead code due to memory allocation with new0 not being
able to fail.

8 years agoandroid: Remove dead code
Szymon Janc [Fri, 16 Oct 2015 10:24:09 +0000 (12:24 +0200)]
android: Remove dead code

This removes dead code due to memory allocation with new0 not being
able to fail.

8 years agoshared: Remove dead code
Szymon Janc [Fri, 16 Oct 2015 12:12:13 +0000 (14:12 +0200)]
shared: Remove dead code

This removes dead code due to memory allocation with new0 not being
able to fail.

8 years agoshared: Make new0 abort on failure
Szymon Janc [Fri, 16 Oct 2015 10:11:10 +0000 (12:11 +0200)]
shared: Make new0 abort on failure

New is used to allocate small (typically much less than 1 page) chunks
and if such allocation fails system is most likely in state where
recovery is unlikely. Also by default Linux follows an optimistic memory
allocation strategy with OOM killer.

Aborting on allocationg failure allows to significantly simplify error
paths (which were most likely never tested anyway) and thus makes code
easier to understand.

btd_malloc name is used as malloc wrapper so that it can be exported
by bluetoothd and used also in external plugins.

8 years agoRelease 5.36
Marcel Holtmann [Fri, 30 Oct 2015 03:26:04 +0000 (04:26 +0100)]
Release 5.36

8 years agolib: Fix UTF-8 characters in company name
Marcel Holtmann [Fri, 30 Oct 2015 03:21:55 +0000 (04:21 +0100)]
lib: Fix UTF-8 characters in company name

8 years agobuild: Update library version
Marcel Holtmann [Fri, 30 Oct 2015 03:19:05 +0000 (04:19 +0100)]
build: Update library version

8 years agolib: Update company identifiers
Marcel Holtmann [Fri, 30 Oct 2015 03:18:14 +0000 (04:18 +0100)]
lib: Update company identifiers

8 years agomonitor: Add support for handling SCM_CREDENTIALS if present
Marcel Holtmann [Fri, 30 Oct 2015 03:03:56 +0000 (04:03 +0100)]
monitor: Add support for handling SCM_CREDENTIALS if present

8 years agotools/hciconfig: Fix hci_close_dev
Kunio AKASHI [Mon, 26 Oct 2015 22:52:10 +0000 (07:52 +0900)]
tools/hciconfig: Fix hci_close_dev

It had been closed different file descriptor.
When has two or more interfaces, hciconfig -a exit after cmd_class
function.

8 years agounit: Fix gobex unit tests
Szymon Janc [Mon, 26 Oct 2015 21:48:03 +0000 (22:48 +0100)]
unit: Fix gobex unit tests

/gobex/test_header_encode_connid test name was duplicated.
This results in Glib assert:
(unit/test-gobex-header:15356): GLib-ERROR **: duplicate test
    case path: /gobex/test_header_encode_connid

8 years agoandroid/README: Update known Android issues section
Grzegorz Kolodziejczyk [Tue, 20 Oct 2015 14:05:02 +0000 (16:05 +0200)]
android/README: Update known Android issues section

This adds a patch which allows handling ssp passkey request.

8 years agocore/device: Fix not claiming attributes of drivers
Luiz Augusto von Dentz [Mon, 26 Oct 2015 08:48:23 +0000 (10:48 +0200)]
core/device: Fix not claiming attributes of drivers

Driver loaded during init do not call add_gatt_service since the
attributes are only loaded during the first connection which means the
attributes need to be claimed on add_gatt_service but it was returning
if the driver was already probed causing the attribute to be exported
over D-Bus.

8 years agocore/service: Fix calling driver .accept multiple times
Luiz Augusto von Dentz [Mon, 26 Oct 2015 08:41:43 +0000 (10:41 +0200)]
core/service: Fix calling driver .accept multiple times

service_accept shall not call driver .accept callback multiple times.

8 years agoprofiles/deviceinfo: rewrite deviceinfo profile
Jakub Pawlowski [Thu, 22 Oct 2015 18:10:39 +0000 (11:10 -0700)]
profiles/deviceinfo: rewrite deviceinfo profile

This patch include new version of deviceinfo profile. It is now
not triggering autoconnect. It's also using accept callback instead
of btd_device_add_attio_callback.

8 years agoprofiles/scanparam: rewrite scanparam profile
Jakub Pawlowski [Thu, 22 Oct 2015 23:07:56 +0000 (16:07 -0700)]
profiles/scanparam: rewrite scanparam profile

This patch rewrites scanparam profile. It will no longer trigger
autoconnect.

8 years agosystemd: Check if bluetooth is supported in the kernel
Martin Pitt [Tue, 20 Oct 2015 10:24:45 +0000 (12:24 +0200)]
systemd: Check if bluetooth is supported in the kernel

When running a kernel without bluetooth support, bluetooth.service fails to
start with

    bluetoothd[1640]: Failed to access management interface
    bluetoothd[1640]: Adapter handling initialization failed
    systemd[1]: bluetooth.service: Main process exited, code=exited, status=1/FAILURE
    systemd[1]: Failed to start Bluetooth service.

This causes an unnecessary "degraded" state and more importantly breaks package
installation when the bluez package auto-starts the daemon.

Add a condition to only start the service if /sys/class/bluetooth exists.

https://launchpad.net/bugs/1506774

8 years agoaudio: Fix mtu input order
Chan-yeol Park [Fri, 23 Oct 2015 16:14:27 +0000 (01:14 +0900)]
audio: Fix mtu input order

This patch fixes imtu,omtu input order in avdtp_stream_set_transport().

8 years agocore/device: Fix build on some platforms
Jakub Pawlowski [Fri, 23 Oct 2015 05:52:23 +0000 (22:52 -0700)]
core/device: Fix build on some platforms

due to type promotions in C this code was failing on some platforms.

src/device.c:2016:8: error: format specifies type 'unsigned short' but the
      argument has type 'uint8_t' (aka 'unsigned char') [-Werror,-Wformat]
  properties, uuid_str);
  ^~~~~~~~~~
/build/falco/usr/include/bits/stdio2.h:39:7: note: expanded from macro 'sprintf'
                           __VA_ARGS__)
                           ^

8 years agogap/gas: Remove unused field
Luiz Augusto von Dentz [Thu, 22 Oct 2015 09:32:25 +0000 (12:32 +0300)]
gap/gas: Remove unused field

db_id is no longer necessary since gatt_db_register is no longer called.

8 years agogap/gas: Remove code handling service added/removed
Luiz Augusto von Dentz [Thu, 22 Oct 2015 07:46:44 +0000 (10:46 +0300)]
gap/gas: Remove code handling service added/removed

The will take care of calling probe/remove when a matching service is
added removed.

8 years agocore/device: Be consistent with function names
Luiz Augusto von Dentz [Thu, 22 Oct 2015 07:56:03 +0000 (10:56 +0300)]
core/device: Be consistent with function names

Rename device_remove_gatt_profile to device_remove_gatt_service.

8 years agocore/device: Fix not calling accept callback
Luiz Augusto von Dentz [Wed, 21 Oct 2015 12:09:05 +0000 (15:09 +0300)]
core/device: Fix not calling accept callback

For GATT based services accept is used to indicate that there is a new
connection available so it needs to be called immediately once ATT
connects so the driver can register for notification, etc.

This also renames probe_gatt_profile to add_gatt_service which is what
in fact it was doing.

8 years agocore: Fix double ATT connect() upon failure
Johan Hedberg [Wed, 21 Oct 2015 11:41:50 +0000 (14:41 +0300)]
core: Fix double ATT connect() upon failure

If we fail connecting ATT we should not attempt to call
device_browse_gatt(). This would only trigger a new connect attempt
which would likely also fail.

8 years agomonitor: Handle the Intel memory write and secure send correctly
Marcel Holtmann [Tue, 20 Oct 2015 23:50:50 +0000 (01:50 +0200)]
monitor: Handle the Intel memory write and secure send correctly

8 years agomonitor: Add more Intel specific debugging events
Marcel Holtmann [Tue, 20 Oct 2015 21:33:11 +0000 (23:33 +0200)]
monitor: Add more Intel specific debugging events

8 years agomonitor: Check length when decoding extended LMP opcodes
Marcel Holtmann [Tue, 20 Oct 2015 20:07:19 +0000 (22:07 +0200)]
monitor: Check length when decoding extended LMP opcodes

8 years agomonitor: Add detailed decoding support for various Intel commands
Marcel Holtmann [Tue, 20 Oct 2015 17:02:55 +0000 (19:02 +0200)]
monitor: Add detailed decoding support for various Intel commands

8 years agoobexd: pbap: add headers correctly for size query
Simon Fels [Mon, 19 Oct 2015 20:12:17 +0000 (22:12 +0200)]
obexd: pbap: add headers correctly for size query

When client queries for the size of a phonebook we fall into a
indefinite loop as g_obex_apparam_encode always returns the same
number of items added to the buffer regardless how often it is
called. In former times where this code wasn't using GObexApparams
a array was reduced each time the headers where added and so we could
easily find out when we've added all headers. However today we need
to solve this a bit differently by also setting the firstpacket flag
when we receive the phonebook size result from the phonebook
implementation which then lets us correctly go through without
falling into a indefinite loop.

8 years agosrc/profile: Fix segmentation fault
Vinicius Costa Gomes [Fri, 16 Oct 2015 23:03:47 +0000 (20:03 -0300)]
src/profile: Fix segmentation fault

The change that made the 'deviceinfo' profile "external" had an side
effect, now it is possible to have an external profile without 'owner'
and 'path' information. The fix considers that having an external
profile without that information is not an error.

Valgrind log:

bluetoothd[9974]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
bluetoothd[9974]: src/adapter.c:add_uuid() sending add uuid command for index 0
bluetoothd[9974]: Endpoint registered: sender=:1.38 path=/MediaEndpoint/A2DPSink
bluetoothd[9974]: src/profile.c:register_profile() sender :1.38 path /Profile/HSPAGProfile
==9974== Invalid read of size 1
==9974==    at 0x65F21E0: __strcmp_sse2_unaligned (in /usr/x86_64-pc-linux-gnu/lib/libc-2.22.so)
==9974==    by 0x4E6C7E8: g_str_equal (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x467917: find_ext_profile (profile.c:745)
==9974==    by 0x469A8D: register_profile (profile.c:2373)
==9974==    by 0x4889C3: process_message.isra.5 (object.c:259)
==9974==    by 0x518E33E: _dbus_object_tree_dispatch_and_unlock (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3)
==9974==    by 0x51805E3: dbus_connection_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3)
==9974==    by 0x4856DF: message_dispatch (mainloop.c:72)
==9974==    by 0x4E7C669: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x4E7C9E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x4E7CD01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x40BABE: main (main.c:661)
==9974==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==9974==
==9974==
==9974== Process terminating with default action of signal 11 (SIGSEGV)
==9974==  Access not within mapped region at address 0x0
==9974==    at 0x65F21E0: __strcmp_sse2_unaligned (in /usr/x86_64-pc-linux-gnu/lib/libc-2.22.so)
==9974==    by 0x4E6C7E8: g_str_equal (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x467917: find_ext_profile (profile.c:745)
==9974==    by 0x469A8D: register_profile (profile.c:2373)
==9974==    by 0x4889C3: process_message.isra.5 (object.c:259)
==9974==    by 0x518E33E: _dbus_object_tree_dispatch_and_unlock (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3)
==9974==    by 0x51805E3: dbus_connection_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3)
==9974==    by 0x4856DF: message_dispatch (mainloop.c:72)
==9974==    by 0x4E7C669: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x4E7C9E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x4E7CD01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1)
==9974==    by 0x40BABE: main (main.c:661)
==9974==  If you believe this happened as a result of a stack
==9974==  overflow in your program's main thread (unlikely but
==9974==  possible), you can try to increase the size of the
==9974==  main thread stack using the --main-stacksize= flag.
==9974==  The main thread stack size used in this run was 8388608.
==9974==

8 years agocore/gatt: Fix logging invalid device address
Luiz Augusto von Dentz [Mon, 19 Oct 2015 07:44:10 +0000 (10:44 +0300)]
core/gatt: Fix logging invalid device address

This fix extra ':' at the end of device address if service interface
cannot be registered.

8 years agocore/device: Fix crash when disconnecting
Luiz Augusto von Dentz [Thu, 15 Oct 2015 10:10:08 +0000 (13:10 +0300)]
core/device: Fix crash when disconnecting

When device disconnect while GATT discovery is ongoing the following
crash can happen if the device is destroyed in case it is temporary:

Invalid read of size 4
   at 0x40A707C: g_slist_find_custom (in /usr/lib/libglib-2.0.so.0.4400.1)
   by 0x80B7382: gatt_service_removed (device.c:3422)
   by 0x80DF2FB: handle_notify (gatt-db.c:266)
   by 0x80D3B8E: queue_foreach (queue.c:251)
   by 0x80DF981: notify_service_changed (gatt-db.c:283)
   by 0x80DF981: gatt_db_service_destroy (gatt-db.c:294)
   by 0x80D3DFE: queue_remove_all (queue.c:387)
   by 0x80DFA4C: gatt_db_clear (gatt-db.c:438)
   by 0x80D908C: init_fail (gatt-client.c:1524)
   by 0x80D9A52: discovery_op_unref (gatt-client.c:419)
   by 0x80E18F2: destroy_mtu_op (gatt-helpers.c:495)
   by 0x80D7F6E: cancel_att_send_op (att.c:212)
   by 0x80D7F6E: bt_att_cancel (att.c:1238)
   by 0x80DB26A: bt_gatt_client_cancel_all (gatt-client.c:1962)
 Address 0x5536b58 is 0 bytes inside a block of size 8 free'd
   at 0x402B2C9: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x408CE4F: g_free (in /usr/lib/libglib-2.0.so.0.4400.1)
   by 0x40A6772: g_slice_free_chain_with_offset (in /usr/lib/libglib-2.0.so.0.4400.1)
   by 0x40A6B6B: g_slist_free (in /usr/lib/libglib-2.0.so.0.4400.1)
   by 0x40A7374: g_slist_free_full (in /usr/lib/libglib-2.0.so.0.4400.1)
   by 0x80B6CE0: device_free (device.c:624)
   by 0x80CFCCB: remove_interface (object.c:658)
   by 0x80D0208: g_dbus_unregister_interface (object.c:1382)
   by 0x80BC281: btd_device_unref (device.c:5942)
   by 0x80A9ACA: btd_adapter_remove_device (adapter.c:1165)
   by 0x80A9C52: adapter_remove_connection (adapter.c:5624)
   by 0x80AA77F: dev_disconnected (adapter.c:6584)

8 years agomonitor: Fix firmware version numbering for Broadcom chips
Marcel Holtmann [Sun, 18 Oct 2015 20:31:46 +0000 (22:31 +0200)]
monitor: Fix firmware version numbering for Broadcom chips

8 years agomonitor: Update handling for vendor commands and events
Marcel Holtmann [Sun, 18 Oct 2015 19:45:39 +0000 (21:45 +0200)]
monitor: Update handling for vendor commands and events

8 years agotools: Add p_ prefix to parser field helper functions
Marcel Holtmann [Sun, 18 Oct 2015 19:30:07 +0000 (21:30 +0200)]
tools: Add p_ prefix to parser field helper functions

8 years agomonitor: Print vendor specific string before vendor command
Marcel Holtmann [Sun, 18 Oct 2015 18:39:03 +0000 (20:39 +0200)]
monitor: Print vendor specific string before vendor command

8 years agomonitor: Don't print index label for HCI_DEV_NONE messages
Marcel Holtmann [Sun, 18 Oct 2015 17:36:34 +0000 (19:36 +0200)]
monitor: Don't print index label for HCI_DEV_NONE messages

8 years agomonitor: Add support for handling Intel vendor commands
Marcel Holtmann [Sun, 18 Oct 2015 13:14:57 +0000 (15:14 +0200)]
monitor: Add support for handling Intel vendor commands

8 years agomonitor: Add support for handling Broadcom vendor commands
Marcel Holtmann [Sat, 17 Oct 2015 22:22:06 +0000 (00:22 +0200)]
monitor: Add support for handling Broadcom vendor commands

8 years agomonitor: Add the missing LL opcodes for Bluetooth 4.1 and 4.2 features
Marcel Holtmann [Sat, 17 Oct 2015 15:37:21 +0000 (08:37 -0700)]
monitor: Add the missing LL opcodes for Bluetooth 4.1 and 4.2 features

8 years agomonitor: Update controller address from Read BD Addr command
Marcel Holtmann [Sat, 17 Oct 2015 14:04:42 +0000 (16:04 +0200)]
monitor: Update controller address from Read BD Addr command

8 years agobtsnoop: Fix timestamp assignment for little-endian packet logger format
Marcel Holtmann [Sat, 17 Oct 2015 09:07:11 +0000 (11:07 +0200)]
btsnoop: Fix timestamp assignment for little-endian packet logger format

8 years agobtsnoop: Add support for little-endian packet logger (pklg) format
Marcel Holtmann [Fri, 16 Oct 2015 10:12:42 +0000 (12:12 +0200)]
btsnoop: Add support for little-endian packet logger (pklg) format

8 years agodeviceinfo: Enable external flag
Luiz Augusto von Dentz [Wed, 7 Oct 2015 12:40:02 +0000 (15:40 +0300)]
deviceinfo: Enable external flag

This enable attributes to be accessed over D-Bus.

8 years agomonitor/avctp: Decode player features
Luiz Augusto von Dentz [Mon, 12 Oct 2015 14:14:00 +0000 (17:14 +0300)]
monitor/avctp: Decode player features

This decodes the bits related to browsing channel which is useful to
debug:

> ACL Data RX: Handle 256 flags 0x02 dlen 68
      Channel: 69 len 64 ctrl 0x0100 [PSM 27 mode 3] {chan 5}
      I-frame: Unsegmented TxSeq 0 ReqSeq 1
      AVCTP Browsing: Response: type 0x00 label 0 PID 0x110e
        AVRCP: GetFolderItems: len 0x0036
          Status: 0x04 (Success)
          UIDCounter: 0x0000 (0)
          NumOfItems: 0x0001 (1)
          Item: 0x01 (Media Player)
          Length: 0x002e (46)
          PlayerID: 0x0001 (1)
          PlayerType: 0x0001 (Audio)
          PlayerSubType: 0x00000000 (None)
          PlayStatus: 0x01 (PLAYING)
          Features: 0x00000000003700050000000000000000
            Advanced Control Player
            Browsing
            NowPlaying

8 years agoaudio/avrcp: Fix ctype code of PlayItem and AddToNowPlaying
Luiz Augusto von Dentz [Mon, 12 Oct 2015 09:15:49 +0000 (12:15 +0300)]
audio/avrcp: Fix ctype code of PlayItem and AddToNowPlaying

Both PlayItem and AddToNowPlaying should use control type not status.