Commit Graph

350 Commits

Author SHA1 Message Date
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
Luiz Augusto von Dentz
e4fd2dc5aa client/player: Enable acquiring multiple transports
This enables acquiring multiple transports simultaneously.
2022-06-22 11:00:55 -07:00
Gopal Tiwari
b4233bca18 client/gatt: Fix memory leak issues
While performing the static tool analysis using coverity tool
found following reports

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:1531: leaked_storage: Variable "service"
going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2626: leaked_storage: Variable "chrc"
going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
bluez-5.64/client/gatt.c:2906: leaked_storage: Variable "desc"
going out of scope leaks the storage it points to.
2022-05-31 12:48:33 -07:00
Inga Stotland
79fe529d64 client: Fix setting of advertisement interval
This fixes incorrect argument read when using "interval" command
in "advertisement" submenu
2022-05-23 13:47:15 -07:00
Zhengping Jiang
bda2a9e6f9 client: Add filter to devices and show Bonded in info
Use the property name as optional filters to the command "devices" and
show the "Bonded" property for the command "info".

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
2022-05-04 14:56:05 -07:00
Luiz Augusto von Dentz
7a87497da4 client/player: Add transport.receive command
This adds transport.receive command:

Get/Set file to receive
Usage:
	 receive [filename]
2022-04-26 11:03:26 -07:00
Luiz Augusto von Dentz
dd5b66695c client/player: Add transport.volume command
This adds transport.volume command:

Get/Set transport volume
Usage:
	 volume <transport> [value]
2022-04-22 16:01:29 -07:00
Luiz Augusto von Dentz
b2db8f0e3a client/player: Fix use of unsupported config_qos
QoS is not yet supported by bluetoothd so remove them.
2022-04-18 16:57:49 -07:00
Luiz Augusto von Dentz
777bc7c3f5 client/player: Add transport menu
This adds transport menu:

[bluetooth]# menu transport
Menu transport:
Available commands:
-------------------
list                                              List available transports
show <transport>                                  Transport information
acquire <transport>                               Acquire Transport
release <transport>                               Release Transport
send <filename>                                   Send contents of a file
2022-04-14 17:05:25 -07:00
Luiz Augusto von Dentz
46f171a86c client/player: Add endpoint menu
This adds endpoint menu:

[bluetooth]# menu endpoint
Menu endpoint:
Available commands:
-------------------
list [local]                                      List available endpoints
show <endpoint>                                   Endpoint information
register <UUID> <codec> [capabilities...]         Register Endpoint
unregister <UUID/object>                          Register Endpoint
config <endpoint> <local endpoint> [preset]       Configure Endpoint
presets <UUID> [default]                          List available presets
2022-04-14 17:05:24 -07:00
Luiz Augusto von Dentz
d204e84c06 client: Add support for player submenu
This moves adds the functionality of bluetooth-player into
bluetoothctl.
2022-03-30 12:54:29 -07:00
Luiz Augusto von Dentz
18af5f4faf client: Add support for scan <le/bredr>
This adds support for entering the transport directly as an scan
argument rather than having to first set it scan.transport.
2022-03-02 16:30:11 -08:00
Luiz Augusto von Dentz
cfab569484 build: Replace use of g_memdup with util_memdup
This replaces the uses of g_memdup with util_memdup since the former has
been deprecated:

  warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead
  [-Wdeprecated-declarations]

