platform/upstream/bluez.git
5 months agodoc/test-runner: Update documentation using rst format
Luiz Augusto von Dentz [Mon, 14 Aug 2023 19:13:12 +0000 (12:13 -0700)]
doc/test-runner: Update documentation using rst format

This updates test-runner documentation with a few examples using rst
format.

5 months agoshared/gatt-server: Fix not allowing valid attribute writes
Bart Philips [Wed, 9 Aug 2023 20:27:23 +0000 (22:27 +0200)]
shared/gatt-server: Fix not allowing valid attribute writes

The length check shall not consider the command header, just its
payload.

5 months agodevice: Fix not probing drivers at startup
Luiz Augusto von Dentz [Wed, 9 Aug 2023 19:31:25 +0000 (12:31 -0700)]
device: Fix not probing drivers at startup

Patch 67a26abe53bf ("profile: Add probe_on_discover flag") introduced a
regression which prevents drivers to be properly loaded at startup since
at that point they are not connected when code shall testing if
the devide is temporary instead.

5 months agoconfigure.ac: Bump minimum D-Bus version to 1.10
Gioele Barabucci [Wed, 9 Aug 2023 06:51:42 +0000 (08:51 +0200)]
configure.ac: Bump minimum D-Bus version to 1.10

D-Bus 1.10, released in 2015, is the first version that supports reading
policy files from `/usr/share/dbus-1` in addition to `/etc/dbus-1`.

The previous minimum version, 1.6, was released in 2012.

5 months agoprofile: Add probe_on_discover flag
Luiz Augusto von Dentz [Tue, 8 Aug 2023 11:50:37 +0000 (14:50 +0300)]
profile: Add probe_on_discover flag

This adds probe_on_discover flag which indicates if profile needs to be
probed when the remote_uuid is discovered and changes device logic to
attempt to probe driver when a new UUID is discovered and
probe_on_discover is set.

5 months agoadapter: Do not filter out broadcast advertiser
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:36 +0000 (14:50 +0300)]
adapter: Do not filter out broadcast advertiser

This allows a broadcast advertiser to be passed up to application,
if the adapter has the capability of being a Synchronized Receiver.

5 months agoeir: Add eir_get_service_data
Luiz Augusto von Dentz [Tue, 8 Aug 2023 23:47:55 +0000 (16:47 -0700)]
eir: Add eir_get_service_data

This adds eir_get_service_data function which can be used to get a
specific service data.

5 months agobtio: Add support for getsockopt(BT_ISO_BASE)
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:35 +0000 (14:50 +0300)]
btio: Add support for getsockopt(BT_ISO_BASE)

This adds the posibility for a broadcast sink to retrieve the
BASE information received from a source afeter a PA synchronization,
using the getsockopt(BT_ISO_BASE) function.
This needs the patch from bluetooth-next:
Bluetooth: ISO: Add support for periodic adv reports processing

5 months agoclient/player: Add broadcast sink endpoint
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:34 +0000 (14:50 +0300)]
client/player: Add broadcast sink endpoint

Added support for broadcast sink registration using the 0x1851 UUID.
Added support for remote endpoint creation when a broadcast source
is discovered.
Added support for creating a local endpoint when the broadcast sink
endpoint was registered from an external application (Pipewire).
To test this feature use the following commands:

[bluetooth]# endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06
[bluetooth]# scan on
[NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
[bluetooth]# endpoint.config
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
/local/endpoint/ep0 16_2_1

5 months agoiso-tester: test busy CIG error does not drop existing connections
Pauli Virtanen [Sat, 5 Aug 2023 12:29:07 +0000 (15:29 +0300)]
iso-tester: test busy CIG error does not drop existing connections

A second connection made with same CIG while the CIG is busy, shall not
disconnect the first already existing connection.

Add test for this:

ISO Connect2 Busy CIG 0x01 - Success/Invalid

This was the original intent of "ISO Connect2 CIG 0x01 -
Success/Invalid", but the busy check should not be made synchronously in
connect() (to maintain ordering with Remove CIG etc), but must be done
in hci_sync. So the test needs to check the error async and explictly
that the first conn is not dropped.

5 months agobtdev: fix CIG ID on Set CIG Parameters error response
Pauli Virtanen [Sat, 5 Aug 2023 12:29:06 +0000 (15:29 +0300)]
btdev: fix CIG ID on Set CIG Parameters error response

Set CIG Parameters shall return correct CIG ID in Command_Complete also
when it errors.

5 months agoa2dp: Expose "Key missing" error
Simon Mikuda [Sun, 6 Aug 2023 08:01:09 +0000 (10:01 +0200)]
a2dp: Expose "Key missing" error

This error is not expected and retries will likely end up with same error.

5 months agoerror: Add "Invalid exchange" mapping
Simon Mikuda [Sun, 6 Aug 2023 08:01:08 +0000 (10:01 +0200)]
error: Add "Invalid exchange" mapping

This error is returned on this event:
> HCI Event: Auth Complete (0x06) plen 3
        Status: PIN or Key Missing (0x06)
        Handle: 11 Address: 00:00:00:00:00:00 (OUI 00-00-00)

5 months agomonitor: Plot RX information with -a/--analyze
Luiz Augusto von Dentz [Mon, 7 Aug 2023 21:45:34 +0000 (14:45 -0700)]
monitor: Plot RX information with -a/--analyze

This attempts to plot the RX information just as TX:

  Found BR-ACL connection with handle 256
        Address: XX:XX:XX:XX:XX:XX
        RX packets: 60/60
        RX Latency: 0-39040 msec (~20294 msec)
        RX size: 6-344 octets (~34 octets)
        RX speed: ~0 Kb/s

  100 +-+------------------------------------------------------------------+
       +|                                                                  |
       +|                                                       RX +-----+ |
       +|                                                                  |
       +|                                                                  |
       +|                                                                  |
        |                                                                  |
        |                                                                  |
   10 +-|                                                                  |
       +|                                                                  |
       +|                                                                  |
       +|                                                                  |
       +|                                                                  |
       +|                                                                  |
        |                                                                  |
        |                                                                  |
    1 +-|  + +                                                           + |
       +|  | |                                                           | |
       ++------------------------------------------------------------------+
        +       +        +       +        +       +       +        +       +
        0      5000    10000   15000    20000   25000   30000    35000   40000
                                   Latency (ms)

        TX packets: 22548/22547
        TX Latency: 3-73 msec (~11 msec)
        TX size: 6-850 octets (~847 octets)
        TX speed: ~568 Kb/s

5 months agoiso-tester: Fix test ISO Connect2 CIG 0x01 - Success/Invalid
Luiz Augusto von Dentz [Fri, 4 Aug 2023 21:51:54 +0000 (14:51 -0700)]
iso-tester: Fix test ISO Connect2 CIG 0x01 - Success/Invalid

This test shall succeed rather than fail as this appears to be a bug in
the kernel code preventing Set CIG Parameters to work properly when
there are concurrent tasks only one CIS is being programmed.

5 months agoiso-tester: add tests checking Remove CIG is emitted
Pauli Virtanen [Tue, 1 Aug 2023 16:38:42 +0000 (19:38 +0300)]
iso-tester: add tests checking Remove CIG is emitted

Kernel should send LE Remove CIG after all CIS are shut down.  Add tests
checking this, closing either immediately or after waiting connection to
complete.

ISO Defer Close - Success
ISO Connect Close - Success
ISO Defer Wait Close - Success
ISO Connect Wait Close - Success

5 months agoiso-tester: test with large CIS_ID and invalid CIG_ID/CIS_ID
Pauli Virtanen [Tue, 1 Aug 2023 16:38:41 +0000 (19:38 +0300)]
iso-tester: test with large CIS_ID and invalid CIG_ID/CIS_ID

Add test with a large CIS_ID and multiple CIS so it hits an error
condition in current kernels (which is why the AC configuration is
used).

Add tests for invalid configurations with bad or duplicate IDs, and for
trying to connect two CIS in same CIG without BT_DEFER_SETUP.

ISO QoS CIG 0xF0 - Invalid
ISO QoS CIS 0xF0 - Invalid
ISO Connect2 CIG 0x01 - Success/Invalid
ISO AC 6(ii) CIS 0xEF/auto - Success
ISO AC 6(ii) CIS 0xEF/0xEF - Invalid

5 months agosco-tester: test local and remote disconnecting simultaneously
Pauli Virtanen [Tue, 1 Aug 2023 16:38:40 +0000 (19:38 +0300)]
sco-tester: test local and remote disconnecting simultaneously

Demonstrate a kernel race condition when remote side disconnects at the
same time as local side tries to cancel the connection. I.e.

[controller] > HCI Synchronous Connect Complete
[controller] > HCI Disconnection Complete (from remote)
[user] shutdown(sco_socket)
[kernel] hci_conn_abort(SCO handle)
[kernel] > HCI Create Connection Cancel
[kernel] < HCI Synchronous Connect Complete
[kernel] < HCI Disconnect Complete
[controller] < HCI Create Connection Cancel
[controller] > HCI Command Status (Create Connection Cancel)
[kernel] < HCI Command Status (Create Connection Cancel)

and then we get BUG: KASAN: slab-use-after-free in hci_conn_failed when
hci_conn_abort tries to delete the same connection a second time.

This type of crash is probably not limited to the sequence here, but for
this one it was possible to get the timing right in the emulator.

Add a test that hits this in the emulator environment (pretty narrow
window to hit on real hardware):

eSCO Simultaneous Disconnect - Failure

5 months agobtdev: fix Command Status command opcodes for Setup Sync Conn
Pauli Virtanen [Tue, 1 Aug 2023 16:38:39 +0000 (19:38 +0300)]
btdev: fix Command Status command opcodes for Setup Sync Conn

The command opcode should be the CMD, not EVT.

5 months agobtdev: check error conditions for HCI_Create_Connection_Cancel
Pauli Virtanen [Tue, 1 Aug 2023 16:38:38 +0000 (19:38 +0300)]
btdev: check error conditions for HCI_Create_Connection_Cancel

Create Connection Cancel shall return Command Complete with error status
when there is no Create Connection that can be canceled.  In these
cases, we should not send a (spurious) Connection Complete event.

Fix by keeping a list of pending Create Connection commands, and
returning command errors if there is none pending at the moment.

5 months agomonitor/analyze: Inline data to gnuplot
Luiz Augusto von Dentz [Tue, 1 Aug 2023 23:18:10 +0000 (16:18 -0700)]
monitor/analyze: Inline data to gnuplot

Instead of creating a separate file just to write the x:y axis inline
the data via gnuplot $data variable then use it to plot.

5 months agomonitor: Add connection tracking for SCO/ISO with -a/--analyze
Luiz Augusto von Dentz [Tue, 1 Aug 2023 21:32:48 +0000 (14:32 -0700)]
monitor: Add connection tracking for SCO/ISO with -a/--analyze

This adds proper connection tracking to SCO/ISO connection by handling
the events that establishes them.

5 months agomonitor: Print channel latency information with -a/--analyze
Luiz Augusto von Dentz [Mon, 31 Jul 2023 22:13:38 +0000 (15:13 -0700)]
monitor: Print channel latency information with -a/--analyze

This prints channel latency information and use gnuplot when using
-a/--analyze to plot a graph of channels:

  Found TX L2CAP channel with CID 68
        PSM 25
        22490 packets
        7-50 msec (~11 msec) TX Latency
        850-850 octets TX packet size
        ~569 Kb/s TX transfer speed

  10000 +-+----------------------------------------------------------------+
         +|     ++                                                         |
         +|     || +                                       Packets +-----+ |
         +|   + || |                                                       |
   1000 +-|   | || |+ ++                                                   |
         +|   | || || ||   +                                               |
         +|   | || || ||+ +|                                               |
         +|   | || || ||| || ++ ++                                         |
    100 +-|   | || || ||| || || ||   +                                     |
         +|   | || || ||| || || || ++| +   +                               |
         +|   | || || ||| || || || ||| |   |                               |
         +|   | || || ||| || || || ||| |+ +| +                             |
          |   | || || ||| || || || ||| || || |+ +                          |
     10 +-|   | || || ||| || || || ||| || || || |+                         |
         +|   | || || ||| || || || ||| || || || ||     +                   |
         +|  +| || || ||| || || || ||| || || || ||+ ++ |+ ++ +             |
          |  || || || ||| || || || ||| || || || ||| || || || |             |
      1 +-|  || || || ||| || || || ||| || || || ||| || || || |   +     +   |
         ++----------------------------------------------------------------+
          +      +      +       +      +      +      +       +      +      +
          5      10     15      20     25     30     35      40     45     50
                                    Latency (ms)

5 months agomonitor/analyze: Use conn_pkt_tx on acl_pkt
Luiz Augusto von Dentz [Mon, 31 Jul 2023 21:01:09 +0000 (14:01 -0700)]
monitor/analyze: Use conn_pkt_tx on acl_pkt

This makes use of conn_pkt_tx also on acl_pkt like other connections.

5 months agomonitor: Add TX frame number and speed estimation
Luiz Augusto von Dentz [Mon, 31 Jul 2023 18:26:19 +0000 (11:26 -0700)]
monitor: Add TX frame number and speed estimation

This adds the frame information while decoding:

> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 256 Address: XX:XX:XX:XX:XX:XX
        Count: 1
        #188: len 850 (755 Kb/s)
        Latency: 9 msec (3-21 msec ~6 msec)
        Channel: 68 [PSM 25 mode Basic (0x00)] {chan 4}
        Channel Latency: 9 msec (7-21 msec ~9 msec)

Or the speed estimation while analyzing:

  Found BR-ACL connection with handle 256
        Address: XX:XX:XX:XX:XX:XX
        60 RX packets
        22548 TX packets
        22547 TX completed packets
        3-73 msec (~11 msec) TX Latency
        6-850 octets (~847 octets) TX packet size
        ~568 Kb/s TX transfer speed

5 months agogatt: Fix not establishing a socket for each device
Luiz Augusto von Dentz [Mon, 24 Jul 2023 20:57:34 +0000 (13:57 -0700)]
gatt: Fix not establishing a socket for each device

AcquireWrite and AcquireNotify shall establish a socket pair for each
device connected otherwise the application cannot distinct the
operations of each client.

Fixes: https://github.com/bluez/bluez/issues/460

5 months agomonitor: Add parsing Service Data of UUID 128
Łukasz Rymanowski [Sat, 29 Jul 2023 00:45:52 +0000 (02:45 +0200)]
monitor: Add parsing Service Data of UUID 128

In the advertising report, instead of deciding EIR 0x21 into this:

Unknown EIR field 0x21: 3a048f2ba97ea6ae1b49c619e973a4a701480d130d

We can do bit better

        Service Data UUID 128: Vendor specific
          Data: 01480d130d
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
5 months agomonitor: Add support to decode le read ISO link quality
Łukasz Rymanowski [Sat, 29 Jul 2023 00:45:51 +0000 (02:45 +0200)]
monitor: Add support to decode le read ISO link quality

btmon: Add parsing LE Read ISO link quality

    > HCI Event: Command Complete (0x0e) plen 34
          LE Read ISO link quality (0x08|0x0075) ncmd 1
            Status: Success (0x00)
            Handle: 98
            TX unacked packets 0
            TX flushed packets 257602
            TX last subevent packets 0
            TX retrnansmitted packets 0
            TX crc error packets 2594
            RX unreceived packets 0
            Duplicated packets 0

5 months agomonitor/ll: Add support for connection parameter command.
Szymon Czapracki [Sat, 29 Jul 2023 00:45:50 +0000 (02:45 +0200)]
monitor/ll: Add support for connection parameter command.

LL_CONNECTION_PARAM_REQ (0x0f)
  Interval min: 7.50 msec (0x0006)
  Interval max: 7.50 msec (0x0006)
  Latency: 0 (0x0000)
  Timeout: 5000 msec (0x01f4)
  Preffered periodicity: 0.00 (0x00)
  Reference connection event count: 4 (0x04)
  Offset 0: 0.00 msec (0x00)
  Offset 1: 0.00 msec (0x00)
  Offset 2: 1.25 msec (0x01)
  Offset 3: 0.00 msec (0x00)
  Offset 4: 2.50 msec (0x02)
  Offset 5: 0.00 msec (0x00)

LL_CONNECTION_PARAM_RSP (0x10)
  Interval min: 7.50 msec (0x0006)
  Interval max: 7.50 msec (0x0006)
  Latency: 0 (0x0000)
  Timeout: 5000 msec (0x01f4)
  Preffered periodicity: 0.00 (0x00)
  Reference connection event count: 4 (0x04)
  Offset 0: 318.75 msec (0xff)
  Offset 1: 318.75 msec (0xff)
  Offset 2: 318.75 msec (0xff)
  Offset 3: 318.75 msec (0xff)
  Offset 4: 318.75 msec (0xff)
  Offset 5: 318.75 msec (0xff)

5 months agomonitor: Update le event mask with bits 20-23
Łukasz Rymanowski [Sat, 29 Jul 2023 00:45:49 +0000 (02:45 +0200)]
monitor: Update le event mask with bits 20-23

5 months agomonitor: Fix decoding Command Complete for Remove ISO Data path
Łukasz Rymanowski [Sat, 29 Jul 2023 00:45:48 +0000 (02:45 +0200)]
monitor: Fix decoding Command Complete for Remove ISO Data path

Before

< HCI Command: LE Remove Isochronous Data Path (0x08|0x006f) plen 3
        Connection Handle: 96
        Data Path Direction: Output (Controller to Host) (0x01)
> HCI Event: Command Complete (0x0e) plen 6
      LE Remove Isochronous Data Path (0x08|0x006f) ncmd 1
        invalid packet size
        00 60 00

After patch

< HCI Command: LE Remove Isochronous Data Path (0x08|0x006f) plen 3
        Connection Handle: 96
        Data Path Direction: 0x01
          Input (Host to Controller)
> HCI Event: Command Complete (0x0e) plen 6
      LE Remove Isochronous Data Path (0x08|0x006f) ncmd 1
        Status: Success (0x00)
        Connection handle: 96

5 months agoRename BAA_SERVICE to BCAA_SERVICE add BAA_SERVICE(0x1851)
Silviu Florian Barbulescu [Mon, 31 Jul 2023 09:16:42 +0000 (12:16 +0300)]
Rename BAA_SERVICE to BCAA_SERVICE add BAA_SERVICE(0x1851)

Rename BAA_SERVICE to BCAA_SERVICE and added BAA_SERVICE(0x1851)
as UUID for the broadcast sink.

5 months agomain: Fix integer configuration option parse failures
Zijun Hu [Mon, 31 Jul 2023 09:28:42 +0000 (17:28 +0800)]
main: Fix integer configuration option parse failures

parse_config_int() has a obvious logical error, so causes many
parse failures of integer configuration options, fixed by this
change.

5 months agoadapter: Update ConnectDevice documentation
Simon Mikuda [Mon, 31 Jul 2023 04:12:29 +0000 (06:12 +0200)]
adapter: Update ConnectDevice documentation

5 months agoadapter: Be able to use ConnectDevice for discovered devices
Simon Mikuda [Mon, 31 Jul 2023 04:12:28 +0000 (06:12 +0200)]
adapter: Be able to use ConnectDevice for discovered devices

This can be useful when you want to specify trasport type for already
paired device (e.g. use LE transport for dual mode device).

5 months agomonitor/analyze: Fix not calculating latency for ISO/SCO packets
Luiz Augusto von Dentz [Fri, 28 Jul 2023 21:53:13 +0000 (14:53 -0700)]
monitor/analyze: Fix not calculating latency for ISO/SCO packets

ISO/SCO packets latency was not being calculated because no connection was
being assigned to them.

5 months agomonitor/analyze: Fix not dequeing TX packet properly
Luiz Augusto von Dentz [Fri, 28 Jul 2023 21:48:43 +0000 (14:48 -0700)]
monitor/analyze: Fix not dequeing TX packet properly

num_completed_packets_evt contain a count for how many packets have been
completed per handle.

5 months agomonitor: Fix not calculating latency for ISO/SCO packets
Luiz Augusto von Dentz [Fri, 28 Jul 2023 21:26:13 +0000 (14:26 -0700)]
monitor: Fix not calculating latency for ISO/SCO packets

ISO/SCO packets latency was not being calculated because no connection
was assigned to them.

5 months agomonitor: Fix not dequeing TX packet properly
Luiz Augusto von Dentz [Fri, 28 Jul 2023 21:24:41 +0000 (14:24 -0700)]
monitor: Fix not dequeing TX packet properly

num_completed_packets_evt contain a count for how many packets have been
completed per handle.

5 months agomonitor: Consolidate code around latency calculation
Luiz Augusto von Dentz [Thu, 27 Jul 2023 23:55:25 +0000 (16:55 -0700)]
monitor: Consolidate code around latency calculation

This move latency calculations to a helper function called
packet_latency_add so it can get reused by the likes of l2cap.c and
analyze.c

5 months agomonitor: Update documentation
Luiz Augusto von Dentz [Fri, 28 Jul 2023 00:16:58 +0000 (17:16 -0700)]
monitor: Update documentation

This updates the documentation to mention gnuplot usage.

5 months agomonitor: Use gnuplot to plot graph of Latency-Packets
Luiz Augusto von Dentz [Wed, 26 Jul 2023 22:14:26 +0000 (15:14 -0700)]
monitor: Use gnuplot to plot graph of Latency-Packets

This make use of gnuplot when using -a/--analyze to plot a graph of
Latency-Packets:

  Found BR-ACL connection with handle 256
        Address: XX:XX:XX:XX:XX:XX (Sony Home Entertainment&Sound Products Inc)
        60 RX packets
        22548 TX packets
        22547 TX completed packets
        3 msec min latency
        73 msec max latency
        11 msec median latency
        6 octets TX min packet size
        850 octets TX max packet size
        847 octets TX median packet size

  10000 +-+----------------------------------------------------------------+
         +|      ++                                                        |
         +|      ||+                                       Packets +-----+ |
         +|      |||                                                       |
   1000 +-|      |||++                                                     |
         +|      |||||  +                                                  |
         +|      |||||++|                                                  |
         +|      ||||||||+++                                               |
    100 +-|      |||||||||||  +                                            |
         +|      |||||||||||+++  +                                         |
         +|      ||||||||||||||  |                                         |
         +| ++   ||||||||||||||++|+                                        |
          | ||   |||||||||||||||||++                                       |
     10 +-| ||   |||||||||||||||||||+                                      |
         +| ||   ||||||||||||||||||||  +                                   |
         +| || ++||||||||||||||||||||++|++++       +                       |
          | || |||||||||||||||||||||||||||||       |                       |
      1 +-| ||+||||||||||||||||||||||||||||| +  +  |                 +     |
         ++----------------------------------------------------------------+
          +       +       +       +        +       +       +       +       +
          0       10      20      30       40      50      60      70      80
                                    Latency (ms)

5 months agogatt-client: Add read-only handles to dbus
Simon Mikuda [Fri, 28 Jul 2023 04:49:44 +0000 (06:49 +0200)]
gatt-client: Add read-only handles to dbus

This can be usefull when mapping names for services and characteristics
to their handle numbers.

5 months agoadvertising: Fix peripheral adverts when Discoverable = false
Simon Mikuda [Fri, 28 Jul 2023 10:56:04 +0000 (12:56 +0200)]
advertising: Fix peripheral adverts when Discoverable = false

There is a problem with this configuration: Type = peripheral,
Discoverable = false and Adapter is discoverable

In this state device will start advertise discoverable advertisements
even when user wanted non-discoverable advertisements.

This change will add empty Flags when "Discoverable" parameter is set.

5 months agoadapter: Fix generating IRK for adapter with privacy enabled
Simon Mikuda [Fri, 28 Jul 2023 04:45:56 +0000 (06:45 +0200)]
adapter: Fix generating IRK for adapter with privacy enabled

When root folder for adapter doesn't exist we will get this runtime error:
src/adapter.c:generate_and_write_irk() Unable set contents for
 /var/lib/bluetooth/00:00:00:00:00:00/identity:
 (Failed to create file “/var/lib/bluetooth/00:00:00:00:00:00/identity.EKQ581”:
 No such file or directory)

5 months agobap: Fix memory leaks
Luiz Augusto von Dentz [Wed, 26 Jul 2023 19:36:21 +0000 (12:36 -0700)]
bap: Fix memory leaks

This fixes the following memory leaks on exit:

g32 bytes in 1 blocks are definitely lost in loss record 170 of 800
g   at 0x484182F: malloc (vg_replace_malloc.c:431)
g   by 0x47C942: util_malloc (util.c:46)
g   by 0x47AD6A: queue_new (queue.c:47)
g   by 0x379CB6: bap_data_new (bap.c:1565)
g   by 0x379E24: bap_probe (bap.c:1757)
g   by 0x4048F3: service_probe (service.c:153)
g   by 0x4190D5: probe_service (device.c:4817)
g   by 0x41927D: dev_probe (device.c:4836)
g   by 0x403918: btd_profile_foreach (profile.c:740)
g   by 0x421861: device_probe_profiles (device.c:4896)
g   by 0x3E5023: probe_devices (adapter.c:4590)
g   by 0x498022F: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.7600.4)
g
g64 bytes in 2 blocks are definitely lost in loss record 556 of 800
g   at 0x484182F: malloc (vg_replace_malloc.c:431)
g   by 0x47C942: util_malloc (util.c:46)
g   by 0x47AD6A: queue_new (queue.c:47)
g   by 0x379CB6: bap_data_new (bap.c:1565)
g   by 0x37DEA7: bap_adapter_probe (bap.c:1843)
g   by 0x3CDB51: probe_profile (adapter.c:5066)
g   by 0x403918: btd_profile_foreach (profile.c:740)
g   by 0x3F557E: adapter_register (adapter.c:9288)
g   by 0x3F557E: read_info_complete (adapter.c:10186)
g   by 0x480D91: request_complete (mgmt.c:306)
g   by 0x484466: can_read_data (mgmt.c:394)
g   by 0x4ED93F: watch_callback (io-glib.c:157)
g   by 0x496348B: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.7600.4)

