OSDN Git Service

android-x86/external-bluetooth-bluez.git
6 years agoAdd RTL8723BS Bluetooth tool nougat-x86 oreo-x86 android-x86-7.1-r1 android-x86-7.1-r2 android-x86-7.1-r3 android-x86-7.1-r4 android-x86-7.1-r5 android-x86-8.1-r1 android-x86-8.1-r2 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6
Chih-Wei Huang [Wed, 7 Jun 2017 01:52:44 +0000 (09:52 +0800)]
Add RTL8723BS Bluetooth tool

Copy and modify from https://github.com/lwfinger/rtl8723bs_bt.

6 years agoandroid: btattach: get options from properties
Chih-Wei Huang [Wed, 12 Oct 2016 10:10:09 +0000 (18:10 +0800)]
android: btattach: get options from properties

Since Android 7.0 the services can't accept arguments from cmdline.
To workaround it, let btattach get options from android properties.

6 years agoandroid: disable BlueZ stack
Chih-Wei Huang [Thu, 6 Oct 2016 14:30:08 +0000 (22:30 +0800)]
android: disable BlueZ stack

The BlueZ stack was broken in Android 7.0. Unfortunately the
main BlueZ developers have no time to fix it.

Let's switch back to AOSP's Fluoride Bluetooth stack.
However, we still need some BlueZ tools like btattach.

6 years agoandroid: cm: update interfaces for CM 13.0 (6.0.1 r52)
Jaap Jan Meijer [Thu, 28 Jul 2016 22:31:54 +0000 (00:31 +0200)]
android: cm: update interfaces for CM 13.0 (6.0.1 r52)

6 years agoandroid: fix building errors on android-6.0.1_r52
Chih-Wei Huang [Fri, 8 Jul 2016 14:26:23 +0000 (22:26 +0800)]
android: fix building errors on android-6.0.1_r52

Fix all Android Bluetooth APIs mismatching.

Treat all warnings as errors to avoid overlooking such issues
in the future.

6 years agoAndroid: Add interfaces for CM 13.0
Jaap Jan Meijer [Wed, 11 May 2016 17:50:56 +0000 (19:50 +0200)]
Android: Add interfaces for CM 13.0

Signed-off-by: Jaap Jan Meijer <jjmeijer88@gmail.com>
6 years agoAndroid: Add CM_ANDROID_VERSION macro
Jaap Jan Meijer [Wed, 11 May 2016 18:44:04 +0000 (20:44 +0200)]
Android: Add CM_ANDROID_VERSION macro

Signed-off-by: Jaap Jan Meijer <jjmeijer88@gmail.com>
6 years agoandroid: add dummy implementation for new functions
Chih-Wei Huang [Tue, 10 May 2016 17:28:58 +0000 (01:28 +0800)]
android: add dummy implementation for new functions

Some new functions were added since android-6.0.1_r31.
Add dummy implementation to avoid crashing the Bluetooth service.

6 years agoandroid: add btattach (the successor to hciattach)
Jaap Jan Meijer [Mon, 18 Jan 2016 22:33:28 +0000 (23:33 +0100)]
android: add btattach (the successor to hciattach)

6 years agoandroid: Update device class info
André Vitor [Fri, 15 Jan 2016 22:28:50 +0000 (19:28 -0300)]
android: Update device class info

Android-x86 devices are not phone.

6 years agoUpdate signal socket structure to match Android 6.0
Andre Vitor [Sat, 9 Jan 2016 04:27:09 +0000 (01:27 -0300)]
Update signal socket structure to match Android 6.0

Android 6.0 introduced l2cap sockets to the bluetooth framework.
One of the changes modified the signal socket structure by
adding two unsigned short for l2cap use only.

6 years agoandroid: fix building errors on Android 6.0
Chih-Wei Huang [Thu, 10 Dec 2015 07:40:59 +0000 (15:40 +0800)]
android: fix building errors on Android 6.0

Change libhal to match the new HAL headers.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
6 years agoandroid: fix building errors of the 64-bit targets
Chih-Wei Huang [Wed, 9 Dec 2015 10:08:39 +0000 (18:08 +0800)]
android: fix building errors of the 64-bit targets

