Commit Graph

25444 Commits

Author SHA1 Message Date
David Lechner
307eb8cc8e src/gatt-client: allow "command" even when property not set
This modifies the GATT client characteristic WriteValue D-Bus method to
not check that the characteristic supports the requested type of
write when the "type" option is set to "command".

Before this change, if the "type" option was used and it was set to
"reliable" or "request", then BlueZ would attempt the write even if the
characteristic does not support that write type. On the other hand, if
"type" was set to "command" or was not specified, the method would
return a org.bluez.Error.NotSupported error without attempting to write.

After this change, the WriteValue method will consistently always
ignore the characteristic properties and attempt to write when the
"type" option is used instead of having a different behavior for the
"command" type.
2020-04-28 17:00:59 -07:00
Archie Pusaka
ed4c79e6fd gatt: Fix service_changed characteristic permission
According to bluetooth spec Ver 5.2, Vol 3, Part G, 7.1, the
service_changed characteristic is not readable. Therefore, this
patch marks it as such.
2020-04-28 09:44:24 -07:00
Miao-chen Chou
00fc220049 doc: Add Advertisement Monitoring API
This patch proposes an Advertisement Monitoring API for an application
to register a job of monitoring ADV reports with content filter and
RSSI thresholds.
2020-04-27 14:34:20 -07:00
Alain Michaud
008057775d doc/adapter-api: Add Roles property
This change adds a new property to indicate the support for concurrent
roles which means that the controller has reported the appropriate
LE_Supported_States (hdev->le_states) and that the controller's driver
has reported correctly handling the various reported states.
2020-04-27 09:46:18 -07:00
Luiz Augusto von Dentz
b9937e92a8 device: Fix not reporting errors to Connect
The check for connected services was inverted.
2020-04-24 10:32:16 -07:00
Pali Rohár
3aa815a310 device: Return error when ConnectProfile DBus method fails
Without this patch ConnectProfile DBus method does not return failure if
profile connection failed and some other profile was already connected.
This is not correct behavior as ConnectProfile DBus method should always
return error when specified profile failed to connect. This patch fixes
this it.
2020-04-24 10:20:54 -07:00
Pali Rohár
f0b7c11ad7 btio: Fix error number
In commit d20ee8273e was unintentionally
negated error number. Fix this mistake.
2020-04-24 10:03:55 -07:00
Luiz Augusto von Dentz
a96ddbc1b6 emulator: Add support for LE Remove ISO Data Path
This implements support for LE Remove ISO Data Path command.
2020-04-23 14:53:57 -07:00
Luiz Augusto von Dentz
d6a8193701 emulator: Add support for LE Setup ISO Data Path
This implements support for LE Setup ISO Data Path command.
2020-04-23 14:53:57 -07:00
Luiz Augusto von Dentz
2e9a3f8c34 emulator: Add support for LE Set Host Feature
This implements support for LE Set Host Feature
2020-04-23 14:53:57 -07:00
Luiz Augusto von Dentz
729b007a2e emulator: Fix version number of ISO related features
There are part of Bluetooth 5.2 specification not 6.0.
2020-04-23 14:52:49 -07:00
Luiz Augusto von Dentz
ad1223b32c monitor: Add decoding support for HCI LE Set Host Feature
This adds decoding support for LE Set Host Feature.
2020-04-22 14:27:42 -07:00
Luiz Augusto von Dentz
dafb2e2023 monitor: Remove use of base defines for 5.2
Use the allocated value directly instead of base value + offset.
2020-04-22 14:27:42 -07:00
Pali Rohár
b0ebdd778b profile: Fix reporting error message when connection failed
Some bluetooth headsets do not support connecting more then one bluetooth
profile (e.g. in parallel A2DP and HSP, or HSP and HFP) and issuing
connect() syscall for second profile returns just ECONNREFUSED.

Prior this patch bluetooth daemon for such situation reported following
message to log:

  Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)

Message is incorrect as connect() syscall failed, not getpeername(). This
patch fixes this problem and logs correct error message:

  Headset Voice gateway failed connect to XX:XX:XX:XX:XX:XX: Connection refused (111)