g_memdup2 requires bumping glib version which would likely have its
own problems thus why util_memdup was introduced.
2022-01-06 12:58:39 -08:00
Ulisses Costa
433f7cce3b client/gatt: Fix property_change in WriteValue for desc
g_dbus_emit_property_changed was not working properly in the WriteValue
for the descriptor because the Characteristic interface was being used.
2021-12-07 18:48:46 -08:00
Tedd Ho-Jeong An
6ea642f6ef client: Fix uninitiailzed scalar variable
This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.
2021-11-15 13:07:08 -08:00
Luiz Augusto von Dentz
8d2b847b00 client/gatt: Fix using atoi
atoi doesn't support values entered in hexadecimal (0x...) which is
likely the prefered format for the likes of handles, etc, so this
replaces the uses of atoi with strtol.
2021-11-09 14:45:23 -08:00
Miao-chen Chou
f4151f35b2 client: Print error code for connect methods
The following steps were performed.
- Issuing repeated commands to connect the same BLE device.
- Verifying the print in bluetoothctl console

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:56 -07:00
Luiz Augusto von Dentz
1e9ce5ed80 client: Print MTU on attribute-info
This prints the MTU of the characteristic when available.
2021-09-28 16:53:08 -07:00
Archie Pusaka
28a5c47650 client: Inclusive language changes
Use "parent" to describe dbus hierarchy.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2021-09-21 10:51:54 +02:00
Luiz Augusto von Dentz
b84f294cb1 client: Add support for printing ExperimentalFeatures property
Thid adds support to show command to print ExperimentalFeatures property:

[bluetooth]# show
Controller ...
	Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)
2021-09-08 14:12:58 -07:00
Yun-Hao Chung
bb0714be21 client: add AffectedByPolicy property
This prints property AffectedByPolicy in device info if
org.bluez.AdminPolicyStatus1 exists.

This also rename find_battery_by_path to find_proxies_by_path to reuse
the function.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
2021-08-11 11:18:22 -07:00
Yun-Hao Chung
4f3adc7bef client: add admin submenu and allow command
This creates a menu - admin and add a commands to bluetoothctl
- allow [clear/uuid1 uuid2 ...]

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
2021-08-11 11:18:22 -07:00
Luiz Augusto von Dentz
f287a42cd6 client/advertising: Fix not disabling local-name in Includes
When setting a advertising.name other than on/off it shall also disable
local-name flag from Includes as that would cause an error when parsed
by the daemon.
2021-08-10 14:59:12 -07:00
Luiz Augusto von Dentz
c3159848b9 client: Fix advertise broadcast
When advertising with type broadcast it cannot be discoverable as that
would require setting flags which is not allowed by the spec.
2021-05-14 17:25:52 -07:00
Luiz Augusto von Dentz
4e7780d0eb client/advertising: Add support for setting min/max intervals
This adds support for setting MinInterval/MaxInterval.
2021-05-13 13:26:13 -07:00
Daniel Winkler
0b8e166fd8 client: Add adv SupportedFeatures to bluetoothctl
This change adds SupportedFeatures to be shown in "show" option of
bluetoothctl. It was tested with and without kernel support for features
to verify that they are shown or not shown correctly.

Change was tested by verifying SupportedFeatures were populated
correctly in bluetoothctl on hatch and kukui chromebooks

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
2021-03-17 11:30:27 -07:00
Archie Pusaka
ad02a4eddb bluetoothctl: advmon rssi support for mgmt
Using the new opcode MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI to
monitor advertisement according to some RSSI criteria.
2021-01-15 11:55:06 -08:00
Manish Mandlik
fa53b7018b client: Use correct root path for RegisterMonitor
Bluetoothctl uses "/" as the app root path. So, use the same
app root path while invoking RegisterMonitor method. This will
also ensure that InterfacesAdded/InterfacesRemoved signals are
emitted on the correct app root path.
2020-12-02 21:09:07 -08:00
Inga Stotland
c29a438abe client: Remove reference to g_steal_pointer()
In order to avoid requiring higher version of GLib, replace
g_steal_pointer() with explicitly setting the pointer value
to NULL.
2020-11-09 13:54:06 -08:00
Daniel Winkler
664c55440b client: Add SupportedCapabilities to bluetoothctl
This patch adds the new "SupportedCapabilities" property to the
bluetoothctl "show" view.