Some functions prototypes are not declared implicitly for
the Android 6.0 64-bit targets that result in the errors:

  external/bluetooth/bluez/android/hal-ipc.c: In function 'notification_handler':
  external/bluetooth/bluez/android/hal-ipc.c:143:3: error: implicit declaration of function 'memset' [-Werror=implicit-function-declaration]
     memset(&msg, 0, sizeof(msg));
     ^
  external/bluetooth/bluez/android/log.c: In function 'init_logd':
  external/bluetooth/bluez/android/log.c:175:2: error: implicit declaration of function 'memset' [-Werror=implicit-function-declaration]
    memset(&addr, 0, sizeof(addr));
    ^

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
6 years agoandroid: remove bluetooth-headers
Chih-Wei Huang [Wed, 2 Dec 2015 15:03:45 +0000 (23:03 +0800)]
android: remove bluetooth-headers

The Android build system discourages from copying headers.
Besides, it's incorrect to do actions in the make shell function.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
6 years agoshared/utils: add the missing header <strings.h>
Chih-Wei Huang [Wed, 2 Dec 2015 07:21:26 +0000 (15:21 +0800)]
shared/utils: add the missing header <strings.h>

It defines the prototype of ffs() that fixes the building errors
of an Android 6.0 64-bit target.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
6 years agoandroid: tools: add brcm_patchram_plus
Chih-Wei Huang [Mon, 6 Jul 2015 17:28:24 +0000 (01:28 +0800)]
android: tools: add brcm_patchram_plus

6 years agoRelease 5.45
Marcel Holtmann [Thu, 4 May 2017 21:05:21 +0000 (23:05 +0200)]
Release 5.45

6 years agocore/gatt-client: Add support for Includes property
Marcin Kraglak [Wed, 26 Apr 2017 12:32:13 +0000 (14:32 +0200)]
core/gatt-client: Add support for Includes property

Add implementation of Includes property in GATT service interface.
Include services are updated after exporting all services, when new service
has been added or service was removed.

6 years agounit/test-gatt: Add test for unknown request
Luiz Augusto von Dentz [Mon, 1 May 2017 15:40:59 +0000 (18:40 +0300)]
unit/test-gatt: Add test for unknown request

This send an unknown command (0xff) to test that no response is sent
since the spec mandates the server to not respond to commands:

BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part F page 2179

  'If a server receives a command that it does not support, indicated
  by the Command Flag of the PDU set to one, then the server shall
  ignore the Command.'

6 years agounit/test-gatt: Add test for unknown request
Luiz Augusto von Dentz [Mon, 1 May 2017 15:00:31 +0000 (18:00 +0300)]
unit/test-gatt: Add test for unknown request

This send an unknown request (0xbf) to test if a response is sent since
the spec mandates the server to always respond to all requests it
receives:

BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part F page 2173

  'A client may send attribute protocol requests to a server, and the
  server shall respond to all requests that it receives.'

6 years agoshared/att: Respond to any opcode that is not command
Luiz Augusto von Dentz [Fri, 28 Apr 2017 18:20:51 +0000 (21:20 +0300)]
shared/att: Respond to any opcode that is not command

Although get_op_type does now check for the command mask it must
respond to anything other than ATT_OP_TYPE_CMD since there is no mask
for response opcode.

6 years agoemulator: Improved handling of Set Default PHY command
Marcel Holtmann [Tue, 2 May 2017 09:06:31 +0000 (02:06 -0700)]
emulator: Improved handling of Set Default PHY command

6 years agomonitor: Change decoding for channel selection algorithm event
Marcel Holtmann [Tue, 2 May 2017 07:45:54 +0000 (00:45 -0700)]
monitor: Change decoding for channel selection algorithm event

6 years agoemulator: Enable LE power class and minimum channels feature
Marcel Holtmann [Tue, 2 May 2017 06:43:18 +0000 (23:43 -0700)]
emulator: Enable LE power class and minimum channels feature

6 years agoemulator: Fix comments for event mask descriptions
Marcel Holtmann [Tue, 2 May 2017 06:04:59 +0000 (23:04 -0700)]
emulator: Fix comments for event mask descriptions

6 years agomonitor: Fix handling of Set Default PHY command complete event
Marcel Holtmann [Tue, 2 May 2017 05:53:27 +0000 (22:53 -0700)]
monitor: Fix handling of Set Default PHY command complete event

6 years agoemulator: Add basic PHY command handling to LE only controller
Marcel Holtmann [Tue, 2 May 2017 05:26:17 +0000 (22:26 -0700)]
emulator: Add basic PHY command handling to LE only controller

