OSDN Git Service

android-x86/external-bluetooth-bluez.git
7 years agoandroid: fix a build break android-x86-6.0-r1 android-x86-6.0-r2
Chih-Wei Huang [Sat, 6 Aug 2016 10:23:23 +0000 (18:23 +0800)]
android: fix a build break

It's seems a typo introduced by the previous commit 10342fe.

Also fixes incorrect indents.

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

7 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.

7 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>
7 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>
7 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.

7 years agoAdd btattach (the successor to hciattach)
meijjaa [Mon, 18 Jan 2016 22:33:28 +0000 (23:33 +0100)]
Add btattach (the successor to hciattach)

7 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.

7 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.

7 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>
7 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>
7 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>
7 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>
7 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

7 years agotest/simple-endpoint: Fix ClearConfiguration signature
Luiz Augusto von Dentz [Mon, 30 May 2016 09:55:55 +0000 (12:55 +0300)]
test/simple-endpoint: Fix ClearConfiguration signature

7 years agoRelease 5.40
Marcel Holtmann [Thu, 26 May 2016 16:49:03 +0000 (18:49 +0200)]
Release 5.40

7 years agobuild: Update library version
Marcel Holtmann [Thu, 26 May 2016 16:40:34 +0000 (18:40 +0200)]
build: Update library version

7 years agolib: Update company identifiers
Marcel Holtmann [Thu, 26 May 2016 16:37:49 +0000 (18:37 +0200)]
lib: Update company identifiers

7 years agoaudio/avrcp: Fix not handling Addressed Player Changed error
Luiz Augusto von Dentz [Fri, 31 Jul 2015 17:08:16 +0000 (20:08 +0300)]
audio/avrcp: Fix not handling Addressed Player Changed error

Some notification are completed in case the addressed player changes:

  'On completion of the Addressed Player Changed notification the TG
  shall complete all player specific notifications with AV/C C-Type
  REJECTED with error code Addressed Player Changed.'

Because reject only has the error code not the event it is necessary to
lookup by transaction to find out which event was completed thus the
transaction needs to be added to the avctp_rsp_cb callback.

7 years agomonitor: Split public key into multiple lines
Johan Hedberg [Wed, 25 May 2016 13:14:07 +0000 (16:14 +0300)]
monitor: Split public key into multiple lines

Printing the entire public key value on a single line requires some
160 characters which ends up wrapping on most terminals. Instead,
print the X and Y components separately, which is also consistent with
how SMP is decoded.

7 years agodoc: btsnoop: Document the various BTSnoop opcodes
Johan Hedberg [Mon, 23 May 2016 07:10:22 +0000 (10:10 +0300)]
doc: btsnoop: Document the various BTSnoop opcodes

7 years agodoc: btsnoop: Clarify drop counts.
Johan Hedberg [Wed, 25 May 2016 07:16:54 +0000 (10:16 +0300)]
doc: btsnoop: Clarify drop counts.

7 years agoprofile: Fix accepting connections without an associated service
Johan Hedberg [Tue, 24 May 2016 11:09:34 +0000 (14:09 +0300)]
profile: Fix accepting connections without an associated service

This fixes the flawed logic from the following commit:

commit b669604f43bbbf04ebaa66dd14ad9cfb005e561b
Author: Hsin-Yu Chao <hychao@chromium.org>
Date:   Fri Apr 24 10:36:09 2015 -0700

    src/profile: Set service to connecting in ext_connect

7 years agodoc: Add BTSnoop/Monitor protocol documentation
Johan Hedberg [Mon, 23 May 2016 07:09:57 +0000 (10:09 +0300)]
doc: Add BTSnoop/Monitor protocol documentation

7 years agoshared/gatt-client: Fix sending confirmation
Mikhail I. Krivtsov [Sat, 14 May 2016 08:37:30 +0000 (11:37 +0300)]
shared/gatt-client: Fix sending confirmation

Confirmation shall be sent from topmost parent only.
Extra confirmation sent by clone confuses remote side.

> ACL Data RX: Handle 69 flags 0x02 dlen 27
      ATT: Handle Value Indication (0x1d) len 22
        Handle: 0x001f
          Data: 68656c6c6f2027302e302e302e303a3532353332
< ACL Data TX: Handle 69 flags 0x00 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0
< ACL Data TX: Handle 69 flags 0x00 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0

7 years agotools/gatt-service: Update to use new GATT API
Luiz Augusto von Dentz [Mon, 9 May 2016 11:55:12 +0000 (14:55 +0300)]
tools/gatt-service: Update to use new GATT API

This update use of ReadValue and WriteValue to include the options
introduced in the API.

7 years agoclient: Update to use new GATT API
Luiz Augusto von Dentz [Sun, 8 May 2016 14:24:14 +0000 (17:24 +0300)]
client: Update to use new GATT API

This update use of ReadValue and WriteValue to include the options
introduced in the API.

7 years agotest: Update GATT examples with the new API
Luiz Augusto von Dentz [Fri, 6 May 2016 08:36:28 +0000 (11:36 +0300)]
test: Update GATT examples with the new API

7 years agodoc/gatt-api: Add secure flags
Luiz Augusto von Dentz [Fri, 29 Apr 2016 10:16:56 +0000 (13:16 +0300)]
doc/gatt-api: Add secure flags