Main problem was in ext_connect() function which called bt_io_get() for
retrieving remote address (BT_IO_OPT_DEST) and if it failed then original
error from connect() syscall was masked. Because it is not possible to
retrieve BT_IO_OPT_DEST for unconnected socket, original destination
address for error message is propagated via connect_add() function in btio.
2020-04-22 11:20:23 -07:00
Pali Rohár
d20ee8273e btio: Show destination address in connect error message
When connect() fails it is not possible to retrieve destination address as
socket is not bound. So put destination address into error message.
2020-04-22 11:20:20 -07:00
Brian Gix
c031b5ed4c test/mesh: Remove Provisioner interface
This change removes the Provisioner Initiator from the python test
script, along with the menu commands for create, scan and add. This
makes it a cleaner Python3 example of a simple On/Off node, and a
fuller featured Provisioner/Config Client still exists in the tools
subdirectory.
2020-04-22 08:12:42 -07:00
Brian Gix
ca2163d370 test/mesh: Fix token format to use all 16 digits 2020-04-21 09:12:39 -07:00
Stéphane Cerveau
71b5dbc704 add hog ref before adding to instances
To avoid a double hog free, need to add a ref
when adding the hog to the slist.

This bug has been reproduced with gamepad-8718
which was connecting/disconnecting frantically.

Fix also a typo in the method hog_attach_instance
2020-04-20 14:05:48 -07:00
Szymon Janc
86fbb15cb7 device: Fix compilation with GCC 10
Class is using only 3 bytes so make sure GCC is aware of that.

src/device.c:397:3: note: ‘sprintf’ output between 9 and 11 bytes into a destination of size 9
  397 |   sprintf(class, "0x%6.6x", device->class);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2020-04-20 11:00:03 -07:00
Szymon Janc
211067d557 avctp: Fix compilation with GCC 10
This one is a false positive but since we never use more than
UINPUT_MAX_NAME_SIZE bytes of name we can silence GCC by reducing
size of source string.

  CC       profiles/audio/bluetoothd-avctp.o
In function ‘uinput_create’,
    inlined from ‘init_uinput’ at profiles/audio/avctp.c:1259:20:
profiles/audio/avctp.c:1188:3: error: ‘strncpy’ output may be truncated copying 79 bytes from a string of length 248 [-Werror=stringop-truncation]
 1188 |   strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2020-04-20 11:00:00 -07:00
Szymon Janc
df66caf9b3 sap: Fix compilation with GCC 10 2020-04-20 10:59:56 -07:00
Szymon Janc
f8f2962334 android: Fix build with GCC 10
status and state are used to hold various enum types depending on test
and callback passed. Define them as int to avoid warnings about enum
assignment from invalid type.
2020-04-20 10:59:52 -07:00
Brian Gix
ef0970a723 mesh: Fix GCC 10.0 warnings 2020-04-18 08:21:03 -07:00
Olivier Martin
8519cdbf4f emulator: Fix command line parameters with optional argument
Some parameters were missing the indication that additional
argument could be expected.
2020-04-15 16:02:50 -07:00
Pali Rohár
8fcbb6b01f doc: Update documentation for HSP and HFP profiles
Fix information about default rfcomm channel number in HFP HS role
(it is 7, not 6) and add documentation about default values.
2020-04-14 14:00:46 -07:00
Luiz Augusto von Dentz
bc3cd6a3b9 profile: Return -ENOENT for HSP AG
HSP AG role doesn't have any supported features.
2020-04-14 13:24:34 -07:00
Brian Gix
8a73c868b7 mesh: Add Time-outs to critical dbus send-with-replies
JoinComplete() dbus method calls are the only time that node tokens are
delivered to client Applications, so if the call fails for any reason
(including time-outs) the daemon has a way to clean-up the stale unused
node data.
2020-04-14 08:45:47 -07:00
Przemysław Fierek
fda1a55799 tools/mesh-cfgclient: Add waiting for 'JoinComplete' 2020-04-14 08:45:47 -07:00
Przemysław Fierek
a4ead01159 mesh: Change API to deliver tokens via JoinComplete
This patch changes Import and CreateNetwork API to deliver tokens via
the JoinComplete method call.  When application doesn't raise any error
during handling JoinComplete then it is assumed that the token has been
saved, otherwise when application replies with an error message then the
node is removed.
2020-04-14 08:45:47 -07:00
Michał Lowas-Rzechonek
2fb966d804 doc/mesh: Change API to deliver tokens via JoinComplete
If Application is not be able to reliably store the token, the daemon
will end up with a uncontrollable node in its database.

Let's fix the issue by always delivering tokens using JoinComplete call,
and expecting a reply - if the application return an error, daemon will
get rid of the node.
2020-04-14 08:45:47 -07:00
Pali Rohár
e3b8a6484b profile: Add default SDP record for Headset role of HSP 1.2
This would allow D-Bus agents to implement HS role of HSP profile.
2020-04-13 17:07:12 -07:00
Pali Rohár
040bd56a94 profile: Export Remote Audio Volume Control SDP value
Remote Audio Volume Control property in SDP record for HSP HS role
indicates if device supports volume control.

