OSDN Git Service

android-x86/external-bluetooth-bluez.git
7 years agoMerge remote-tracking branch 'origin/master' into marshmallow-x86 marshmallow-x86 android-x86-6.0-r3
Chih-Wei Huang [Thu, 23 Mar 2017 13:14:09 +0000 (21:14 +0800)]
Merge remote-tracking branch 'origin/master' into marshmallow-x86

7 years agoclient: Use selected attribute when selecting by UUID
Luiz Augusto von Dentz [Tue, 14 Mar 2017 11:46:21 +0000 (13:46 +0200)]
client: Use selected attribute when selecting by UUID

There could be multiple instances of the same UUID, like e.g CCC and CEP,
so instead of matching the first one found from the beginning this uses
the current selected attribute as parent looking up existing child
attributes first.

7 years agoclient: Add support to pass UUIDs to select-attribute
Luiz Augusto von Dentz [Tue, 14 Mar 2017 11:09:06 +0000 (13:09 +0200)]
client: Add support to pass UUIDs to select-attribute

This adds support to match attributes by UUID instead of object path.

7 years agoclient: Use case insensitive matching for addresses completion
Szymon Janc [Wed, 15 Mar 2017 11:25:32 +0000 (12:25 +0100)]
client: Use case insensitive matching for addresses completion

Allow giving Bluetooth addresses both in upper and lower case. When
address is completed it is capitalized.

7 years agoclient: Use case insensitive matching for addresses
Johan Hedberg [Wed, 15 Mar 2017 11:05:15 +0000 (13:05 +0200)]
client: Use case insensitive matching for addresses

Allow giving Bluetooth addresses both in upper and lower case.

7 years agopolicy: Fix removing reconnect flag while still connecting
Luiz Augusto von Dentz [Wed, 22 Apr 2015 15:02:39 +0000 (17:02 +0200)]
policy: Fix removing reconnect flag while still connecting

If a service connects it should stop new attempts but the current ones
should continue so reconnection should not be reset.

7 years agobuild: Enable --enable-deprecated in bootstrap-configure
Luiz Augusto von Dentz [Wed, 1 Mar 2017 11:57:57 +0000 (13:57 +0200)]
build: Enable --enable-deprecated in bootstrap-configure

bootstrap-configure shall contain all possible options to be able to
catch any build problems.

7 years agoRelease 5.44
Marcel Holtmann [Sat, 25 Feb 2017 16:02:37 +0000 (17:02 +0100)]
Release 5.44

7 years agohog: When no VID&PID also register a DIS notifier
Juha Kuikka [Sat, 25 Feb 2017 00:13:26 +0000 (16:13 -0800)]
hog: When no VID&PID also register a DIS notifier

DIS was reading VID & PID but they were not communicated to the HOG due to lack
of registered notifier.

Add a notified also in this case.

7 years agohog: Move dis_notify around
Juha Kuikka [Sat, 25 Feb 2017 00:13:25 +0000 (16:13 -0800)]
hog: Move dis_notify around

No functional changes

7 years agodis: Fix attribute handle when initializing from db
Juha Kuikka [Sat, 25 Feb 2017 00:13:24 +0000 (16:13 -0800)]
dis: Fix attribute handle when initializing from db

The handle field in struct bt_dis is initialized to the handle of the DIS gatt
service. It should be the value handle of the PNP ID characteristic.

This patch fixes the issue.

7 years agobuild: Update library version
Marcel Holtmann [Fri, 24 Feb 2017 18:14:45 +0000 (19:14 +0100)]
build: Update library version

7 years agomonitor: Add missing error code for LE Connection Response
Szymon Janc [Tue, 21 Feb 2017 13:23:22 +0000 (14:23 +0100)]
monitor: Add missing error code for LE Connection Response

This adds missing decoding for 0x000b result code.

7 years agomonitor: Fix LE Connection Response error decoding
Szymon Janc [Tue, 21 Feb 2017 13:22:01 +0000 (14:22 +0100)]
monitor: Fix LE Connection Response error decoding

"Connection refused - Source CID already allocated" is 0x000a not 0x0010

> ACL Data RX: Handle 76 flags 0x02 dlen 18
      LE L2CAP: LE Connection Response (0x15) ident 7 len 10
        Destination CID: 0
        MTU: 0
        MPS: 0
        Credits: 0
        Result: Connection refused - Source CID already allocated (0x000a)

7 years agoclient: fix calling ad_unregister
SeulKi Shin [Tue, 14 Feb 2017 09:27:50 +0000 (18:27 +0900)]
client: fix calling ad_unregister