5 months agoshared/vcp: Reserve one more handle in VCS for VOCS
Nitin Jadhav [Tue, 25 Jul 2023 13:47:42 +0000 (16:47 +0300)]
shared/vcp: Reserve one more handle in VCS for VOCS

Fix: As per specs, VOCS is a secondary service;
hence it should be included under a primary service VCS.
The current number of handles is increased to accommodate the
included service

5 months agoshared/vcp: Fix issues of audio location and descriptor
Nitin Jadhav [Tue, 25 Jul 2023 13:47:41 +0000 (16:47 +0300)]
shared/vcp: Fix issues of audio location and descriptor

Issues
- Audio output descriptor & location read functions requires code
correction.
- During reading audio location descriptor value was checked
instead of the pointer. DBG statement wrongly accessed value
to print the log that caused the crash.

Fix
- Corrected audio output descriptor read variable
- Corrected the audio location debug printing function
- Allocated the memory as a char pointer to the audio descriptor variable.
- Corrected the audio descriptor pointer checking condition

5 months agoshared/vcp: Fix the crash observed with VOCS
Nitin Jadhav [Tue, 25 Jul 2023 13:47:40 +0000 (16:47 +0300)]
shared/vcp: Fix the crash observed with VOCS

Root cause
- There are two types of database- Remote and Local (rdb and ldb).
- In client mode currently the code was written to access ldb.