This add secure-{read,write} which shall be used by servers that want
to restrict attribute access to secure connection only (BT_SECURITY_FIPS)

7 years agodoc/gatt-api: Merge RegisterProfile with RegisterApplication
Luiz Augusto von Dentz [Tue, 26 Apr 2016 10:45:07 +0000 (13:45 +0300)]
doc/gatt-api: Merge RegisterProfile with RegisterApplication

Since RegisterApplication makes use of ObjectManager it is also possible
to verify the existance of GattProfile objects unifying the API for both
services (GATT server) and profiles (GATT client).

7 years agodoc/gatt-api: Add options dictionary to ReadValue/WriteValue
Luiz Augusto von Dentz [Tue, 26 Apr 2016 10:41:02 +0000 (13:41 +0300)]
doc/gatt-api: Add options dictionary to ReadValue/WriteValue

This adds the possibility to pass an offset to these operations, and
also in the server case to give the device object.

7 years agolib: Update company identifiers
Marcel Holtmann [Tue, 17 May 2016 16:49:12 +0000 (18:49 +0200)]
lib: Update company identifiers

7 years agotools: add more entities to company ID parser
Mike Ryan [Wed, 6 Apr 2016 18:40:44 +0000 (11:40 -0700)]
tools: add more entities to company ID parser

This patch adds lower and uppercase u with umlaut.

7 years agodevice: Fix invalid memory access when removing a device
Vinicius Costa Gomes [Fri, 6 May 2016 20:16:54 +0000 (17:16 -0300)]
device: Fix invalid memory access when removing a device

The current code uses disconnect_all() outside the disconnection timer
callback but doesn't remove the timer from the list of timeout sources,
making it possible (but tricky) to get into the situation that the
disconnect_all() callback gets called with a device that was already
removed/blocked.

Valgrind log:

bluetoothd[5207]: src/device.c:device_remove() Removing device /org/bluez/hci0/dev_00_1A_7D_DA_71_07
bluetoothd[5207]: src/service.c:change_state() 0x84f0d70: device 00:1A:7D:DA:71:07 profile gap-profile state changed: connecting -> disconnected (-103)
bluetoothd[5207]: src/device.c:device_profile_connected() gap-profile Software caused connection abort (103)
bluetoothd[5207]: src/service.c:change_state() 0x84f0d70: device 00:1A:7D:DA:71:07 profile gap-profile state changed: disconnected -> unavailable (0)
bluetoothd[5207]: profiles/gap/gas.c:gap_driver_remove() GAP profile remove (00:1A:7D:DA:71:07)
bluetoothd[5207]: src/service.c:btd_service_unref() 0x84f0d70: ref=0
bluetoothd[5207]: src/device.c:btd_device_unref() Freeing device /org/bluez/hci0/dev_00_1A_7D_DA_71_07
bluetoothd[5207]: src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_00_1A_7D_DA_71_07/service0006
bluetoothd[5207]: src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_00_1A_7D_DA_71_07/service0006/char0007
bluetoothd[5207]: src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_00_1A_7D_DA_71_07/service0006/char0007/desc0009
bluetoothd[5207]: src/device.c:device_free() 0x8446200
bluetoothd[5207]: src/adapter.c:dev_disconnected() Device 00:1A:7D:DA:71:07 disconnected, reason 2
bluetoothd[5207]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 00:1A:7D:DA:71:07 type 1 status 0xe
bluetoothd[5207]: src/adapter.c:resume_discovery()
bluetoothd[5207]: src/adapter.c:trigger_start_discovery()
bluetoothd[5207]: src/adapter.c:cancel_passive_scanning()
==5207== Invalid read of size 1
==5207==    at 0x49E87C: disconnect_all (device.c:1218)
==5207==    by 0x50C5FA2: g_timeout_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x50C5569: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x50C58E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x50C5C01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x40CA68: main (main.c:687)
==5207==  Address 0x8446412 is 530 bytes inside a block of size 616 free'd
==5207==    at 0x4C2AEA0: free (vg_replace_malloc.c:530)
==5207==    by 0x4A2EA5: device_free (device.c:670)
==5207==    by 0x4C7439: remove_interface (object.c:667)
==5207==    by 0x4C8051: g_dbus_unregister_interface (object.c:1391)
==5207==    by 0x4AAADC: btd_device_unref (device.c:5998)
==5207==    by 0x4AAC85: device_remove (device.c:3951)
==5207==    by 0x48F541: btd_adapter_remove_device (adapter.c:1180)
==5207==    by 0x49136A: connect_failed_callback (adapter.c:7707)
==5207==    by 0x4CE139: notify_handler (mgmt.c:292)
==5207==    by 0x4CD723: queue_foreach (queue.c:220)
==5207==    by 0x4CF568: process_notify (mgmt.c:304)
==5207==    by 0x4CF568: can_read_data (mgmt.c:370)
==5207==    by 0x4E01EA: watch_callback (io-glib.c:170)
==5207==  Block was alloc'd at
==5207==    at 0x4C2BD20: calloc (vg_replace_malloc.c:711)
==5207==    by 0x4A2F7C: device_new (device.c:3535)
==5207==    by 0x4A4F14: device_create (device.c:3623)
==5207==    by 0x484A08: adapter_create_device (adapter.c:1115)
==5207==    by 0x48EBE2: update_found_devices (adapter.c:5473)
==5207==    by 0x48EBE2: device_found_callback (adapter.c:5647)
==5207==    by 0x4CE139: notify_handler (mgmt.c:292)
==5207==    by 0x4CD723: queue_foreach (queue.c:220)
==5207==    by 0x4CF568: process_notify (mgmt.c:304)
==5207==    by 0x4CF568: can_read_data (mgmt.c:370)
==5207==    by 0x4E01EA: watch_callback (io-glib.c:170)
==5207==    by 0x50C5569: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x50C58E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==    by 0x50C5C01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4800.0)
==5207==