ad_register shall only be called in case the advertise command has been
called so registered flag should be checked before calling
UnregisterAdvertisement.

7 years agobootstrap-configure: Add --enable-tools
Luiz Augusto von Dentz [Mon, 13 Feb 2017 11:01:49 +0000 (13:01 +0200)]
bootstrap-configure: Add --enable-tools

bootstrap-configure shall contain all possible options so it can catch
any build problem in the tree.

7 years agoprofiles/midi: Moved MIDI UUIDs to library header
Felipe F. Tonello [Thu, 9 Feb 2017 14:55:49 +0000 (14:55 +0000)]
profiles/midi: Moved MIDI UUIDs to library header

This allows other users of libmidi to consistently use MIDI UUIDs.

7 years agoprofiles/midi: Add safer buffer setter function
Felipe F. Tonello [Thu, 9 Feb 2017 14:55:48 +0000 (14:55 +0000)]
profiles/midi: Add safer buffer setter function

This function helper makes buffer operations more consistent and adds
boundary check when its available.

7 years agomonitor: Add HCI commands and events for Bluetooth 5.0
Marcel Holtmann [Mon, 30 Jan 2017 09:30:41 +0000 (01:30 -0800)]
monitor: Add HCI commands and events for Bluetooth 5.0

7 years agomonitor: Add LMP PDUs for Bluetooth 5.0
Marcel Holtmann [Mon, 30 Jan 2017 09:30:15 +0000 (01:30 -0800)]
monitor: Add LMP PDUs for Bluetooth 5.0

7 years agomonitor: Add link layer control PDUs for Bluetooth 5.0
Marcel Holtmann [Mon, 30 Jan 2017 06:23:34 +0000 (22:23 -0800)]
monitor: Add link layer control PDUs for Bluetooth 5.0

7 years agomonitor: Add Bluetooth 5.0 features and version information
Marcel Holtmann [Mon, 30 Jan 2017 05:34:25 +0000 (21:34 -0800)]
monitor: Add Bluetooth 5.0 features and version information

7 years agolib: Add version number for Bluetooth 5.0
Marcel Holtmann [Mon, 30 Jan 2017 05:31:33 +0000 (21:31 -0800)]
lib: Add version number for Bluetooth 5.0

7 years agounit/test-midi: Make unit test compatible with GLIB v2.28
Brian Gix [Tue, 24 Jan 2017 19:52:44 +0000 (11:52 -0800)]
unit/test-midi: Make unit test compatible with GLIB v2.28

g_assert_memcmp would require to bump the glib version so instead just
use just use g_assert_cmpint and g_assert.

7 years agoAdd test-midi to ignore list
Brian Gix [Tue, 24 Jan 2017 19:52:43 +0000 (11:52 -0800)]
Add test-midi to ignore list

7 years agopolicy: Fix not reseting sink source
Luiz Augusto von Dentz [Tue, 24 Jan 2017 13:13:23 +0000 (15:13 +0200)]
policy: Fix not reseting sink source

policy_connect_sink shall reset the sink_timer not source_timer.

7 years agoaudio/a2dp: Fix possible invalid reads
Luiz Augusto von Dentz [Mon, 23 Jan 2017 13:11:02 +0000 (15:11 +0200)]
audio/a2dp: Fix possible invalid reads

In case the D-Bus endpoint needs to respond or select a configuration for
SetConfiguration the setup given as user_data needs to be referenced as
the setup can be aborted before there is a reply leading to crash like
following the following:

Invalid read of size 8
   at 0x41B45E: select_cb (a2dp.c:1779)
   by 0x426881: select_cb (media.c:510)
   by 0x427A0F: endpoint_reply (media.c:315)
   by 0x53A7391: ??? (in /usr/lib64/libdbus-1.so.3.16.3)
   by 0x53AACDE: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.16.3)
   by 0x4C54EF: message_dispatch (mainloop.c:72)
   by 0x50C88E6: ??? (in /usr/lib64/libglib-2.0.so.0.5000.2)
   by 0x50CBE41: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5000.2)
   by 0x50CC1BF: ??? (in /usr/lib64/libglib-2.0.so.0.5000.2)
   by 0x50CC4E1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.5000.2)
   by 0x40C85E: main (main.c:708)
 Address 0x9704de8 is 56 bytes inside a block of size 88 free'd
   at 0x4C2ED4A: free (vg_replace_malloc.c:530)
   by 0x50D16BD: g_free (in /usr/lib64/libglib-2.0.so.0.5000.2)
   by 0x418FAA: setup_free (a2dp.c:166)
   by 0x418FAA: setup_unref (a2dp.c:178)
   by 0x41E3DE: a2dp_cancel (a2dp.c:2176)
   by 0x418244: sink_disconnect (sink.c:402)
   by 0x41C5B7: a2dp_sink_disconnect (a2dp.c:2344)