Fix
- Correcting it, to access rdb has resolved the problem in VOCS.
- Same correction is done for VCS.

Reported-by: Pauli Virtanen <pav@iki.fi>
5 months agobtmon: Make BIG identifier consistent
Łukasz Rymanowski [Fri, 21 Jul 2023 12:03:20 +0000 (14:03 +0200)]
btmon: Make BIG identifier consistent

Bluetooth spec uses BIG Handle as a BIG identifier.
Btmon sometimes use this and sometimes BIG ID.
This patch makes code consistent

5 months agobtmon: Fix obvious typo
Łukasz Rymanowski [Fri, 21 Jul 2023 12:03:19 +0000 (14:03 +0200)]
btmon: Fix obvious typo

5 months agomonitor: Fix invalid Create BIG Test command
Grzegorz Kolodziejczyk [Fri, 21 Jul 2023 12:03:18 +0000 (14:03 +0200)]
monitor: Fix invalid Create BIG Test command

As per Bluetooth Core 5.4 Vol 4 Part E, 7.8.104,
max pdu is 2 octect long and there is no adv_handle before encyption
flag

5 months agomonitor: Fix adv_handle size in the set info transfer packet
Jakub Tyszkowski [Fri, 21 Jul 2023 12:03:17 +0000 (14:03 +0200)]
monitor: Fix adv_handle size in the set info transfer packet

As per Bluetooth Core 5.4 Vol 4. Part E, 7.8.90,
adv_handle is 1 octet size and not 2.

5 months agoclient: Add bluetoothctl-monitor.1 man page
Luiz Augusto von Dentz [Wed, 19 Jul 2023 20:30:37 +0000 (13:30 -0700)]
client: Add bluetoothctl-monitor.1 man page

This adds bluetoothctl-monitor.rst which is then converted to
bluetoothctl-mgmt.1 using rst2man.

5 months agoclient: Add bluetoothctl-mgmt.1 man page
Luiz Augusto von Dentz [Wed, 19 Jul 2023 20:11:07 +0000 (13:11 -0700)]
client: Add bluetoothctl-mgmt.1 man page

This adds bluetoothctl-mgmt.rst which is then converted to
bluetooth-mgmt.1 using rst2man.

5 months agobtmgmt: Add man page
Luiz Augusto von Dentz [Mon, 17 Jul 2023 23:01:45 +0000 (16:01 -0700)]
btmgmt: Add man page

This adds btmgmt.rst which is then converted to btmgmt.1 using rst2man.

5 months agomidi: Fix build errors
Luiz Augusto von Dentz [Mon, 17 Jul 2023 19:36:15 +0000 (12:36 -0700)]
midi: Fix build errors

This fixes the following build errors:

unit/test-midi.c:541:82: error: function definition is not allowed here
void compare_events_cb(const struct midi_write_parser *parser,
void *user_data) {
 ^
unit/test-midi.c:587:17: error: use of undeclared identifier
'compare_events_cb'; did you mean 'compare_events'?
                                     compare_events_cb, &midi_data);
                                     ^~~~~~~~~~~~~~~~~
                                     compare_events