6 years agomonitor: Fix parameter indentation for PHY commands
Marcel Holtmann [Tue, 2 May 2017 05:19:28 +0000 (22:19 -0700)]
monitor: Fix parameter indentation for PHY commands

6 years agoemulator: Add Bluetooth 5.0 defines to LE only controller
Marcel Holtmann [Tue, 2 May 2017 04:23:56 +0000 (21:23 -0700)]
emulator: Add Bluetooth 5.0 defines to LE only controller

6 years agosmp-tester: Add CT2 to expected valid SMP PDU
Johan Hedberg [Sat, 29 Apr 2017 11:16:32 +0000 (14:16 +0300)]
smp-tester: Add CT2 to expected valid SMP PDU

6 years agoRevert "build: Make btmgmt tools installable"
Luiz Augusto von Dentz [Fri, 28 Apr 2017 06:43:21 +0000 (09:43 +0300)]
Revert "build: Make btmgmt tools installable"

Don't install btmgmt as there are plans for other tools to cover the
likes of hciconfig, etc.

6 years agoshared/att: Fix responding to unknown command opcode
Luiz Augusto von Dentz [Wed, 26 Apr 2017 14:16:04 +0000 (17:16 +0300)]
shared/att: Fix responding to unknown command opcode

In case of receiving an unknown command no response shall be generated.

6 years agomonitor: Add option -A/--a2dp to dump A2DP stream data
Luiz Augusto von Dentz [Tue, 25 Apr 2017 11:56:34 +0000 (14:56 +0300)]
monitor: Add option -A/--a2dp to dump A2DP stream data

This is similar to SCO which disable audio dumping by default so only
signalling data is shown:

< ACL Data TX: Handle 256 flags 0x02 dlen 850      #6041 11:32:29.299212
      Channel: 451 len 846 [PSM 25 mode 0] {chan 2}

6 years agoclient: Always start an agent
Luiz Augusto von Dentz [Thu, 20 Apr 2017 12:29:30 +0000 (15:29 +0300)]
client: Always start an agent

Always register agent with default capability.

6 years agomonitor: Fix not decoding control frames
Luiz Augusto von Dentz [Thu, 20 Apr 2017 12:01:45 +0000 (15:01 +0300)]
monitor: Fix not decoding control frames

In order to enable decoding control frames packet_monitor needs to check
if the index is set to HCI_DEV_NONE since that will call packet_ctrl_open
which setups the ctrl and assign it a cookie.

6 years agomonitor: Add frame counter support
Luiz Augusto von Dentz [Wed, 19 Apr 2017 18:32:42 +0000 (21:32 +0300)]
monitor: Add frame counter support

This adds frame counter support for io frames:

> HCI Event: Command Complete (0x0e) plen 4          #86 [hci1] 13:00:02.639412
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2  #87 [hci1] 13:00:02.639663
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4             #88 [hci1] 13:00:02.640420
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

6 years agoobexd/pbap: Fix hanging when maxlistcount = 0
Luiz Augusto von Dentz [Fri, 21 Apr 2017 17:24:58 +0000 (20:24 +0300)]
obexd/pbap: Fix hanging when maxlistcount = 0

vobject_list_get_next_header shall only attempt to call
g_obex_apparam_encode otherwise it will just keep adding the same tag
in a loop.

6 years agogobex: Make g_obex_apparam_encode NULL safe
Luiz Augusto von Dentz [Fri, 21 Apr 2017 15:58:39 +0000 (18:58 +0300)]
gobex: Make g_obex_apparam_encode NULL safe

Make g_obex_apparam_encode ignore if the apparam pointer is NULL.

7 years agomonitor: Add LE PHY update complete event decoding
Łukasz Rymanowski [Wed, 12 Apr 2017 12:41:27 +0000 (14:41 +0200)]
monitor: Add LE PHY update complete event decoding

7 years agomonitor: Add LE Set PHY decoding
Łukasz Rymanowski [Wed, 12 Apr 2017 12:41:26 +0000 (14:41 +0200)]
monitor: Add LE Set PHY decoding

< HCI Command: LE Set PHY (0x08|0x0032) plen 7
        Handle: 1
        All PHYs preference: 0x00
        TX PHYs preference: 0x07
          LE 1M
          LE 2M
          LE Coded
        RX PHYs preference: 0x07
          LE 1M
          LE 2M
          LE Coded
        PHY options preference: S8 coding (0x0002)

7 years agomonitor: Add LE Set default PHY decoding
Łukasz Rymanowski [Wed, 12 Apr 2017 12:41:25 +0000 (14:41 +0200)]
monitor: Add LE Set default PHY decoding

< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3
        All PHYs preference: 0x00
        TX PHYs preference: 0x07
          LE 1M
          LE 2M
          LE Coded
        RX PHYs preference: 0x0e
          LE 2M
          LE Coded
          Reserved (0x08)

< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3
        All PHYs preference: 0x03
          No TX PHY preference
          No RX PHY preference
        TX PHYs preference: 0x00
        RX PHYs preference: 0x00

7 years agomonitor: Add LE Read PHY decoding
Łukasz Rymanowski [Wed, 12 Apr 2017 12:41:24 +0000 (14:41 +0200)]
monitor: Add LE Read PHY decoding

7 years agomonitor: Add description for filter in scan parameters
Łukasz Rymanowski [Wed, 12 Apr 2017 12:41:23 +0000 (14:41 +0200)]
monitor: Add description for filter in scan parameters

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
        Type: Active (0x01)
        Interval: 30.000 msec (0x0030)
        Window: 30.000 msec (0x0030)
        Own address type: Public (0x00)
        Filter policy: Accept all advertisement, inc. directed unresolved RPA (0x02)

7 years agotools/obexctl: Fix not being able to PullAll
Luiz Augusto von Dentz [Wed, 19 Apr 2017 13:18:08 +0000 (16:18 +0300)]
tools/obexctl: Fix not being able to PullAll

The change to use wordexp breaks PullAll since '*' seems to be expanded
to something else, the manpage in fact mention the $* is expansion is
undefined:

[40:88:05:14:3A:7A]# cp * /tmp/all.vcf
Attempting to Pull
[NEW] Transfer /org/bluez/obex/client/session7/transfer29
Pull successful
[CHG] Transfer /org/bluez/obex/client/session7/transfer29 Status: error
[DEL] Transfer /org/bluez/obex/client/session7/transfer29
[40:88:05:14:3A:7A]# cp *.vcf /tmp/all.vcf
Attempting to PullAll
[NEW] Transfer /org/bluez/obex/client/session7/transfer30
PullAll successful
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Status: active
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Transferred: 4085 (@4KB/s)
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Transferred: 8170 (@4KB/s)
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Transferred: 12255 (@4KB/s)
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Transferred: 20425 (@8KB/s)
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Transferred: 24510 (@4KB/s)
[CHG] Transfer /org/bluez/obex/client/session7/transfer30 Status: complete
[DEL] Transfer /org/bluez/obex/client/session7/transfer30

7 years agoaudio/avdtp: Increase timeout for Suspend request
Luiz Augusto von Dentz [Wed, 12 Apr 2017 12:06:02 +0000 (15:06 +0300)]
audio/avdtp: Increase timeout for Suspend request

There have been reports that some device may delay the Suspend response
when switching to HFP/SCO.

7 years agomonitor: Add support for decoding LE Channel Selection Algorithm Event
Szymon Janc [Thu, 6 Apr 2017 13:41:35 +0000 (15:41 +0200)]
monitor: Add support for decoding LE Channel Selection Algorithm Event

> HCI Event: LE Meta Event (0x3e) plen 4                     44.589780
      LE Channel Selection Algorithm (0x14)
        Handle: 1
        LE Channel Selection Algorithm #2 (0x01)

7 years agocore: replace sizeof(filename) with PATH_MAX
Konrad Zapałowicz [Fri, 31 Mar 2017 14:44:34 +0000 (16:44 +0200)]
core: replace sizeof(filename) with PATH_MAX

This commit replaces sizeof(filename) with PATH_MAX to match the common
scheme which is used in other places.

7 years agobuild: Make btmgmt tools installable
Luiz Augusto von Dentz [Fri, 31 Mar 2017 13:56:15 +0000 (16:56 +0300)]
build: Make btmgmt tools installable

7 years agotools: Add hw_variant for Intel Bluetooth 9160/9260
Tedd Ho-Jeong An [Mon, 6 Mar 2017 23:38:37 +0000 (15:38 -0800)]
tools: Add hw_variant for Intel Bluetooth 9160/9260

This patch adds hw_variant for Intel Bluetooth 9160/9260 also
known as ThunderPeak(ThP).

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.