7 years agoaudio/avdtp: Fix not aborting SetConfiguration
Luiz Augusto von Dentz [Fri, 20 Jan 2017 13:35:43 +0000 (15:35 +0200)]
audio/avdtp: Fix not aborting SetConfiguration

If for some reason SetConfiguration is cancelled an Abort shall be
generated since it there could be a stream pending.

7 years agoaudio/avdtp: Fix calling abort confirmation
Luiz Augusto von Dentz [Fri, 20 Jan 2017 13:21:21 +0000 (15:21 +0200)]
audio/avdtp: Fix calling abort confirmation

Abort confirmation shall only be called in case an abort has been sent
and the setup has to be unref asynchronously.

7 years agoaudio/avctp: Match opcode when parsing responses
Luiz Augusto von Dentz [Wed, 18 Jan 2017 17:37:40 +0000 (19:37 +0200)]
audio/avctp: Match opcode when parsing responses

The transaction may not be unique given the fact that notifications can
take all the outstanding transaction which may cause transactions to be
reused as explained in the errata:

https://www.bluetooth.org/errata/errata_view.cfm?errata_id=3812

7 years agobuild: Add testing config option
Luiz Augusto von Dentz [Wed, 4 Jan 2017 13:24:45 +0000 (15:24 +0200)]
build: Add testing config option

This adds --enable-testing that can be used to enable emulator and tester
which are no longer experimental but also are not meant for production.

7 years agobuild: Promote experiemental tools
Luiz Augusto von Dentz [Wed, 4 Jan 2017 12:47:13 +0000 (14:47 +0200)]
build: Promote experiemental tools

This promotes many tools that were behind --enable-experimental which are
in fact used as stable tools for a while.

7 years agobuild: Hide deprecated tools under --enable-deprecated
Luiz Augusto von Dentz [Wed, 4 Jan 2017 12:23:58 +0000 (14:23 +0200)]
build: Hide deprecated tools under --enable-deprecated

This marks the following tools as deprecated as they are not longer
maintained or have been replaced by other tools:

  hciattach hciconfig hcitool hcidump rfcomm sdptool ciptool gatttool

7 years agomain.conf: Fix adaper/adapter typo
Nobuhiro Iwamatsu [Fri, 2 Dec 2016 08:53:46 +0000 (17:53 +0900)]
main.conf: Fix adaper/adapter typo

7 years agolib/sdp: Remove deprecated VIDEO_CONF profile id
Tomasz Gorochowik [Sat, 10 Dec 2016 22:59:26 +0000 (23:59 +0100)]
lib/sdp: Remove deprecated VIDEO_CONF profile id