profiles/midi/midi.c:61:75: error: function definition is not allowed
here
void foreach_cb(const struct midi_write_parser *parser, void *user_data) {
                                                                         ^
profiles/midi/midi.c:78:40: error: use of undeclared identifier 'foreach_cb'
                midi_read_ev(&midi->midi_out, event, foreach_cb, midi);
                                                     ^

5 months agoclient: Add support for mgmt submenu
Luiz Augusto von Dentz [Fri, 14 Jul 2023 22:14:02 +0000 (15:14 -0700)]
client: Add support for mgmt submenu

This moves the functionality of btmgmt into client/mgmt.c so its
commands become available on bluetoothctl via mgmt submenu.

5 months agoiso-tester: Add test for BT_PKT_STATUS sockopt
Luiz Augusto von Dentz [Thu, 13 Jul 2023 22:40:20 +0000 (15:40 -0700)]
iso-tester: Add test for BT_PKT_STATUS sockopt

This adds a test for setting BT_PKT_STATUS sockopt and checks if
BT_SCM_PKT_STATUS is properly received.

5 months agobthost: Add support to set ISO Packet Status
Luiz Augusto von Dentz [Thu, 13 Jul 2023 22:38:28 +0000 (15:38 -0700)]
bthost: Add support to set ISO Packet Status

This adds support to set ISO Packet Status to bthost_send_iso.

5 months agotest-runner: fix behavior when no audio server
Pauli Virtanen [Wed, 12 Jul 2023 21:22:49 +0000 (00:22 +0300)]
test-runner: fix behavior when no audio server

If no audio server, don't pass NULL to printf and parse TESTAUDIO
correctly.

5 months agotest-runner: set non-quiet printk before running tests
Pauli Virtanen [Wed, 12 Jul 2023 21:22:48 +0000 (00:22 +0300)]
test-runner: set non-quiet printk before running tests

It is useful to see WARN_ON etc. messages when running the tests.

The 'quiet' in cmdline suppresses levels >= WARN, so re-enable them
explicitly after boot, so that it is on by default and doesn't need to
be handled in local test scripts.

5 months agoconfigure: Fix check ell path for cross compiling
Rudi Heitbaum [Sat, 1 Jul 2023 04:12:52 +0000 (04:12 +0000)]
configure: Fix check ell path for cross compiling

Use of AC_CHECK_FILE prevents cross compilation.
Instead use test to support cross compiling.

5 months agotest-eir: Run tests using bt_ad
Luiz Augusto von Dentz [Wed, 12 Jul 2023 19:36:37 +0000 (12:36 -0700)]
test-eir: Run tests using bt_ad

This enables the same tests done with eir_data using bt_ad.

5 months agoshared/ad: Make use of util_iov_pull_* to parse data
Luiz Augusto von Dentz [Wed, 12 Jul 2023 19:34:20 +0000 (12:34 -0700)]
shared/ad: Make use of util_iov_pull_* to parse data

This makes use of util_iov_pull_* helpers to parse data.

5 months agoshared/util: Introduce strisutf8
Luiz Augusto von Dentz [Tue, 11 Jul 2023 23:45:07 +0000 (16:45 -0700)]
shared/util: Introduce strisutf8

This introduces strisutf8 which can be used to verify if a string is
encoded using UTF-8 format.

5 months agomain: Remove DEFAULT_SIRK
Luiz Augusto von Dentz [Mon, 10 Jul 2023 22:19:24 +0000 (15:19 -0700)]
main: Remove DEFAULT_SIRK

DEFAULT_SIRK is currently not used.

5 months agoshared/ad: Use util_iov_push_* helpers to generate data
Luiz Augusto von Dentz [Mon, 10 Jul 2023 20:27:34 +0000 (13:27 -0700)]
shared/ad: Use util_iov_push_* helpers to generate data

This makes use of util_iov_push_* helpers to generate the data.

5 months agoadvertising: Fix build warning
Luiz Augusto von Dentz [Mon, 10 Jul 2023 19:28:42 +0000 (12:28 -0700)]
advertising: Fix build warning

This fixes the following warning:

src/advertising.c:942:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
        memcpy(cp->data + adv_data_len, scan_rsp, scan_rsp_len);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

5 months agoclient/advetising: Allow use of EA data length
Luiz Augusto von Dentz [Fri, 7 Jul 2023 21:59:24 +0000 (14:59 -0700)]
client/advetising: Allow use of EA data length

The code was supporting a maximum of 25 bytes (31 - 6) to be entered as
advertising data, but in case of EA is used that allows up to 245 bytes
(251 - 6) to be entered.

5 months agoadvertising: Use bt_ad_set_max_len
Luiz Augusto von Dentz [Fri, 7 Jul 2023 21:57:46 +0000 (14:57 -0700)]
advertising: Use bt_ad_set_max_len

This uses bt_ad_set_max_len to properly set the maximum data length of
the bt_ad instances based on what the kernel returns.

5 months agoshared/ad: Fix hardcoding maximum data length
Luiz Augusto von Dentz [Fri, 7 Jul 2023 21:54:56 +0000 (14:54 -0700)]
shared/ad: Fix hardcoding maximum data length

Instances shall not assume BT_AD_MAX_DATA_LEN is always the maximum
length as they could be used with EA which supports bigger length.

5 months agomgmt-tester: Fix tests that consider 31 bytes the max adv lenght
Luiz Augusto von Dentz [Thu, 6 Jul 2023 19:45:17 +0000 (12:45 -0700)]
mgmt-tester: Fix tests that consider 31 bytes the max adv lenght

This fixes a couple of tests that consider 31 bytes the max advertising
length since in case of extended advertising that number is actually
251.

5 months agotest-runner: Add documentation
Luiz Augusto von Dentz [Thu, 6 Jul 2023 23:04:55 +0000 (16:04 -0700)]
test-runner: Add documentation

This adds test-runner.rst documentation with a few examples of how it
can be used to run kernel testers like mgmt-tester and also bluetoothd,
audio and Bluetooth controller plugged in the host system which is quite
useful when trying experimental features such LE Audio, etc.

5 months agoshared/bass: Introduce Add Source opcode handler
Iulia Tanasescu [Thu, 29 Jun 2023 08:07:35 +0000 (11:07 +0300)]
shared/bass: Introduce Add Source opcode handler

This implements the Control Point handler for the Add Source operation.

5 months agobtio: Add options for binding iso broadcast address
Iulia Tanasescu [Thu, 29 Jun 2023 08:07:34 +0000 (11:07 +0300)]
btio: Add options for binding iso broadcast address

This adds additional btio options, to allow binding a socket
to a broadcaster address.

5 months agoplugins/admin: Fix heap-use-after-free when using 2 controllers
Vlad Pruteanu [Tue, 4 Jul 2023 05:56:43 +0000 (08:56 +0300)]
plugins/admin: Fix heap-use-after-free when using 2 controllers

This commit fixes the heap-use-after-free error when connecting 2
controllers. When a controller is connected
admin_policy_adapter_probe is called. If policy_data was already
allocated it gets freed, if not, it only gets allocated. Eventually
add_interface is called. Here policy_data is put in the "data" variable
(specific for each controller) and the process_changes task is called
with idle priority. This function ultimately accesses policy_data from
the "data" variable.

When Bluez crashes the flow is:
1)first controller is attached
2)admin_policy_adapter_probe is called and policy_data is allocated
4)second controller is attached
5)admin_policy_adapter_probe is called and policy_data is freed, then
allocated again
6)process_changes runs and the policy_data for the first controller is
read, but it was already freed, thus the crash

5 months agomonitor: Add decoding support for Sync Receiver events
Claudia Draghicescu [Tue, 4 Jul 2023 07:41:44 +0000 (10:41 +0300)]
monitor: Add decoding support for Sync Receiver events

This commit adds decoding support for PA Sync Established,
BIG Sync Established and BIG Sync Lost events.

5 months agobap: wait for CIG to become configurable before recreating CIS
Pauli Virtanen [Sun, 2 Jul 2023 18:43:05 +0000 (21:43 +0300)]
bap: wait for CIG to become configurable before recreating CIS

ISO sockets cannot be reconnected before all sockets in the same CIG
have been closed, if the CIG was previously active.

Keep track which endpoints have active CIG, and postpone connecting CIS
until their CIG is no longer active.

This addresses getting EBUSY from connect() when multiple CIS in the
same CIG move streaming -> qos at the same time, which disconnects CIS
and recreates them.  The EBUSY originates from COMMAND_DISALLOWED
response to Set CIG Parameters.

This requires the kernel side do the Disconnect CIS / Remove CIG / Set
CIG Parameters HCI command steps in the right order, when all old
sockets are closed first before connecting new ones.

5 months agoshared/bap: detach io for source ASEs only after Stop Ready
Pauli Virtanen [Sun, 2 Jul 2023 18:43:04 +0000 (21:43 +0300)]
shared/bap: detach io for source ASEs only after Stop Ready

The Client may terminate a CIS when sink is in QOS and source in
Disabling states (BAP v1.0.1 Sec 5.6.5).  It may also terminate it when
Receiver Stop Ready has completed successfully (BAP v1.0.1 Sec 5.6.5.1).

It appears Samsung Galaxy Buds2 Pro (R510XXUOAWA5) ignores the Receiver
Stop Ready command if CIS is already disconnected, and then gets stuck
in disabling state. It works if CIS is disconnected after Receiver Stop
Ready.

For better compatibility as client for this device, and since it
shouldn't matter for us in which order we do it, disconnect CIS after
completion of Receiver Stop Ready, instead of immediately in Disabling.

We disconnect also if Receiver Stop Ready fails, given that
disconnecting in Disabled state should be OK.

Link: https://github.com/bluez/bluez/issues/516
5 months agomgmt-tester: Add a regression test hitting hci_sync bug
Pauli Virtanen [Thu, 15 Jun 2023 20:02:51 +0000 (23:02 +0300)]
mgmt-tester: Add a regression test hitting hci_sync bug

Add a test "Add + Remove Device Nowait - Success" that hits a race
condition in kernel hci_sync.c.  On current kernels this causes

BUG: KASAN: slab-use-after-free in hci_update_passive_scan_sync+0x857/0x1230

due to unsafe iteration of hdev->pend_le_conns (in Linux <= 6.4-rc4).

This seems to hit the race condition also without the added emulator
delay (since the emulator runs in the same thread), but it's better to
add the delay since otherwise it'll depend on timings on kernel side.

5 months agodoc/tester-config: enable DEBUG_KERNEL, PROVE_RCU, DEBUG_ATOMIC_SLEEP
Pauli Virtanen [Tue, 4 Jul 2023 17:06:51 +0000 (20:06 +0300)]
doc/tester-config: enable DEBUG_KERNEL, PROVE_RCU, DEBUG_ATOMIC_SLEEP

Add more lock/sleep debugging to the default tester config.

Enable DEBUG_KERNEL since olddefconfig won't enable PROVE_LOCKING
without it. Enable PROVE_RCU to also check RCU usage. Enable
DEBUG_ATOMIC_SLEEP to catch those as well.

5 months agoshared/bap: use only nonzero req->id
Pauli Virtanen [Sun, 2 Jul 2023 19:34:19 +0000 (22:34 +0300)]
shared/bap: use only nonzero req->id

In bap_req_new, use same pattern as elsewhere to not use zero as
a valid id.

5 months agotransport: handle BAP Enabling state correctly when resuming
Pauli Virtanen [Sun, 2 Jul 2023 19:34:18 +0000 (22:34 +0300)]
transport: handle BAP Enabling state correctly when resuming

If BAP stream is in Enabling state when transport acquire is attempted,
we should wait for bap_state_changed to emit the completion event.

transport->resume() is only called with new owner with no
owner->pending, and shall return nonzero completion id on success.
Currently if BAP stream is Enabling, it returns zero which fails the
acquire operation.

To fix this, return valid completion id in this case instead.  Also keep
track of the g_idle_add resume id, so that we don't try to give it to
bt_bap_stream_cancel.

Fixes sound server getting spurious Not Authorized errors when trying to
acquire a pending transport.  This can happen on BAP server: linked
transports become pending when the first of the two enters Streaming. If
sound server tries to acquire the other linked transport whose stream is
still Enabling, the acquire fails (media_owner_free +
btd_error_not_authorized).

