Commit Graph

489 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
4dea3fb932 client/advertising: Add flag to mark if data is valid
This allows the use of type 0x00 which otherwise could not be selected
since the property would not be exposed even though the data could be
set.
2024-04-19 15:35:10 -04:00
Silviu Florian Barbulescu
a2b2d2e4ab player: Adjust SDU size based on the number of locations
Adjust the SDU size based on the number of locations/channels
that is being requested.
2024-03-22 10:05:38 +00:00
Silviu Florian Barbulescu
bbf198280e Fix crash in iov_append_ltv function
Fix function iov_append_ltv crashes because is not reallocating memory
Use util_ltv_push from util.c

[bluetooth]# [NEW] Endpoint /org/bluez/hci0/pac_bcast0
[bluetooth]# Endpoint /local/endpoint/ep0 registered
endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1
[/local/endpoint/ep0] BIG (auto/value): 0
[/local/endpoint/ep0] Enter channel location (value/no): 3
=================================================================
==80806==ERROR: AddressSanitizer: heap-buffer-overflow on
 address 0x60200000a8ba at pc 0x561971611e0e bp 0x7ffd45ab1f00
 sp 0x7ffd45ab1ef0 WRITE of size 1 at 0x60200000a8ba thread T0
  0x561971611e0d in put_u8 src/shared/util.h:254
  0x561971611e0d in util_iov_push_u8 src/shared/util.c:534
  0x5619715c28f0 in iov_append_ltv client/player.c:3565
  0x5619715c28f0 in config_endpoint_channel_location client/player.c:3593
  0x5619716226ce in bt_shell_release_prompt src/shared/shell.c:744
  0x561971623087 in rl_handler src/shared/shell.c:769
2024-03-22 10:05:38 +00:00
Vlad Pruteanu
e96a7fdd69 client/player: Use util_iov_append instead of iov_append
util_iov_append has been recently created. This implementation
allocates new memory for the appended data, while the old
version of iov_append from client/player.c did not. This could
lead to crashes in some scenarios, such as Unicast.
2024-03-20 09:17:54 +00:00
Vlad Pruteanu
84628e5d10 client/player: Update minimum LC3 SDU size to accommodate 8_1 config
Currently the minimum LC3 SDU size is set to 30B. Thus, if a source
uses the 8_1_1 config which has a SDU size of 26 the sink's capabilities
won't match and the appropriate endpoint won't be created.
2024-03-14 10:45:55 -04:00
Luiz Augusto von Dentz
3ad3678746 client/player: Cleanup broadcast QoS
There is no need to setup broadcast QoS related to PA/BIG as bluetootd
already sets default settings.
2024-03-13 16:55:56 -04:00
Luiz Augusto von Dentz
25f42cfc46 client/player: Use QOS macros from lc3.h to define presets
This makes use of QOS macros for for lc3.h to define preset
configuration and remove existing macros since they were just
duplicates.
2024-03-13 11:12:21 -04:00
Luiz Augusto von Dentz
cae922c63b client/player: Use macros from lc3.h to define presets
This makes use of macros for for lc3.h to define preset configuration
and remove existing macros since they were just duplicates.
2024-03-13 11:08:38 -04:00
Luiz Augusto von Dentz
e35f458342 client/player: Split unicast and broadcast presets
Although their name matches unicast and broadcast are not actually the
same when it comes to RTN and Max Latency, so this splits their settings
into 2 presets tables and fix the values for broadcast.
2024-03-13 11:08:38 -04:00
Iulia Tanasescu
9e9f079e89 client: Add scripts to start broadcast source/sink
This adds sample bluetoothctl scripts for the broadcast source/sink
scenarios.

The broadcast-source.bt script does the full setup: It registers a
broadcast source endpoint, with supported locations as FL/FR and
media context supported. It then configures the endpoint to create
a stereo media stream, for the BIG handle 1. The transport is also
acquired.

The broadcast-sink.bt script registers a broadacast sink endpoint,
supporting FL/FR locations and the media context. It also starts
scanning, and the user is responsible to detect sources and select
which endpoint to config.
2024-03-08 11:11:49 -05:00
Iulia Tanasescu
32e9d15a60 client/adv_monitor: Remove shell quit from adv_monitor_register_app
In adv_monitor, adv_monitor_register_app is called when an advertising
monitor manager proxy has been added, when a new adapter is added.

This commit removes bt_shell_noninteractive_quit from this function,
since it causes the shell to exit without a user command having
executed.
2024-03-08 11:11:49 -05:00
Iulia Tanasescu
352e752636 client/gatt: Quit shell after user input has been processed
Inside gatt_register_service and gatt_register_chrc,
bt_shell_noninteractive_quit should be called after
the input was processed.
2024-03-08 11:11:49 -05:00
Luiz Augusto von Dentz
cb7375fb8a client: Remove Pygments dependency from manpage
This patch removes the Pygments dependency from btmon .rst file.
When the code-block type is specified, the rst2man throws a warning
asking for Pygments package.
2024-03-04 11:45:29 -05:00
Pauli Virtanen
1c60eb02e6 client/player: parse Google's Opus A2DP vendor codec capabilities
Support parsing Opus (Google) A2DP vendor codec capabilities.