Commit 75e0c32af6bf ("lib/sdp: Replace VIDEO_CONF_SVCLASS_ID with
AV_REMOTE_CONTROLLER_SVCLASS_ID") removed the deprecated
VIDEO_CONF_SVCLASS_ID definition, but left the corresponding profile
definition..

According to the specification linked below A/V_RemoteControlController
UUID can only be used as a service class so its profile definition
should be removed.

https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery

7 years agoREADME: Add documentation for --enable-midi
Luiz Augusto von Dentz [Sun, 8 Jan 2017 13:12:53 +0000 (15:12 +0200)]
README: Add documentation for --enable-midi

7 years agodoc/mgmt-api: Mark 4.9 kernel as released
Johan Hedberg [Sat, 7 Jan 2017 08:01:05 +0000 (10:01 +0200)]
doc/mgmt-api: Mark 4.9 kernel as released

7 years agobtproxy: Add option to ignore initial zero byte
Johan Hedberg [Thu, 5 Jan 2017 07:38:02 +0000 (09:38 +0200)]
btproxy: Add option to ignore initial zero byte

This helps deal with a broken host that might send an initial zero
byte before any valid data.

7 years agobuild: Add --enable-midi to bootstrap-configure
Luiz Augusto von Dentz [Thu, 5 Jan 2017 07:42:27 +0000 (09:42 +0200)]
build: Add --enable-midi to bootstrap-configure

bootstrap-configure shall have all the possible build options.

7 years agounit/test-midi: Added libmidi use-case tests
Felipe F. Tonello [Tue, 3 Jan 2017 17:30:07 +0000 (17:30 +0000)]
unit/test-midi: Added libmidi use-case tests

I tried to test all basic and most common use-case scenarios here and
some more weird as well. It tests cases where the parser needs to handle
problematic MIDI messages as well as ALSA Sequencer events.

It is really simple to add new tests, so others are welcome to do so.

7 years agoprofiles/midi: Added MIDI over BLE profile implementation
Felipe F. Tonello [Tue, 3 Jan 2017 17:30:06 +0000 (17:30 +0000)]
profiles/midi: Added MIDI over BLE profile implementation

This plugin implements the Central role of MIDI over Bluetooth
Low-Energy (BLE-MIDI) 1.0 specification as published by MMA in
November/2015.

It was implmemented as a bluetoothd plugin because of latency requirements
of MIDI. There are still room for improvements on this regard.

Like previsouly mentioned, it only implements the Central role, but
since all parsing and state-machine code is in libmidi.[hc] it should be
simple to implement the Peripheral role as a GATT service as well.

Files added:
 * profiles/midi/midi.c: Actual GATT plugin
 * profiles/midi/libmidi.[ch]: MIDI parsers

Techinal notes
==============

This plugin doesn't require any new threads. It relies on notifications
from a device to parse and render proper events that are queued in the
kernel, causing no blocks at all. Even if an error occur, it will be
handled and returned control to bluetoothd.

It also adds a new file descriptor to be read using struct io. That is
necessary to read events from applications and render raw BLE packets to
be sent to the device with a write without response command. It doesn't
block as well.

This patch introduces ALSA as dependency. But this feature is disabled
by default. To enable it, pass --enable-midi to the configure script.

Even though this introduces ALSA dependency, it is not an audio plugin.
It is rather a MIDI plugin, which is a byte stream protocol with low
throughput but requires low-latency.

Observations
============

I have tested on a normal laptop Arch-linux (x86_64) and a Raspberry Pi 2
(ARM Cortex-A8) and it works very well. As I mentioned, the latency can
always be improved.

I will still maintain a personal branch on my github[1] so others can
contribute there and I can test before sending to BlueZ.

IMPORTAT: the timestamp support is incomplete since ALSA doesn't support the
way MIDI over BLE expects (asign timestamp to an event without scheduling).
We are working on ALSA to support this.

Credits
=======

I would like to send kudos to ROLI Ltd. which allowed my to work
on this as part of my full-time job.

[1] https://github.com/ftonello/bluez/

7 years agomonitor: Add UUIDs of BBC micro:bit services
Luiz Augusto von Dentz [Mon, 2 Jan 2017 13:25:52 +0000 (15:25 +0200)]
monitor: Add UUIDs of BBC micro:bit services

This add the UUID of GATT attributes used in BBC micro:bit services as
specified bellow:

https://lancaster-university.github.io/microbit-docs/resources/bluetooth/bluetooth_profile.html

7 years agoinput/hog-lib: Attempt to read PNP values if not set
Luiz Augusto von Dentz [Tue, 27 Dec 2016 10:30:13 +0000 (12:30 +0200)]
input/hog-lib: Attempt to read PNP values if not set

7 years agodis: Add support to gatt-db
Luiz Augusto von Dentz [Tue, 27 Dec 2016 10:26:09 +0000 (12:26 +0200)]
dis: Add support to gatt-db

This add support of passing a gatt-db to avoid having to discover the
services again, this should also make it easier to port to bt_gatt_client
once Android code support it.

7 years agoinput/hog-lib: Add support to gatt-db
Luiz Augusto von Dentz [Fri, 23 Dec 2016 11:28:36 +0000 (13:28 +0200)]
input/hog-lib: Add support to gatt-db

This add support of passing a gatt-db to avoid having to discover the
services again, this should also make it easier to port to bt_gatt_client
once Android code support it.

7 years agotools/btgatt-client: Update set-security usage
Maxime Chevallier [Thu, 22 Dec 2016 10:36:05 +0000 (11:36 +0100)]
tools/btgatt-client: Update set-security usage

7 years agotools/btgatt-client: Fix set-security interactive command
Maxime Chevallier [Thu, 22 Dec 2016 10:36:04 +0000 (11:36 +0100)]
tools/btgatt-client: Fix set-security interactive command

Fix the interactive "set-security" command in btgatt-client, that would
always fail due to bad initialization of argv buffer :

[GATT client]# set-security 2
Usage: set_security <level>
level: 1-3
e.g.:
        set-sec-level 2

7 years agotools/btgatt-client: Fix register-notify prompt
Maxime Chevallier [Sat, 27 Feb 2016 22:54:54 +0000 (23:54 +0100)]
tools/btgatt-client: Fix register-notify prompt

Added missing carriage return in register_notify_cb.
Changed a call to PRLOG to a simple printf to avoid
getting a extra prompt in cmd_register_notify.

7 years agoRemove deprecated UHID_FEATURE API
Juha Kuikka [Thu, 22 Dec 2016 01:17:19 +0000 (17:17 -0800)]
Remove deprecated UHID_FEATURE API

I believe I have identified an issue with the HID-over-GATT (HoG) where,
through hidraw, the HIDIOCGFEATURE does not work correctly.

The symptom is that the ioctl call returns immediately with bogus data,
before the Read Request to the peripheral has been completed.

I believe the issue is caused by the hog-lib.c registering a handler for
both UHID_FEATURE and UHID_GET_REPORT events, which in the uhid header
file turn out to be the same enum.

This causes the get_report() to get called first, it issues the Read
Request and waits for it's completion. After this the get_feature() is
immediately called with the same uhid message, which sends the
UHID_FEATURE_ANSWER in to the kernel with stale data, which then gets
returned to the hidraw caller.

I have fixed this by removing the get_feature() as it is unnecessary
anyway. See attached patch.

I have tested with against both old and new uhid API (kernels 3.8 and
4.4).

7 years agoUncomment section headers in config file
Mansour Behabadi [Thu, 15 Dec 2016 00:39:50 +0000 (11:39 +1100)]
Uncomment section headers in config file

If a config key under [Policy] section is uncommented right now, it's
assumed to be in [General] section because [Policy] line is commented
out and it won't work.

7 years agomonitor/rfcomm: Fix a potential memory access issue for compatibility with LLVM
Miao-chen Chou [Thu, 22 Dec 2016 00:12:33 +0000 (16:12 -0800)]
monitor/rfcomm: Fix a potential memory access issue for compatibility with LLVM

This patch removes "packed" attribute from the definition of struct rfcomm_rpn
to prevent the access to an unaligned struct member in mmc_rpn(). This patch
also introduces a temp variable in mcc_pn() to prevent unaligned access without
touching the definition of struct rfcomm_pn, since struct rfcomm_pn is used as
a PDU.

error messages from LLVM build:

monitor/rfcomm.c:238:36: error: taking address of packed member 'pm' of class
or structure 'rfcomm_rpn' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        if (!l2cap_frame_get_le16(frame, &rpn.pm))
monitor/rfcomm.c:287:36: error: taking address of packed member 'mtu' of class
or structure 'rfcomm_pn' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        if (!l2cap_frame_get_le16(frame, &pn.mtu))

Currently there is no corresponding flag in GCC to generate the same error
messages. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628.

7 years agodoc/test-runner: Add Bluetooth config options
Luiz Augusto von Dentz [Tue, 20 Dec 2016 14:07:29 +0000 (16:07 +0200)]
doc/test-runner: Add Bluetooth config options

List the build options for Bluetooth necessary to run testers.

7 years agomonitor/rfcomm: Fix left over packed struct
Luiz Augusto von Dentz [Tue, 20 Dec 2016 09:52:00 +0000 (11:52 +0200)]
monitor/rfcomm: Fix left over packed struct

7 years agotools/test-runner: Fix not creating /usr/share/dbus-1/system.conf
Luiz Augusto von Dentz [Mon, 19 Dec 2016 11:12:32 +0000 (13:12 +0200)]
tools/test-runner: Fix not creating /usr/share/dbus-1/system.conf

Apparently this is the new location where D-Bus will look for its
configuration so just creare a symlink to /etc/dbus-1/system.conf.

7 years agocore/gatt-database: Send offset if set to WriteValue
Luiz Augusto von Dentz [Fri, 16 Dec 2016 13:09:36 +0000 (15:09 +0200)]
core/gatt-database: Send offset if set to WriteValue

If there remote is using Prepare + Execute Write commands as part of
a Write Long procedure the offset needs to be set in order for the
application to detect from where it shall write the data.

7 years agocore/gatt-database: Send offset if set to ReadValue
Luiz Augusto von Dentz [Fri, 16 Dec 2016 13:01:54 +0000 (15:01 +0200)]
core/gatt-database: Send offset if set to ReadValue

If there remote is using Read Blob command as part of a Read Long
procedure the offset needs to be set in order for the application to
detect from where it shall start.

Note that with this it is also possible to detect what the chunk sizes
needs to be as the first offset indicates the maximum payload.

7 years agomonitor: Remove redundant parentheses
Johan Hedberg [Sat, 17 Dec 2016 09:42:55 +0000 (11:42 +0200)]
monitor: Remove redundant parentheses

7 years agomonitor/rfcomm: Remove packed attribute from structs
Luiz Augusto von Dentz [Fri, 9 Dec 2016 10:21:45 +0000 (12:21 +0200)]
monitor/rfcomm: Remove packed attribute from structs

These structs do not represent the raw PDU format thus they don't need
to be the exact same size.

7 years agocore/adapter: Fix not updating names of connected devices
Luiz Augusto von Dentz [Mon, 12 Dec 2016 12:19:29 +0000 (14:19 +0200)]
core/adapter: Fix not updating names of connected devices

If there is a device found event for a connected device let it update
the name as the device may still be temporary but it might be useful to
display a proper name while profile connections or paring are pending.

7 years agomonitor/avctp: Fix reading attribute length as 1 octet
Luiz Augusto von Dentz [Fri, 9 Dec 2016 14:21:18 +0000 (16:21 +0200)]
monitor/avctp: Fix reading attribute length as 1 octet

Attribute length is actually 2 octets long.

7 years agomonitor/avctp: Fix printing variable length names/values
Luiz Augusto von Dentz [Fri, 9 Dec 2016 14:19:47 +0000 (16:19 +0200)]
monitor/avctp: Fix printing variable length names/values

Print variable names/values in a single line.

7 years agoshared/mainloop: Fix timeout data memleak
Loic Poulain [Wed, 7 Dec 2016 13:44:23 +0000 (14:44 +0100)]
shared/mainloop: Fix timeout data memleak

Valgrind reports "timeout_data" as definitely lost.
Fix this issue in timeout_destroy function.

7 years agomonitor: Add decoding of SMP CT2 authentication flag
Johan Hedberg [Wed, 7 Dec 2016 20:12:26 +0000 (22:12 +0200)]
monitor: Add decoding of SMP CT2 authentication flag

7 years agogobex: Fix a compilation error for the compatibility with LLVM
Miao-chen Chou [Sat, 3 Dec 2016 02:06:12 +0000 (18:06 -0800)]
gobex: Fix a compilation error for the compatibility with LLVM

The C Standard, subclause 7.16.1.4, paragraph 4 [ISO/IEC 9899:2011], states:
The parameter parmN is the identifier of the rightmost parameter in
the variable parameter list in the function definition (the one just
before the ...). If the parameter parmN is declared with the register
storage class, with a function or array type, or with a type that is
not compatible with the type that results after application of the
default argument promotions, the behavior is undefined.

7 years agoaudio/avrcp: Fix PlayItem response handling
Luiz Augusto von Dentz [Wed, 7 Dec 2016 09:05:06 +0000 (11:05 +0200)]
audio/avrcp: Fix PlayItem response handling

PlayItem is actually a control PDU so it should expect avrcp_header as
header not avrcp_browsing_header.

7 years agoaudio/player: Fix method definition of MediaItem.Play
Luiz Augusto von Dentz [Wed, 7 Dec 2016 08:58:07 +0000 (10:58 +0200)]
audio/player: Fix method definition of MediaItem.Play

The return is no longer synchronous so update it to use
GDBUS_ASYNC_METHOD.

7 years agoshared/gatt-client: Don't clear db in case of errors
Luiz Augusto von Dentz [Thu, 1 Dec 2016 09:21:01 +0000 (11:21 +0200)]
shared/gatt-client: Don't clear db in case of errors

If the db was not empty when initializing the instance set the
discovery last handle to avoid clearing the database in case of
cache validation error.

7 years agoshared/gatt-db: Make gatt_db_clear call gatt_db_clear_range
Luiz Augusto von Dentz [Thu, 1 Dec 2016 08:41:01 +0000 (10:41 +0200)]
shared/gatt-db: Make gatt_db_clear call gatt_db_clear_range

This makes gatt_db_clear much simpler while making gatt_db_clear_range
detect full database clear resetting next_handle properly if the
database is empty.

7 years agoshared/gatt-client: Fix discover_secondary_cb()
Petri Gynther [Thu, 1 Dec 2016 20:16:02 +0000 (12:16 -0800)]
shared/gatt-client: Fix discover_secondary_cb()

If included services discovery cannot be started, the services discovery
operation has failed.

7 years agoshared/gatt-client: Fix discover_primary_cb()
Petri Gynther [Thu, 1 Dec 2016 20:16:01 +0000 (12:16 -0800)]
shared/gatt-client: Fix discover_primary_cb()

Fix the handling of primary services discovery failure.

7 years agogap: scanparam: Use bt_gatt_client_clone
Luiz Augusto von Dentz [Mon, 28 Nov 2016 13:20:56 +0000 (15:20 +0200)]
gap: scanparam: Use bt_gatt_client_clone

Use bt_gatt_client_clone instead of bt_gatt_client_ref as that can
track requests per clone instead of using the core reference.

7 years agoshared/mainloop: Fix msec to nsec conversion in timerfd config
Loic Poulain [Sun, 27 Nov 2016 18:51:36 +0000 (19:51 +0100)]
shared/mainloop: Fix msec to nsec conversion in timerfd config

7 years agobuild: Fix building with bootstrap-configure
Luiz Augusto von Dentz [Mon, 21 Nov 2016 09:49:31 +0000 (11:49 +0200)]
build: Fix building with bootstrap-configure

This fixes errors caused by the new options:
configure: WARNING: unrecognized options: --enable-nfc, --enable-sap, --enable-health

7 years agocore/advertising: Simplify names
Luiz Augusto von Dentz [Fri, 18 Nov 2016 11:44:25 +0000 (13:44 +0200)]
core/advertising: Simplify names

This simplifies names so terms like advertisement/advertising are
reduced to adv, also use client term to refer to registered D-Bus
clients to make the code more readable.

7 years agocore/advertising: Fix crash when passing invalid dictionary
Luiz Augusto von Dentz [Thu, 17 Nov 2016 13:59:42 +0000 (15:59 +0200)]
core/advertising: Fix crash when passing invalid dictionary

We expect dict entries to have a{sv} format but the code don't check if
the entries really encode the variant which may lead to a crash in
dbus_message_iter_recurse.

7 years agobuild: Update bootstrap-configure with new build options
Luiz Augusto von Dentz [Fri, 11 Nov 2016 15:17:19 +0000 (17:17 +0200)]
build: Update bootstrap-configure with new build options

7 years agobuild: Update experimental documentation
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:28:34 +0000 (16:28 +0200)]
build: Update experimental documentation

