Message ID | ebc8762f1d7d65b9fb414d2b538985b23546ab57.1745233468.git.pav@iki.fi |
---|---|
State | New |
Headers | show |
Series | [BlueZ,1/2] org.bluez.Media: add SupportedFeatures | expand |
Hi Pauli, On Mon, Apr 21, 2025 at 7:05 AM Pauli Virtanen <pav@iki.fi> wrote: > > Add org.bluez.Media.SupportedFeatures. The value tx-timestamping is > hardcoded as it is currently always enabled. > --- > profiles/audio/media.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/profiles/audio/media.c b/profiles/audio/media.c > index 69c6dc671..df36bc2df 100644 > --- a/profiles/audio/media.c > +++ b/profiles/audio/media.c > @@ -3340,8 +3340,28 @@ static gboolean supported_uuids(const GDBusPropertyTable *property, > return TRUE; > } > > +static gboolean supported_features(const GDBusPropertyTable *property, > + DBusMessageIter *iter, void *data) > +{ > + static const char * const features[] = { "tx-timestamping" }; > + 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) > + dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, > + &features[i]); That doesn't really handle if the kernel doesn't support it or setting SO_TIMESTAMPING fails in case the kernel is too old? We might need to have a MGMT flag indicating that kernel has support for it otherwise, that said perhaps it would actually be better to have a socket option since for the likes of SCO sockets we actually need hardware support as well. > + dbus_message_iter_close_container(iter, &entry); > + > + return TRUE; > +} > + > static const GDBusPropertyTable media_properties[] = { > { "SupportedUUIDs", "as", supported_uuids }, > + { "SupportedFeatures", "as", supported_features }, > { } > }; > > -- > 2.49.0 > >
diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 69c6dc671..df36bc2df 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -3340,8 +3340,28 @@ static gboolean supported_uuids(const GDBusPropertyTable *property, return TRUE; } +static gboolean supported_features(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + static const char * const features[] = { "tx-timestamping" }; + 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) + dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, + &features[i]); + + dbus_message_iter_close_container(iter, &entry); + + return TRUE; +} + static const GDBusPropertyTable media_properties[] = { { "SupportedUUIDs", "as", supported_uuids }, + { "SupportedFeatures", "as", supported_features }, { } };