Transport /org/bluez/hci0/dev_B8_7B_D4_32_44_15/sep3/fd2
        UUID: 0000110a-0000-1000-8000-00805f9b34fb
        Codec: 0xff (255)
        Media Codec: Vendor Specific A2DP Codec
        Vendor ID 0x000000e0
        Vendor Specific Codec ID 0x0001
        Vendor Specific Data: 0x92
                Vendor Specific Value (Opus [Google])
                Frequencies: 48kHz
                Channel modes: Stereo
                Frame durations: 20 ms
        Device: /org/bluez/hci0/dev_B8_7B_D4_32_44_15
        State: idle
        Delay: 0x0898 (2200)
        Volume: 0x001e (30)
        Endpoint: /org/bluez/hci0/dev_B8_7B_D4_32_44_15/sep3
2024-02-06 17:24:42 -05:00
Luiz Augusto von Dentz
17623000ef client/mgmt: Add missing settings strings
This adds "iso-broadcaster" and "sync-receiver" which were missing.
2024-02-02 10:10:38 -05:00
Iulia Tanasescu
a692cc44dc client/player: Update bcast endpoint input prompts
This updates the input prompts for broadcast endpoint register and
config.

To register a broadcast endpoint, the user will be asked to enter
the supported stream locations and context types.

At broadcast source endpoint config, the user will provide stream
config options: The BIG that the new stream will be part of, the
stream Channel Allocation, and the metadata of the subgroup to
include the stream. These options will be used to configure the
BASE and the BIG.

The flow to create a Broadcast Source is the following:

[bluetooth]# endpoint.register 00001852-0000-1000-8000-
00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] Max Transports (auto/value): a
[/local/endpoint/ep0] Locations: 3
[/local/endpoint/ep0] Supported Context (value): 15
[NEW] Endpoint /org/bluez/hci0/pac_bcast0
Endpoint /local/endpoint/ep0 registered

[bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
/local/endpoint/ep0 16_2_1
[/local/endpoint/ep0] BIG (auto/value): 1
[/local/endpoint/ep0] Enter channel location (value/no): 3
[/local/endpoint/ep0] Enter Metadata (value/no): 0x03 0x02
0x04 0x00

To create a Broadcast Sink, enter the following:

[bluetooth]# endpoint.register 00001851-0000-1000-8000-
00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] Max Transports (auto/value): a
[/local/endpoint/ep0] Locations: 3
[/local/endpoint/ep0] Supported Context (value): 15

[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
2024-01-30 13:32:55 -05:00
Luiz Augusto von Dentz
0273602c19 client/player: Enable endpoint.show to work with local endpoints
This enables local endpoints to be printed with endpoint.show:

[bluetooth]# endpoint.show /local/endpoint/pac_snk/lc3
Endpoint /local/endpoint/pac_snk/lc3
	UUID 00002bc9-0000-1000-8000-00805f9b34fb
	Codec 0x06 (6)
	Capabilities.#0: len 0x03 type 0x01
	Capabilities.Sampling Frequencies: 0x00ff
	Capabilities.Sampling Frequency: 8 Khz (0x0001)
	Capabilities.Sampling Frequency: 11.25 Khz (0x0002)
	Capabilities.Sampling Frequency: 16 Khz (0x0004)
	Capabilities.Sampling Frequency: 22.05 Khz (0x0008)
	Capabilities.Sampling Frequency: 24 Khz (0x0010)
	Capabilities.Sampling Frequency: 32 Khz (0x0020)
	Capabilities.Sampling Frequency: 44.1 Khz (0x0040)
	Capabilities.Sampling Frequency: 48 Khz (0x0080)
	Capabilities.#1: len 0x02 type 0x02
	Capabilities.Frame Duration: 0x03
	Capabilities.Frame Duration: 7.5 ms (0x01)
	Capabilities.Frame Duration: 10 ms (0x02)
	Capabilities.#2: len 0x02 type 0x03
	Capabilities.Audio Channel Count: 0x03
	Capabilities.Audio Channel Count: 1 channel (0x01)
	Capabilities.Audio Channel Count: 2 channel (0x02)
	Capabilities.#3: len 0x05 type 0x04
	Capabilities.Frame Length: 30 (0x001e) - 240 (0x00f0)
	Locations 0x00000003 (3)
	SupportedContext 0x00000fff (4095)
	Context 0x00000fff (4095)
2024-01-30 13:32:27 -05:00
Luiz Augusto von Dentz
74e49f67e9 client/player: Add .name field to struct capabilities
This adds .name field to struct capabilities which is then used to form
the endpoint object path so it is easier to identify the endpoint
capabilities:

[bluetooth]# endpoint.list local
/local/endpoint/pac_snk/lc3
/local/endpoint/pac_src/lc3
/local/endpoint/bcaa/lc3
2024-01-29 16:17:30 -05:00
Luiz Augusto von Dentz
2faff4cadf client/player: Use util_iov_dup/util_iov_free whenever possible
This uses util_iov_dup/util_iov_free whenever possible.
2024-01-29 16:08:15 -05:00
Luiz Augusto von Dentz
423fcc4c4c client/player: Add metadata support to struct capabilities
This enables defining metadata as part of the struct capabilities.
2024-01-29 15:50:47 -05:00
Silviu Florian Barbulescu
ba943aadd0 client/player: Remove hardcoded BASE from player
Remove hardcoded BASE and QoS for broadcast and use the information
from the preset instead.
2024-01-23 10:30:14 -05:00
Emil Velikov
af552cd906 lib: const annotate hci_map instances and related API 2024-01-19 15:45:07 -05:00
Emil Velikov
20864af937 client: annotate struct option instances as const 2024-01-19 15:44:07 -05:00
Luiz Augusto von Dentz
4908e58bd1 player: Fix endpoint.config for broadcast
endpoint.config where taking different arguments for broadcast which is
not recommended with shell as it doesn't support such a thing.

So instead of taking different arguments for broadcast both remote and
local endpoints shall be passed but in case of broadcast source both the
remote and the local endpoint actually refer to the same endpoint
registered by bluetoothctl:

endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep2 16_2_1
2024-01-19 13:12:40 -05:00
Luiz Augusto von Dentz
62cf4a2ab5 client/player: Add support for printing A2DP codec details
This adds support for printing Capabilities and Configuration of A2DP
endpoints and transports:

bluetoothctl> endpoint.show /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep1
Endpoint /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep1
	UUID: 0000110b-0000-1000-8000-00805f9b34fb
	Codec: 0x00 (0)
	Media Codec: SBC
	Channel Modes: Mono DualChannel Stereo JointStereo
	Frequencies: 44.1Khz 48Khz
	Subbands: 4 8
	Blocks: 4 8 12 16
	Bitpool Range: 2-53
	...

bluetoothctl> transport.show /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep1/fd7
Transport /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep1/fd7
	UUID: 0000110a-0000-1000-8000-00805f9b34fb
	Codec: 0x00 (0)
	Media Codec: SBC
	Channel Modes: JointStereo
	Frequencies: 48Khz
	Subbands: 8
	Blocks: 16
	Bitpool Range: 2-53
2024-01-17 16:22:15 -05:00
Luiz Augusto von Dentz
c85546cba7 client/player: Adjust the SDU size based on the number of locations
If there are multiple locations, aka. multiplexing, being selected then
that should be accounted properly on the SDU size since the presets only
account for just 1 channel.

Fixes: https://github.com/bluez/bluez/issues/662
2024-01-04 12:55:13 -05:00
Vinit Mehta
60d60166e4 mgmt: Fix crash after pair command
After pair command, if the user doesn't provide any input on bluetoothctl
CLI interface after receiving the prompt(yes/no) below crash is observed:

dbus[782]: arguments to dbus_message_get_no_reply() were incorrect,
assertion "message != NULL" failed in file
/usr/src/debug/dbus/1.14.10-r0/dbus/dbus-message.c line 3250.
This is normally a bug in some application using the D-Bus library.
/usr/lib/libc.so.6(+0x27534) [0xffffa1b67534]
/usr/lib/libc.so.6(__libc_start_main+0x9c) [0xffffa1b6760c]
bluetoothctl(+0x188f0) [0xaaaac9c088f0]
Aborted (core dumped)
2024-01-03 15:59:23 -05:00
Paul Otto
c623de844c client: Add initial manpage of bluetoothctl
This page was accidently not added in the recent documentation update.
2023-12-18 16:28:47 -05:00
Luiz Augusto von Dentz
e01208dac6 client/player: Use ChannelAllocation given on SelectProperties
This makes use of ChannelAllocation when present on SelectProperties
dictionary which is then passed on to bluetoothd and send over as part
of Codec Configuration:

< ACL Data TX: Handle 2048 flags 0x00 dlen 109
      ATT: Write Command (0x52) len 104
        Handle: 0x0098 Type: ASE Control Point (0x2bc6)
          Data: 0104050202060000000010020103020201030428000503010000000
	  6020206000000001002010302020103042800050302000000010202060000
	  0000100201030202010304280005030100000002020206000000001002010
	  302020103042800050302000000
            Opcode: Codec Configuration (0x01)
            Number of ASE(s): 4
            ASE: #0
            ASE ID: 0x05
            Target Latency: Balance Latency/Reliability (0x02)
            PHY: 0x02
            LE 2M PHY (0x02)
            Codec: LC3 (0x06)
            Codec Specific Configuration: #0: len 0x02 type 0x01
              Sampling Frequency: 16 Khz (0x03)
            Codec Specific Configuration: #1: len 0x02 type 0x02
              Frame Duration: 10 ms (0x01)
            Codec Specific Configuration: #2: len 0x03 type 0x04
              Frame Length: 40 (0x0028)
            Codec Specific Configuration: #3: len 0x05 type 0x03
           Location: 0x00000001
              Front Left (0x00000001)
            ASE: #1
            ASE ID: 0x06
            Target Latency: Balance Latency/Reliability (0x02)
            PHY: 0x02
            LE 2M PHY (0x02)
            Codec: LC3 (0x06)
            Codec Specific Configuration: #0: len 0x02 type 0x01
              Sampling Frequency: 16 Khz (0x03)
            Codec Specific Configuration: #1: len 0x02 type 0x02
              Frame Duration: 10 ms (0x01)
            Codec Specific Configuration: #2: len 0x03 type 0x04
              Frame Length: 40 (0x0028)
            Codec Specific Configuration: #3: len 0x05 type 0x03
           Location: 0x00000002
              Front Right (0x00000002)
            ASE: #2
            ASE ID: 0x01
            Target Latency: Balance Latency/Reliability (0x02)
            PHY: 0x02
            LE 2M PHY (0x02)
            Codec: LC3 (0x06)
            Codec Specific Configuration: #0: len 0x02 type 0x01
              Sampling Frequency: 16 Khz (0x03)
            Codec Specific Configuration: #1: len 0x02 type 0x02
              Frame Duration: 10 ms (0x01)
            Codec Specific Configuration: #2: len 0x03 type 0x04
              Frame Length: 40 (0x0028)
            Codec Specific Configuration: #3: len 0x05 type 0x03
           Location: 0x00000001
              Front Left (0x00000001)
            ASE: #3
            ASE ID: 0x02
            Target Latency: Balance Latency/Reliability (0x02)
            PHY: 0x02
            LE 2M PHY (0x02)
            Codec: LC3 (0x06)
            Codec Specific Configuration: #0: len 0x02 type 0x01
              Sampling Frequency: 16 Khz (0x03)
            Codec Specific Configuration: #1: len 0x02 type 0x02
              Frame Duration: 10 ms (0x01)
            Codec Specific Configuration: #2: len 0x03 type 0x04
              Frame Length: 40 (0x0028)
            Codec Specific Configuration: #3: len 0x05 type 0x03
           Location: 0x00000002
              Front Right (0x00000002)
2023-12-15 11:08:29 -05:00
Luiz Augusto von Dentz
477c41c683 client/player: Fix not prompting all parameter on endpoint.register
When Auto Accept is not enable not all parameters are requested.
2023-12-08 17:12:53 -05:00
Luiz Augusto von Dentz
813e1ce119 client/player: Add presets from GMAP
This adds the following presets from GMAP:

16_1_gs
16_2_gs
32_1_gs
32_2_gs
48_1_gs
48_2_gs
32_1_gr
32_2_gr
48_1_gr
48_2_gr
48_3_gr
48_4_gr
32_1_gr_l+r
32_2_gr_l+r
48_1_gr_l+r
48_2_gr_l+r
48_3_gr_l+r
48_4_gr_l+r
2023-11-22 15:58:36 -05:00
Paul Otto
4b353ae99a client: Add bluetoothctl-transport.1 man page
This adds bluetoothctl-transport.rst which is then converted to
bluetoothctl-transport.1 using rst2man.
2023-11-14 13:29:19 -05:00
Paul Otto
c0678a4ddc client: Add bluetoothctl-scan.1 man page
This adds bluetoothctl-scan.rst which is then converted to
bluetoothctl-scan.1 using rst2man.
2023-11-14 13:21:44 -05:00
Paul Otto
3797cedadb client: Add bluetoothctl-player.1 man page
This adds bluetoothctl-player.rst which is then converted to
bluetoothctl-player.1 using rst2man.
2023-11-14 13:04:22 -05:00
Paul Otto
fa5fb919a9 client: Add bluetoothctl-gatt.1 man page
This adds bluetoothctl-gatt.rst which is then converted to
bluetoothctl-gatt.1 using rst2man.
2023-11-14 12:37:53 -05:00
Paul Otto
face899cd8 client: Add bluetoothctl-endpoint.1 man page
This adds bluetoothctl-endpoint.rst which is then converted to
bluetoothctl-endpoint.1 using rst2man.
2023-11-14 11:06:04 -05:00
Paul Otto
6c446bdd32 client: Add bluetoothctl-advertise.1 man page
This adds bluetoothctl-advertise.rst which is then converted to
bluetoothctl-advertise.1 using rst2man.
2023-11-14 10:56:57 -05:00
Paul Otto
0d65d6862a client: Add bluetoothctl-admin.1 man page
This adds bluetoothctl-admin.rst which is then converted to
bluetoothctl-admin.1 using rst2man.
2023-11-13 14:33:47 -05:00
Jonas Dreßler
7ef40617a0 client: Invalidate scan filter on "scan" command
The "scan bredr" and "scan le" commands are broken right now because the
transport filter gets set, but not actually invalidated.

Invalidate the filter with `filter.set = false` so that it actually gets
updated when set_discovery_filter() is called afterwards.
2023-11-13 14:01:16 -05:00
Luiz Augusto von Dentz
e126cf2049 client: Add support for setting Locations, SupportedContext and Context
This adds proper defaults for Locations, SupportedContext and Context
properties since bluetoothd no longer automatically set proper
defaults.
2023-10-20 16:25:31 -07:00
Luiz Augusto von Dentz
8a335099bc client: Make use of bap-debug functions
This make use of bap-debug functions to decode Capabilities,
Configuration and Metadata.
2023-10-20 11:05:08 -07:00
Luiz Augusto von Dentz
f253711c0e client: Print Manufacturer and Version on show command
This enables show to print the Manufaturer and Version information if
available:

bluetoothctl> show
...
	Manufacturer: 0x0002 (2)
	Version: 0x0b (11)
2023-10-04 12:40:04 -07:00
Luiz Augusto von Dentz
9741e47aeb client/mgmt: Fix registering pairing callbacks
Don't register pairing callbacks until mgmt.pair is called otherwise it
may take over the role of pairing agent when bluetoothctl agent is in
use.
2023-10-03 14:15:12 -07:00
Luiz Augusto von Dentz
8e5142a1fa client: Make endpoint.show print ISO specific capabilities
This makes endpoint.show print Locations, SupportedContext, Context and
Qos capabilities.
2023-09-28 17:25:43 -07:00
Luiz Augusto von Dentz
1c79a45667 client: Make Endpoint.SelectProperties reply properly
This makes Endpoint.SelectProperties reply with QoS property since it
is now a single property.
2023-09-28 17:25:43 -07:00
Luiz Augusto von Dentz
d1bb05e3ed client: Make transport.show to print QoS configuration
This makes transport.show to print QoS configuration since it is now a
single property:

transport.show <transport>
Transport /org/bluez/hci0/dev_00_AA_01_01_00_03/pac_sink0/fd1
	UUID: 00002bcb-0000-1000-8000-00805f9b34fb
	Codec: 0x06 (6)
	Configuration:
  02 01 03 02 02 01 03 04 28 00                    ........(.
	Device: /org/bluez/hci0/dev_00_AA_01_01_00_03
	State: idle
	Endpoint: /org/bluez/hci0/dev_00_AA_01_01_00_03/pac_sink0
	QoS Key: CIG
	QoS Value: 0x00 (0)
	QoS Key: CIS
	QoS Value: 0x00 (0)
	QoS Key: Framing
	QoS Value: 0x00 (0)
	QoS Key: PresentationDelay
	QoS Value: 0x00009c40 (40000)
	QoS Key: Interval
	QoS Value: 0x00002710 (10000)
	QoS Key: Latency
	QoS Value: 0x000a (10)
	QoS Key: SDU
	QoS Value: 0x0028 (40)
	QoS Key: PHY
	QoS Value: 0x02 (2)
	QoS Key: Retransmissions
	QoS Value: 0x02 (2)
	Location: 0x00000003 (3)
	Links: /org/bluez/hci0/dev_00_AA_01_01_00_03/pac_source0/fd0
2023-09-28 17:25:43 -07:00
Luiz Augusto von Dentz
771b19e196 transport: Implement QoS property
This implements Transport.QoS as a dict instead of listing each field as
a individual property.
2023-09-28 17:25:43 -07:00
Claudia Draghicescu
0a824ce8f6 client/player: Remove Broadcast parameter
Remove unused gdbus parameter.
Fix length for Codec Specific Configuration.
2023-08-23 14:33:59 -07:00
Luiz Augusto von Dentz
35c706f398 client: Add agent auto argument support
This adds "auto" capability which behaves like "on" but instead of
asking user to confirm/autorize it automatically accepts, which is
not secure to be used thus a warning is printed when user selects it.

Usage:

  [bluetoothctl]# agent auto
  Warning: setting auto response is not secure, it bypass user
  confirmation/authorization, it shall only be used for test automation.

  or

  client/bluetoothctl -a auto
2023-08-23 13:49:00 -07:00
Claudia Draghicescu
4352a42ec1 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
2023-08-08 15:10:05 -07:00
Silviu Florian Barbulescu
1dbd9ba1f1 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.
2023-07-31 10:33:25 -07:00
Luiz Augusto von Dentz
82d3d803d4 client: Add bluetoothctl-monitor.1 man page
This adds bluetoothctl-monitor.rst which is then converted to
bluetoothctl-mgmt.1 using rst2man.
2023-07-20 11:14:42 -07:00
Luiz Augusto von Dentz
f0bfd76280 client: Add bluetoothctl-mgmt.1 man page
This adds bluetoothctl-mgmt.rst which is then converted to
bluetooth-mgmt.1 using rst2man.
2023-07-20 11:14:31 -07:00
Luiz Augusto von Dentz
2b063f47ab 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.
2023-07-14 15:14:02 -07:00
Luiz Augusto von Dentz
4578395b53 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.
2023-07-10 12:24:47 -07:00
Luiz Augusto von Dentz
8f525dbccd client/player: Fix transport.acquire for linked transports
Linked (bi-directional) transports can be acquired on single D-Bus
method call which was not being handled properly by the current code
causing unexpected errors.
2023-06-20 12:54:23 -07:00
Luiz Augusto von Dentz
0053bc5472 client/player: Fix auto registration of broadcast endpoint
For broadcast endpoint broadcast must be set properly.
2023-06-20 12:54:23 -07:00
Luiz Augusto von Dentz
2c9ab2d3f4 client: Print integers decimal value
This make the code print D-Bus integer iterators also in decimal format
in addition to hexadecimal.
2023-06-20 12:54:23 -07:00
Silviu Florian Barbulescu
eb821743f9 client/player: Add support for broadcast source
This adds bluetoothctl support for broadcast source.
To test the current implementation use bluetoothctl with the commands:
endpoint.register 00001852-0000-1000-8000-00805f9b34fb 0x06
endpoint.config <created endpoint> <local endpoint> 16_2_1
transport.acquire <created transport>
transport.send <created transport> <file.wav>
2023-06-07 16:03:10 -07:00
Luiz Augusto von Dentz
f3977023f9 client/player: Add codec as parameter to endpoint.presets
This changes endpoint.presets command to take codec as parameter.
2023-05-12 13:31:53 -07:00
Luiz Augusto von Dentz
1707c35771 client/player: Fix not checking for SupportedUUIDs
When registering an endpoint it should always check for SupportedUUIDs.
2023-05-12 13:31:53 -07:00
Luiz Augusto von Dentz
fe16cf2a7e client/player: Add support to Max Transports in endpoint.register
[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] Max Transports (auto/value): 1
[/local/endpoint/ep0] CIG (auto/value): a
[/local/endpoint/ep0] CIS (auto/value): a
2023-05-12 13:31:53 -07:00
Luiz Augusto von Dentz
67fd8479f1 client/player: Fix crashes accessing metadata
If metadata is not set the respective iovec is left NULL so it needs to
be checked before accessing its fields.
2023-05-12 13:31:53 -07:00
Luiz Augusto von Dentz
416b8375ff client/player: Fix crash when RegisterEndpoint fails
If RegisterEndpoint fails when there are multiple adapters it would
attempt to free the same endpoint multiple times.
2023-05-01 12:27:20 -07:00
Abhay Maheta
f9376b13b3 client/player: Add support for Metadata in BAP Profile
This adds support for Metadata in BAP profile.
In order to register zero Metadata, 0 shall be
entered when prompted.

[bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06
[/local/endpoint/ep0] Enter Metadata (value/no): n
[/local/endpoint/ep0] Auto Accept (yes/no): y
[/local/endpoint/ep0] CIG (auto/value): a
[/local/endpoint/ep0] CIS (auto/value): a
Capabilities:
  03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00  ................
Endpoint /local/endpoint/ep0 registered
2023-04-28 16:07:41 -07:00
Luiz Augusto von Dentz
070c78c426 client/advertising: Add support for advertise.rsi command
This adds support for advertise.rsi command which can be used to request
the generation of RSI and include it as part of advertising data:

[bluetooth]# advertise.rsi --help
Show/Enable/Disable RSI to be advertised
Usage:
	 rsi [on/off]
[bluetooth]# advertise.rsi
RSI: on
[bluetooth]# advertise on
...
Advertising object registered
Tx Power: off
Name: off
Appearance: off
Discoverable: on
RSI: on
[bluetooth]#
2023-04-05 17:00:00 -07:00
Iulia Tanasescu
c4d9b99db5 Split bt_iso_qos into dedicated structures
Split bt_iso_qos into dedicated unicast and broadcast
structures and add additional broadcast parameters.
2023-03-31 14:33:28 -07:00
Luiz Augusto von Dentz
fb1c694100 client: Add samples init scripts
This adds sample init scripts that can be passed to bluetoothctl for
testing.
2023-03-24 16:52:45 -07:00
Luiz Augusto von Dentz
815f779aa8 client: Use AdvertisingFlags when available
This prints devices not discoverable in grey so the user are able to
distict when for example set members are actually visible.
2023-03-10 13:41:06 -08:00
Luiz Augusto von Dentz
373bafc34c client: Add support for DeviceSet proxy 2023-03-10 13:41:06 -08:00
Luiz Augusto von Dentz
31ab084f07 client/player: Update High Reliability presets
This updates High Reliability presets as published in BAP 1.0.1:

https://www.bluetooth.com/specifications/bap-1-0-1/
2023-03-10 13:41:06 -08:00
Luiz Augusto von Dentz
24aeb31961 client: Allow transport.send command to work with multiple transports
This enables transport.send to work with multiple transports instead of
sending one by one which can create synchronization problems.
2023-03-02 12:19:39 -08:00
Luiz Augusto von Dentz
dcbdf5e67f media: Rework support of Vendor to use uint32_t as type
This reworks the handlings of Vendor property to use a single uint32_t.
2023-01-31 17:07:31 -08:00
Abhay Maheta
33d99e12c3 client/player: Add support for Company ID, Vendor ID
This adds support for Company ID and Vendor Codec ID in  BAP profile.
This also adds handling of Vendor Specific Coding format for BAP
Profile.

Now it allows to enter zero codec capabilities for vendor codec.
In order to register zero codec capabilities, 0 shall be
entered when prompted.
2023-01-31 17:07:31 -08:00
Luiz Augusto von Dentz
1270afa5aa client/player: Fix transport.send/receice tab completion
Commands transport.send/receive were not settings any completion
callback so this makes sure it uses transport_generator to generate the
list of transport that could be used to send.
2022-12-15 13:07:41 -08:00
Luiz Augusto von Dentz
318b1a19cb client/player: Print transport progress
This uses bt_shell_echo to print out the transfer progress on the echo
area.
2022-12-15 13:04:45 -08:00
Luiz Augusto von Dentz
e51d6c5f2e client/player: Use bt_shell_echo to print transfer progress
This uses bt_shell_echo to print transfer progress.
2022-12-15 13:04:33 -08:00
Luiz Augusto von Dentz
89b2072b4f client/player: Make transport.send non-blocking
This makes transport.send command non-blocking by using timerfd
callback to initiate the transfers.
2022-12-14 13:26:40 -08:00
Luiz Augusto von Dentz
e07c1e723e client/player: Fix not calculating time to wait
The difference of time start and current time may have advanced just
enough to add a second leaving start nanoseconds to be bigger.
2022-12-09 13:24:16 -08:00
Luiz Augusto von Dentz
9a550d43b8 client: Allow gatt.select-attribute to work with local attributes
This allows gatt.select-attribute local to select from the registered
attributes:

[bluetooth]# gatt.select-attribute local /org/bluez/app/service0/chrc0
[/org/bluez/app/service0/chrc0]# gatt.write 0x01
[CHG] Attribute /org/bluez/app/service0/chrc0 (%UUID) written
[/org/bluez/app/service0/chrc0]# gatt.read
01                                               .
[/org/bluez/app/service0/chrc0]# gatt.select-attribute local
 /org/bluez/app/service0/chrc1
[/org/bluez/app/service0/chrc1]# gatt.write 0x01
[CHG] Attribute /org/bluez/app/service0/chrc1 (%UUID) written
[/org/bluez/app/service0/chrc1]# gatt.read
01                                               .
[/org/bluez/app/service0/chrc1]#
2022-12-06 13:01:28 -08:00
Luiz Augusto von Dentz
a4bde19d3b client: Move common print_* functions to its own file
This move common print_* functions to its own file so they can be
properly reused instead of duplicating the code.
2022-12-02 11:20:26 -08:00
Luiz Augusto von Dentz
7642669e44 client/player: Add support for custom preset
This adds support for a custom preset which asks the user to enter its
configuration:

[bluetooth]# endpoint.presets 00002bc9-0000-1000-8000-00805f9b34fb custom
[Codec] Enter frequency (Khz): 48
[Codec] Enter frame duration (ms): 10
[Codec] Enter channel allocation: 0x000000003
[Codec] Enter frame length: 100
[QoS] Enter Target Latency (Low, Balance, High): Low
[QoS] Enter SDU Interval (us): 10000
[QoS] Enter Framing (Unframed, Framed): Unframed
[QoS] Enter PHY (1M, 2M): 2M
[QoS] Enter Max SDU: 200
[QoS] Enter RTN: 3
[QoS] Enter Max Transport Latency (ms): 20
[QoS] Enter Presentation Delay (us): 10000
2022-12-02 11:19:53 -08:00
Luiz Augusto von Dentz
5a872af406 client/player: Fix scan-build warning
This fixes the following warning:

client/player.c:1775:25: warning: Dereference of null pointer
[core.NullDereference]
iov_append(&cfg->caps, preset->data.iov_base, preset->data.iov_len);
                        ^~~~~~~~~~~~~~~~~~~~~
2022-11-21 13:03:04 -08:00
Luiz Augusto von Dentz
c8836711ad client: Fix advertise.data command
advertise.data when no parameter is given shall print what is set on
ad.data not the ad.manufacturer which is a different field set by
advertise.manufacturer.
2022-10-20 15:55:55 -07:00
Luiz Augusto von Dentz
25a31f5a93 client/player: Fix attempting to acquire already acquired transport
If the transport has links check if the link is acquiring before
attempting to call Acquire otherwise it may cause an error to be
printed.
2022-09-29 13:58:41 -07:00
Christian Eggers
7b07f1f980 client/player: fix printf format string
Use macros from inttypes.h for correct printf format specifier for
int64_t
2022-09-26 10:57:00 -07:00
Luiz Augusto von Dentz
6c71203056 client/gatt: Fix scan-build warning
This fixes the following warning:

client/gatt.c:2146:2: warning: Null pointer passed to 2nd parameter
expecting 'nonnull' [core.NonNullParamChecker]
        memcpy(*dst_value + offset, src_val, src_len);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-23 13:47:10 -07:00
Christian Eggers
ee750bbaf6 client/gatt: proxy_property_changed: check for NULL iterator
The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--client/gatt.c::proxy_property_changed(..., ..., iter, ...);
      +--dbus_message_iter_get_arg_type(iter);
...
2022-09-23 13:42:49 -07:00
Luiz Augusto von Dentz
c2734c41f7 client/gatt: Fix notification enabled/disabled output
When notifications are enabled/disable the output was not print a new
line.
2022-09-21 14:45:03 -07:00
Bastien Nocera
48992da64f client: Print the PowerState property 2022-09-01 11:43:41 -07:00
Luiz Augusto von Dentz
d8febc76a4 client/player: Fix checkpatch warning
This fixes the following checkpatch warning:

WARNING:LINE_SPACING: Missing a blank line after declarations
216: FILE: client/player.c:625:
+               GDBusProxy *proxy = l->data;
+               print_player(proxy, NULL);
2022-08-30 14:24:08 -07:00
Luiz Augusto von Dentz
d297a5873d client: Add -e/--endpoint option to auto register endpoints
This adds -e/--endpoint option that can be used to auto register
supported endpoints.
2022-08-29 14:36:06 -07:00
Christian Eggers
147cc4cf99 client/advertising: Fix typos: *_exits --> *_exists 2022-08-29 13:06:23 -07:00
Christian Eggers
9b93d95884 client: Add missing return statement in error path
Client will SEGFAULT if default_ctrl==NULL
2022-08-29 13:06:14 -07:00
Luiz Augusto von Dentz
9e298f8402 client/player: Use QoS interval on transport.send
This makes use of QoS interval when sending a file.
2022-08-29 12:43:05 -07:00
Luiz Augusto von Dentz
dc61ec4419 client/player: Add support for PACS endpoints
This adds support for PAC_SINK and PAC_SOURCE endpoints as well as LC3
presets.
2022-08-29 12:43:05 -07:00
Luiz Augusto von Dentz
64abbf7cee client: Move admin submenu
This moves admin submenu to admin.c so it is not mixed up with other
submenus code.
2022-08-15 16:28:14 -07:00
Luiz Augusto von Dentz
6270ad35b2 client: Fix build warning
This fixes the following build warning:

      warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead
      [-Wdeprecated-declarations]
2022-07-05 10:31:39 -07:00
Luiz Augusto von Dentz
7f92f75e88 client/advertising: Fixes errors found by scan-build
This fixes the following errors:

client/advertising.c:129:4: warning: Value stored to 'n' is never read
[deadcode.DeadStores]
                        n = sizeof(str) - 1;
                        ^   ~~~~~~~~~~~~~~~
client/advertising.c:1012:25: warning: Dereference of null pointer
(loaded from variable 'min') [core.NullDereference]
        if (ad.min_interval != *min) {
                               ^~~~
2022-06-22 11:16:18 -07:00
Luiz Augusto von Dentz
33c96ca658 client/player: Fixes errors found by scan-build
This fixes the following errors:

client/player.c:1406:44: warning: Dereference of null pointer
[core.NullDereference]
        reply = endpoint_select_config_reply(msg, p->data.iov_base,
                                                  ^~~~~~~~~~~~~~~~
client/player.c:1866:2: warning: 3rd function call argument is an
uninitialized value [core.CallAndMessage]
        iov_append(&cfg->caps, data, len);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-06-22 11:09:04 -07:00