Reflect the build changes to only leave experimental tools being
--enable-experimental.

7 years agobuild: Add option to enable health profiles
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:10:10 +0000 (16:10 +0200)]
build: Add option to enable health profiles

This adds--enable-health option dedicated to enabled health plugin
so it is no longer enabled with --enable-experimental since that
enables other plugins that might not be relevant for the system.

7 years agobuild: Add option to disable HoG profile
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:05:40 +0000 (16:05 +0200)]
build: Add option to disable HoG profile

This adds --disable-hog option to configure which make HoG plugin
to not be build thus reducing the build time and binary size of
bluetoothd in systems where HID over GATT profile is not supported.

7 years agobuild: Add option to disable HID profile
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:02:06 +0000 (16:02 +0200)]
build: Add option to disable HID profile

This adds --disable-hid option to configure which make input plugin
to not be build thus reducing the build time and binary size of
bluetoothd in systems where HID profile is not supported.

7 years agobuild: Add option to disable network profiles
Luiz Augusto von Dentz [Fri, 11 Nov 2016 13:52:55 +0000 (15:52 +0200)]
build: Add option to disable network profiles

This adds --disable-network option to configure which make network plugin
to not be build thus reducing the build time and binary size of
bluetoothd in systems where those profiles are not supported.

7 years agobuild: Add option to disable AVRCP profile
Luiz Augusto von Dentz [Fri, 11 Nov 2016 13:47:25 +0000 (15:47 +0200)]
build: Add option to disable AVRCP profile