8 years agotools/bluemoon: Add hardware variant for Intel Bluetooth 8265
Tedd Ho-Jeong An [Fri, 6 May 2016 18:53:51 +0000 (11:53 -0700)]
tools/bluemoon: Add hardware variant for Intel Bluetooth 8265

This patch adds support for HW variant for Intel Bluetooth 8265
also known as Windstorm Peak (WsP).

8 years agogdbus: Fix the ordering of signals
Vinicius Costa Gomes [Tue, 3 May 2016 17:56:27 +0000 (14:56 -0300)]
gdbus: Fix the ordering of signals

Consider the following example:

/foo
  properties: "A", "B"

/bar
  properties: "C", "D"

If during a given mainloop iteration, property "A" of object '/foo' is
changed, then properties "C" and "D" of '/bar', lastly "B" of '/foo',
the current code will emit the PropertiesChanged signals in following
order: "A", "B", "C", "D".

This may confuse applications that have a dependency on the order of
those signals.

This fixes the ordering, so in the example, the order becomes:
"C", "D", "A", B". This is considered not to be a problem, as
applications may use the flag G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH, so
property changed signals are emitted as soon as possible.

The solution is for each object, to reschedule the signals every time a
signal is emitted.

8 years agomonitor: Pass drop count from TTY to BTSnoop file
Johan Hedberg [Wed, 4 May 2016 07:37:13 +0000 (10:37 +0300)]
monitor: Pass drop count from TTY to BTSnoop file

8 years agoshared/btsnoop: Add support for providing cumulative drops count
Johan Hedberg [Wed, 4 May 2016 07:37:01 +0000 (10:37 +0300)]
shared/btsnoop: Add support for providing cumulative drops count

8 years agomonitor: Add support for writing to BTSnoop file from TTY input
Johan Hedberg [Tue, 3 May 2016 20:15:33 +0000 (23:15 +0300)]
monitor: Add support for writing to BTSnoop file from TTY input

8 years agomonitor: Introduce support for extended TTY header
Johan Hedberg [Tue, 3 May 2016 06:11:04 +0000 (09:11 +0300)]
monitor: Introduce support for extended TTY header

Add support for packet drops and 32-bit timestamps.

8 years agodoc/settings-storage: Add alternative format for descriptors
Luiz Augusto von Dentz [Fri, 22 Apr 2016 11:30:41 +0000 (14:30 +0300)]
doc/settings-storage: Add alternative format for descriptors

In case of some descriptors like CEP we must store the actual value since
extended properties are not part of the discovery and btd_gatt_client no
longer attempt to read it the value must be loaded in the db so
gatt_db_attribute_get_char_data is able to retrieve it.

8 years agocore/device: Fix not storing GATT attributes
Luiz Augusto von Dentz [Fri, 22 Apr 2016 09:30:35 +0000 (12:30 +0300)]
core/device: Fix not storing GATT attributes

If services has been refreshed the attributes shall be stored so they can
be reloaded properly the next time.

8 years agocore/device: Remove code related to GattServices
Luiz Augusto von Dentz [Fri, 22 Apr 2016 09:24:46 +0000 (12:24 +0300)]
core/device: Remove code related to GattServices

GattService has been removed so there shouldn't be any code related to it

8 years agocore/gatt-client: Don't read extended properties
Luiz Augusto von Dentz [Fri, 22 Apr 2016 08:34:56 +0000 (11:34 +0300)]
core/gatt-client: Don't read extended properties

Extended properties are already read and stored in the database and can be
retrieved with gatt_db_attribute_get_char_data.

8 years agomonitor: Disable monitor socket if a TTY is used
Johan Hedberg [Fri, 29 Apr 2016 09:11:41 +0000 (12:11 +0300)]
monitor: Disable monitor socket if a TTY is used

For now we don't have a way of resolving index conflicts between a TTY
and a monitor socket. Simply disable the monitor socket for now if a
TTY is used.

8 years agoMake use of new tty_get_speed helper
Johan Hedberg [Wed, 27 Apr 2016 18:06:54 +0000 (21:06 +0300)]
Make use of new tty_get_speed helper

8 years agoshared: Add TTY speed helper
Johan Hedberg [Wed, 27 Apr 2016 18:02:22 +0000 (21:02 +0300)]
shared: Add TTY speed helper

8 years agomonitor: Update to new header format of TTY protocol
Johan Hedberg [Wed, 27 Apr 2016 11:03:35 +0000 (14:03 +0300)]
monitor: Update to new header format of TTY protocol

The updated TTY protocol content looks like:

uint16  data_len
uint16  opcode
uint8   flags
uint8   hdr_len
uint8   extra_hdr[hdr_len];
uint8   payload[data_len - 4 - hdr_len]

8 years agomonitor: Permit monitor/mgmt socket errors if a TTY is used
Johan Hedberg [Sat, 23 Apr 2016 13:41:52 +0000 (16:41 +0300)]
monitor: Permit monitor/mgmt socket errors if a TTY is used

One may want to run btmon without special privileges when using it in
TTY mode. Ignore any errors from control_tracing() in such a case.

8 years agomonitor: Add error return value to control_tty()
Johan Hedberg [Wed, 27 Apr 2016 11:16:08 +0000 (14:16 +0300)]
monitor: Add error return value to control_tty()

8 years agomonitor: Add --tty-speed command line switch
Johan Hedberg [Fri, 22 Apr 2016 12:56:09 +0000 (15:56 +0300)]
monitor: Add --tty-speed command line switch

8 years agomonitor: Fix processing left-over data
Johan Hedberg [Wed, 27 Apr 2016 11:02:57 +0000 (14:02 +0300)]
monitor: Fix processing left-over data

If there's enough data in the buffer after processing a packet we
should just continue looping and trying to parse it too.

8 years agomonitor: Fix checking for sufficient data
Johan Hedberg [Wed, 27 Apr 2016 08:25:36 +0000 (11:25 +0300)]
monitor: Fix checking for sufficient data

8 years agoclient: Fix select-attribute behaviour
Francois Beaufort [Tue, 26 Apr 2016 08:30:29 +0000 (10:30 +0200)]
client: Fix select-attribute behaviour

8 years agoRecognize Eddystone Configuration Service UUIDs
Francois Beaufort [Fri, 22 Apr 2016 14:20:04 +0000 (16:20 +0200)]
Recognize Eddystone Configuration Service UUIDs

8 years agolib: Add recently introduced SPI & I2C bus defines
Johan Hedberg [Fri, 22 Apr 2016 16:22:44 +0000 (19:22 +0300)]
lib: Add recently introduced SPI & I2C bus defines

8 years agomonitor: Add --tty switch to help text
Johan Hedberg [Fri, 22 Apr 2016 12:36:14 +0000 (15:36 +0300)]
monitor: Add --tty switch to help text

8 years agoHACKING: Fix nit in instructions
Francois Beaufort [Wed, 20 Apr 2016 09:25:17 +0000 (11:25 +0200)]
HACKING: Fix nit in instructions

8 years agoaudio/avrcp: Fix uninitialized variable
Francois Beaufort [Thu, 21 Apr 2016 08:18:49 +0000 (10:18 +0200)]
audio/avrcp: Fix uninitialized variable

This fixes the following error:

profiles/audio/avrcp.c:2847:6: error: variable 'num_of_items' is used
      uninitialized whenever 'if' condition is true
      [-Werror,-Wsometimes-uninitialized]
        if (pdu->params[0] == AVRCP_STATUS_OUT_OF_BOUNDS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/avrcp.c:2857:40: note: uninitialized use occurs here
        media_player_total_items_complete(mp, num_of_items);
                                              ^~~~~~~~~~~~
profiles/audio/avrcp.c:2847:2: note: remove the 'if' if its condition is always
      false
        if (pdu->params[0] == AVRCP_STATUS_OUT_OF_BOUNDS)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/avrcp.c:2839:23: note: initialize the variable 'num_of_items' to
      silence this warning
        uint32_t num_of_items;
                             ^
                              = 0

8 years agogatt-client: Read extended props on service discovery
Łukasz Rymanowski [Wed, 13 Apr 2016 21:09:57 +0000 (23:09 +0200)]
gatt-client: Read extended props on service discovery

Now once extended props can be taken with characteristic data
we need to makes sure that after discovery correct value is in
database.

With this patch, value of all the extended properties descriptors
are read during discovery just after discover of descriptors

8 years agoshared/gatt-server Check for ext. charact. prop. on reliable session
Łukasz Rymanowski [Wed, 13 Apr 2016 21:09:56 +0000 (23:09 +0200)]
shared/gatt-server Check for ext. charact. prop. on reliable session

With this patch we make sure that reliable session is done on
characteristics which does support it.

8 years agoshared/gatt-db: Extend gatt_db_attribute_get_char_data with ext. prop
Łukasz Rymanowski [Wed, 13 Apr 2016 21:09:55 +0000 (23:09 +0200)]
shared/gatt-db: Extend gatt_db_attribute_get_char_data with ext. prop

This patch adds way to get extended properties from characteristic
extended property descriptor

8 years agotest-gatt: Fix characteristic properties
Łukasz Rymanowski [Wed, 13 Apr 2016 21:09:54 +0000 (23:09 +0200)]
test-gatt: Fix characteristic properties

This patch fixes characteristic property for those characteristics
which contains extended characteristic properties descriptor.

8 years agobtgatt-server: Fix GATT device name properties
Łukasz Rymanowski [Wed, 13 Apr 2016 21:09:53 +0000 (23:09 +0200)]
btgatt-server: Fix GATT device name properties

Since GATT device name characteristic has extended characteristic
property descriptor, that should be set in properties as well.
This patch fixes that.

8 years agomonitor: Add support for TTY based data
Johan Hedberg [Thu, 21 Apr 2016 14:09:48 +0000 (17:09 +0300)]
monitor: Add support for TTY based data

Add support for receiving a monitor data stream over a TTY.

8 years agoaudio/media: Fix return NULL to .get_name
Luiz Augusto von Dentz [Wed, 13 Apr 2016 13:29:35 +0000 (16:29 +0300)]
audio/media: Fix return NULL to .get_name

Player need to have a name set otherwise it may cause the following
crash:

Invalid read of size 1
   at 0x4826BD8: strlen (mc_replace_strmem.c:404)
   by 0x138289: avrcp_handle_get_folder_items (in /usr/libexec/bluetooth/bluetoothd)
   by 0x13A278: handle_browsing_pdu (in /usr/libexec/bluetooth/bluetoothd)
   by 0x1315F2: session_browsing_cb (in /usr/libexec/bluetooth/bluetoothd)
   by 0x48C69BB: g_io_unix_dispatch (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x487FB2A: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x487FEB7: g_main_context_iterate.clone.5 (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x48803AA: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.3600.0)
   by 0x16D008: main (in /usr/libexec/bluetooth/bluetoothd)
 Address 0x0 is not stack'd, malloc'd or (recently) free'd

8 years agocore/device: Fix breakage of Bluetooth pairing
Jakub Pawlowski [Mon, 11 Apr 2016 12:27:19 +0000 (14:27 +0200)]
core/device: Fix breakage of Bluetooth pairing

This patch converts old propertis containing list of services available
on remote devices. Without that previously paired devices, i.e.
keyboards, will not work properly.

8 years agoHACKING: Add necessary commands to configure git send-email
Luiz Augusto von Dentz [Mon, 11 Apr 2016 13:37:51 +0000 (16:37 +0300)]
HACKING: Add necessary commands to configure git send-email

This is convenient for people not involved with projects using email to
as review process.

8 years agosystemd: Enable ProtectHome and ProtectSystem options
Luiz Augusto von Dentz [Fri, 8 Apr 2016 12:08:30 +0000 (15:08 +0300)]
systemd: Enable ProtectHome and ProtectSystem options

These options protect from unintended access to the filesystem see
SYSTEMD.EXEC(5) for mode detail.

8 years agodoc/gatt-api: Make Notifying property optional
Luiz Augusto von Dentz [Tue, 5 Apr 2016 14:27:39 +0000 (17:27 +0300)]
doc/gatt-api: Make Notifying property optional

If the characteristic does not support nofications nor indications the
Notifying property can be omitted as it will never going to be used.

8 years agotools: Change test-runner license to LGPL easy reuse
Marcel Holtmann [Thu, 7 Apr 2016 21:39:34 +0000 (23:39 +0200)]
tools: Change test-runner license to LGPL easy reuse

8 years agoRelease 5.39
Marcel Holtmann [Mon, 4 Apr 2016 22:15:47 +0000 (00:15 +0200)]
Release 5.39

8 years agolib: Update company identifiers
Marcel Holtmann [Mon, 4 Apr 2016 22:06:05 +0000 (00:06 +0200)]
lib: Update company identifiers

8 years agoshared/gatt-server: Add support for long write
Łukasz Rymanowski [Sat, 2 Apr 2016 20:26:47 +0000 (22:26 +0200)]
shared/gatt-server: Add support for long write

With this patch long write and nested long write reliable is supported.
GATT server is responsible now to do aggregation of prep write data
for long write session.
Note: We consider long write as the consequtive prepare writes with
continues offsets.

E.g. 1

prep_write: handle 1, offset 0, value_len 10
prep_write: handle 1, offset 10, value_len 10
prep_write: handle 2, offset 0, value_len 10
prep_write: handle 2, offset 10, value_len 10

Will result with following calles to app:

exec_write: handle 1: offset 0, value_len 20
exec_write: handle 2: offset 0, value_len 20

E.g. 2

prep_write: handle 1, offset 0, value_len 10
prep_write: handle 1, offset 2, value_len 5
prep_write: handle 2, offset 0, value_len 10
prep_write: handle 2, offset 4, value_len 5

Will result with following calles to app:

exec_write: handle 1: offset 0, value_len 10
exec_write: handle 1: offset 2, value_len 5
exec_write: handle 2: offset 0, value_len 10
exec_write: handle 2: offset 4, value_len 5

E.g. 3
prep_write: handle 1, offset 0, value_len 10
prep_write: handle 1, offset 5, value_len 5
prep_write: handle 1, offset 10, value_len 6

will result with following calles to app:

exec_write: handle 1, offset 0, value 10
exec_write: handle 1, offset 5, value 11

8 years agoclient: Fix code style problems
Luiz Augusto von Dentz [Mon, 4 Apr 2016 10:12:54 +0000 (13:12 +0300)]
client: Fix code style problems

Only tabs shall be used for indentation.

8 years agoinput/hog: Fix crash if uhid is not enabled
Szymon Janc [Fri, 1 Apr 2016 19:58:29 +0000 (21:58 +0200)]
input/hog: Fix crash if uhid is not enabled

If /dev/uhid is not present bt_hog_new_default() returns NULL.
This was resulting in NULL pointer dereference in attio_connected_cb.

8 years agoaudio: Fix double free
Luiz Augusto von Dentz [Fri, 1 Apr 2016 14:00:05 +0000 (17:00 +0300)]
audio: Fix double free

Because avdtp_unref can now cause a state change the stream reference
shall be dropped before a2dp_cancel is called otherwise the code may
attempt to unref once more using the same reference:

Invalid read of size 8
   at 0x41F33B: avdtp_set_state (avdtp.c:695)
   by 0x420CE7: connection_lost (avdtp.c:1118)
   by 0x4216C4: avdtp_unref (avdtp.c:1178)
   by 0x418098: source_disconnect (source.c:395)
   by 0x41D417: a2dp_source_disconnect (a2dp.c:2312)
   by 0x49A64B: btd_service_disconnect (service.c:273)
   by 0x49E120: dev_disconn_service (device.c:1325)
   by 0x50E6DAC: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.4600.2)
   by 0x4A3894: device_request_disconnect (device.c:1357)
   by 0x4A3A3C: dev_disconnect (device.c:1442)
   by 0x4C7F22: process_message.isra.3 (object.c:259)
   by 0x4C877C: generic_message (object.c:1071)
 Address 0x929b0c0 is 16 bytes inside a block of size 1,160 free'd
   at 0x4C29E00: free (vg_replace_malloc.c:530)
   by 0x50CE5ED: g_free (in /usr/lib64/libglib-2.0.so.0.4600.2)
   by 0x42163B: avdtp_free (avdtp.c:1101)
   by 0x42163B: avdtp_unref (avdtp.c:1182)
   by 0x417808: source_set_state (source.c:108)
   by 0x4178F9: avdtp_state_callback (source.c:122)
   by 0x41F386: avdtp_set_state (avdtp.c:698)
   by 0x420CE7: connection_lost (avdtp.c:1118)
   by 0x4216C4: avdtp_unref (avdtp.c:1178)
   by 0x418098: source_disconnect (source.c:395)
   by 0x41D417: a2dp_source_disconnect (a2dp.c:2312)
   by 0x49A64B: btd_service_disconnect (service.c:273)
   by 0x49E120: dev_disconn_service (device.c:1325)

8 years agoaudio/avdtp: Fix code style
Luiz Augusto von Dentz [Fri, 1 Apr 2016 13:44:16 +0000 (16:44 +0300)]
audio/avdtp: Fix code style

8 years agobuild: Make old GATT plugins deprecated
Luiz Augusto von Dentz [Thu, 24 Mar 2016 09:15:43 +0000 (11:15 +0200)]
build: Make old GATT plugins deprecated

This disables building plugins that are no longer supported by the core
since the transition to gatt-db. In the future these plugins will have to
be ported to use gatt-db or be removed if the profile can be implemented
using the GATT D-Bus APIs.

8 years agoaudio/avrcp: Fix registering to player events
Luiz Augusto von Dentz [Fri, 1 Apr 2016 08:07:15 +0000 (11:07 +0300)]
audio/avrcp: Fix registering to player events

If controller does not have a player skip registering to events which
requires a player.

8 years agoaudio/avdtp: Fix crash on outgoing connection failure
Szymon Janc [Fri, 25 Mar 2016 15:11:33 +0000 (16:11 +0100)]
audio/avdtp: Fix crash on outgoing connection failure

This fix double free if outgoing connection failed. This was due to
connection_lost() being called from avdtp_unref which could result
in another call to connection_lost when session ref is already 0.

Fix this in similar way pairing agent is handled: takes extra reference
before calling callbacks and unref it before exit. Then only unref is
suppose to free session.

connect error: Host is down (112)
profiles/audio/avdtp.c:connection_lost() Disconnected from 00:0C:8A:FB:D4:16
profiles/audio/a2dp.c:discover_cb() err 0xfff000240
profiles/audio/avdtp.c:avdtp_unref() 0x85a88f0: ref=1
src/service.c:change_state() 0x7f7c710: device 00:0C:8A:FB:D4:16 profile
    a2dp-sink state changed: connecting -> disconnected (-11)
src/device.c:device_profile_connected() a2dp-sink Resource temporarily
    unavailable (11)
src/device.c:device_profile_connected() returning response to :1.37
profiles/audio/a2dp.c:setup_unref() 0x85b0380: ref=0
profiles/audio/a2dp.c:setup_free() 0x85b0380
profiles/audio/avdtp.c:avdtp_unref() 0x85a88f0: ref=0
profiles/audio/avdtp.c:connection_lost() Disconnected from 00:0C:8A:FB:D4:16
profiles/audio/a2dp.c:discover_cb() err 0xfff000170
profiles/audio/sink.c:sink_set_state() State changed  /org/bluez/hci0/
    dev_00_0C_8A_FB_D4_16: SINK_STATE_CONNECTING -> SINK_STATE_DISCONNECTED
profiles/audio/a2dp.c:channel_remove() chan 0x85a8780
profiles/audio/avdtp.c:avdtp_free() 0x85a88f0
 Invalid free() / delete / delete[] / realloc()
    at 0x4C29CF0: free (vg_replace_malloc.c:530)
    by 0x50CE5ED: g_free (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x4177E3: finalize_discovery (avdtp.c:1039)
    by 0x41789A: connection_lost (avdtp.c:1114)
    by 0x41A7FD: avdtp_connect_cb (avdtp.c:2339)
    by 0x44CBFB: connect_cb (btio.c:232)
    by 0x50C8E39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x50C91CF: ??? (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x50C94F1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x40B7B7: main (main.c:687)
  Address 0x85b4c30 is 0 bytes inside a block of size 24 free'd
    at 0x4C29CF0: free (vg_replace_malloc.c:530)
    by 0x50CE5ED: g_free (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x4177E3: finalize_discovery (avdtp.c:1039)
    by 0x41789A: connection_lost (avdtp.c:1114)
    by 0x413EE2: setup_free (a2dp.c:163)
    by 0x413EE2: setup_unref (a2dp.c:178)
    by 0x413F5F: setup_cb_free (a2dp.c:201)
    by 0x41638D: finalize_discover (a2dp.c:346)
    by 0x41638D: discover_cb (a2dp.c:1855)
    by 0x4177DB: finalize_discovery (avdtp.c:1037)
    by 0x41789A: connection_lost (avdtp.c:1114)
    by 0x41A7FD: avdtp_connect_cb (avdtp.c:2339)
    by 0x44CBFB: connect_cb (btio.c:232)
    by 0x50C8E39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.2)
  Block was alloc'd at
    at 0x4C2A988: calloc (vg_replace_malloc.c:711)
    by 0x50CE530: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.4600.2)
    by 0x4190FB: avdtp_discover (avdtp.c:3186)
    by 0x416C19: a2dp_discover (a2dp.c:1872)
    by 0x413642: sink_setup_stream (sink.c:265)
    by 0x4136C4: sink_connect (sink.c:294)
    by 0x470165: btd_service_connect (service.c:238)
    by 0x47583C: connect_next.isra.18 (device.c:1455)
    by 0x478500: connect_profiles (device.c:1710)
    by 0x48EC4A: process_message.isra.5 (object.c:259)
    by 0x53DD1A2: ??? (in /usr/lib64/libdbus-1.so.3.14.6)
    by 0x53CE733: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.14.6)

8 years agotools/btattach: Add command line switch for specifying the baudrate
Johan Hedberg [Thu, 24 Mar 2016 12:01:23 +0000 (14:01 +0200)]
tools/btattach: Add command line switch for specifying the baudrate

8 years agotests/example-gatt-client: Fix using invalid property
Luiz Augusto von Dentz [Tue, 22 Mar 2016 14:50:41 +0000 (16:50 +0200)]
tests/example-gatt-client: Fix using invalid property

This fixes the following trace caused by GattServices1 no longer
containing a property called Characteristics:

Traceback (most recent call last):
  File "./example-gatt-client", line 221, in <module>
    main()
  File "./example-gatt-client", line 207, in main
    if not process_hr_service(service_path):
  File "./example-gatt-client", line 167, in process_hr_service
    chrc_paths = service_props['Characteristics']
KeyError: 'Characteristics'

8 years agoaudio/a2dp: Simplify error handling
Luiz Augusto von Dentz [Wed, 23 Mar 2016 12:31:18 +0000 (14:31 +0200)]
audio/a2dp: Simplify error handling

Don't expose avdtp_error in a2dp.h instead handle it internally
converting to posix error whenever necessary.

8 years agoaudio/avdtp: Fix passing wrong error code
Luiz Augusto von Dentz [Wed, 23 Mar 2016 11:15:59 +0000 (13:15 +0200)]
audio/avdtp: Fix passing wrong error code

finalize_discovery actually expect positive codes since it passes to
avdtp_error_init.

8 years agoaudio/avdtp: Only set disconnect timer if connected
Luiz Augusto von Dentz [Wed, 23 Mar 2016 10:39:28 +0000 (12:39 +0200)]
audio/avdtp: Only set disconnect timer if connected

If the session is not connected it makes no sense to enable the
disconnect timer.

8 years agoaudio/avrcp: Fix crash when connecting to controllers
Luiz Augusto von Dentz [Tue, 22 Mar 2016 15:37:18 +0000 (17:37 +0200)]
audio/avrcp: Fix crash when connecting to controllers

Patch 70fdb77d0af137aa859f267da976f610cd9bbbd2 has actually caused the
following regression since no player is set:

Invalid read of size 8
  at 0x435B8E: avrcp_player_value_rsp (avrcp.c:2150)
  by 0x42FB83: control_response (avctp.c:831)
  by 0x42FB83: session_cb (avctp.c:996)
  by 0x50C8E39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x50C91CF: ??? (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x50C94F1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x40C258: main (main.c:687)
Address 0x58 is not stack'd, malloc'd or (recently) free'd

8 years agoshared/gatt-server: Fix handle error on execute write
Łukasz Rymanowski [Fri, 18 Mar 2016 13:08:14 +0000 (14:08 +0100)]
shared/gatt-server: Fix handle error on execute write

If there is an error during execute write we should drop all
outstanding prep_write data. This patch fix that.

8 years agounit/test-gatt: Fix long write test
Łukasz Rymanowski [Fri, 18 Mar 2016 13:08:13 +0000 (14:08 +0100)]
unit/test-gatt: Fix long write test

This patch change characteristic we are writing too in the nested
long write reliable testcase.

Basically characteristic with handle 0x0072 already have characteristic
extended descriptor required for reliable session

8 years agounit/test-gatt: Extend large-db
Łukasz Rymanowski [Fri, 18 Mar 2016 13:08:12 +0000 (14:08 +0100)]
unit/test-gatt: Extend large-db

This patch adds characteristic extended descriptor to characteristic
handle 0x0081. Also fixes testes using this.

We need this to make script pass when following patches start
to look into this descriptor on reliable write session

8 years agounit/test-gatt: Modify small-db
Łukasz Rymanowski [Fri, 18 Mar 2016 13:08:11 +0000 (14:08 +0100)]
unit/test-gatt: Modify small-db

This patch adds Characteristic Extended descriptor to characteristic
with handle 0x0002 nad 0x0014.

Also fixes scripts using small-db.

We need this as next patches will start to look into this descriptor
on reliable write session.

8 years agounit/test-gatt: Fix long write testcases
Łukasz Rymanowski [Fri, 18 Mar 2016 13:08:10 +0000 (14:08 +0100)]
unit/test-gatt: Fix long write testcases

Idea of long write is that each part of data is continuation
of previous one. There shall be not gaps in the offsets between.

If there are gaps in offset then we have reliable write rather than
long write

8 years agoshared/gatt-client: Forward events from parent to clones
Luiz Augusto von Dentz [Mon, 21 Mar 2016 12:30:09 +0000 (14:30 +0200)]
shared/gatt-client: Forward events from parent to clones

Some events such as ready and service changed shall be forward to clones
since the clones may have set callbacks as well.

8 years agoshared/gatt-client: Make it possible to clone non-ready clients
Luiz Augusto von Dentz [Mon, 21 Mar 2016 13:42:31 +0000 (15:42 +0200)]
shared/gatt-client: Make it possible to clone non-ready clients

This is necessary in order to be possible to send commands while the
discovery is in progress.

8 years agocore/gatt-client: Fix crash on service changed
Luiz Augusto von Dentz [Mon, 21 Mar 2016 10:39:41 +0000 (12:39 +0200)]
core/gatt-client: Fix crash on service changed

The following crash can be observed when a service is removed from the
remote device leading to remove a client but instead a different
pointer was given causing which may leave the notification queue with
invalid clients:

Invalid read of size 8
  at 0x4A80D1: remove_client (gatt-client.c:1311)
  by 0x4DA16E: queue_remove_all (queue.c:351)
  by 0x4A7DF3: unregister_characteristic (gatt-client.c:1331)
  by 0x4DA16E: queue_remove_all (queue.c:351)
  by 0x4A7D65: unregister_service (gatt-client.c:1447)
  by 0x4DA0D5: queue_remove_all (queue.c:336)
  by 0x4AB11C: btd_gatt_client_service_removed (gatt-client.c:1747)
  by 0x4AFEA3: gatt_service_removed (device.c:3448)
  by 0x4E8FD1: handle_notify (gatt-db.c:249)
  by 0x4D9DC3: queue_foreach (queue.c:220)
  by 0x4E9ECB: notify_service_changed (gatt-db.c:266)
  by 0x4E9F7C: gatt_db_service_destroy (gatt-db.c:277)
Address 0x8cf8620 is 0 bytes inside a block of size 32 free'd
  at 0x4C29E00: free (vg_replace_malloc.c:530)
  by 0x4A9405: register_notify (gatt-client.c:1669)
  by 0x4D9DC3: queue_foreach (queue.c:220)
  by 0x4AAFBB: btd_gatt_client_connected (gatt-client.c:1714)
  by 0x4B2DAA: gatt_client_init (device.c:4591)
  by 0x4B2DAA: device_attach_att (device.c:4705)
  by 0x4B4712: att_connect_cb (device.c:4742)
  by 0x47375B: connect_cb (btio.c:232)
  by 0x50C8E39: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x50C91CF: ??? (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x50C94F1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.2)
  by 0x40C258: main (main.c:687)

8 years agotools: make parse_companies.pl more forgiving of weird HTML
Mike Ryan [Sat, 19 Mar 2016 03:48:48 +0000 (20:48 -0700)]
tools: make parse_companies.pl more forgiving of weird HTML

Several company identifier lines do not end in a </td> but rather <br/>
followed by newline followed by </td>. This dirty hack is more forgiving
of HTML weirdnesses in the SIGs company identifiers page.

8 years agounit/test-crypto: Add test based on sample data from errata 4243
Szymon Janc [Fri, 11 Mar 2016 16:16:06 +0000 (17:16 +0100)]
unit/test-crypto: Add test based on sample data from errata 4243

8 years agoRelease 5.38
Marcel Holtmann [Fri, 18 Mar 2016 02:15:59 +0000 (03:15 +0100)]
Release 5.38

8 years agomonitor: Update vendor defined 16-bit UUID entries
Marcel Holtmann [Fri, 18 Mar 2016 00:14:25 +0000 (01:14 +0100)]
monitor: Update vendor defined 16-bit UUID entries

8 years agolib: Update company identifiers
Marcel Holtmann [Thu, 17 Mar 2016 23:58:57 +0000 (00:58 +0100)]
lib: Update company identifiers