The change is tested by verifying bluetoothctl shows the desired
properties.
2020-10-29 17:45:40 -07:00
Tedd Ho-Jeong An
f22f166d6e client: Add SPDX License Identifier
This patch adds SPDX License Identifier and removes the license text.

-------------------------------------
       License            COUNT
-------------------------------------
 GPL-2.0-or-later     :      11

License: GPL-2.0-or-later
   client/adv_monitor.c
   client/adv_monitor.h
   client/advertising.h
   client/display.c
   client/main.c
   client/display.h
   client/agent.h
   client/gatt.c
   client/agent.c
   client/advertising.c
   client/gatt.h
2020-09-21 16:19:33 -07:00
Howard Chung
d465c70f9b client: Expose ADV monitor objects
This adds logic to expose user-defined advertisement monitor to dbus and
also implements methods for exposed objects.
2020-09-16 09:38:14 -07:00
Howard Chung
566db0ed69 client: Implement more interfaces of ADV monitor in bluetoothctl
This patch creates a submenu in bluetoothctl and implements several
commands.

new commands:
[bluetooth]# menu monitor
[bluetooth]# add-or-pattern 1 2 ab0011
Advertisement Monitor 0 added
[bluetooth]# add-or-pattern-rssi -80, ,5 1 2 aa 3 4 ff
Advertisement Monitor 1 added
[bluetooth]# get-pattern all
Advertisement Monitor 0
	path: /org/bluez/adv_monitor_app/0
	type: or_patterns
	pattern 1:
		start position: 1
		AD data type: 2
		content: ab0011
Advertisement Monitor 1
	path: /org/bluez/adv_monitor_app/1
	type: or_patterns
	rssi:
		high threshold: -50
		high threshold timer: 5
		low threshold: -80
		low threshold timer: 5
	pattern 1:
		start position: 1
		AD data type: 2
		content: aa
	pattern 2:
		start position: 3
		AD data type: 4
		content: ff
[bluetooth]# get-supported-info
Supported Features:
Supported Moniter Types: or_patterns
[bluetooth]# remove-pattern 0
Monitor 0 deleted
2020-09-16 09:38:03 -07:00
Howard Chung
664e10ff7e client: Implement basic interface of ADV monitor in bluetoothctl
This patch implements some basic functions for ADV monitor in
bluetoothctl

[bluetooth]# show
...
Advertisement Monitor Features:
	SupportedMonitorTypes: or_patterns
2020-09-16 09:37:42 -07:00
Barry Byford
c24db50c43 client: Fix typo in bluetoothctl 2020-08-31 10:33:48 -07:00
Miao-chen Chou
4d0336ea40 client: Add cancel-pairing command
This adds cancel-pairing command which can be used to cancel the ongoing
pairing.
2020-08-21 10:50:04 -07:00
Alain Michaud
615d82331d client: Add support for the Roles property.
This adds support for reading the Roles property through bluetootctl's
show option.

[bluetooth]# show
...
Roles: central
Roles: peripheral
Roles: central-peripheral
2020-07-07 10:49:34 -07:00
Abhishek Pandit-Subedi
d4c2c8a473 client: Display wake allowed property with info
Display whether the device is configured as wake allowed when queried
with cmd_info.
2020-07-07 10:46:48 -07:00
Sonny Sasaka
841b7ebe0f client: Add battery percentage to info command
This adds the Battery Percentage to the info command based on
org.bluez.Battery1 API. Example usage:

[bluetooth]# info XX:XX:XX:XX:XX:XX
Device XX:XX:XX:XX:XX:XX (random)
        Name: ...
        Alias: ...
        ...
        Modalias: ...
        Battery Percentage: 0x64 (100)
2020-07-02 16:22:10 -07:00
Mariusz Skamra
236fb26ff4 client: Update write callbacks with invalid offset error handlers
This patch adds invalid offset handlers to write callbacks of attributes.
2020-05-11 15:26:55 +02:00