This adds --disable-avrcp option to configure which make AVRCP plugin
to not be build thus reducing the build time and binary size of
bluetoothd in systems where AVRCP is not supported.

7 years agobuild: Add option to disable A2DP profile
Luiz Augusto von Dentz [Fri, 11 Nov 2016 13:40:54 +0000 (15:40 +0200)]
build: Add option to disable A2DP profile

This adds --disable-a2dp option to configure which make A2DP plugin
to not be build thus reducing the build time and binary size of
bluetoothd in systems where A2DP is not supported.

7 years agobuild: Add option to enable SAP profile
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:25:39 +0000 (16:25 +0200)]
build: Add option to enable SAP profile

This adds --enable-sap option dedicated to enabled sap plugin
so it is no longer enabled with --enable-experimental leaving it to just
enable experimental tools.

7 years agobuild: Add option to enable NFC pairing
Luiz Augusto von Dentz [Fri, 11 Nov 2016 14:17:18 +0000 (16:17 +0200)]
build: Add option to enable NFC pairing

This adds --enable-nfc option dedicated to enabled neard plugin
so it is no longer enabled with --enable-experimental since that
enables other plugins that might not be relevant for the system.

7 years agocore/advertising: Fix not clearing instance id properly
Luiz Augusto von Dentz [Wed, 16 Nov 2016 14:52:06 +0000 (16:52 +0200)]
core/advertising: Fix not clearing instance id properly