Log:
===============================================================
profiles/audio/transport.c:bap_state_changed() stream 0x25c2880: qos(2) -> enabling(3)
...
profiles/audio/transport.c:bap_state_changed() stream 0x25cc590: qos(2) -> enabling(3)
...
src/shared/bap.c:bap_stream_state_changed() stream 0x25cc590 dir 0x01: enabling -> streaming
profiles/audio/bap.c:bap_state() stream 0x25cc590: enabling(3) -> streaming(4)
profiles/audio/transport.c:bap_state_changed() stream 0x25cc590: enabling(3) -> streaming(4)
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1: fd(36) ready
profiles/audio/transport.c:transport_update_playing() /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1 State=TRANSPORT_STATE_IDLE Playing=1
profiles/audio/transport.c:transport_set_state() State changed /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd1: TRANSPORT_STATE_IDLE -> TRANSPORT_STATE_PENDING
profiles/audio/transport.c:transport_set_state() State changed /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd0: TRANSPORT_STATE_IDLE -> TRANSPORT_STATE_PENDING
profiles/audio/transport.c:media_owner_create() Owner created: sender=:1.1242
profiles/audio/transport.c:media_owner_free() Owner :1.1242
===============================================================

5 months agoRelease 5.68
Marcel Holtmann [Fri, 30 Jun 2023 19:39:03 +0000 (21:39 +0200)]
Release 5.68

5 months agotransport: Fix crash on Transport.Acquire
Luiz Augusto von Dentz [Fri, 30 Jun 2023 19:24:54 +0000 (12:24 -0700)]
transport: Fix crash on Transport.Acquire

This fixes crash introduced by 3030883 which caused requests not be
initialized properly for A2DP.

Fixes: https://github.com/bluez/bluez/issues/542

5 months agoRelease 5.67
Marcel Holtmann [Fri, 30 Jun 2023 08:09:06 +0000 (10:09 +0200)]
Release 5.67

5 months agobuild: Use LT_INIT instead of AC_PROG_LIBTOOL
Marcel Holtmann [Fri, 30 Jun 2023 07:35:21 +0000 (09:35 +0200)]
build: Use LT_INIT instead of AC_PROG_LIBTOOL

5 months agobuild: Update library version
Marcel Holtmann [Fri, 30 Jun 2023 07:30:40 +0000 (09:30 +0200)]
build: Update library version

5 months agoshared/bap: Fix handling of codec fields
Luiz Augusto von Dentz [Tue, 27 Jun 2023 23:47:09 +0000 (16:47 -0700)]
shared/bap: Fix handling of codec fields

Codec fields needs to be converted when codec.id is 0xff as the host
endian may not always be little endian.

5 months agoshared/bap: Fix parsing of vendor specific codecs
Luiz Augusto von Dentz [Tue, 27 Jun 2023 16:45:55 +0000 (09:45 -0700)]
shared/bap: Fix parsing of vendor specific codecs

While parsing vendor specific codecs cid and vid fields need to be
converted using le16_to_cpu.

5 months agoandroid: Fix compiler warning from GCC
Marcel Holtmann [Tue, 27 Jun 2023 16:08:19 +0000 (18:08 +0200)]
android: Fix compiler warning from GCC

This ignores the following two warnings from the compiler.

  CC       android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3733:9: error: ‘memcpy’ offset [0, 16] is out of the bounds [0, 0] [-Werror=array-bounds=]
 3733 |         memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  CC       android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3735:9: error: ‘memcpy’ writing 17 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 3735 |         memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It could be possible that these warnings are valid or they might be a
false positive. However since this is Android based code based on
Android HAL headers, just set pragma to ignore them.

5 months agoisotest: Add check after accepting connection
Iulia Tanasescu [Fri, 23 Jun 2023 07:44:06 +0000 (10:44 +0300)]
isotest: Add check after accepting connection

This checks for the POLLERR event on a newly accepted connection,
to determine if the connection was successful or not.

5 months agoiso-tester: Fix checks of latency and interval
Luiz Augusto von Dentz [Fri, 23 Jun 2023 21:17:46 +0000 (14:17 -0700)]
iso-tester: Fix checks of latency and interval

Due to rounding of latency, BAP uses msec while HCI uses slots of
1.25 ms, values may not return an exact match which is fine since the
BAP QoS suggests they are the maximum latency/interval so values bellow
that shall be considered a match.

5 months agobtdev: Fix CIS Established Event parameters
Luiz Augusto von Dentz [Fri, 23 Jun 2023 21:16:02 +0000 (14:16 -0700)]
btdev: Fix CIS Established Event parameters

ISO Interval and Transport Latency were inverted.

5 months agobtdev: Fix LE CIS Established Event
Luiz Augusto von Dentz [Thu, 22 Jun 2023 19:06:17 +0000 (12:06 -0700)]
btdev: Fix LE CIS Established Event

LE CIS Established Event Transport Latency shall follow the formula from
the spec:

 BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 6, Part G
 page 3050:

 Transport_Latency_C_To_P = CIG_Sync_Delay + FT_C_To_P ×
 ISO_Interval - SDU_Interval_C_To_P
 Transport_Latency_P_To_C = CIG_Sync_Delay + FT_P_To_C ×
 ISO_Interval - SDU_Interval_P_To_C

5 months agomonitor: Use get_le24 to convert 24 bits values
Luiz Augusto von Dentz [Wed, 21 Jun 2023 22:05:31 +0000 (15:05 -0700)]
monitor: Use get_le24 to convert 24 bits values

This uses get_le24 to convert 24 bits microseconds values.

5 months agobtdev: Fix CIS Establish ISO Interval
Luiz Augusto von Dentz [Tue, 20 Jun 2023 22:37:35 +0000 (15:37 -0700)]
btdev: Fix CIS Establish ISO Interval

ISO Interval is actually using 1.25 ms slots so it needs to be properly
converted.

5 months agomonitor: Fix decoding of HCI CIS Established Event
Luiz Augusto von Dentz [Tue, 20 Jun 2023 22:35:37 +0000 (15:35 -0700)]
monitor: Fix decoding of HCI CIS Established Event

The ISO Interval is actually using set using 1.25ms slots:

BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
page 2304:

  Time = N * 1.25 ms

5 months agoadapter: Handle Device Found Event with Scan Response flag
Luiz Augusto von Dentz [Tue, 20 Jun 2023 20:37:53 +0000 (13:37 -0700)]
adapter: Handle Device Found Event with Scan Response flag

This handles recently introduced Scan Response flag since that
shouldn't affect connectable flag the device would be considered
connectable but it shall not create a new device by itself.