It is required for D-Bus agents which implements audio part of HSP
profile to know if remote device supports volume control or not.

With this change bluez exports status of this SDP property via firt bit
in Features entry in NewConnection() DBus callback method, like for HFP
profile.
2020-04-13 17:06:59 -07:00
Luiz Augusto von Dentz
b84bd5ee0b profile: Remove duplicate initialization of version and profile
These values are always set later by send_new_connection.
2020-04-13 17:06:30 -07:00
Pali Rohár
6a7fe599e7 profile: Fix not setting default features for HFP 1.7
When HFP AG features are not set then according to HFP 1.7.2
specification it has value 0b001001.
2020-04-13 17:06:16 -07:00
Przemysław Fierek
d5cc4ffd55 mesh: Fix invalid app_path on 'Join'
This patch fixes invalid app_path on 'Join' method call - the daemon
tried to use the value of app_root API argument, while it should use
path discovered by scanning result of GetManagedObjects() call.
2020-04-10 06:06:30 -07:00
Szymon Janc
427033253d test/example-advertisement: Fix advertising when discoverable
If adapter is discoverable (or LE-only) advertising was failing due
to too big adv data being set. Make sure there is enough space left
for flags if needed.
2020-04-09 11:27:30 -07:00
Rafał Gajda
60423fed39 mesh: Ignore beacons with IVU if IV already updated
When daemon receives beacon with IV=n+1, IVU=False it will
start sending messages with new IV and set sequence to 0.
However if daemon receives another beacon with IV=n+1, IVU=True it
will go back to sending messages with old IV=n (IVU set to True).
Because sequence number has been reset those messages will be dropped
by replay protection and node will lose communication.

Once IV is updated daemon should not go back to using the old value.

This patch adds beacon rejection if IV has already been updated.
2020-04-08 10:08:31 -07:00
Marcel Holtmann
5b294a5666 monitor: Add support for opening extra mgmt socket for events 2020-04-08 10:09:05 +02:00
Archie Pusaka
cbbb0c2ead shared/att: Check the signature of att packets
Tested to pass these BT certification test
SM/MAS/SIGN/BV-03-C
SM/MAS/SIGN/BI-01-C
2020-04-07 12:52:24 -07:00
Archie Pusaka
18169e7c23 unit/test-crypto: test for bt_crypto_verify_att_sign
Adding tests for verifying att signature
2020-04-07 12:52:24 -07:00
Archie Pusaka
992ce8be2c shared/crypto: Add bt_crypto_verify_att_sign
This is used to verify the signature of incoming ATT packets.
2020-04-07 12:52:23 -07:00
Luiz Augusto von Dentz
397cbeb864 client: Make advertise instances default to discoverable
The more common case is that advertisements are discoverable not the
other way around.
2020-04-07 12:52:23 -07:00
Brian Gix
31003c95d8 tools/mesh-cfgclient: Default to highest security
To encourage best practices, we request the highest level of
security available in common between provision initiator and
acceptor.
2020-04-07 10:01:55 -07:00
Brian Gix
5fc60b2ce7 unit: Exit test-mesh-crypto on any detected fail
Unit test would signal failures if run on commandline, but not if
run as part of a unit test sweep. This change forces an exit(1) on
any detected fail, and is caught by test suite runner.
2020-04-07 09:52:44 -07:00
Michał Lowas-Rzechonek
59aae8b1cc mesh: Remove redundant code from mesh/crypto
- Remove application_encrypt/application_decrypt
- Make mesh_crypto_privacy_counter private, add mesh_crypto_pecb
- Make *_nonce functions private and align their implementation to be
  more consistent
- Refactor network_encrypt/network_decrypt to use *_nonce functions and
  rename them to packet_encrypt/packet_decrypt
- Refactor packet_encode/packet_decode
2020-04-07 09:52:44 -07:00
Luiz Augusto von Dentz
e45b7a21f9 gatt: Fix not sending any data when server supports AcquireWrite
msg.msg_iovlen should be set to 1 to forward the data received over the
file descriptor.
2020-04-07 09:13:17 +02:00
Szymon Janc
590a11b82f gatt: Fix AcquireWrite and AcquireNotify server support
Register read handler only for notify IO and handle socket
disconnection in sock_io_read.
2020-04-07 09:13:17 +02:00
Marcel Holtmann
2a7df9323e monitor: Fix off-by-one error with IRKs and LTKs 2020-04-05 20:51:36 +02:00
Marcel Holtmann
ba3cbc5b1c lib: Update company identifiers 2020-04-05 09:58:31 +02:00
Marcel Holtmann
14301cf0d4 doc: Define bus controller value for VIRTIO transport 2020-04-04 22:24:57 +02:00