The instance id needs to be cleared in case of an error during
registration otherwise it cannot be reused anymore.

7 years agotools: Add option to not set flow control for btattach
Marcel Holtmann [Tue, 15 Nov 2016 17:54:02 +0000 (18:54 +0100)]
tools: Add option to not set flow control for btattach

7 years agocore/adapter: Fix using wrong address type to listen ATT
Luiz Augusto von Dentz [Mon, 14 Nov 2016 11:30:09 +0000 (13:30 +0200)]
core/adapter: Fix using wrong address type to listen ATT

bdaddr_type shall only matter for controllers supporting LE otherwise
it may cause BDADDR_BREDR to be used for things like LE ATT socket
listen breaking reconnections.

7 years agocore: Fix passing correct local address type to ATT socket
Johan Hedberg [Fri, 11 Nov 2016 12:04:18 +0000 (14:04 +0200)]
core: Fix passing correct local address type to ATT socket

7 years agoaudio/player: Report PlayItem errors
Luiz Augusto von Dentz [Mon, 7 Nov 2016 12:49:38 +0000 (14:49 +0200)]
audio/player: Report PlayItem errors

Wait for the response of PlayItem and forward and in case of not being
successful reply with an error.

7 years agobuild: Remove gatt-example plugin
Luiz Augusto von Dentz [Tue, 8 Nov 2016 09:00:28 +0000 (11:00 +0200)]
build: Remove gatt-example plugin

