* [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures
@ 2025-05-03 7:24 Pauli Virtanen
2025-05-03 7:24 ` [PATCH BlueZ v4 2/2] media: implement SupportedFeatures property Pauli Virtanen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pauli Virtanen @ 2025-05-03 7:24 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Add SupportedFeatures property for feature information that applications
cannot find otherwise.
Add feature tx-timestamping. Applications cannot enable it on old BlueZ
versions without that feature, as it requires special handling on BlueZ
side.
---
Notes:
v4 & v3:
- no change
v2:
- mention user application can check tstamp types itself
doc/org.bluez.Media.rst | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/doc/org.bluez.Media.rst b/doc/org.bluez.Media.rst
index ecd982652..ef13a56a9 100644
--- a/doc/org.bluez.Media.rst
+++ b/doc/org.bluez.Media.rst
@@ -7,7 +7,7 @@ BlueZ D-Bus Media API documentation
-----------------------------------
:Version: BlueZ
-:Date: September 2023
+:Date: April 2025
:Manual section: 5
:Manual group: Linux System Administration
@@ -131,3 +131,16 @@ array{string} SupportedUUIDs [readonly]
List of 128-bit UUIDs that represents the supported Endpoint
registration.
+
+array{string} SupportedFeatures [readonly]
+``````````````````````````````````````````
+
+ List of strings that represent supported special features.
+ Possible values:
+
+ :"tx-timestamping":
+
+ Bluetooth TX timestamping in media stream sockets is
+ supported by BlueZ and kernel. Applications may check
+ kernel support for specific timestamp types via
+ SIOCETHTOOL.
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ v4 2/2] media: implement SupportedFeatures property
2025-05-03 7:24 [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures Pauli Virtanen
@ 2025-05-03 7:24 ` Pauli Virtanen
2025-05-03 8:50 ` [BlueZ,v4,1/2] org.bluez.Media: add SupportedFeatures bluez.test.bot
2025-05-06 15:00 ` [PATCH BlueZ v4 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Pauli Virtanen @ 2025-05-03 7:24 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Add org.bluez.Media.SupportedFeatures. Add feature tx-timestamping.
---
Notes:
v4:
- add code comments
- remove stray change in adapter.h
v3:
- fix #includes
v2:
- use SIOCETHTOOL to get kernel support
profiles/audio/media.c | 83 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 69c6dc671..a18ddc9fe 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -18,6 +18,17 @@
#include <errno.h>
#include <inttypes.h>
+#include <time.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <linux/errqueue.h>
+#include <linux/net_tstamp.h>
+#include <linux/ethtool.h>
+#include <linux/sockios.h>
+#include <net/if.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
#include <glib.h>
#include "lib/bluetooth.h"
@@ -81,6 +92,7 @@ struct media_adapter {
#ifdef HAVE_AVRCP
GSList *players; /* Players list */
#endif
+ int so_timestamping;
};
struct endpoint_request {
@@ -3340,8 +3352,78 @@ static gboolean supported_uuids(const GDBusPropertyTable *property,
return TRUE;
}
+static bool probe_tx_timestamping(struct media_adapter *adapter)
+{
+ struct ifreq ifr = {};
+ struct ethtool_ts_info cmd = {};
+ int sk = -1;
+
+ /* TX timestamping requires support from BlueZ in order to not mistake
+ * errqueue for socket errors in media stream sockets. This is always
+ * enabled (io_glib_add_err_watch), so need only check kernel side here.
+ */
+
+ if (adapter->so_timestamping != -1)
+ goto done;
+
+ snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "hci%u",
+ btd_adapter_get_index(adapter->btd_adapter));
+ ifr.ifr_data = (void *)&cmd;
+ cmd.cmd = ETHTOOL_GET_TS_INFO;
+
+ /* Check kernel reports some support for TX timestamping for L2CAP. If
+ * yes then kernel version is new enough to have TX timestamping
+ * available for other socket types too.
+ */
+ sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
+ if (sk < 0)
+ goto error;
+ if (ioctl(sk, SIOCETHTOOL, &ifr))
+ goto error;
+ close(sk);
+
+ adapter->so_timestamping = cmd.so_timestamping;
+
+done:
+ return adapter->so_timestamping & SOF_TIMESTAMPING_TX_SOFTWARE;
+
+error:
+ if (sk >= 0)
+ close(sk);
+ adapter->so_timestamping = 0;
+ return false;
+}
+
+static const struct {
+ const char *name;
+ bool (*probe)(struct media_adapter *adapter);
+} features[] = {
+ { "tx-timestamping", probe_tx_timestamping },
+};
+
+static gboolean supported_features(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct media_adapter *adapter = data;
+ DBusMessageIter entry;
+ size_t i;
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING, &entry);
+
+ for (i = 0; i < ARRAY_SIZE(features); ++i)
+ if (features[i].probe(adapter))
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
+ &features[i].name);
+
+ dbus_message_iter_close_container(iter, &entry);
+
+ return TRUE;
+}
+
static const GDBusPropertyTable media_properties[] = {
{ "SupportedUUIDs", "as", supported_uuids },
+ { "SupportedFeatures", "as", supported_features },
{ }
};
@@ -3383,6 +3465,7 @@ int media_register(struct btd_adapter *btd_adapter)
adapter = g_new0(struct media_adapter, 1);
adapter->btd_adapter = btd_adapter_ref(btd_adapter);
adapter->apps = queue_new();
+ adapter->so_timestamping = -1;
if (!g_dbus_register_interface(btd_get_dbus_connection(),
adapter_get_path(btd_adapter),
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v4,1/2] org.bluez.Media: add SupportedFeatures
2025-05-03 7:24 [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures Pauli Virtanen
2025-05-03 7:24 ` [PATCH BlueZ v4 2/2] media: implement SupportedFeatures property Pauli Virtanen
@ 2025-05-03 8:50 ` bluez.test.bot
2025-05-06 15:00 ` [PATCH BlueZ v4 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-05-03 8:50 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
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=959306
---Test result---
Test Summary:
CheckPatch PENDING 0.21 seconds
GitLint PENDING 0.21 seconds
BuildEll PASS 20.37 seconds
BluezMake PASS 2626.66 seconds
MakeCheck PASS 19.91 seconds
MakeDistcheck PASS 198.02 seconds
CheckValgrind PASS 279.34 seconds
CheckSmatch PASS 308.92 seconds
bluezmakeextell PASS 131.38 seconds
IncrementalBuild PENDING 0.30 seconds
ScanBuild PASS 913.02 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures
2025-05-03 7:24 [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures Pauli Virtanen
2025-05-03 7:24 ` [PATCH BlueZ v4 2/2] media: implement SupportedFeatures property Pauli Virtanen
2025-05-03 8:50 ` [BlueZ,v4,1/2] org.bluez.Media: add SupportedFeatures bluez.test.bot
@ 2025-05-06 15:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-05-06 15:00 UTC (permalink / raw)
To: Pauli Virtanen; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sat, 3 May 2025 10:24:25 +0300 you wrote:
> Add SupportedFeatures property for feature information that applications
> cannot find otherwise.
>
> Add feature tx-timestamping. Applications cannot enable it on old BlueZ
> versions without that feature, as it requires special handling on BlueZ
> side.
>
> [...]
Here is the summary with links:
- [BlueZ,v4,1/2] org.bluez.Media: add SupportedFeatures
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=30d2de12868d
- [BlueZ,v4,2/2] media: implement SupportedFeatures property
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9ea27141c71f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-06 14:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-03 7:24 [PATCH BlueZ v4 1/2] org.bluez.Media: add SupportedFeatures Pauli Virtanen
2025-05-03 7:24 ` [PATCH BlueZ v4 2/2] media: implement SupportedFeatures property Pauli Virtanen
2025-05-03 8:50 ` [BlueZ,v4,1/2] org.bluez.Media: add SupportedFeatures bluez.test.bot
2025-05-06 15:00 ` [PATCH BlueZ v4 1/2] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox