Skip to contentSkip to conversation

adapter: Add (readwrite) Connectable property.

PATCH Applied Vibhav Pant 3 participants 5 messages Sep 11, 2024 – Sep 19, 2024 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

cover adapter: Add (readwrite) Connectable property.

Hi,

This series adds the "Connectable" property to Adapter objects in BlueZ. This property is needed in order to implement the corresponding functionality for Wine[1][2]. However, to not break current behaviour, enabling Discoverable while Connectable is false will not result in an error.

[1]: https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothenableincomingconnections
[2]: https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothisconnectable

Vibhav Pant (2):
adapter: Add support for the Connectable property. org.bluez.Adapter: Add documentation for the Connectable property.

 doc/org.bluez.Adapter.rst | 13 +++++++++++++
 src/adapter.c             | 25 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
Signature · 1 line
2.46.0
#1 lore raw

PATCH 1/2 adapter: Add support for the Connectable property.

To not break previous behavior, allow enabling the Discoverable property even if Connectable is currently false.

---
 src/adapter.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
src/adapter.c +25 -0
index d6c058196..f5a876382 100644
@@ -3180,6 +3180,11 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
 		param = &mode;
 		len = sizeof(mode);
 		break;
+	case MGMT_SETTING_CONNECTABLE:
+		opcode = MGMT_OP_SET_CONNECTABLE;
+		param = &mode;
+		len = sizeof(mode);
+		break;
 	default:
 		goto failed;
 	}
@@ -3576,6 +3581,24 @@ static gboolean property_get_version(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean property_get_connectable(const GDBusPropertyTable *property,
+					 DBusMessageIter *iter, void *user_data)
+{
+	struct btd_adapter *adapter = user_data;
+
+	return property_get_mode(adapter, MGMT_SETTING_CONNECTABLE, iter);
+}
+
+static void property_set_connectable(const GDBusPropertyTable *property,
+				     DBusMessageIter *iter,
+				     GDBusPendingPropertySet id,
+				     void *user_data)
+{
+	struct btd_adapter *adapter = user_data;
+
+	property_set_mode(adapter, MGMT_SETTING_CONNECTABLE, iter, id);
+}
+
 static DBusMessage *remove_device(DBusConnection *conn,
 					DBusMessage *msg, void *user_data)
 {
@@ -3917,6 +3940,8 @@ static const GDBusPropertyTable adapter_properties[] = {
 	{ "Name", "s", property_get_name },
 	{ "Alias", "s", property_get_alias, property_set_alias },
 	{ "Class", "u", property_get_class },
+	{ "Connectable", "b", property_get_connectable,
+					property_set_connectable },
 	{ "Powered", "b", property_get_powered, property_set_powered },
 	{ "PowerState", "s", property_get_power_state },
 	{ "Discoverable", "b", property_get_discoverable,
Signature · 1 line
2.46.0
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=889389

---Test result---

Test Summary:

CheckPatch                    PASS      0.86 seconds
GitLint                       FAIL      1.06 seconds
BuildEll                      PASS      25.37 seconds
BluezMake                     PASS      1694.59 seconds
MakeCheck                     PASS      12.73 seconds
MakeDistcheck                 FAIL      67.33 seconds
CheckValgrind                 PASS      255.06 seconds
CheckSmatch                   PASS      361.85 seconds
bluezmakeextell               PASS      121.00 seconds
IncrementalBuild              PASS      3030.42 seconds
ScanBuild                     PASS      1013.97 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,1/2] adapter: Add support for the Connectable property.

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T3 Title has trailing punctuation (.): "[BlueZ,1/2] adapter: Add support for the Connectable property."
[BlueZ,2/2] org.bluez.Adapter: Add documentation for the Connectable property.

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T3 Title has trailing punctuation (.): "[BlueZ,2/2] org.bluez.Adapter: Add documentation for the Connectable property."
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
../../mesh/mesh-config-json.c:31:10: fatal error: mesh/missing.h: No such file or directory
31 | #include "mesh/missing.h"

      |          ^~~~~~~~~~~~~~~~

compilation terminated.
make[2]: *** [Makefile:7857: mesh/mesh-config-json.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:4681: all] Error 2
make: *** [Makefile:12233: distcheck] Error 1

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH 2/2 org.bluez.Adapter: Add documentation for the Connectable property.

In reply to Vibhav Pant
---
 doc/org.bluez.Adapter.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)
doc/org.bluez.Adapter.rst +13 -0
index f53728123..3f5fdc8fe 100644
@@ -283,6 +283,19 @@ uint32 Class [readonly]
 	This property represents the value that is either automatically
 	configured by DMI/ACPI information or provided as static configuration.
 
+boolean Connectable [readwrite]
+```````````````````````````````
+
+	Set an adapter to connectable or non-connectable. This is a global
+	setting and should only be used by the settings application.
+
+	Setting this property to false will set the Discoverable property
+	of the adapter to false as well, which will not be reverted if
+	if Connectable is set back to true. If required, the application
+	will need to manually set Discoverable to true.
+
+	Note that this property only affects incoming connections.
+
 boolean Powered [readwrite]
 ```````````````````````````
 
Signature · 1 line
2.46.0
#4 lore raw
In reply to Vibhav Pant
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Wed, 11 Sep 2024 20:21:12 +0530 you wrote:

Hi,

This series adds the "Connectable" property to Adapter objects in BlueZ. This property is needed in order to implement the corresponding functionality for Wine[1][2]. However, to not break current behaviour, enabling Discoverable while Connectable is false will not result in an error.

[...]

Here is the summary with links:
- [BlueZ,1/2] adapter: Add support for the Connectable property.

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=17f485f207e6
  - [BlueZ,2/2] org.bluez.Adapter: Add documentation for the Connectable property.
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=bf6bfc3356ef

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html