This examples can be done over D-Bus already so it makes no sense to have
it as a plugin and in fact it currently it doesn't even work since it was
never ported to the new code under src/shared.

7 years agocore/gatt: Don't register attribute handler until core service are registered
Luiz Augusto von Dentz [Tue, 8 Nov 2016 08:38:43 +0000 (10:38 +0200)]
core/gatt: Don't register attribute handler until core service are registered

Wait until GAP and GATT service are registered to register attribute
handlers otherwise it may attempt to generate service changed without
having service changed registered which leads to print errors:

bluetoothd[2376]: Failed to obtain handles for "Service Changed" characteristic

7 years agoinput/hog: Remove unused attioid from hog_device
Petri Gynther [Thu, 3 Nov 2016 20:03:53 +0000 (13:03 -0700)]
input/hog: Remove unused attioid from hog_device

7 years agotools/mgmt-tester: Fix device found tests
Szymon Janc [Tue, 1 Nov 2016 19:58:15 +0000 (20:58 +0100)]
tools/mgmt-tester: Fix device found tests

Make sure discovery is enabled before enabling advertising.

7 years agotools/mgmt-tester: Fix use of uninitialized memory
Szymon Janc [Tue, 1 Nov 2016 14:47:01 +0000 (15:47 +0100)]
tools/mgmt-tester: Fix use of uninitialized memory

unmet_setup_conditions in test_data was not properly initialized by
test_* macros. To avoid this issue in future use new0 for test_data
allocation and explicitly initialize variables with non-zero values
only.

7 years agoadapter: Add support for using static random identity address
Johan Hedberg [Sun, 30 Oct 2016 18:58:31 +0000 (20:58 +0200)]
adapter: Add support for using static random identity address

Add support for single-mode adapters without a public address, by
generating and storing a static random address for them.

7 years agoshared/crypto: Use void * instead of uint8_t * for random data
Johan Hedberg [Sun, 30 Oct 2016 16:56:54 +0000 (18:56 +0200)]
shared/crypto: Use void * instead of uint8_t * for random data

Make the API friendlier by letting the caller pass arbitrary pointer.

7 years agodoc: Add definition of a new addresses file
Johan Hedberg [Sun, 30 Oct 2016 15:40:20 +0000 (17:40 +0200)]
doc: Add definition of a new addresses file

Currently bluetoothd doesn't support single-mode adapters without a
public address. This patch defines a new 'addresses' file that will be
used for managing generated static random addresses.

7 years agoRelease 5.43
Marcel Holtmann [Fri, 28 Oct 2016 12:55:25 +0000 (14:55 +0200)]
Release 5.43

7 years agodoc: Update test coverage
Szymon Janc [Tue, 25 Oct 2016 19:53:25 +0000 (21:53 +0200)]
doc: Update test coverage