From patchwork Wed Sep 27 21:39:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45D19E82CC0 for ; Wed, 27 Sep 2023 21:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbjI0VkJ (ORCPT ); Wed, 27 Sep 2023 17:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjI0VkI (ORCPT ); Wed, 27 Sep 2023 17:40:08 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2C3D6 for ; Wed, 27 Sep 2023 14:40:07 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-690d8fb3b7eso10889752b3a.1 for ; Wed, 27 Sep 2023 14:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850806; x=1696455606; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UZDbId/Oq6bQoYjYM1BCQT82RB8NkOnAtSqUmB0Kd0w=; b=KuzB7LRIUHXGG9MhBkrycDv52nC+4MIva/x3XnB5upiKYQVDm/iUB3j9OnzBbSffWw TBywpKUHRWybNW++hcQot35ZjYutBOvyyTxXvP1Z4RayqgSVov++FaUMQrQtK1UHSK3a vGkgvnP1Z+VXHFFD1OwXt10+uOIm+TaWLIT8wE0ZsDMx/HrMiETbBhPMG04oWBqe1lWQ B6Csdk/H74quYJJbqMmNLKveMONY2F3X5/Uuf46sF1g49IdDN5adp3nyHiah8ESNgwZs dt1JJWfmegdGtswql7Idm3bt6natlGhaiA5GzeI2dJhoR3Ge0uMC2Pz4KclRBxAl2+6s hI7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850806; x=1696455606; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UZDbId/Oq6bQoYjYM1BCQT82RB8NkOnAtSqUmB0Kd0w=; b=nXQmoYzQMTK1Nn/iz1S94oxY3UevhKyL3VfCWjH8rMcGoQpXcDuIQj83tTOhLiU9YP LQp/OL6xmCo/X1zAnh16MiYnlFFZn4BfzD+tQTjl7MRT+eouMwVFuDSoxf8bJnPhdYLA eEc+3RON9M8Dzg+rpAqBnZrqpkkTF35H45I7Tq3Mioa8VghSR6IIfDP9UDR6Jok5T2bM nAHaRe2KiS+WA668EswwDfYKAnDx7tt9o8Erl88AhRvdf0deRPWHhNgDfrlyY9Rbc+8C wPpJQnh7YGaeDIuQ6nU1dr+mGW2f5tU/jSvCVQ0C26ujSf2QumOkDdhwlK4Gdc+op1GU eJmg== X-Gm-Message-State: AOJu0Yy4+1otrctJcdUHg8ivCEDBzp9lzI9N+PxuSpU+l4gIrTsu/9kC 1uFjFH5nP04WfA+DvnT9YAHxRQ3onYxBalZR X-Google-Smtp-Source: AGHT+IEjeadmeW3e7ehJUayzq5wu79oLTxAGjFS3b2ZAZ5gn0QnlqBagVEl+OhdHKoyjfVdfVhyQlQ== X-Received: by 2002:aa7:8893:0:b0:690:3a0f:4165 with SMTP id z19-20020aa78893000000b006903a0f4165mr3675217pfe.32.1695850806074; Wed, 27 Sep 2023 14:40:06 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:04 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] bap: Fix freeing value of dbus_message_iter_get_fixed_array Date: Wed, 27 Sep 2023 14:39:51 -0700 Message-ID: <20230927214003.1873224-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz The value returned by dbus_message_iter_get_fixed_array is a reference and shall not be freed: 'The returned value is by reference and should not be freed.' --- profiles/audio/bap.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 18872329d4ac..48a1a4f86f8d 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -365,19 +365,17 @@ static const GDBusPropertyTable ep_properties[] = { { } }; -static int parse_array(DBusMessageIter *iter, struct iovec **iov) +static int parse_array(DBusMessageIter *iter, struct iovec *iov) { DBusMessageIter array; if (!iov) return 0; - if (!(*iov)) - *iov = new0(struct iovec, 1); - dbus_message_iter_recurse(iter, &array); - dbus_message_iter_get_fixed_array(&array, &(*iov)->iov_base, - (int *)&(*iov)->iov_len); + dbus_message_iter_get_fixed_array(&array, &iov->iov_base, + (int *)&iov->iov_len); + return 0; } @@ -594,10 +592,15 @@ static int parse_bcast_qos(const char *key, int var, DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &qos->bcast.timeout); } else if (!strcasecmp(key, "BCode")) { + struct iovec iov; + if (var != DBUS_TYPE_ARRAY) return -EINVAL; - parse_array(iter, &qos->bcast.bcode); + parse_array(iter, &iov); + + util_iov_free(qos->bcast.bcode, 1); + qos->bcast.bcode = util_iov_dup(&iov, 1); } else { int err; @@ -653,6 +656,9 @@ static int parse_configuration(DBusMessageIter *props, struct iovec **caps, struct bt_bap_qos *qos) { const char *key; + struct iovec iov; + + memset(&iov, 0, sizeof(iov)); while (dbus_message_iter_get_arg_type(props) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter value, entry; @@ -670,14 +676,20 @@ static int parse_configuration(DBusMessageIter *props, struct iovec **caps, if (var != DBUS_TYPE_ARRAY) goto fail; - if (parse_array(&value, caps)) + if (parse_array(&value, &iov)) goto fail; + + util_iov_free(*caps, 1); + *caps = util_iov_dup(&iov, 1); } else if (!strcasecmp(key, "Metadata")) { if (var != DBUS_TYPE_ARRAY) goto fail; - if (parse_array(&value, metadata)) + if (parse_array(&value, &iov)) goto fail; + + util_iov_free(*metadata, 1); + *metadata = util_iov_dup(&iov, 1); } else if (!strcasecmp(key, "QoS")) { if (var != DBUS_TYPE_ARRAY) goto fail; @@ -1202,6 +1214,7 @@ static void select_cb(struct bt_bap_pac *pac, int err, struct iovec *caps, goto done; } + util_iov_free(ep->caps, 1); ep->caps = util_iov_dup(caps, 1); if (metadata && metadata->iov_base && metadata->iov_len) { From patchwork Wed Sep 27 21:39:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F777E7109E for ; Wed, 27 Sep 2023 21:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjI0VkQ (ORCPT ); Wed, 27 Sep 2023 17:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjI0VkO (ORCPT ); Wed, 27 Sep 2023 17:40:14 -0400 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2514D6 for ; Wed, 27 Sep 2023 14:40:11 -0700 (PDT) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-57ba2cd3507so4694893eaf.2 for ; Wed, 27 Sep 2023 14:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850810; x=1696455610; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bLRjLlaoWXCdXJECDkADcOZLMqt8RCUscACboAgme1A=; b=SgEK3+JIkaJ/yBuImo8nqJpgnbAhG5XSPVGhtmmcZiIXVpfb/NZb0OMVaMFfV38Nvc 7XSQ5XYffcdbCcdZGnlPIwdBwqPpJWECerLKVyTo+s8/E2Vhl0xR9asZm/0cINoCp+H3 J+o9pvdrs1A76Rx/pn+Y0oan7J/pTVB8Nfq9X62VJkpfYLT21MKYmKcrxjyC6xO01cNG f4bL3nyIZ/9Y7N9HS6t4kOgjePz8VwgOV7/EvpsnQLKJ8SUbY9p390/O8YhqoUE0xLoR avyd18JzO3JpylfnffftJiPMsgXwz5Xe7s/2tL5q86q12Bk+ZkGvjySn5ATH6I0/vDnP 2wRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850810; x=1696455610; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bLRjLlaoWXCdXJECDkADcOZLMqt8RCUscACboAgme1A=; b=grsOKk7MEsG7HrYIoAuKhyYIrEExnEkhLRmlQOmzGDQJSvBSx60qKnQuY8fg3I2LCE 5vnqWojmvx2Sf7LtnnyNvSvN3EXbexvB/xCQKg5pfN0CBE7dtH/MwqbbML5kpL2dI+DS 02MeHcis74tIdi7rCQWSrQc7Im8Cr314gtwQzbt8zWOW0eSWGRoLKzS1PccAoSROSINH BxeVmVe1r8HobanBoqVAx6Q67d1KaW8DmG59+AIMalRJa6OqkXL7fXLfQzlFYm/bZakM CGczd2iQQs3fPHW7V9LC3krumHmHF687c2ACWy2tU5UMSbmXsBHh3XWt+w1tMSWIHf8M Hj5w== X-Gm-Message-State: AOJu0YxCFZfshUYC/VZVnjiokysfCFf+nOx/33fJViqixNOstGYA4V86 oMs2IOZtVs0VkcKIqK7VWsNAeU33djDfpgF/ X-Google-Smtp-Source: AGHT+IG4B/ClfLAx5aIXtlzVtV38DVxO6pSsSS4yMfDxXpkWt+Z7Ag8HdcL8eCP4AXq3CWW5R3u9uA== X-Received: by 2002:a05:6358:590d:b0:142:d0dc:a3ce with SMTP id g13-20020a056358590d00b00142d0dca3cemr3945065rwf.2.1695850809705; Wed, 27 Sep 2023 14:40:09 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:08 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 02/12] transport: Implement QoS property Date: Wed, 27 Sep 2023 14:39:53 -0700 Message-ID: <20230927214003.1873224-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This implements Transport.QoS as a dict instead of listing each field as a individual property. --- client/player.c | 6 +- lib/bluetooth.h | 2 +- profiles/audio/bap.c | 6 +- profiles/audio/transport.c | 431 ++++++++----------------------------- src/shared/bap.h | 2 +- src/shared/bass.c | 2 +- tools/iso-tester.c | 6 +- tools/isotest.c | 2 +- 8 files changed, 98 insertions(+), 359 deletions(-) diff --git a/client/player.c b/client/player.c index 42721c21062b..fdc27c281ed8 100644 --- a/client/player.c +++ b/client/player.c @@ -1756,7 +1756,7 @@ static struct bt_iso_qos bcast_qos = { .bcast = { .big = BT_ISO_QOS_BIG_UNSET, .bis = BT_ISO_QOS_BIS_UNSET, - .sync_interval = 24, + .sync_factor = 24, .packing = 0x00, .framing = 0x00, .encryption = 0x00, @@ -1874,10 +1874,10 @@ static void append_properties(DBusMessageIter *iter, if (!cfg->ep->broadcast) goto done; - bt_shell_printf("SyncInterval %u\n", bcast_qos.bcast.sync_interval); + bt_shell_printf("SyncInterval %u\n", bcast_qos.bcast.sync_factor); g_dbus_dict_append_entry(&dict, "SyncInterval", DBUS_TYPE_BYTE, - &bcast_qos.bcast.sync_interval); + &bcast_qos.bcast.sync_factor); bt_shell_printf("Encryption %u\n", bcast_qos.bcast.encryption); diff --git a/lib/bluetooth.h b/lib/bluetooth.h index 1286aa763208..ba08c70e61b8 100644 --- a/lib/bluetooth.h +++ b/lib/bluetooth.h @@ -174,7 +174,7 @@ struct bt_iso_ucast_qos { struct bt_iso_bcast_qos { uint8_t big; uint8_t bis; - uint8_t sync_interval; + uint8_t sync_factor; uint8_t packing; uint8_t framing; struct bt_iso_io_qos in; diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index d70ad872eb87..b05d7a2d9675 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -533,7 +533,7 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, goto fail; dbus_message_iter_get_basic(&value, - &qos->bcast.sync_interval); + &qos->bcast.sync_factor); } else if (!strcasecmp(key, "MSE")) { if (var != DBUS_TYPE_BYTE) goto fail; @@ -744,7 +744,7 @@ static void update_bcast_qos(struct bt_iso_qos *qos, { bap_qos->bcast.big = qos->bcast.big; bap_qos->bcast.bis = qos->bcast.bis; - bap_qos->bcast.sync_interval = qos->bcast.sync_interval; + bap_qos->bcast.sync_factor = qos->bcast.sync_factor; bap_qos->bcast.packing = qos->bcast.packing; bap_qos->bcast.framing = qos->bcast.framing; bap_qos->bcast.encryption = qos->bcast.encryption; @@ -1659,7 +1659,7 @@ static void bap_create_bcast_io(struct bap_data *data, struct bap_ep *ep, iso_qos.bcast.big = ep->qos.bcast.big; iso_qos.bcast.bis = ep->qos.bcast.bis; - iso_qos.bcast.sync_interval = ep->qos.bcast.sync_interval; + iso_qos.bcast.sync_factor = ep->qos.bcast.sync_factor; iso_qos.bcast.packing = ep->qos.bcast.packing; iso_qos.bcast.framing = ep->qos.bcast.framing; iso_qos.bcast.encryption = ep->qos.bcast.encryption; diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index dd923b03ed9d..1e03b7b51475 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -850,160 +850,41 @@ static const GDBusPropertyTable a2dp_properties[] = { { } }; -static gboolean qos_exists(const GDBusPropertyTable *property, void *data) +static void append_io_qos(DBusMessageIter *dict, struct bt_bap_io_qos *qos) { - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - if (media_endpoint_is_broadcast(transport->endpoint)) - return bap->qos.bcast.io_qos.sdu != 0x00; - - return bap->qos.ucast.io_qos.phy != 0x00; + dict_append_entry(dict, "Interval", DBUS_TYPE_UINT32, &qos->interval); + dict_append_entry(dict, "Latency", DBUS_TYPE_UINT16, &qos->latency); + dict_append_entry(dict, "SDU", DBUS_TYPE_UINT16, &qos->sdu); + dict_append_entry(dict, "PHY", DBUS_TYPE_BYTE, &qos->phy); + dict_append_entry(dict, "Retransmissions", DBUS_TYPE_BYTE, &qos->rtn); } -static gboolean get_cig(const GDBusPropertyTable *property, +static gboolean get_ucast_qos(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { struct media_transport *transport = data; struct bap_transport *bap = transport->data; + DBusMessageIter dict; - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.ucast.cig_id); + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &dict); - return TRUE; -} + dict_append_entry(&dict, "CIG", DBUS_TYPE_BYTE, + &bap->qos.ucast.cig_id); + dict_append_entry(&dict, "CIS", DBUS_TYPE_BYTE, + &bap->qos.ucast.cis_id); + dict_append_entry(&dict, "Framing", DBUS_TYPE_BYTE, + &bap->qos.ucast.framing); + dict_append_entry(&dict, "PresentationDelay", DBUS_TYPE_UINT32, + &bap->qos.ucast.delay); -static gboolean get_big(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; + append_io_qos(&dict, &bap->qos.ucast.io_qos); - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.big); - - return TRUE; -} - -static gboolean get_cis(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.ucast.cis_id); - - return TRUE; -} - -static gboolean get_bis(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.bis); - - return TRUE; -} - -static gboolean get_interval(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, - &bap->qos.ucast.io_qos.interval); - - return TRUE; -} - -static gboolean get_framing(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - dbus_bool_t val = bap->qos.ucast.framing; - - if (media_endpoint_is_broadcast(transport->endpoint)) - val = bap->qos.bcast.framing; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val); - - return TRUE; -} - -static gboolean get_phy(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - if (media_endpoint_is_broadcast(transport->endpoint)) { - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.io_qos.phy); - return TRUE; - } - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.ucast.io_qos.phy); - - return TRUE; -} - -static gboolean get_sdu(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - if (media_endpoint_is_broadcast(transport->endpoint)) { - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.bcast.io_qos.sdu); - return TRUE; - } - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.ucast.io_qos.sdu); - - return TRUE; -} - -static gboolean get_retransmissions(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.ucast.io_qos.rtn); - - return TRUE; -} - -static gboolean get_latency(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.ucast.io_qos.latency); - - return TRUE; -} - -static gboolean get_delay(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, - &bap->qos.ucast.delay); + dbus_message_iter_close_container(iter, &dict); return TRUE; } @@ -1084,119 +965,12 @@ static gboolean get_links(const GDBusPropertyTable *property, return TRUE; } -static gboolean get_sync_interval(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) +static gboolean qos_ucast_exists(const GDBusPropertyTable *property, void *data) { struct media_transport *transport = data; struct bap_transport *bap = transport->data; - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.sync_interval); - - return TRUE; -} - -static gboolean get_packing(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.packing); - - return TRUE; -} - -static gboolean get_bcode(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - DBusMessageIter array; - - dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, - DBUS_TYPE_BYTE_AS_STRING, &array); - - if (bap->qos.bcast.bcode && bap->qos.bcast.bcode->iov_len) - dbus_message_iter_append_fixed_array(&array, DBUS_TYPE_BYTE, - &bap->qos.bcast.bcode->iov_base, - bap->qos.bcast.bcode->iov_len); - - dbus_message_iter_close_container(iter, &array); - return TRUE; -} - -static gboolean get_options(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.options); - - return TRUE; -} - -static gboolean get_skip(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.bcast.skip); - - return TRUE; -} - -static gboolean get_sync_timeout(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.bcast.sync_timeout); - - return TRUE; -} - -static gboolean get_sync_cte_type(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.sync_cte_type); - - return TRUE; -} - -static gboolean get_mse(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, - &bap->qos.bcast.mse); - - return TRUE; -} - -static gboolean get_timeout(const GDBusPropertyTable *property, - DBusMessageIter *iter, void *data) -{ - struct media_transport *transport = data; - struct bap_transport *bap = transport->data; - - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, - &bap->qos.bcast.timeout); - - return TRUE; + return bap->qos.ucast.io_qos.phy != 0x00; } static const GDBusPropertyTable bap_ucast_properties[] = { @@ -1205,15 +979,7 @@ static const GDBusPropertyTable bap_ucast_properties[] = { { "Codec", "y", get_codec }, { "Configuration", "ay", get_configuration }, { "State", "s", get_state }, - { "CIG", "y", get_cig, NULL, qos_exists }, - { "CIS", "y", get_cis, NULL, qos_exists }, - { "Interval", "u", get_interval, NULL, qos_exists }, - { "Framing", "b", get_framing, NULL, qos_exists }, - { "PHY", "y", get_phy, NULL, qos_exists }, - { "SDU", "q", get_sdu, NULL, qos_exists }, - { "Retransmissions", "y", get_retransmissions, NULL, qos_exists }, - { "Latency", "q", get_latency, NULL, qos_exists }, - { "Delay", "u", get_delay, NULL, qos_exists }, + { "QoS", "a{sv}", get_ucast_qos, NULL, qos_ucast_exists }, { "Endpoint", "o", get_endpoint, NULL, endpoint_exists }, { "Location", "u", get_location }, { "Metadata", "ay", get_metadata }, @@ -1221,6 +987,61 @@ static const GDBusPropertyTable bap_ucast_properties[] = { { } }; +static gboolean get_bcast_qos(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + DBusMessageIter dict; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &dict); + + dict_append_entry(&dict, "BIG", DBUS_TYPE_BYTE, + &bap->qos.bcast.big); + dict_append_entry(&dict, "BIS", DBUS_TYPE_BYTE, + &bap->qos.bcast.bis); + dict_append_entry(&dict, "SyncFactor", DBUS_TYPE_BYTE, + &bap->qos.bcast.sync_factor); + dict_append_entry(&dict, "Packing", DBUS_TYPE_BYTE, + &bap->qos.bcast.packing); + dict_append_entry(&dict, "Framing", DBUS_TYPE_BYTE, + &bap->qos.bcast.framing); + if (bap->qos.bcast.bcode) + dict_append_array(&dict, "BCode", DBUS_TYPE_BYTE, + &bap->qos.bcast.bcode->iov_base, + bap->qos.bcast.bcode->iov_len); + dict_append_entry(&dict, "Options", DBUS_TYPE_BYTE, + &bap->qos.bcast.options); + dict_append_entry(&dict, "Skip", DBUS_TYPE_UINT16, + &bap->qos.bcast.skip); + dict_append_entry(&dict, "SyncTimeout", DBUS_TYPE_UINT16, + &bap->qos.bcast.sync_timeout); + dict_append_entry(&dict, "SyncType", DBUS_TYPE_BYTE, + &bap->qos.bcast.sync_cte_type); + dict_append_entry(&dict, "MSE", DBUS_TYPE_BYTE, + &bap->qos.bcast.mse); + dict_append_entry(&dict, "Timeout", DBUS_TYPE_UINT16, + &bap->qos.bcast.timeout); + + append_io_qos(&dict, &bap->qos.bcast.io_qos); + + dbus_message_iter_close_container(iter, &dict); + + return TRUE; +} + +static gboolean qos_bcast_exists(const GDBusPropertyTable *property, void *data) +{ + struct media_transport *transport = data; + struct bap_transport *bap = transport->data; + + return bap->qos.bcast.io_qos.phy != 0x00; +} static const GDBusPropertyTable bap_bcast_properties[] = { { "Device", "o", get_device }, @@ -1228,17 +1049,7 @@ static const GDBusPropertyTable bap_bcast_properties[] = { { "Codec", "y", get_codec }, { "Configuration", "ay", get_configuration }, { "State", "s", get_state }, - { "BIG", "y", get_big, NULL, qos_exists }, - { "BIS", "y", get_bis, NULL, qos_exists }, - { "SyncInterval", "y", get_sync_interval, NULL, qos_exists }, - { "Packing", "y", get_packing, NULL, qos_exists }, - { "BCode", "ay", get_bcode, NULL, qos_exists }, - { "Options", "y", get_options, NULL, qos_exists }, - { "Skip", "q", get_skip, NULL, qos_exists }, - { "SyncTimeout", "q", get_sync_timeout, NULL, qos_exists }, - { "SyncCteType", "y", get_sync_cte_type, NULL, qos_exists }, - { "MSE", "y", get_mse, NULL, qos_exists }, - { "Timeout", "q", get_timeout, NULL, qos_exists }, + { "QoS", "a{sv}", get_bcast_qos, NULL, qos_bcast_exists }, { "Endpoint", "o", get_endpoint, NULL, endpoint_exists }, { "Location", "u", get_location }, { "Metadata", "ay", get_metadata }, @@ -1471,31 +1282,7 @@ static void bap_update_qos(const struct media_transport *transport) g_dbus_emit_property_changed(btd_get_dbus_connection(), transport->path, MEDIA_TRANSPORT_INTERFACE, - "CIG"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "CIS"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Interval"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Framing"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "PHY"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "SDU"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Retransmissions"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Latency"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Delay"); + "QoS"); } static gboolean bap_resume_complete_cb(void *data) @@ -1538,55 +1325,7 @@ static void bap_update_bcast_qos(const struct media_transport *transport) g_dbus_emit_property_changed(btd_get_dbus_connection(), transport->path, MEDIA_TRANSPORT_INTERFACE, - "BIG"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "BIS"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "SyncInterval"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Packing"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Framing"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "BCode"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Options"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Skip"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "SyncTimeout"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "SyncCteType"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "MSE"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Timeout"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Interval"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "Latency"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "PHY"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "SDU"); - g_dbus_emit_property_changed(btd_get_dbus_connection(), - transport->path, MEDIA_TRANSPORT_INTERFACE, - "RTN"); + "QoS"); g_dbus_emit_property_changed(btd_get_dbus_connection(), transport->path, MEDIA_TRANSPORT_INTERFACE, "Codec"); diff --git a/src/shared/bap.h b/src/shared/bap.h index edb5c1bed27e..e4eae86502f3 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -75,7 +75,7 @@ struct bt_bap_ucast_qos { struct bt_bap_bcast_qos { uint8_t big; uint8_t bis; - uint8_t sync_interval; + uint8_t sync_factor; uint8_t packing; uint8_t framing; uint8_t encryption; diff --git a/src/shared/bass.c b/src/shared/bass.c index 86dab03e3993..37255aff64f3 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -102,7 +102,7 @@ static struct bt_iso_qos default_qos = { .bcast = { .big = BT_ISO_QOS_BIG_UNSET, .bis = BT_ISO_QOS_BIS_UNSET, - .sync_interval = 0x07, + .sync_factor = 0x07, .packing = 0x00, .framing = 0x00, .in = DEFAULT_IO_QOS, diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 410da2c930ac..a392a06ebcb3 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -241,7 +241,7 @@ .bcast = { \ .big = _big, \ .bis = _bis, \ - .sync_interval = 0x07, \ + .sync_factor = 0x07, \ .packing = 0x00, \ .framing = 0x00, \ .in = _in, \ @@ -1676,9 +1676,9 @@ static bool check_bcast_qos(const struct bt_iso_qos *qos1, return false; } - if (qos1->bcast.sync_interval != qos2->bcast.sync_interval) { + if (qos1->bcast.sync_factor != qos2->bcast.sync_factor) { tester_warn("Unexpected QoS sync interval: 0x%02x != 0x%02x", - qos1->bcast.sync_interval, qos2->bcast.sync_interval); + qos1->bcast.sync_factor, qos2->bcast.sync_factor); return false; } diff --git a/tools/isotest.c b/tools/isotest.c index 68729d97730e..234e4f1b0453 100644 --- a/tools/isotest.c +++ b/tools/isotest.c @@ -1028,7 +1028,7 @@ static void multy_connect_mode(char *peer) .bcast = { \ .big = BT_ISO_QOS_BIG_UNSET, \ .bis = BT_ISO_QOS_BIS_UNSET, \ - .sync_interval = 0x07, \ + .sync_factor = 0x07, \ .packing = 0x00, \ .framing = 0x00, \ .out = QOS_IO(_interval, _latency, _sdu, _phy, _rtn), \ From patchwork Wed Sep 27 21:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8141E82CC0 for ; Wed, 27 Sep 2023 21:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbjI0VkR (ORCPT ); Wed, 27 Sep 2023 17:40:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjI0VkO (ORCPT ); Wed, 27 Sep 2023 17:40:14 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F24121 for ; Wed, 27 Sep 2023 14:40:13 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-690bd8f89baso9645658b3a.2 for ; Wed, 27 Sep 2023 14:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850812; x=1696455612; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FOmbSCSuxl/iBoDJgSbUBLhFhdtVyCAjbkktwlieTt8=; b=Nahq3CdJHwlN506RoFSZSSVSpXHJASi+BpxBkRAsmdHJULunr0vAi8GL74OJTMz9YN Xlkjyvm7/cBjPZihKzF+5kvfJMOgah2s3E8msU0LxZPGHoFn4HtiXUdiGIJOxlGSU3j+ RH61G5gJIxi7OH1qxvUhhiJAVXcyvVw6rCGahSrWQeqOFzWCKFPcxyS7a0+I/8b5p6XD RSmGW1JZ/oVb5sBwY4HgRe9/pZcb8gcOiVdnZtppHwLnvGXBYj1wxgb3yCp1YbrLzMcs V3CG3CanoNlR29ja7UraP79fS0w7vmmYsCliA7iLIFuAWcwQ43LNQQKxT4S4AgKq/1Bn Y4MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850812; x=1696455612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FOmbSCSuxl/iBoDJgSbUBLhFhdtVyCAjbkktwlieTt8=; b=fvAEtBZDfyPArkohKgrxLwA+l2Jm4PmJbULMEv0zpDC0DdwX8mMnl2VvodDHUjX//f TWZtOW/mU5iAHZG7BUKu0qKBNvWzqnelAPZRBotsHwpDqsnM5nnv9ivWfVHRkR0TlOiB AstNp+jFiTPj5tYrG6y3/JtFr9Vxds2U8w84qaHl5PkBAzEYjJSpq3hUBIWGT6A6yX77 fVdgMCX+7c7113lQ+aL7GHOAvnOJCPSzrkhmiRdyPeDU2w6ZF6INFEqkmWHgM0iDD/EW 3CElNfHupqYM9u2TM5NHuXfLLrxSYMgedrHjqHZ4jiL2BgR7fWiXRO120/kTlzcQ617G hrjg== X-Gm-Message-State: AOJu0YzbbbNZlrOBD0wdZE4erTMqkxIwuldMZB2EA57BuMu2+CL4pIpD x0eVewzdRRGaKdBUUKVClRu7W+vPl7pRHZ2K X-Google-Smtp-Source: AGHT+IGLGT1SmlNfKcvKrMbN0Jcy87BXuzMjBksp9QnhR3aglI8EsCVoWrToEIikDrS4L57lACab9Q== X-Received: by 2002:a05:6a00:1a06:b0:692:b6e8:ce88 with SMTP id g6-20020a056a001a0600b00692b6e8ce88mr3229396pfv.17.1695850811828; Wed, 27 Sep 2023 14:40:11 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:10 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 03/12] client: Make transport.show to print QoS configuration Date: Wed, 27 Sep 2023 14:39:54 -0700 Message-ID: <20230927214003.1873224-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This makes transport.show to print QoS configuration since it is now a single property: transport.show 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 --- client/player.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/player.c b/client/player.c index fdc27c281ed8..d72ad6a5da01 100644 --- a/client/player.c +++ b/client/player.c @@ -3799,11 +3799,7 @@ static void cmd_show_transport(int argc, char *argv[]) print_property(proxy, "Volume"); print_property(proxy, "Endpoint"); - print_property(proxy, "Interval"); - print_property(proxy, "Framing"); - print_property(proxy, "SDU"); - print_property(proxy, "Retransmissions"); - print_property(proxy, "Latency"); + print_property(proxy, "QoS"); print_property(proxy, "Location"); print_property(proxy, "Metadata"); print_property(proxy, "Links"); From patchwork Wed Sep 27 21:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E61E7109E for ; Wed, 27 Sep 2023 21:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbjI0VkU (ORCPT ); Wed, 27 Sep 2023 17:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbjI0VkR (ORCPT ); Wed, 27 Sep 2023 17:40:17 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E14121 for ; Wed, 27 Sep 2023 14:40:15 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6c454a5f3c7so7260103a34.0 for ; Wed, 27 Sep 2023 14:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850814; x=1696455614; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pCOAwzZquIAA6I0LJRrSHC+IC23oO0R9zJDyQaULYio=; b=EQ4RAVgJAKjIc7GRsVTfwVklB3/qbryzb5JhQwechBE/sDt5qNSmveqm11KT/HOFri FmBe554MzdOo4nezMwZaP+6K8Gj6qOaNWyFvbIrpnTPs4F8dHTF9xaEpPH8w4yfRdOa2 7nJ3KbieSRTHj7lJ9bCvnwsCyjkViLpVZ5qJrBeA+XDIPUDo0mhayjYOCMilMsoaUXtk AY7IM2IKxAcnPXp/h9fobqdw1neqide1M7kSK5zl5lOQ5Q7tq1NbbySY2B7+q2ns7prA NLtm3fQpI+pUcABpXS3VTRmdCKdu5VSU2gOL1HfPIyPmLpk7OF/CsF2LkwlqkoWTHFCn JHpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850814; x=1696455614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pCOAwzZquIAA6I0LJRrSHC+IC23oO0R9zJDyQaULYio=; b=kFzwzPII1lpPnx3zG6ynID821cXNXAFGi5xBxzdu89iEYG7l2m3J3jXkOTEM/iyG6P Ighw4/nykFQ9nODe4hJqoxUKO+uh+UU45nv39guFGvwBmsHwkITwPCgFCtQBSnNc+IwM FYi9nVYYB6YQCtEorZq++u+i6ocYtolPsSnpeq1ymVRSGB5Yv3xci8M4zFxIfv+qarXJ x/KNUT/gny4oaeP381wNai84mQQYpwnXshB8pXhNJUKNJjULdmez9gElNWRNZl4X0qZb Mpcf3dC6Y0tbuc2XD7CXgBKlNpPA2aTzEIAlSqcSqlKgoeY3jX3QkYWED54To8Y6R4he /EmQ== X-Gm-Message-State: AOJu0YwvEycQcRSvPIrYabTEVhqtzw3oDSy9jwxR73S0dOSkyspsTaP3 pTe9u6cR3VTd6bw+naDhF37RPufQRYqjnHsU X-Google-Smtp-Source: AGHT+IGyrOw2l6BmPwxdku7qp8p/35kyWE/8EtS5BtuusjbdYHPh1c+QOA2IM90mZyqX/xLQF3DOhA== X-Received: by 2002:a9d:7354:0:b0:6c4:ac5b:1f83 with SMTP id l20-20020a9d7354000000b006c4ac5b1f83mr3273100otk.2.1695850813920; Wed, 27 Sep 2023 14:40:13 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:12 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 04/12] media: Implement QoS property Date: Wed, 27 Sep 2023 14:39:55 -0700 Message-ID: <20230927214003.1873224-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This implements QoS as a dict instead of listing each field as a individual property. --- profiles/audio/bap.c | 15 +--- profiles/audio/media.c | 159 ++++++++++++++++++++++++----------------- profiles/audio/media.h | 3 +- 3 files changed, 96 insertions(+), 81 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index b05d7a2d9675..ed02db40be8c 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -457,19 +457,10 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, framing = val; } else if (!strcasecmp(key, "PHY")) { - const char *str; - - if (var != DBUS_TYPE_STRING) + if (var != DBUS_TYPE_BYTE) goto fail; - dbus_message_iter_get_basic(&value, &str); - - if (!strcasecmp(str, "1M")) - io_qos.phy = 0x01; - else if (!strcasecmp(str, "2M")) - io_qos.phy = 0x02; - else - goto fail; + dbus_message_iter_get_basic(&value, &io_qos.phy); } else if (!strcasecmp(key, "SDU")) { if (var != DBUS_TYPE_UINT16) goto fail; @@ -546,7 +537,7 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, dbus_message_iter_get_basic(&value, &qos->bcast.timeout); - } else if (!strcasecmp(key, "BroadcastCode")) { + } else if (!strcasecmp(key, "BCode")) { if (var != DBUS_TYPE_ARRAY) goto fail; parse_array(&value, &qos->bcast.bcode); diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 66f512e007e4..8345487d7a45 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -743,15 +743,100 @@ static int parse_array(DBusMessageIter *iter, struct iovec *iov) return 0; } +static int parse_ucast_qos(DBusMessageIter *iter, struct bt_bap_qos *qos) +{ + DBusMessageIter array; + const char *key; + struct bt_bap_io_qos io_qos; + + dbus_message_iter_recurse(iter, &array); + + memset(&io_qos, 0, sizeof(io_qos)); + while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) { + DBusMessageIter value, entry; + int var; + + dbus_message_iter_recurse(&array, &entry); + dbus_message_iter_get_basic(&entry, &key); + + dbus_message_iter_next(&entry); + dbus_message_iter_recurse(&entry, &value); + + var = dbus_message_iter_get_arg_type(&value); + + if (!strcasecmp(key, "CIG")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, &qos->ucast.cig_id); + } else if (!strcasecmp(key, "CIS")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, &qos->ucast.cis_id); + } else if (!strcasecmp(key, "Interval")) { + if (var != DBUS_TYPE_UINT32) + goto fail; + + dbus_message_iter_get_basic(&value, &io_qos.interval); + } else if (!strcasecmp(key, "Framing")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, + &qos->ucast.framing); + } else if (!strcasecmp(key, "PHY")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, &io_qos.phy); + } else if (!strcasecmp(key, "SDU")) { + if (var != DBUS_TYPE_UINT16) + goto fail; + + dbus_message_iter_get_basic(&value, &io_qos.sdu); + } else if (!strcasecmp(key, "Retransmissions")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, &io_qos.rtn); + } else if (!strcasecmp(key, "Latency")) { + if (var != DBUS_TYPE_UINT16) + goto fail; + + dbus_message_iter_get_basic(&value, &io_qos.latency); + } else if (!strcasecmp(key, "PresentationDelay")) { + if (var != DBUS_TYPE_UINT32) + goto fail; + + dbus_message_iter_get_basic(&value, &qos->ucast.delay); + } else if (!strcasecmp(key, "TargetLatency")) { + if (var != DBUS_TYPE_BYTE) + goto fail; + + dbus_message_iter_get_basic(&value, + &qos->ucast.target_latency); + } + + dbus_message_iter_next(&array); + } + + memcpy(&qos->ucast.io_qos, &io_qos, sizeof(io_qos)); + + return 0; + +fail: + DBG("Failed parsing %s", key); + + return -EINVAL; +} + static int parse_select_properties(DBusMessageIter *props, struct iovec *caps, struct iovec *metadata, struct bt_bap_qos *qos) { const char *key; - struct bt_bap_io_qos io_qos; - uint8_t framing = 0; - memset(&io_qos, 0, sizeof(io_qos)); while (dbus_message_iter_get_arg_type(props) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter value, entry; int var; @@ -776,77 +861,17 @@ static int parse_select_properties(DBusMessageIter *props, struct iovec *caps, if (parse_array(&value, metadata)) goto fail; - } else if (!strcasecmp(key, "CIG")) { - if (var != DBUS_TYPE_BYTE) + } else if (!strcasecmp(key, "QoS")) { + if (var != DBUS_TYPE_ARRAY) goto fail; - dbus_message_iter_get_basic(&value, &qos->ucast.cig_id); - } else if (!strcasecmp(key, "CIS")) { - if (var != DBUS_TYPE_BYTE) + if (parse_ucast_qos(&value, qos)) goto fail; - - dbus_message_iter_get_basic(&value, &qos->ucast.cis_id); - } else if (!strcasecmp(key, "Interval")) { - if (var != DBUS_TYPE_UINT32) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.interval); - } else if (!strcasecmp(key, "Framing")) { - dbus_bool_t val; - - if (var != DBUS_TYPE_BOOLEAN) - goto fail; - - dbus_message_iter_get_basic(&value, &val); - - framing = val; - } else if (!strcasecmp(key, "PHY")) { - const char *str; - - if (var != DBUS_TYPE_STRING) - goto fail; - - dbus_message_iter_get_basic(&value, &str); - - if (!strcasecmp(str, "1M")) - io_qos.phy = 0x01; - else if (!strcasecmp(str, "2M")) - io_qos.phy = 0x02; - else - goto fail; - } else if (!strcasecmp(key, "SDU")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.sdu); - } else if (!strcasecmp(key, "Retransmissions")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.rtn); - } else if (!strcasecmp(key, "Latency")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.latency); - } else if (!strcasecmp(key, "Delay")) { - if (var != DBUS_TYPE_UINT32) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->ucast.delay); - } else if (!strcasecmp(key, "TargetLatency")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->ucast.target_latency); } dbus_message_iter_next(props); } - memcpy(&qos->ucast.io_qos, &io_qos, sizeof(io_qos)); - qos->ucast.framing = framing; return 0; fail: @@ -1549,7 +1574,7 @@ static int parse_properties(DBusMessageIter *props, const char **uuid, if (var != DBUS_TYPE_BYTE) return -EINVAL; dbus_message_iter_get_basic(&value, &qos->phy); - } else if (strcasecmp(key, "RTN") == 0) { + } else if (strcasecmp(key, "Retransmissions") == 0) { if (var != DBUS_TYPE_BYTE) return -EINVAL; dbus_message_iter_get_basic(&value, &qos->rtn); diff --git a/profiles/audio/media.h b/profiles/audio/media.h index 0eeb5746a4fa..2b579877ba34 100644 --- a/profiles/audio/media.h +++ b/profiles/audio/media.h @@ -22,6 +22,5 @@ const char *media_endpoint_get_uuid(struct media_endpoint *endpoint); uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint); struct btd_adapter *media_endpoint_get_btd_adapter( struct media_endpoint *endpoint); -bool media_endpoint_is_broadcast( - struct media_endpoint *endpoint); +bool media_endpoint_is_broadcast(struct media_endpoint *endpoint); int8_t media_player_get_device_volume(struct btd_device *device); From patchwork Wed Sep 27 21:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 721B3E7F14F for ; Wed, 27 Sep 2023 21:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbjI0VkW (ORCPT ); Wed, 27 Sep 2023 17:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjI0VkU (ORCPT ); Wed, 27 Sep 2023 17:40:20 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0E6AD6 for ; Wed, 27 Sep 2023 14:40:17 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-57b67c84999so6537796eaf.3 for ; Wed, 27 Sep 2023 14:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850816; x=1696455616; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7LYirlf9dOaUzJulMGXdd1bw4TsoU8BSK/GBa/WWho8=; b=GxtfODHNB/bguWj9/QTTWrcV3cZfSeitcus7CL3bfIE6Rqfb8gSBoIkyrtMjGKAc/s i2iMRabdk992ExBSbRbwUOyBBOgaae7clKyV4x+hxqY/ShfpxgTCiIcYUjGTBTCx/o8f wEck2c1RYhFcRktKKad+OWTcmZigVOOFGTM2aojahLP6tbKIMoVlrZA+NLxQv2nD2nEs 7LYBlXUaIy3narNPmisVO02g+fhkH/q9g9pL9MjhuVgWKgPCFJ2JvsblSrcbuWdnWftf BGWxAUR7Zdkzl/kIOm/c0W3Xku9AS/wBkgtPU/ho5/ONHsF4NtGQKau4Sjr2fxloopjg H7oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850816; x=1696455616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7LYirlf9dOaUzJulMGXdd1bw4TsoU8BSK/GBa/WWho8=; b=TmvJw7aCqBf/ryraYUSjou6Gv9u4Z6Y9mnJFcfYWoVdoGbiSC1wpjCiH3C9ZuKgyTl SirIpxH+rE7ex0VypT4ZfWnyYvKH3Q9O5OWftpFstFVOi1W4iAROxRGTVDU6d60gCNiC gwhU1ciU+sxHtr+mZThw8k3NbRNIQU7OF8BXcHdC7V6mfkRJs2653yUCJ/9TiPLhcjXg deGpOtn/1b/p5Qp0Jilbg22TooXWXdpR1OeARqu1K6l4MaaKfH+khyV0ehxtarz8seG1 bz4tccr5PkcLlyTkRk7qDURXxnRTC5/vcWsOd9VY1DyTEDl1MOTCGnJMCJBfyi6Ea1rs YvGA== X-Gm-Message-State: AOJu0Yzdb3K5v2Rqj9ntvuKqES5LAxtNspRNyj5WJP0utuvl15HXAnyI SKqCczb6o+uof2pjrTslNYNlkPoHGOUuESAz X-Google-Smtp-Source: AGHT+IFqdokrHf8lrbSFTrxxzbqIzTWI8m+2S043ylXzTNE/s0YC0cwWAme4K9mRIjyjaKHR34zvJQ== X-Received: by 2002:a05:6358:5913:b0:143:9425:e2b6 with SMTP id g19-20020a056358591300b001439425e2b6mr4823155rwf.2.1695850815621; Wed, 27 Sep 2023 14:40:15 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:14 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 05/12] client: Make Endpoint.SelectProperties reply properly Date: Wed, 27 Sep 2023 14:39:56 -0700 Message-ID: <20230927214003.1873224-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This makes Endpoint.SelectProperties reply with QoS property since it is now a single property. --- client/player.c | 316 +++++++++++++++++++++++++++--------------------- client/print.c | 16 ++- 2 files changed, 188 insertions(+), 144 deletions(-) diff --git a/client/player.c b/client/player.c index d72ad6a5da01..6953eff28543 100644 --- a/client/player.c +++ b/client/player.c @@ -1199,7 +1199,7 @@ static const struct capabilities { struct codec_qos { uint32_t interval; uint8_t framing; - char *phy; + uint8_t phy; uint16_t sdu; uint8_t rtn; uint16_t latency; @@ -1274,22 +1274,22 @@ static struct codec_preset sbc_presets[] = { QOS_CONFIG(_interval, 0x01, _phy, _sdu, _rtn, _latency, _delay) #define QOS_UNFRAMED_1M(_interval, _sdu, _rtn, _latency, _delay) \ - QOS_UNFRAMED(_interval, "1M", _sdu, _rtn, _latency, _delay) \ + QOS_UNFRAMED(_interval, 0x01, _sdu, _rtn, _latency, _delay) \ #define QOS_FRAMED_1M(_interval, _sdu, _rtn, _latency, _delay) \ - QOS_FRAMED(_interval, "1M", _sdu, _rtn, _latency, _delay) \ + QOS_FRAMED(_interval, 0x01, _sdu, _rtn, _latency, _delay) \ #define QOS_UNFRAMED_2M(_interval, _sdu, _rtn, _latency, _delay) \ - QOS_UNFRAMED(_interval, "2M", _sdu, _rtn, _latency, _delay) \ + QOS_UNFRAMED(_interval, 0x02, _sdu, _rtn, _latency, _delay) \ #define QOS_FRAMED_2M(_interval, _sdu, _rtn, _latency, _delay) \ - QOS_FRAMED(_interval, "2M", _sdu, _rtn, _latency, _delay) \ + QOS_FRAMED(_interval, 0x02, _sdu, _rtn, _latency, _delay) \ #define LC3_7_5_UNFRAMED(_sdu, _rtn, _latency, _delay) \ - QOS_UNFRAMED(7500u, "2M", _sdu, _rtn, _latency, _delay) + QOS_UNFRAMED(7500u, 0x02, _sdu, _rtn, _latency, _delay) #define LC3_7_5_FRAMED(_sdu, _rtn, _latency, _delay) \ - QOS_FRAMED(7500u, "2M", _sdu, _rtn, _latency, _delay) + QOS_FRAMED(7500u, 0x02, _sdu, _rtn, _latency, _delay) #define LC3_10_UNFRAMED(_sdu, _rtn, _latency, _delay) \ QOS_UNFRAMED_2M(10000u, _sdu, _rtn, _latency, _delay) @@ -1770,14 +1770,174 @@ static struct bt_iso_qos bcast_qos = { } }; +static void append_io_qos(DBusMessageIter *iter, struct endpoint_config *cfg) +{ + struct codec_qos *qos = (void *)cfg->qos; + + bt_shell_printf("Interval %u\n", qos->interval); + + g_dbus_dict_append_entry(iter, "Interval", DBUS_TYPE_UINT32, + &qos->interval); + + bt_shell_printf("PHY 0x%02x\n", qos->phy); + + g_dbus_dict_append_entry(iter, "PHY", DBUS_TYPE_BYTE, &qos->phy); + + bt_shell_printf("SDU %u\n", cfg->qos->sdu); + + g_dbus_dict_append_entry(iter, "SDU", DBUS_TYPE_UINT16, &qos->sdu); + + bt_shell_printf("Retransmissions %u\n", qos->rtn); + + g_dbus_dict_append_entry(iter, "Retransmissions", + DBUS_TYPE_BYTE, &qos->rtn); + + bt_shell_printf("Latency %u\n", qos->latency); + + g_dbus_dict_append_entry(iter, "Latency", + DBUS_TYPE_UINT16, &qos->latency); +} + +static void append_ucast_qos(DBusMessageIter *iter, struct endpoint_config *cfg) +{ + struct codec_qos *qos = (void *)cfg->qos; + + if (cfg->ep->iso_group != BT_ISO_QOS_GROUP_UNSET) { + bt_shell_printf("CIG 0x%2.2x\n", cfg->ep->iso_group); + g_dbus_dict_append_entry(iter, "CIG", DBUS_TYPE_BYTE, + &cfg->ep->iso_group); + } + + if (cfg->ep->iso_stream != BT_ISO_QOS_STREAM_UNSET) { + bt_shell_printf("CIS 0x%2.2x\n", cfg->ep->iso_stream); + g_dbus_dict_append_entry(iter, "CIS", DBUS_TYPE_BYTE, + &cfg->ep->iso_stream); + } + + bt_shell_printf("Framing 0x%02x\n", qos->framing); + + g_dbus_dict_append_entry(iter, "Framing", DBUS_TYPE_BYTE, + &qos->framing); + + bt_shell_printf("PresentationDelay %u\n", qos->delay); + + g_dbus_dict_append_entry(iter, "PresentationDelay", + DBUS_TYPE_UINT32, &qos->delay); + + if (cfg->target_latency) { + bt_shell_printf("TargetLatency 0x%02x\n", cfg->target_latency); + g_dbus_dict_append_entry(iter, "TargetLatency", + DBUS_TYPE_BYTE, &cfg->target_latency); + } + + append_io_qos(iter, cfg); +} + +static void append_bcast_qos(DBusMessageIter *iter, struct endpoint_config *cfg) +{ + if (bcast_qos.bcast.big != BT_ISO_QOS_BIG_UNSET) { + bt_shell_printf("BIG 0x%2.2x\n", bcast_qos.bcast.big); + g_dbus_dict_append_entry(iter, "BIG", DBUS_TYPE_BYTE, + &bcast_qos.bcast.big); + } + + if (bcast_qos.bcast.bis != BT_ISO_QOS_BIS_UNSET) { + bt_shell_printf("BIS 0x%2.2x\n", bcast_qos.bcast.bis); + g_dbus_dict_append_entry(iter, "BIS", DBUS_TYPE_BYTE, + &bcast_qos.bcast.bis); + } + + bt_shell_printf("Framing 0x%02x\n", bcast_qos.bcast.framing); + + g_dbus_dict_append_entry(iter, "Framing", DBUS_TYPE_BYTE, + &bcast_qos.bcast.framing); + + bt_shell_printf("SyncFactor %u\n", bcast_qos.bcast.sync_factor); + + g_dbus_dict_append_entry(iter, "SyncFactor", DBUS_TYPE_BYTE, + &bcast_qos.bcast.sync_factor); + + bt_shell_printf("Options %u\n", bcast_qos.bcast.options); + + g_dbus_dict_append_entry(iter, "Options", DBUS_TYPE_BYTE, + &bcast_qos.bcast.options); + + bt_shell_printf("Skip %u\n", bcast_qos.bcast.skip); + + g_dbus_dict_append_entry(iter, "Skip", DBUS_TYPE_UINT16, + &bcast_qos.bcast.skip); + + bt_shell_printf("SyncTimeout %u\n", bcast_qos.bcast.sync_timeout); + + g_dbus_dict_append_entry(iter, "SyncTimeout", DBUS_TYPE_UINT16, + &bcast_qos.bcast.sync_timeout); + + bt_shell_printf("SyncCteType %u\n", bcast_qos.bcast.sync_cte_type); + + g_dbus_dict_append_entry(iter, "SyncType", DBUS_TYPE_BYTE, + &bcast_qos.bcast.sync_cte_type); + + bt_shell_printf("MSE %u\n", bcast_qos.bcast.mse); + + g_dbus_dict_append_entry(iter, "MSE", DBUS_TYPE_BYTE, + &bcast_qos.bcast.mse); + + bt_shell_printf("Timeout %u\n", bcast_qos.bcast.timeout); + + g_dbus_dict_append_entry(iter, "Timeout", DBUS_TYPE_UINT16, + &bcast_qos.bcast.timeout); + + if (cfg->ep->bcode) { + const char *key = "BCode"; + + bt_shell_printf("BCode:\n"); + bt_shell_hexdump(cfg->ep->bcode->iov_base, + cfg->ep->bcode->iov_len); + + g_dbus_dict_append_basic_array(iter, DBUS_TYPE_STRING, + &key, DBUS_TYPE_BYTE, + &cfg->ep->bcode->iov_base, + cfg->ep->bcode->iov_len); + } + + append_io_qos(iter, cfg); +} + +static void append_qos(DBusMessageIter *iter, struct endpoint_config *cfg) +{ + DBusMessageIter entry, var, dict; + struct codec_qos *qos = (void *)cfg->qos; + const char *key = "QoS"; + + if (!qos) + return; + + dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY, + NULL, &entry); + + dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key); + + dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, + "a{sv}", &var); + + dbus_message_iter_open_container(&var, DBUS_TYPE_ARRAY, "{sv}", + &dict); + + if (cfg->ep->broadcast) + append_bcast_qos(&dict, cfg); + else + append_ucast_qos(&dict, cfg); + + dbus_message_iter_close_container(&var, &dict); + dbus_message_iter_close_container(&entry, &var); + dbus_message_iter_close_container(iter, &entry); +} + static void append_properties(DBusMessageIter *iter, struct endpoint_config *cfg) { DBusMessageIter dict; - struct codec_qos *qos = (void *)cfg->qos; const char *key = "Capabilities"; - const char *meta = "Metadata"; - const char *keyBCode = "BroadcastCode"; dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "{sv}", &dict); @@ -1789,6 +1949,8 @@ static void append_properties(DBusMessageIter *iter, cfg->caps->iov_len); if (cfg->meta && cfg->meta->iov_len) { + const char *meta = "Metadata"; + g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &meta, DBUS_TYPE_BYTE, &cfg->meta->iov_base, cfg->meta->iov_len); @@ -1797,132 +1959,8 @@ static void append_properties(DBusMessageIter *iter, bt_shell_hexdump(cfg->meta->iov_base, cfg->meta->iov_len); } - if (!qos) - goto done; + append_qos(&dict, cfg); - if (cfg->target_latency) { - bt_shell_printf("TargetLatency 0x%02x\n", qos->interval); - g_dbus_dict_append_entry(&dict, "TargetLatency", - DBUS_TYPE_BYTE, &cfg->target_latency); - } - - if ((!cfg->ep->broadcast) && - (cfg->ep->iso_group != BT_ISO_QOS_GROUP_UNSET)) { - bt_shell_printf("CIG 0x%2.2x\n", cfg->ep->iso_group); - g_dbus_dict_append_entry(&dict, "CIG", DBUS_TYPE_BYTE, - &cfg->ep->iso_group); - } else { - bt_shell_printf("BIG 0x%2.2x\n", bcast_qos.bcast.big); - g_dbus_dict_append_entry(&dict, "BIG", DBUS_TYPE_BYTE, - &bcast_qos.bcast.big); - } - - if ((!cfg->ep->broadcast) && - (cfg->ep->iso_stream != BT_ISO_QOS_STREAM_UNSET)) { - bt_shell_printf("CIS 0x%2.2x\n", cfg->ep->iso_stream); - g_dbus_dict_append_entry(&dict, "CIS", DBUS_TYPE_BYTE, - &cfg->ep->iso_stream); - - } else { - bt_shell_printf("BIS 0x%2.2x\n", bcast_qos.bcast.bis); - g_dbus_dict_append_entry(&dict, "BIS", DBUS_TYPE_BYTE, - &bcast_qos.bcast.bis); - } - - bt_shell_printf("Interval %u\n", qos->interval); - - g_dbus_dict_append_entry(&dict, "Interval", DBUS_TYPE_UINT32, - &qos->interval); - - if (!cfg->ep->broadcast) { - bt_shell_printf("Framing %s\n", - qos->framing ? "true" : "false"); - - g_dbus_dict_append_entry(&dict, "Framing", DBUS_TYPE_BOOLEAN, - &qos->framing); - } else { - bt_shell_printf("Framing %s\n", - bcast_qos.bcast.framing ? "true" : "false"); - - g_dbus_dict_append_entry(&dict, "Framing", DBUS_TYPE_BOOLEAN, - &bcast_qos.bcast.framing); - } - - bt_shell_printf("PHY %s\n", qos->phy); - - g_dbus_dict_append_entry(&dict, "PHY", DBUS_TYPE_STRING, &qos->phy); - - bt_shell_printf("SDU %u\n", cfg->qos->sdu); - - g_dbus_dict_append_entry(&dict, "SDU", DBUS_TYPE_UINT16, &qos->sdu); - - bt_shell_printf("Retransmissions %u\n", qos->rtn); - - g_dbus_dict_append_entry(&dict, "Retransmissions", DBUS_TYPE_BYTE, - &qos->rtn); - - bt_shell_printf("Latency %u\n", qos->latency); - - g_dbus_dict_append_entry(&dict, "Latency", DBUS_TYPE_UINT16, - &qos->latency); - - bt_shell_printf("Delay %u\n", qos->delay); - - g_dbus_dict_append_entry(&dict, "Delay", DBUS_TYPE_UINT32, - &qos->delay); - - if (!cfg->ep->broadcast) - goto done; - - bt_shell_printf("SyncInterval %u\n", bcast_qos.bcast.sync_factor); - - g_dbus_dict_append_entry(&dict, "SyncInterval", DBUS_TYPE_BYTE, - &bcast_qos.bcast.sync_factor); - - bt_shell_printf("Encryption %u\n", bcast_qos.bcast.encryption); - - g_dbus_dict_append_entry(&dict, "Encryption", DBUS_TYPE_BYTE, - &bcast_qos.bcast.encryption); - - bt_shell_printf("Options %u\n", bcast_qos.bcast.options); - - g_dbus_dict_append_entry(&dict, "Options", DBUS_TYPE_BYTE, - &bcast_qos.bcast.options); - - bt_shell_printf("Skip %u\n", bcast_qos.bcast.skip); - - g_dbus_dict_append_entry(&dict, "Skip", DBUS_TYPE_UINT16, - &bcast_qos.bcast.skip); - - bt_shell_printf("SyncTimeout %u\n", bcast_qos.bcast.sync_timeout); - - g_dbus_dict_append_entry(&dict, "SyncTimeout", DBUS_TYPE_UINT16, - &bcast_qos.bcast.sync_timeout); - - bt_shell_printf("SyncCteType %u\n", bcast_qos.bcast.sync_cte_type); - - g_dbus_dict_append_entry(&dict, "SyncCteType", DBUS_TYPE_BYTE, - &bcast_qos.bcast.sync_cte_type); - - bt_shell_printf("MSE %u\n", bcast_qos.bcast.mse); - - g_dbus_dict_append_entry(&dict, "MSE", DBUS_TYPE_BYTE, - &bcast_qos.bcast.mse); - - bt_shell_printf("Timeout %u\n", bcast_qos.bcast.timeout); - - g_dbus_dict_append_entry(&dict, "Timeout", DBUS_TYPE_UINT16, - &bcast_qos.bcast.timeout); - - bt_shell_printf("BroadcastCode:\n"); - bt_shell_hexdump(cfg->ep->bcode->iov_base, cfg->ep->bcode->iov_len); - - g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &keyBCode, - DBUS_TYPE_BYTE, - &cfg->ep->bcode->iov_base, - cfg->ep->bcode->iov_len); - -done: dbus_message_iter_close_container(iter, &dict); } @@ -2892,9 +2930,9 @@ static void custom_phy(const char *input, void *user_data) struct codec_qos *qos = (void *)&p->qos; if (!strcmp(input, "1M")) - qos->phy = "1M"; + qos->phy = 0x01; else if (!strcmp(input, "2M")) - qos->phy = "2M"; + qos->phy = 0x02; else { char *endptr = NULL; uint8_t phy = strtol(input, &endptr, 0); @@ -2906,10 +2944,8 @@ static void custom_phy(const char *input, void *user_data) switch (phy) { case 0x01: - qos->phy = "1M"; - break; case 0x02: - qos->phy = "2M"; + qos->phy = phy; break; default: bt_shell_printf("Invalid argument: %s\n", input); diff --git a/client/print.c b/client/print.c index 66439e541307..8d721e21df4b 100644 --- a/client/print.c +++ b/client/print.c @@ -165,11 +165,19 @@ void print_iter(const char *label, const char *name, DBusMessageIter *iter) break; case DBUS_TYPE_DICT_ENTRY: dbus_message_iter_recurse(iter, &subiter); - entry = g_strconcat(name, " Key", NULL); - print_iter(label, entry, &subiter); - g_free(entry); - entry = g_strconcat(name, " Value", NULL); + if (dbus_message_iter_get_arg_type(&subiter) == + DBUS_TYPE_STRING) { + dbus_message_iter_get_basic(&subiter, &valstr); + entry = g_strconcat(name, ".", valstr, NULL); + } else { + entry = g_strconcat(name, ".Key", NULL); + print_iter(label, entry, &subiter); + g_free(entry); + + entry = g_strconcat(name, ".Value", NULL); + } + dbus_message_iter_next(&subiter); print_iter(label, entry, &subiter); g_free(entry); From patchwork Wed Sep 27 21:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B21E82CC0 for ; Wed, 27 Sep 2023 21:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjI0Vk2 (ORCPT ); Wed, 27 Sep 2023 17:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjI0Vk0 (ORCPT ); Wed, 27 Sep 2023 17:40:26 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62AE2194 for ; Wed, 27 Sep 2023 14:40:20 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6934202b8bdso1312586b3a.1 for ; Wed, 27 Sep 2023 14:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850819; x=1696455619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=AITTg7wzMfwstGQCpgCXYeNHsCBEEvHmneYfk2K9WCQ=; b=FjBRvN5GhdBozsFJrBTZiba3JJ9uMXQvp4Cp9dU4UNp5xro3h9DPBoCGQQpqK3eXbP rL9k9WsC+ayaqbydYL56wbCKkm0jNWhDIghjf/pldvcwmjMKMTMjx4THQ66lUMK186jW venCAsIzhyGN6bOk8DqsHJPaoO1/YuzcxcweiTtivCCx01+FAkgy5uqDPrn6241VuNOa XxhqhALIX5KYoWnHrduOpfKa+/+jOCXaVUZ9veQy53wNBO1UZCQs3iKMd6W3F8HJbxMm yeqIHL61v7fYn7kKAaIn/VZ8/hIPoCOpfPl5vxoUMODWU38AKAx/NWsG1keDcRdQ3Is2 SaJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850819; x=1696455619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AITTg7wzMfwstGQCpgCXYeNHsCBEEvHmneYfk2K9WCQ=; b=Px/u1hG9a7HagzGNoBfY0shCogqjAg4QlIadAFEd66IhbSGYMr8er59KC17pPyJiQp qhAC8VybfxtaDZIbSO2ij2Za3/2Nw+6RBByDXY0uRoA1fTfd3YQYpOvrF06TE6Wbs4yj P/kAp1VfrK/D/ATKCjbEBa25k6uYghh28AggsLPVoRMP/HBNt2QyMTx413qqkkWQA1MY 8RAddt4bLZ2gH0TrvyM6Zv3pzPuXTzJ0/cagYHup/TQQ8rLoIwQnNJ+pYFH5xv7+9faz dQHp/+KReAv2cpt9T61IAhXlOTnhXYLjh6hv2ex0ZOVBE6fjGhCPxbmyNmzIUFTgKMRi oxUw== X-Gm-Message-State: AOJu0Yxv+G08n0jYkoiYxrdcGNoBJh1k+8TtJHtnryG2CZ6AQhxWNyyB zC2Dd+T18Gy1s6rSKVEcHvfHMEIUIWtpTdi2 X-Google-Smtp-Source: AGHT+IHsbAFfLMOxcychEUuZOKW04HS0tOGL7Wjsk7FE5KtUnuclS2xqpRgwulxDensclSyaq6a3Fw== X-Received: by 2002:a05:6a00:1808:b0:690:d2de:14cc with SMTP id y8-20020a056a00180800b00690d2de14ccmr4250998pfa.33.1695850817657; Wed, 27 Sep 2023 14:40:17 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:16 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 06/12] doc/media: Convert media-api.rst into manpages Date: Wed, 27 Sep 2023 14:39:57 -0700 Message-ID: <20230927214003.1873224-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This splits media-api.rst into org.bluez.Media.rst and generate manpages for them. --- Makefile.am | 21 +- doc/media-api.rst | 1144 ------------------------------ doc/org.bluez.Media.rst | 133 ++++ doc/org.bluez.MediaControl.rst | 80 +++ doc/org.bluez.MediaEndpoint.rst | 224 ++++++ doc/org.bluez.MediaFolder.rst | 117 +++ doc/org.bluez.MediaItem.rst | 131 ++++ doc/org.bluez.MediaPlayer.rst | 315 ++++++++ doc/org.bluez.MediaTransport.rst | 274 +++++++ 9 files changed, 1292 insertions(+), 1147 deletions(-) delete mode 100644 doc/media-api.rst create mode 100644 doc/org.bluez.Media.rst create mode 100644 doc/org.bluez.MediaControl.rst create mode 100644 doc/org.bluez.MediaEndpoint.rst create mode 100644 doc/org.bluez.MediaFolder.rst create mode 100644 doc/org.bluez.MediaItem.rst create mode 100644 doc/org.bluez.MediaPlayer.rst create mode 100644 doc/org.bluez.MediaTransport.rst diff --git a/Makefile.am b/Makefile.am index 30db74a0c441..a17841b0668d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -357,8 +357,16 @@ CLEANFILES += $(builtin_files) src/bluetooth.service if MANPAGES man_MANS += src/bluetoothd.8 +man_MANS += doc/org.bluez.Media.5 doc/org.bluez.MediaControl.5 \ + doc/org.bluez.MediaPlayer.5 doc/org.bluez.MediaFolder.5 \ + doc/org.bluez.MediaItem.5 doc/org.bluez.MediaEndpoint.5 \ + doc/org.bluez.MediaTransport.5 endif manual_pages += src/bluetoothd.8 +manual_pages += doc/org.bluez.Media.5 doc/org.bluez.MediaControl.5 \ + doc/org.bluez.MediaPlayer.5 doc/org.bluez.MediaFolder.5 \ + doc/org.bluez.MediaItem.5 doc/org.bluez.MediaEndpoint.5 \ + doc/org.bluez.MediaTransport.5 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \ src/main.conf profiles/network/network.conf \ @@ -397,9 +405,13 @@ EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \ EXTRA_DIST += doc/mgmt-api.txt \ doc/adapter-api.txt doc/device-api.txt \ doc/agent-api.txt doc/profile-api.txt \ - doc/network-api.txt doc/media-api.rst \ - doc/health-api.txt doc/sap-api.txt \ - doc/input-api.txt + doc/network-api.txt doc/health-api.txt \ + doc/sap-api.txt doc/input-api.txt + +EXTRA_DIST += doc/org.bluez.Media.rst doc/org.bluez.MediaControl.rst \ + doc/org.bluez.MediaPlayer.rst doc/org.bluez.MediaFolder.rst \ + doc/org.bluez.MediaItem.rst doc/org.bluez.MediaEndpoint.rst \ + doc/org.bluez.MediaTransport.rst EXTRA_DIST += doc/gatt-api.txt doc/advertising-api.txt @@ -667,6 +679,9 @@ endif %.1: %.rst Makefile $(RST2MAN_PROCESS) +%.5: %.rst Makefile + $(RST2MAN_PROCESS) + %.8: %.rst Makefile $(RST2MAN_PROCESS) diff --git a/doc/media-api.rst b/doc/media-api.rst deleted file mode 100644 index b37ae8f01630..000000000000 --- a/doc/media-api.rst +++ /dev/null @@ -1,1144 +0,0 @@ -=================================== -BlueZ D-Bus Media API documentation -=================================== - - -Media interface -=============== - -:Service: org.bluez -:Interface: org.bluez.Media1 -:Object path: [variable prefix]/{hci0,hci1,...} - -Methods -------- - -void RegisterEndpoint(object endpoint, dict properties) -``````````````````````````````````````````````````````` - - Register a local end point to sender, the sender can register as many - end points as it likes. - - Note: If the sender disconnects the end points are automatically - unregistered. - - possible properties: - - :string UUID: - - UUID of the profile which the endpoint is for. - - UUID must be in the list of SupportedUUIDS. - - :byte Codec: - - Assigned number of codec that the endpoint implements. The - values should match the profile specification which is - indicated by the UUID. - - :uint32_t Vendor [Optional]: - - Vendor-specific Company ID, Codec ID tuple that the endpoint - implements. - - It shall be set to appropriate value when Vendor Specific Codec - (0xff) is used. - - :array{byte} Capabilities: - - Capabilities blob, it is used as it is so the size and byte - order must match. - - :array{byte} Metadata [Optional]: - - Metadata blob, it is used as it is so the size and byte order - must match. - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - - emitted when interface for the end-point is disabled - -void UnregisterEndpoint(object endpoint) -```````````````````````````````````````` - Unregister sender end point. - -void RegisterPlayer(object player, dict properties) -``````````````````````````````````````````````````` - - Register a media player object to sender, the sender can register as - many objects as it likes. - - Object must implement at least org.mpris.MediaPlayer2.Player as defined - in MPRIS 2.2 spec: - - http://specifications.freedesktop.org/mpris-spec/latest/ - - Note: If the sender disconnects its objects are automatically - unregistered. - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - -void UnregisterPlayer(object player) -```````````````````````````````````` - - Unregister sender media player. - -void RegisterApplication(object root, dict options) -``````````````````````````````````````````````````` - - Register endpoints an player objects within root object which must - implement ObjectManager. - - The application object path together with the D-Bus system bus - connection ID define the identification of the application. - - Possible errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.AlreadyExists: - -void UnregisterApplication(object application) -`````````````````````````````````````````````` - - This unregisters the services that has been previously registered. The - object path parameter must match the same value that has been used on - registration. - - Possible errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.DoesNotExist: - -Properties ----------- - -array{string} SupportedUUIDs [readonly] -``````````````````````````````````````` - - List of 128-bit UUIDs that represents the supported Endpoint - registration. - -MediaControl interface -====================== - -:Service: org.bluez -:Interface: org.bluez.MediaControl1 -:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods -------- - -void Play() [Deprecated] -```````````````````````` - - Resume playback. - -void Pause() [Deprecated] -````````````````````````` - - Pause playback. - -void Stop() [Deprecated] -```````````````````````` - - Stop playback. - -void Next() [Deprecated] -```````````````````````` - - Next item. - -void Previous() [Deprecated] -```````````````````````````` - - Previous item. - -void VolumeUp() [Deprecated] -```````````````````````````` - - Adjust remote volume one step up - -void VolumeDown() [Deprecated] -`````````````````````````````` - - Adjust remote volume one step down - -void FastForward() [Deprecated] -``````````````````````````````` - - Fast forward playback, this action is only stopped when another method - in this interface is called. - -void Rewind() [Deprecated] -`````````````````````````` - - Rewind playback, this action is only stopped when another method in - this interface is called. - -Properties ----------- - -boolean Connected [readonly] -```````````````````````````` - -object Player [readonly, optional] -`````````````````````````````````` - - Addressed Player object path. - -MediaPlayer interface -===================== - -:Service: org.bluez (Controller role) -:Interface: org.bluez.MediaPlayer1 -:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX - -Methods -------- - -void Play() -``````````` - - Resume playback. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Pause() -```````````` - - Pause playback. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Stop() -``````````` - - Stop playback. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Next() -``````````` - - Next item. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Previous() -``````````````` - - Previous item. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void FastForward() -`````````````````` - - Fast forward playback, this action is only stopped when another method - in this interface is called. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Rewind() -````````````` - - Rewind playback, this action is only stopped when another method in - this interface is called. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Press(byte avc_key) -```````````````````````` - - Press a specific key to send as passthrough command. The key will be - released automatically. Use Hold() instead if the intention is to hold - down the key. - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Hold(byte avc_key) -``````````````````````` - - Press and hold a specific key to send as passthrough command. It is - your responsibility to make sure that Release() is called after calling - this method. The held key will also be released when any other method - in this interface is called. - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void Release() -`````````````` - - Release the previously held key invoked using Hold(). - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -Properties ----------- - -string Equalizer [readwrite] -```````````````````````````` - - Possible values: "off" or "on" - -string Repeat [readwrite] -````````````````````````` - - Possible values: "off", "singletrack", "alltracks" or "group" - -string Shuffle [readwrite] -`````````````````````````` - - Possible values: "off", "alltracks" or "group" - -string Scan [readwrite] -``````````````````````` - - Possible values: "off", "alltracks" or "group" - -string Status [readonly] -```````````````````````` - - Possible status: "playing", "stopped", "paused", "forward-seek", - "reverse-seek" or "error" - -uint32 Position [readonly] -`````````````````````````` - - Playback position in milliseconds. Changing the position may generate - additional events that will be sent to the remote device. When position - is 0 it means the track is starting and when it's greater than or equal - to track's duration the track has ended. - - Note that even if duration is not available in metadata it's possible - to signal its end by setting position to the maximum uint32 value. - -dict Track [readonly] -````````````````````` - - Track metadata. - - Possible values: - - :string Title: - - Track title name - - :string Artist: - - Track artist name - - :string Album: - - Track album name - - :string Genre: - - Track genre name - - :uint32 NumberOfTracks: - - Number of tracks in total - - :uint32 TrackNumber: - - Track number - - :uint32 Duration: - - Track duration in milliseconds - -object Device [readonly] -```````````````````````` - - Device object path. - -string Name [readonly] -`````````````````````` - - Player name - -string Type [readonly] -`````````````````````` - - Player type - - Possible values: - - "Audio" - "Video" - "Audio Broadcasting" - "Video Broadcasting" - -string Subtype [readonly] -````````````````````````` - - Player subtype - - Possible values: - - "Audio Book" - "Podcast" - -boolean Browsable [readonly] -```````````````````````````` - - If present indicates the player can be browsed using MediaFolder - interface. - - Possible values: - - :True: - - Supported and active - - :False: - - Supported but inactive - - Note: If supported but inactive clients can enable it by using - MediaFolder interface but it might interfere in the playback of other - players. - -boolean Searchable [readonly] -````````````````````````````` - - If present indicates the player can be searched using MediaFolder - interface. - - Possible values: - - :True: - - Supported and active - - :False: - - Supported but inactive - - Note: If supported but inactive clients can enable it by using - MediaFolder interface but it might interfere in the playback of other - players. - -object Playlist -``````````````` - - Playlist object path. - -MediaFolder interface -===================== - -:Service: unique name (Target role) - org.bluez (Controller role) -:Interface: org.bluez.MediaFolder1 -:Object path: freely definable (Target role) - [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX - (Controller role) - -Methods -------- - -object Search(string value, dict filter) -```````````````````````````````````````` - - Return a folder object containing the search result. - - To list the items found use the folder object returned and pass to - ChangeFolder. - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -array{objects, properties} ListItems(dict filter) -````````````````````````````````````````````````` - - Return a list of items found - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void ChangeFolder(object folder) -```````````````````````````````` - - Change current folder. - - Note: By changing folder the items of previous folder might be destroyed - and have to be listed again, the exception is NowPlaying folder which - should be always present while the player is active. - - Possible Errors: - - :org.bluez.Error.InvalidArguments: - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -Properties ----------- - -uint32 NumberOfItems [readonly] -``````````````````````````````` - - Number of items in the folder - -string Name [readonly] -`````````````````````` - - Folder name: - - Possible values: - - :"/Filesystem/...": - - Filesystem scope - - :"/NowPlaying/...": - - NowPlaying scope - - Note: /NowPlaying folder might not be listed if player is stopped, - folders created by Search are virtual so once another Search is perform - or the folder is changed using ChangeFolder it will no longer be listed. - -Filters -------- - -:uint32 Start: - - Offset of the first item. - - Default value: 0 - -:uint32 End: - - Offset of the last item. - - Default value: NumbeOfItems - -:array{string} Attributes: - - Item properties that should be included in the list. - - Possible Values: - - "title", "artist", "album", "genre", "number-of-tracks", - "number", "duration" - - Default Value: All - -MediaItem interface -=================== - -:Service: unique name (Target role) - org.bluez (Controller role) -:Interface: org.bluez.MediaItem1 -:Object path: freely definable (Target role) - [variable - prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX/itemX - (Controller role) - -Methods -------- - -void Play() -``````````` - - Play item - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -void AddtoNowPlaying() -`````````````````````` - - Add item to now playing list - - Possible Errors: - - :org.bluez.Error.NotSupported: - :org.bluez.Error.Failed: - -Properties ----------- - -object Player [readonly] -```````````````````````` - - Player object path the item belongs to - -string Name [readonly] -`````````````````````` - - Item displayable name - -string Type [readonly] -`````````````````````` - - Item type - - Possible values: "video", "audio", "folder" - -string FolderType [readonly, optional] -`````````````````````````````````````` - - Folder type. - - Possible values: "mixed", "titles", "albums", "artists" - - Available if property Type is "Folder" - -boolean Playable [readonly, optional] -````````````````````````````````````` - - Indicates if the item can be played - - Available if property Type is "folder" - -dict Metadata [readonly] -```````````````````````` - - Item metadata. - - Possible values: - - :string Title: - - Item title name - - Available if property Type is "audio" or "video" - - :string Artist: - - Item artist name - - Available if property Type is "audio" or "video" - - :string Album: - - Item album name - - Available if property Type is "audio" or "video" - - :string Genre: - - Item genre name - - Available if property Type is "audio" or "video" - - :uint32 NumberOfTracks: - - Item album number of tracks in total - - Available if property Type is "audio" or "video" - - :uint32 Number: - - Item album number - - Available if property Type is "audio" or "video" - - :uint32 Duration: - - Item duration in milliseconds - - Available if property Type is "audio" or "video" - -MediaEndpoint interface -======================= - -:Service: unique name (Server role) - org.bluez (Client role) -:Interface: org.bluez.MediaEndpoint1 -:Object path: freely definable (Server role) - [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/sepX - (Client role) - -Methods -------- - -void SetConfiguration(object transport, dict properties) -```````````````````````````````````````````````````````` - - Set configuration for the transport. - - For client role transport must be set with a server endpoint oject which - will be configured and the properties must contain the following - properties: - - :array{byte} Capabilities [Mandatory]: - - See Endpoint.Capabilities property. - - :array{byte} Metadata [ISO only]: - - See Endpoint.Metadata property. - - :uint32 Location [ISO only]: - - See Endpoint.Location property. - - :byte Framing [ISO only]: - - See Endpoint.Framing property. - - :byte PHY [ISO only]: - - See Endpoint.PHY property. - - :uint16 MaximumLatency [ISO only]: - - See Endpoint.MaximumLatency property. - - :uint32 MinimumDelay [ISO only]: - - See Endpoint.MinimumDelay property. - - :uint32 MaximumDelay [ISO only]: - - See Endpoint.MaximumDelay property. - - :uint32 PreferredMinimumDelay [ISO only]: - - See Endpoint.PreferredMinimumDelay property. - - :uint32 PreferredMaximumDelay [ISO only]: - - See Endpoint.PreferredMaximumDelay property. - - -array{byte} SelectConfiguration(array{byte} capabilities) -````````````````````````````````````````````````````````` - - Select preferable configuration from the supported capabilities. - - Returns a configuration which can be used to setup a transport. - - Note: There is no need to cache the selected configuration since on - success the configuration is send back as parameter of SetConfiguration. - -dict SelectProperties(dict properties) -`````````````````````````````````````` - - Select preferable properties from the supported properties: - - :object Endpoint [ISO only]: - :Refer to SetConfiguration for the list of other possible properties.: - - Returns propeties which can be used to setup a transport. - - Note: There is no need to cache the selected properties since on - success the configuration is send back as parameter of SetConfiguration. - -void ClearConfiguration(object transport) -````````````````````````````````````````` - - Clear transport configuration. - -void Release() -`````````````` - - This method gets called when the service daemon unregisters the - endpoint. An endpoint can use it to do cleanup tasks. There is no need - to unregister the endpoint, because when this method gets called it has - already been unregistered. - -Properties ----------- - -string UUID [readonly, optional] -```````````````````````````````` - - UUID of the profile which the endpoint is for. - -byte Codec [readonly, optional] -``````````````````````````````` - - Assigned number of codec that the endpoint implements. - The values should match the profile specification which is indicated by - the UUID. - -uint32_t Vendor [readonly, Optional] -```````````````````````````````````` - - Vendor-specific Company ID, Codec ID tuple that the endpoint implements. - - It shall be set to appropriate value when Vendor Specific Codec (0xff) - is used. - -array{byte} Capabilities [readonly, optional] -````````````````````````````````````````````` - - Capabilities blob, it is used as it is so the size and byte order must - match. - -array{byte} Metadata [readonly, Optional] -````````````````````````````````````````` - - Metadata blob, it is used as it is so the size and byte order must - match. - -object Device [readonly, optional] -`````````````````````````````````` - - Device object which the endpoint is belongs to. - -bool DelayReporting [readonly, optional] -```````````````````````````````````````` - - Indicates if endpoint supports Delay Reporting. - -byte Framing [ISO only] -``````````````````````` - - Indicates endpoint support framing. - -byte PHY [ISO only] -``````````````````` - - Indicates endpoint supported PHY. - -uint16_t MaximumLatency [ISO only] -`````````````````````````````````` - - Indicates endpoint maximum latency. - -uint32_t MinimumDelay [ISO only] -```````````````````````````````` - - Indicates endpoint minimum presentation delay. - -uint32_t MaximumDelay [ISO only] -```````````````````````````````` - - Indicates endpoint maximum presentation delay. - -uint32_t PreferredMinimumDelay [ISO only] -````````````````````````````````````````` - - Indicates endpoint preferred minimum presentation delay. - -uint32_t PreferredMinimumDelay [ISO only] -````````````````````````````````````````` - - Indicates endpoint preferred minimum presentation delay. - -uint32 Location [ISO only] -`````````````````````````` - - Indicates endpoint supported locations. - -uint16 SupportedContext [ISO only] -`````````````````````````````````` - - Indicates endpoint supported audio context. - -uint16 Context [ISO only] -````````````````````````` - - Indicates endpoint available audio context. - -MediaTransport interface -======================== - -:Service: org.bluez -:Interface: org.bluez.MediaTransport1 -:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/fdX - -Methods -------- - -fd, uint16, uint16 Acquire() -```````````````````````````` - - Acquire transport file descriptor and the MTU for read and write - respectively. - - Possible Errors: - - :org.bluez.Error.NotAuthorized: - :org.bluez.Error.Failed: - -fd, uint16, uint16 TryAcquire() -``````````````````````````````` - - Acquire transport file descriptor only if the transport is in "pending" - state at the time the message is received by BlueZ. Otherwise no request - will be sent to the remote device and the function will just fail with - org.bluez.Error.NotAvailable. - - Possible Errors: - - :org.bluez.Error.NotAuthorized: - :org.bluez.Error.Failed: - :org.bluez.Error.NotAvailable: - -void Release() -`````````````` - - Releases file descriptor. - -Properties ----------- - -object Device [readonly] -```````````````````````` - - Device object which the transport is connected to. - -string UUID [readonly] -`````````````````````` - - UUID of the profile which the transport is for. - -byte Codec [readonly] -````````````````````` - - Assigned number of codec that the transport support. - The values should match the profile specification which is indicated by - the UUID. - -array{byte} Configuration [readonly] -```````````````````````````````````` - - Configuration blob, it is used as it is so the size and byte order must - match. - -string State [readonly] -``````````````````````` - - Indicates the state of the transport. Possible values are: - - :"idle": not streaming - :"pending": streaming but not acquired - :"active": streaming and acquired - -uint16 Delay [readwrite, optional] -`````````````````````````````````` - - Transport delay in 1/10 of millisecond, this property is only writeable - when the transport was acquired by the sender. - -uint16 Volume [readwrite, optional] -``````````````````````````````````` - - Indicates volume level of the transport, this property is only writeable - when the transport was acquired by the sender. - - Possible Values: 0-127 - -object Endpoint [readonly, optional, experimental] -`````````````````````````````````````````````````` - - Endpoint object which the transport is associated with. - -uint32 Location [readonly, ISO only, experimental] -`````````````````````````````````````````````````` - - Indicates transport Audio Location. - -array{byte} Metadata [readwrite, ISO Only, experimental] -```````````````````````````````````````````````````````` - - Indicates transport Metadata. - -array{object} Links [readonly, optional, ISO only, experimental] -```````````````````````````````````````````````````````````````` - - Linked transport objects which the transport is associated with. - -dict QoS [readonly, optional, ISO only, experimental] -````````````````````````````````````````````````````` - - Only present when QoS is configured. - - Possible values for Unicast: - - :byte CIG: - - Indicates configured CIG. - - Possible values: - - :0x00 - 0xef: - - Valid ID range. - - :0xff: - - Auto allocate. - - :byte CIS: - - Indicates configured CIS. - - Possible values: - - :0x00 - 0xef: - - Valid ID range. - - :0xff: - - Auto allocate. - - :byte Framing: - - Indicates configured framing. - - Possible values: - - :0x00: - - Unframed. - - :0x01: - - Framed. - - :uint32 PresentationDelay: - - Indicates configured transport presentation delay (us). - - :byte TargetLatency: - - Indicates the requested target latency. - - Possible values: - - :0x01: - - Low Latency. - - :0x02: - - Balanced Latency/Reliability. - - :0x03: - - High Reliability. - - Possible values for Broadcast: - - :byte BIG: - - Indicates configured QoS BIG. - - :byte BIS: - - Indicates configured BIS. - - :byte SyncFactor: - - Indicates configured broadcast sync factor. - - :byte Packing: - - Indicates configured packing. - - :byte Framing: - - Indicates configured framing. - - :byte Options: - - Indicates configured broadcast options. - - :uint16 Skip: - - Indicates configured broadcast skip. - - :byte SyncTimeout: - - Indicates configured broadcast sync timeout. - - :byte SyncType: - - Indicates configured broadcast sync CTE type. - - :byte MSE: - - Indicates configured broadcast MSE. - - :uint16 Timeout: - - Indicates configured broadcast timeout. - - Possible values for both Unicast and Broadcast: - - :uint32 Interval: - - Indicates configured ISO interval (us). - - :uint16 Latency: - - Indicates configured transport latency (ms). - - :uint16 SDU: - - Indicates configured maximum SDU. - - :byte PHY: - - Indicates configured PHY. - - Possible values: - - :bit 0: - - LE 1M - - :bit 1: - - LE 2M - - :bit 2: - - LE Coded - - :byte Retransmissions: - - Indicates configured retransmissions. diff --git a/doc/org.bluez.Media.rst b/doc/org.bluez.Media.rst new file mode 100644 index 000000000000..678e6090c6e1 --- /dev/null +++ b/doc/org.bluez.Media.rst @@ -0,0 +1,133 @@ +=============== +org.bluez.Media +=============== + +----------------------------------- +BlueZ D-Bus Media API documentation +----------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: org.bluez +:Interface: org.bluez.Media1 +:Object path: [variable prefix]/{hci0,hci1,...} + +Methods +------- + +void RegisterEndpoint(object endpoint, dict properties) +``````````````````````````````````````````````````````` + + Register a local end point to sender, the sender can register as many + end points as it likes. + + Note: If the sender disconnects the end points are automatically + unregistered. + + possible properties: + + :string UUID: + + UUID of the profile which the endpoint is for. + + UUID must be in the list of SupportedUUIDS. + + :byte Codec: + + Assigned number of codec that the endpoint implements. The + values should match the profile specification which is + indicated by the UUID. + + :uint32_t Vendor [Optional]: + + Vendor-specific Company ID, Codec ID tuple that the endpoint + implements. + + It shall be set to appropriate value when Vendor Specific Codec + (0xff) is used. + + :array{byte} Capabilities: + + Capabilities blob, it is used as it is so the size and byte + order must match. + + :array{byte} Metadata [Optional]: + + Metadata blob, it is used as it is so the size and byte order + must match. + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + + emitted when interface for the end-point is disabled + +void UnregisterEndpoint(object endpoint) +```````````````````````````````````````` + Unregister sender end point. + +void RegisterPlayer(object player, dict properties) +``````````````````````````````````````````````````` + + Register a media player object to sender, the sender can register as + many objects as it likes. + + Object must implement at least org.mpris.MediaPlayer2.Player as defined + in MPRIS 2.2 spec: + + http://specifications.freedesktop.org/mpris-spec/latest/ + + Note: If the sender disconnects its objects are automatically + unregistered. + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + +void UnregisterPlayer(object player) +```````````````````````````````````` + + Unregister sender media player. + +void RegisterApplication(object root, dict options) +``````````````````````````````````````````````````` + + Register endpoints an player objects within root object which must + implement ObjectManager. + + The application object path together with the D-Bus system bus + connection ID define the identification of the application. + + Possible errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.AlreadyExists: + +void UnregisterApplication(object application) +`````````````````````````````````````````````` + + This unregisters the services that has been previously registered. The + object path parameter must match the same value that has been used on + registration. + + Possible errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.DoesNotExist: + +Properties +---------- + +array{string} SupportedUUIDs [readonly] +``````````````````````````````````````` + + List of 128-bit UUIDs that represents the supported Endpoint + registration. diff --git a/doc/org.bluez.MediaControl.rst b/doc/org.bluez.MediaControl.rst new file mode 100644 index 000000000000..54e84e8c62eb --- /dev/null +++ b/doc/org.bluez.MediaControl.rst @@ -0,0 +1,80 @@ +====================== +org.bluez.MediaControl +====================== + +------------------------------------------ +BlueZ D-Bus MediaControl API documentation +------------------------------------------ + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: org.bluez +:Interface: org.bluez.MediaControl1 +:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX + +Methods +------- + +void Play() [Deprecated] +```````````````````````` + + Resume playback. + +void Pause() [Deprecated] +````````````````````````` + + Pause playback. + +void Stop() [Deprecated] +```````````````````````` + + Stop playback. + +void Next() [Deprecated] +```````````````````````` + + Next item. + +void Previous() [Deprecated] +```````````````````````````` + + Previous item. + +void VolumeUp() [Deprecated] +```````````````````````````` + + Adjust remote volume one step up + +void VolumeDown() [Deprecated] +`````````````````````````````` + + Adjust remote volume one step down + +void FastForward() [Deprecated] +``````````````````````````````` + + Fast forward playback, this action is only stopped when another method + in this interface is called. + +void Rewind() [Deprecated] +`````````````````````````` + + Rewind playback, this action is only stopped when another method in + this interface is called. + +Properties +---------- + +boolean Connected [readonly] +```````````````````````````` + +object Player [readonly, optional] +`````````````````````````````````` + + Addressed Player object path. diff --git a/doc/org.bluez.MediaEndpoint.rst b/doc/org.bluez.MediaEndpoint.rst new file mode 100644 index 000000000000..cba8cb3edc6e --- /dev/null +++ b/doc/org.bluez.MediaEndpoint.rst @@ -0,0 +1,224 @@ +======================= +org.bluez.MediaEndpoint +======================= + +------------------------------------------- +BlueZ D-Bus MediaEndpoint API documentation +------------------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: unique name (Server role) + org.bluez (Client role) +:Interface: org.bluez.MediaEndpoint1 +:Object path: freely definable (Server role) + [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/sepX + (Client role) + +Methods +------- + +void SetConfiguration(object transport, dict properties) +```````````````````````````````````````````````````````` + + Set configuration for the transport. + + For client role transport must be set with a server endpoint oject which + will be configured and the properties must contain the following + properties: + + :array{byte} Capabilities [Mandatory]: + + See Capabilities property. + + :array{byte} Metadata [ISO only]: + + See Metadata property. + + :uint32 Location [ISO only]: + + See Location property. + + :byte Framing [ISO only]: + + See Framing property. + + :byte PHY [ISO only]: + + See PHY property. + + :uint16 MaximumLatency [ISO only]: + + See MaximumLatency property. + + :uint32 MinimumDelay [ISO only]: + + See MinimumDelay property. + + :uint32 MaximumDelay [ISO only]: + + See MaximumDelay property. + + :uint32 PreferredMinimumDelay [ISO only]: + + See PreferredMinimumDelay property. + + :uint32 PreferredMaximumDelay [ISO only]: + + See PreferredMaximumDelay property. + +array{byte} SelectConfiguration(array{byte} capabilities) +````````````````````````````````````````````````````````` + + Select preferable configuration from the supported capabilities. + + Returns a configuration which can be used to setup a transport. + + Note: There is no need to cache the selected configuration since on + success the configuration is send back as parameter of SetConfiguration. + +dict SelectProperties(dict properties) +`````````````````````````````````````` + + Select preferable properties from the supported properties: + + :object Endpoint [ISO only]: + :Refer to SetConfiguration for the list of other possible properties.: + + Returns propeties which can be used to setup a transport. + + Note: There is no need to cache the selected properties since on + success the configuration is send back as parameter of SetConfiguration. + +void ClearConfiguration(object transport) +````````````````````````````````````````` + + Clear transport configuration. + +void Release() +`````````````` + + This method gets called when the service daemon unregisters the + endpoint. An endpoint can use it to do cleanup tasks. There is no need + to unregister the endpoint, because when this method gets called it has + already been unregistered. + +MediaEndpoint Properties +------------------------ + +string UUID [readonly, optional] +```````````````````````````````` + + UUID of the profile which the endpoint is for. + +byte Codec [readonly, optional] +``````````````````````````````` + + Assigned number of codec that the endpoint implements. + The values should match the profile specification which is indicated by + the UUID. + +uint32_t Vendor [readonly, Optional] +```````````````````````````````````` + + Vendor-specific Company ID, Codec ID tuple that the endpoint implements. + + It shall be set to appropriate value when Vendor Specific Codec (0xff) + is used. + +array{byte} Capabilities [readonly, optional] +````````````````````````````````````````````` + + Capabilities blob, it is used as it is so the size and byte order must + match. + +array{byte} Metadata [readonly, Optional] +````````````````````````````````````````` + + Metadata blob, it is used as it is so the size and byte order must + match. + +object Device [readonly, optional] +`````````````````````````````````` + + Device object which the endpoint is belongs to. + +bool DelayReporting [readonly, optional] +```````````````````````````````````````` + + Indicates if endpoint supports Delay Reporting. + +byte Framing [ISO only] +``````````````````````` + + Indicates endpoint support framing. + +byte PHY [ISO only] +``````````````````` + + Indicates endpoint supported PHY. + + Possible values: + + :bit 0: + + LE 1M + + :bit 1: + + LE 2M + + :bit 2: + + LE Coded + +byte Retransmissions [ISO only] +``````````````````````````````` + + Indicates endpoint preferred number of retransmissions. + +uint16_t MaximumLatency [ISO only] +`````````````````````````````````` + + Indicates endpoint maximum latency. + +uint32_t MinimumDelay [ISO only] +```````````````````````````````` + + Indicates endpoint minimum presentation delay. + +uint32_t MaximumDelay [ISO only] +```````````````````````````````` + + Indicates endpoint maximum presentation delay. + +uint32_t PreferredMinimumDelay [ISO only] +````````````````````````````````````````` + + Indicates endpoint preferred minimum presentation delay. + +uint32_t PreferredMaximumDelay [ISO only] +````````````````````````````````````````` + + Indicates endpoint preferred maximum presentation delay. + +uint32 Location [ISO only] +`````````````````````````` + + Indicates endpoint supported locations. + +uint16 SupportedContext [ISO only] +`````````````````````````````````` + + Indicates endpoint supported audio context. + +uint16 Context [ISO only] +````````````````````````` + + Indicates endpoint available audio context. diff --git a/doc/org.bluez.MediaFolder.rst b/doc/org.bluez.MediaFolder.rst new file mode 100644 index 000000000000..dd56f06b41e4 --- /dev/null +++ b/doc/org.bluez.MediaFolder.rst @@ -0,0 +1,117 @@ +===================== +org.bluez.MediaFolder +===================== + +----------------------------------------- +BlueZ D-Bus MediaFolder API documentation +----------------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: unique name (Target role) + org.bluez (Controller role) +:Interface: org.bluez.MediaFolder1 +:Object path: freely definable (Target role) + [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX + (Controller role) + +Methods +------- + +object Search(string value, dict filter) +```````````````````````````````````````` + + Return a folder object containing the search result. + + To list the items found use the folder object returned and pass to + ChangeFolder. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +array{objects, properties} ListItems(dict filter) +````````````````````````````````````````````````` + + Return a list of items found + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void ChangeFolder(object folder) +```````````````````````````````` + + Change current folder. + + Note: By changing folder the items of previous folder might be destroyed + and have to be listed again, the exception is NowPlaying folder which + should be always present while the player is active. + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +Properties +---------- + +uint32 NumberOfItems [readonly] +``````````````````````````````` + + Number of items in the folder + +string Name [readonly] +`````````````````````` + + Folder name: + + Possible values: + + :"/Filesystem/...": + + Filesystem scope + + :"/NowPlaying/...": + + NowPlaying scope + + Note: /NowPlaying folder might not be listed if player is stopped, + folders created by Search are virtual so once another Search is perform + or the folder is changed using ChangeFolder it will no longer be listed. + +Filters +------- + +:uint32 Start: + + Offset of the first item. + + Default value: 0 + +:uint32 End: + + Offset of the last item. + + Default value: NumbeOfItems + +:array{string} Attributes: + + Item properties that should be included in the list. + + Possible Values: + + "title", "artist", "album", "genre", "number-of-tracks", + "number", "duration" + + Default Value: All diff --git a/doc/org.bluez.MediaItem.rst b/doc/org.bluez.MediaItem.rst new file mode 100644 index 000000000000..855e8a6395b7 --- /dev/null +++ b/doc/org.bluez.MediaItem.rst @@ -0,0 +1,131 @@ +=================== +org.bluez.MediaItem +=================== + +--------------------------------------- +BlueZ D-Bus MediaItem API documentation +--------------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: unique name (Target role) + org.bluez (Controller role) +:Interface: org.bluez.MediaItem1 +:Object path: freely definable (Target role) + [variable + prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX/itemX + (Controller role) + +Methods +------- + +void Play() +``````````` + + Play item + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void AddtoNowPlaying() +`````````````````````` + + Add item to now playing list + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +Properties +---------- + +object Player [readonly] +```````````````````````` + + Player object path the item belongs to + +string Name [readonly] +`````````````````````` + + Item displayable name + +string Type [readonly] +`````````````````````` + + Item type + + Possible values: "video", "audio", "folder" + +string FolderType [readonly, optional] +`````````````````````````````````````` + + Folder type. + + Possible values: "mixed", "titles", "albums", "artists" + + Available if property Type is "Folder" + +boolean Playable [readonly, optional] +````````````````````````````````````` + + Indicates if the item can be played + + Available if property Type is "folder" + +dict Metadata [readonly] +```````````````````````` + + Item metadata. + + Possible values: + + :string Title: + + Item title name + + Available if property Type is "audio" or "video" + + :string Artist: + + Item artist name + + Available if property Type is "audio" or "video" + + :string Album: + + Item album name + + Available if property Type is "audio" or "video" + + :string Genre: + + Item genre name + + Available if property Type is "audio" or "video" + + :uint32 NumberOfTracks: + + Item album number of tracks in total + + Available if property Type is "audio" or "video" + + :uint32 Number: + + Item album number + + Available if property Type is "audio" or "video" + + :uint32 Duration: + + Item duration in milliseconds + + Available if property Type is "audio" or "video" diff --git a/doc/org.bluez.MediaPlayer.rst b/doc/org.bluez.MediaPlayer.rst new file mode 100644 index 000000000000..60bd679bb7c0 --- /dev/null +++ b/doc/org.bluez.MediaPlayer.rst @@ -0,0 +1,315 @@ +===================== +org.bluez.MediaPlayer +===================== + +----------------------------------------- +BlueZ D-Bus MediaPlayer API documentation +----------------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: org.bluez (Controller role) +:Interface: org.bluez.MediaPlayer1 +:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX + +Methods +------- + +void Play() +``````````` + + Resume playback. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Pause() +```````````` + + Pause playback. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Stop() +``````````` + + Stop playback. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Next() +``````````` + + Next item. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Previous() +``````````````` + + Previous item. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void FastForward() +`````````````````` + + Fast forward playback, this action is only stopped when another method + in this interface is called. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Rewind() +````````````` + + Rewind playback, this action is only stopped when another method in + this interface is called. + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Press(byte avc_key) +```````````````````````` + + Press a specific key to send as passthrough command. The key will be + released automatically. Use Hold() instead if the intention is to hold + down the key. + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Hold(byte avc_key) +``````````````````````` + + Press and hold a specific key to send as passthrough command. It is + your responsibility to make sure that Release() is called after calling + this method. The held key will also be released when any other method + in this interface is called. + + Possible Errors: + + :org.bluez.Error.InvalidArguments: + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +void Release() +`````````````` + + Release the previously held key invoked using Hold(). + + Possible Errors: + + :org.bluez.Error.NotSupported: + :org.bluez.Error.Failed: + +Properties +---------- + +string Equalizer [readwrite] +```````````````````````````` + + Indicates Player Equalizer setting. + + Possible values: + + :"off": + :"on": + +string Repeat [readwrite] +````````````````````````` + + Indicates Player Repeat setting. + + Possible values: + + :"off": + :"singletrack": + :"alltracks": + :"group": + +string Shuffle [readwrite] +`````````````````````````` + + Indicates Player Suffle setting. + + Possible values: + + :"off": + :"alltracks": + :"group": + +string Scan [readwrite] +``````````````````````` + + Indicates Player Scan setting. + + Possible values: + + :"off": + :"alltracks": + :"group": + +string Status [readonly] +```````````````````````` + + Indicates Player Status setting. + + Possible status: + + :"playing": + :"stopped": + :"paused": + :"forward-seek": + :"reverse-seek": + :"error": + +uint32 Position [readonly] +`````````````````````````` + + Playback position in milliseconds. Changing the position may generate + additional events that will be sent to the remote device. When position + is 0 it means the track is starting and when it's greater than or equal + to track's duration the track has ended. + + Note that even if duration is not available in metadata it's possible + to signal its end by setting position to the maximum uint32 value. + +dict Track [readonly] +````````````````````` + + Track metadata. + + Possible values: + + :string Title: + + Track title name + + :string Artist: + + Track artist name + + :string Album: + + Track album name + + :string Genre: + + Track genre name + + :uint32 NumberOfTracks: + + Number of tracks in total + + :uint32 TrackNumber: + + Track number + + :uint32 Duration: + + Track duration in milliseconds + +object Device [readonly] +```````````````````````` + + Device object path. + +string Name [readonly] +`````````````````````` + + Player name + +string Type [readonly] +`````````````````````` + + Player type + + Possible values: + + "Audio" + "Video" + "Audio Broadcasting" + "Video Broadcasting" + +string Subtype [readonly] +````````````````````````` + + Player subtype + + Possible values: + + "Audio Book" + "Podcast" + +boolean Browsable [readonly] +```````````````````````````` + + If present indicates the player can be browsed using MediaFolder + interface. + + Possible values: + + :True: + + Supported and active + + :False: + + Supported but inactive + + Note: If supported but inactive clients can enable it by using + MediaFolder interface but it might interfere in the playback of other + players. + +boolean Searchable [readonly] +````````````````````````````` + + If present indicates the player can be searched using MediaFolder + interface. + + Possible values: + + :True: + + Supported and active + + :False: + + Supported but inactive + + Note: If supported but inactive clients can enable it by using + MediaFolder interface but it might interfere in the playback of other + players. + +object Playlist +``````````````` + + Playlist object path. diff --git a/doc/org.bluez.MediaTransport.rst b/doc/org.bluez.MediaTransport.rst new file mode 100644 index 000000000000..6e95df8f2ee8 --- /dev/null +++ b/doc/org.bluez.MediaTransport.rst @@ -0,0 +1,274 @@ +======================== +org.bluez.MediaTransport +======================== + +-------------------------------------------- +BlueZ D-Bus MediaTransport API documentation +-------------------------------------------- + +:Version: BlueZ +:Date: September 2023 +:Manual section: 5 +:Manual group: Linux System Administration + +Interface +========= + +:Service: org.bluez +:Interface: org.bluez.MediaTransport1 +:Object path: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/fdX + +Methods +------- + +fd, uint16, uint16 Acquire() +```````````````````````````` + + Acquire transport file descriptor and the MTU for read and write + respectively. + + Possible Errors: + + :org.bluez.Error.NotAuthorized: + :org.bluez.Error.Failed: + +fd, uint16, uint16 TryAcquire() +``````````````````````````````` + + Acquire transport file descriptor only if the transport is in "pending" + state at the time the message is received by BlueZ. Otherwise no request + will be sent to the remote device and the function will just fail with + org.bluez.Error.NotAvailable. + + Possible Errors: + + :org.bluez.Error.NotAuthorized: + :org.bluez.Error.Failed: + :org.bluez.Error.NotAvailable: + +void Release() +`````````````` + + Releases file descriptor. + +Properties +---------- + +object Device [readonly] +```````````````````````` + + Device object which the transport is connected to. + +string UUID [readonly] +`````````````````````` + + UUID of the profile which the transport is for. + +byte Codec [readonly] +````````````````````` + + Assigned number of codec that the transport support. + The values should match the profile specification which is indicated by + the UUID. + +array{byte} Configuration [readonly] +```````````````````````````````````` + + Configuration blob, it is used as it is so the size and byte order must + match. + +string State [readonly] +``````````````````````` + + Indicates the state of the transport. Possible values are: + + :"idle": not streaming + :"pending": streaming but not acquired + :"active": streaming and acquired + +uint16 Delay [readwrite, optional] +`````````````````````````````````` + + Transport delay in 1/10 of millisecond, this property is only writeable + when the transport was acquired by the sender. + +uint16 Volume [readwrite, optional] +``````````````````````````````````` + + Indicates volume level of the transport, this property is only writeable + when the transport was acquired by the sender. + + Possible Values: 0-127 + +object Endpoint [readonly, optional, experimental] +`````````````````````````````````````````````````` + + Endpoint object which the transport is associated with. + +uint32 Location [readonly, ISO only, experimental] +`````````````````````````````````````````````````` + + Indicates transport Audio Location. + +array{byte} Metadata [readwrite, ISO Only, experimental] +```````````````````````````````````````````````````````` + + Indicates transport Metadata. + +array{object} Links [readonly, optional, ISO only, experimental] +```````````````````````````````````````````````````````````````` + + Linked transport objects which the transport is associated with. + +dict QoS [readonly, optional, ISO only, experimental] +````````````````````````````````````````````````````` + + Only present when QoS is configured. + + Possible values for Unicast: + + :byte CIG: + + Indicates configured CIG. + + Possible values: + + :0x00 - 0xef: + + Valid ID range. + + :0xff: + + Auto allocate. + + :byte CIS: + + Indicates configured CIS. + + Possible values: + + :0x00 - 0xef: + + Valid ID range. + + :0xff: + + Auto allocate. + + :byte Framing: + + Indicates configured framing. + + Possible values: + + :0x00: + + Unframed. + + :0x01: + + Framed. + + :uint32 PresentationDelay: + + Indicates configured transport presentation delay (us). + + :byte TargetLatency: + + Indicates the requested target latency. + + Possible values: + + :0x01: + + Low Latency. + + :0x02: + + Balanced Latency/Reliability. + + :0x03: + + High Reliability. + + Possible values for Broadcast: + + :byte BIG: + + Indicates configured QoS BIG. + + :byte BIS: + + Indicates configured BIS. + + :byte SyncFactor: + + Indicates configured broadcast sync factor. + + :byte Packing: + + Indicates configured packing. + + :byte Framing: + + Indicates configured framing. + + :byte Options: + + Indicates configured broadcast options. + + :uint16 Skip: + + Indicates configured broadcast skip. + + :byte SyncTimeout: + + Indicates configured broadcast sync timeout. + + :byte SyncType: + + Indicates configured broadcast sync CTE type. + + :byte MSE: + + Indicates configured broadcast MSE. + + :uint16 Timeout: + + Indicates configured broadcast timeout. + + Possible values for both Unicast and Broadcast: + + :uint32 Interval: + + Indicates configured ISO interval (us). + + :uint16 Latency: + + Indicates configured transport latency (ms). + + :uint16 SDU: + + Indicates configured maximum SDU. + + :byte PHY: + + Indicates configured PHY. + + Possible values: + + :bit 0: + + LE 1M + + :bit 1: + + LE 2M + + :bit 2: + + LE Coded + + :byte Retransmissions: + + Indicates configured retransmissions. From patchwork Wed Sep 27 21:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C5A4E82CC0 for ; Wed, 27 Sep 2023 21:40:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbjI0VkY (ORCPT ); Wed, 27 Sep 2023 17:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbjI0VkX (ORCPT ); Wed, 27 Sep 2023 17:40:23 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B1B11F for ; Wed, 27 Sep 2023 14:40:21 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3ae0135c4deso6985645b6e.3 for ; Wed, 27 Sep 2023 14:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850819; x=1696455619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jwjHUPbdhZ0jdDmdOXswQrPccCOLqfWqLeXxUdDF1vI=; b=bjpzGu2kpSjpOpaeAOg1cr2mur8gVqmlTLc+/mzT1Cs2L2q3Q/A1/oq+kuYFdT5PFr t7kxDqcjiZYXALBGm72LQwBkJNNmrXUFcRZI8NRGoW/fa7ez+W6rU8Dv/HlpglIA4Sf3 TxPD3PTIWQA2UjahlkUgM8u9n20oTdlVQE4eZRyIFTaLpQg774H1uPTUS+SKEEdOOWcl Jo3GXb+naeBki/5ODoIW5bcKVoA6SmqVir+80mwnfCNx2pSSOoEP9cXyd13gmZrIr1Dg XPjNuTEgsw7cZ9VwLpk21Jp8y9o6S52QyaUYiaPTGuZLY/LrScNHsePHWxAbWr5/BwbT foyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850819; x=1696455619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jwjHUPbdhZ0jdDmdOXswQrPccCOLqfWqLeXxUdDF1vI=; b=TYUIFuQxCetPnMZXjj0pwiACMMCA6fyAr2jATast9A7l40aLfiL8VwwNv7PsDxHHQr KSbqrs9QYcBj5lmD6RG0yqA48DmiQRlzz9njZoDj6bYNvKSMWrRF4fVIUMqzQeJ+crU2 CbmwSfAa1eTV15ysJmeDlk+v3cCseK9LhVHwWR3KrBZ1JQ3Kgg5OZJ5AvZ4HkIZtGdOH GodRiWUBr5kGT3Z0OqFOP5Dq4Qccp3JolR4W3ZIRp4d7a5B7pPaiiJGUm11zMOi9660p wg7D2jRo8vupeLhjteEHPzhUjXBELJLtOUAmA54U2A1L538qPFESCGTgUths+rGbfMDY xjxA== X-Gm-Message-State: AOJu0YwciCKdNk7s64nUbwriNaKHvocmz1vxr9XhmS7dbBK2RpKmZJDN wRgMDGD3cOUAEnWTdmE5s8rKka9oLIcnXkVZ X-Google-Smtp-Source: AGHT+IE5bhAc/lPnD08XP/J3IZax67fP1gziMhhMg4DYdh2IOkz9vcOp+dpNjgNbKkek3evsqvH8tQ== X-Received: by 2002:a05:6808:23ca:b0:3a9:9bb6:811 with SMTP id bq10-20020a05680823ca00b003a99bb60811mr3603404oib.57.1695850819091; Wed, 27 Sep 2023 14:40:19 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:18 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 07/12] shared/bap: Add support content and contexts to bt_bap_pac_qos Date: Wed, 27 Sep 2023 14:39:58 -0700 Message-ID: <20230927214003.1873224-8-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for setting supported content and contexts on a per PAC record basis which then is carried over to their respective PACS attribute and notified properly when changed (added/removed). --- src/shared/bap.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++- src/shared/bap.h | 3 + 2 files changed, 170 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 1c43680c2457..6400d1d69221 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2468,6 +2468,80 @@ static void bap_pac_free(void *data) free(pac); } +static void pacs_sink_location_changed(struct bt_pacs *pacs) +{ + uint32_t location = cpu_to_le32(pacs->sink_loc_value); + + gatt_db_attribute_notify(pacs->sink_loc, (void *)&location, + sizeof(location), NULL); +} + +static void pacs_add_sink_location(struct bt_pacs *pacs, uint32_t location) +{ + location |= pacs->sink_loc_value; + + /* Check if location value needs updating */ + if (location == pacs->sink_loc_value) + return; + + pacs->sink_loc_value = location; + + pacs_sink_location_changed(pacs); +} + +static void pacs_supported_context_changed(struct bt_pacs *pacs) +{ + struct bt_pacs_context ctx; + + memset(&ctx, 0, sizeof(ctx)); + + ctx.snk = cpu_to_le16(pacs->supported_sink_context_value); + ctx.src = cpu_to_le16(pacs->supported_source_context_value); + + gatt_db_attribute_notify(pacs->supported_context, (void *)&ctx, + sizeof(ctx), NULL); +} + +static void pacs_add_sink_supported_context(struct bt_pacs *pacs, + uint16_t context) +{ + context |= pacs->supported_sink_context_value; + + /* Check if context value needs updating */ + if (context == pacs->supported_sink_context_value) + return; + + pacs->supported_sink_context_value = context; + + pacs_supported_context_changed(pacs); +} + +static void pacs_context_changed(struct bt_pacs *pacs) +{ + struct bt_pacs_context ctx; + + memset(&ctx, 0, sizeof(ctx)); + + ctx.snk = cpu_to_le16(pacs->sink_context_value); + ctx.src = cpu_to_le16(pacs->source_context_value); + + gatt_db_attribute_notify(pacs->context, (void *)&ctx, sizeof(ctx), + NULL); +} + +static void pacs_add_sink_context(struct bt_pacs *pacs, uint16_t context) +{ + context |= pacs->supported_sink_context_value; + + /* Check if context value needs updating */ + if (context == pacs->sink_context_value) + return; + + pacs->sink_context_value = context; + + pacs_context_changed(pacs); +} + static void bap_add_sink(struct bt_bap_pac *pac) { struct iovec iov; @@ -2482,10 +2556,62 @@ static void bap_add_sink(struct bt_bap_pac *pac) queue_foreach(pac->bdb->sinks, pac_foreach, &iov); + pacs_add_sink_location(pac->bdb->pacs, pac->qos.location); + pacs_add_sink_supported_context(pac->bdb->pacs, + pac->qos.supported_context); + pacs_add_sink_context(pac->bdb->pacs, pac->qos.context); gatt_db_attribute_notify(pac->bdb->pacs->sink, iov.iov_base, iov.iov_len, NULL); } +static void pacs_source_location_changed(struct bt_pacs *pacs) +{ + uint32_t location = cpu_to_le32(pacs->source_loc_value); + + gatt_db_attribute_notify(pacs->source_loc, (void *)&location, + sizeof(location), NULL); +} + +static void pacs_add_source_location(struct bt_pacs *pacs, uint32_t location) +{ + location |= pacs->source_loc_value; + + /* Check if location value needs updating */ + if (location == pacs->source_loc_value) + return; + + pacs->source_loc_value = location; + + pacs_source_location_changed(pacs); +} + +static void pacs_add_source_supported_context(struct bt_pacs *pacs, + uint16_t context) +{ + context |= pacs->supported_source_context_value; + + /* Check if context value needs updating */ + if (context == pacs->supported_source_context_value) + return; + + pacs->supported_source_context_value = context; + + pacs_supported_context_changed(pacs); +} + +static void pacs_add_source_context(struct bt_pacs *pacs, uint16_t context) +{ + context |= pacs->supported_sink_context_value; + + /* Check if context value needs updating */ + if (context == pacs->sink_context_value) + return; + + pacs->sink_context_value = context; + + pacs_context_changed(pacs); +} + static void bap_add_source(struct bt_bap_pac *pac) { struct iovec iov; @@ -2500,6 +2626,11 @@ static void bap_add_source(struct bt_bap_pac *pac) queue_foreach(pac->bdb->sinks, pac_foreach, &iov); + pacs_add_source_location(pac->bdb->pacs, pac->qos.location); + pacs_add_source_supported_context(pac->bdb->pacs, + pac->qos.supported_context); + pacs_add_source_context(pac->bdb->pacs, pac->qos.context); + gatt_db_attribute_notify(pac->bdb->pacs->source, iov.iov_base, iov.iov_len, NULL); } @@ -2685,13 +2816,48 @@ static void remove_streams(void *data, void *user_data) bt_bap_stream_release(stream, NULL, NULL); } +static void bap_pac_sink_removed(void *data, void *user_data) +{ + struct bt_bap_pac *pac = data; + struct bt_bap_pac_qos *qos = user_data; + + qos->location |= pac->qos.location; + qos->supported_context |= pac->qos.supported_context; + qos->context |= pac->qos.context; +} + bool bt_bap_remove_pac(struct bt_bap_pac *pac) { if (!pac) return false; - if (queue_remove_if(pac->bdb->sinks, NULL, pac)) + if (queue_remove_if(pac->bdb->sinks, NULL, pac)) { + struct bt_pacs *pacs = pac->bdb->pacs; + struct bt_bap_pac_qos qos; + + memset(&qos, 0, sizeof(qos)); + queue_foreach(pac->bdb->sinks, bap_pac_sink_removed, &qos); + + if (pacs->sink_loc_value != qos.location) { + pacs->sink_loc_value = qos.location; + pacs_sink_location_changed(pacs); + } + + if (pacs->supported_sink_context_value != + qos.supported_context) { + pacs->supported_sink_context_value = + qos.supported_context; + pacs_supported_context_changed(pacs); + } + + if (pacs->sink_context_value != qos.context) { + pacs->sink_context_value = qos.context; + pacs_context_changed(pacs); + } + + goto found; + } if (queue_remove_if(pac->bdb->sources, NULL, pac)) goto found; diff --git a/src/shared/bap.h b/src/shared/bap.h index e4eae86502f3..72d6022a32ec 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -131,6 +131,9 @@ struct bt_bap_pac_qos { uint32_t pd_max; uint32_t ppd_min; uint32_t ppd_max; + uint32_t location; + uint16_t supported_context; + uint16_t context; }; struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db, From patchwork Wed Sep 27 21:39:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 509CFE7109E for ; Wed, 27 Sep 2023 21:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230020AbjI0Vk0 (ORCPT ); Wed, 27 Sep 2023 17:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjI0VkZ (ORCPT ); Wed, 27 Sep 2023 17:40:25 -0400 Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF97199 for ; Wed, 27 Sep 2023 14:40:23 -0700 (PDT) Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-493545b4eaeso4529290e0c.0 for ; Wed, 27 Sep 2023 14:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850821; x=1696455621; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kL7JlXE38q5GALyj8tUkwo5gHHH2hpnI7lnYRbb3EXA=; b=Wu3MqKlVTQlvDUIGlACnFAbsddojqHS89NAy5n+leuVGupuGt5D3pe6CAc8Vzk/Bw0 zAvjLDb8hWMhxm+s2V86MujADnmtx43B8M3HCsbn6LwdiqVuCKo3BdY0dxiU8KbdFxyF HfOu8L4HhDAqb0ZtdYrx2uu1p32G5B9d0t+5pc/go6kfhD0cjP9RnRVyzo+01f2gmakP 1f1oF2hhnscuCQ6E0PhgngUDpdGRWJzduq2YEwg6CrGOw3HE+9n8Pk3HGxHX2dFHfdwj XMNMlt8L4wXY5i3Uhkf/uEAQlaTmFaNE7/em98P1rgm68uKgoA7Rz5TaNSk7wX2/aQYi /Xjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850821; x=1696455621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kL7JlXE38q5GALyj8tUkwo5gHHH2hpnI7lnYRbb3EXA=; b=NDeH6kDsASiSl9sqRMf4Ii0CD4h+xGV4aMyuvdIbwypCMremONAuK5hsro5kh8vR4p DXu04v59AlJtjhFqif5WESykEzb6ynipgH0nk04WeiAJSmmO2vrX8qlaXA19yn6yoBLx JQJzrouUlM6QlqUtmDkNrLgAWvyAClJ5pX5GomNO3dA5/IcDAW86IWUsTVU0IQqTu63y VA/R1DtJZ6vzO7UHSaY0J0HNtFJl8V+ErgI82sNVncrUd1w8Y+YVKnagk0OoB/LscthC RUH4TC6pUW+PTQH0pAin2PjpmofqXbYeGfcvFuDBro6jufRR40vnQh+PY912YruNP7fi 4NzQ== X-Gm-Message-State: AOJu0YxyBUhUPCLtAZkIn854maImw9AAM+ggkRGOikEWHHMshkmJcbT2 sD3EbUroGdq8lApDkM9BI7/Z+6wVd3p3c4D8 X-Google-Smtp-Source: AGHT+IFq0vDGl8iv5HmaYtki/bRk7J3Ne/U3UrMm5lLJsK+mUIj5e3bR96e4hLSGilwbkxuRRwwduQ== X-Received: by 2002:a1f:4ec6:0:b0:49a:6776:3cb0 with SMTP id c189-20020a1f4ec6000000b0049a67763cb0mr2410424vkb.9.1695850821563; Wed, 27 Sep 2023 14:40:21 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:19 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 08/12] doc/MediaEndpoint: Move QoS capabilities to its own dict property Date: Wed, 27 Sep 2023 14:39:59 -0700 Message-ID: <20230927214003.1873224-9-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This moves QoS capabilities to its own dict property just as it was done for MediaTransport QoS configuration. --- doc/org.bluez.MediaEndpoint.rst | 172 ++++++++++++++------------------ 1 file changed, 77 insertions(+), 95 deletions(-) diff --git a/doc/org.bluez.MediaEndpoint.rst b/doc/org.bluez.MediaEndpoint.rst index cba8cb3edc6e..0e201ff9dc6a 100644 --- a/doc/org.bluez.MediaEndpoint.rst +++ b/doc/org.bluez.MediaEndpoint.rst @@ -41,57 +41,31 @@ void SetConfiguration(object transport, dict properties) See Metadata property. - :uint32 Location [ISO only]: + :dict QoS [ISO only]: - See Location property. - - :byte Framing [ISO only]: - - See Framing property. - - :byte PHY [ISO only]: - - See PHY property. - - :uint16 MaximumLatency [ISO only]: - - See MaximumLatency property. - - :uint32 MinimumDelay [ISO only]: - - See MinimumDelay property. - - :uint32 MaximumDelay [ISO only]: - - See MaximumDelay property. - - :uint32 PreferredMinimumDelay [ISO only]: - - See PreferredMinimumDelay property. - - :uint32 PreferredMaximumDelay [ISO only]: - - See PreferredMaximumDelay property. + See **org.bluez.MediaTransport(5)** QoS property. array{byte} SelectConfiguration(array{byte} capabilities) ````````````````````````````````````````````````````````` Select preferable configuration from the supported capabilities. - Returns a configuration which can be used to setup a transport. + Returns a configuration which can be used to setup a transport, see + **org.bluez.MediaTransport(5)** for possible values. Note: There is no need to cache the selected configuration since on success the configuration is send back as parameter of SetConfiguration. -dict SelectProperties(dict properties) -`````````````````````````````````````` +dict SelectProperties(dict capabilities) +```````````````````````````````````````` - Select preferable properties from the supported properties: + Select configuration from the supported capabilities: :object Endpoint [ISO only]: :Refer to SetConfiguration for the list of other possible properties.: - Returns propeties which can be used to setup a transport. + Returns a configuration which can be used to setup a transport, see + **org.bluez.MediaTransport(5)** for possible values. Note: There is no need to cache the selected properties since on success the configuration is send back as parameter of SetConfiguration. @@ -154,71 +128,79 @@ bool DelayReporting [readonly, optional] Indicates if endpoint supports Delay Reporting. -byte Framing [ISO only] -``````````````````````` - - Indicates endpoint support framing. - -byte PHY [ISO only] -``````````````````` - - Indicates endpoint supported PHY. - - Possible values: - - :bit 0: - - LE 1M - - :bit 1: - - LE 2M - - :bit 2: - - LE Coded - -byte Retransmissions [ISO only] -``````````````````````````````` - - Indicates endpoint preferred number of retransmissions. - -uint16_t MaximumLatency [ISO only] -`````````````````````````````````` - - Indicates endpoint maximum latency. - -uint32_t MinimumDelay [ISO only] -```````````````````````````````` - - Indicates endpoint minimum presentation delay. - -uint32_t MaximumDelay [ISO only] -```````````````````````````````` - - Indicates endpoint maximum presentation delay. - -uint32_t PreferredMinimumDelay [ISO only] -````````````````````````````````````````` - - Indicates endpoint preferred minimum presentation delay. - -uint32_t PreferredMaximumDelay [ISO only] -````````````````````````````````````````` - - Indicates endpoint preferred maximum presentation delay. - -uint32 Location [ISO only] -`````````````````````````` +uint32 Locations [readonly, optional, ISO only, experimental] +````````````````````````````````````````````````````````````` Indicates endpoint supported locations. -uint16 SupportedContext [ISO only] -`````````````````````````````````` +uint16 SupportedContext [readonly, optional, ISO only, experimental] +```````````````````````````````````````````````````````````````````` Indicates endpoint supported audio context. -uint16 Context [ISO only] -````````````````````````` +uint16 Context [readonly, optional, ISO only, experimental] +``````````````````````````````````````````````````````````` Indicates endpoint available audio context. + +dict QoS [readonly, optional, ISO only, experimental] +````````````````````````````````````````````````````` + + Indicates QoS capabilities. + + :byte Framing: + + Indicates endpoint support framing. + + + Possible Values: + + :0x00: + + Unframed PDUs supported. + + :0x01: + + Unframed PDUs not supported. + + :byte PHY: + + Indicates endpoint preferred PHY. + + Possible values: + + :bit 0: + + LE 1M preferred. + + :bit 1: + + LE 2M preferred. + + :bit 2: + + LE Coded preferred. + + :byte Retransmissions: + + Indicates endpoint preferred number of retransmissions. + + :uint16 MaximumLatency: + + Indicates endpoint maximum latency. + + :uint32 MinimumDelay: + + Indicates endpoint minimum presentation delay. + + :uint32 MaximumDelay: + + Indicates endpoint maximum presentation delay. + + :uint32 PreferredMinimumDelay: + + Indicates endpoint preferred minimum presentation delay. + + :uint32 PreferredMaximumDelay: + + Indicates endpoint preferred maximum presentation delay. From patchwork Wed Sep 27 21:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5287BE80A8A for ; Wed, 27 Sep 2023 21:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjI0Vk2 (ORCPT ); Wed, 27 Sep 2023 17:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjI0Vk1 (ORCPT ); Wed, 27 Sep 2023 17:40:27 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77DA4121 for ; Wed, 27 Sep 2023 14:40:25 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3af609c4dfeso662455b6e.1 for ; Wed, 27 Sep 2023 14:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850824; x=1696455624; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=X07wSkLYOjKxHCw/p4ZSA9t+KzQYCv6DrtWZMUPxG3M=; b=gK9CozodnHxjR4pX0/r0xvnzcgNUwc7JTrqYXatltFWMhZq+fH0QOw9Avi2Z2jUeUz SVJ7OJ0/9GKxzKFO5kmhPIfm2PZKPS8OB31cUx5tqABTxRfgm7YShbtLRI/52Oo5UuoN Qt+PmWT/O2Xn25y1/4heF3exRC1mlQWD+f+cPy4pGZAI3kEtlzRougJdZI/IKI2ZTiTy BJYorN3X/lBpaQvGkvF8P3BdjvK8sr5kXmLfff7ppmTirJ5h1b/r1EkAA83nQQsc1KAp DbbnojV6QK9jaQVzYkXvfJvP95mWUE6TlnxGuhudtqHhf1B/yRohGXuJmweCUhv2CE0d m2Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850824; x=1696455624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X07wSkLYOjKxHCw/p4ZSA9t+KzQYCv6DrtWZMUPxG3M=; b=CKTMOoJ1aacWjEallOrV93slxvQaJsKbCWFTJtrqnsyY6d8gGS4TeTyVBsHsCbTGpB BMtGb4yW7OKivd/I1Z8BQfE0hQj3590mH4svfYGEU414PxZt1uqWZn1L9Q6fyoKvI7Mr GLxxozwyt6gjAd0zOYppthCLbwiC7GZKlSUrcl47RoJ4kt0HJcjDATGF5KYC5Pp0stbY NJeebNA6rWRH0tjVYLepUBap5yhUllHjvyq1SZ9eFdNWAJX4QnEgtFX+8jm7yv4pRcvS 4kePhP/EqYI6WG9EpWjY+lomKKHuHVsDrR4w2KpEy5ko3cZ1PYUfMAmnqv0NrRttWB92 126g== X-Gm-Message-State: AOJu0YwK4+eE938RrtcbXrERrDchRlFfwGSNmQroakbkMzL/qr8sXhCB e+s+rhKqKYkPFYGjpdH3FqomQacmcVlqGZnl X-Google-Smtp-Source: AGHT+IHfr9TKzYbos089zoeg1+JpfxyRzsQwecAI54HDnoOCdLvQuosEyvZpulNQ2cTao9w1xsOPTg== X-Received: by 2002:a05:6808:1a24:b0:3a4:633:44d2 with SMTP id bk36-20020a0568081a2400b003a4063344d2mr3945719oib.18.1695850823796; Wed, 27 Sep 2023 14:40:23 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:22 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 09/12] shared/bap: Add support for location and contexts to bt_bap_pac_qos Date: Wed, 27 Sep 2023 14:40:00 -0700 Message-ID: <20230927214003.1873224-10-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for location and contexts to bt_bap_pac_qos and function to read them. --- src/shared/bap.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++- src/shared/bap.h | 6 ++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 6400d1d69221..9e9ea1472029 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2740,7 +2740,12 @@ uint8_t bt_bap_pac_get_type(struct bt_bap_pac *pac) uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac) { - struct bt_pacs *pacs = pac->bdb->pacs; + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; switch (pac->type) { case BT_BAP_SOURCE: @@ -2752,6 +2757,52 @@ uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac) } } +uint16_t bt_bap_pac_get_supported_context(struct bt_bap_pac *pac) +{ + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; + + switch (pac->type) { + case BT_BAP_SOURCE: + return pacs->supported_source_context_value; + case BT_BAP_SINK: + return pacs->supported_sink_context_value; + default: + return 0; + } +} + +uint16_t bt_bap_pac_get_context(struct bt_bap_pac *pac) +{ + struct bt_pacs *pacs; + + if (!pac) + return 0; + + pacs = pac->bdb->pacs; + + switch (pac->type) { + case BT_BAP_SOURCE: + return pacs->source_context_value; + case BT_BAP_SINK: + return pacs->sink_context_value; + default: + return 0; + } +} + +struct bt_bap_pac_qos *bt_bap_pac_get_qos(struct bt_bap_pac *pac) +{ + if (!pac || !pac->qos.phy) + return NULL; + + return &pac->qos; +} + uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream) { if (!stream) diff --git a/src/shared/bap.h b/src/shared/bap.h index 72d6022a32ec..ebe4dbf7d858 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -168,6 +168,12 @@ uint8_t bt_bap_pac_get_type(struct bt_bap_pac *pac); uint32_t bt_bap_pac_get_locations(struct bt_bap_pac *pac); +uint16_t bt_bap_pac_get_supported_context(struct bt_bap_pac *pac); + +uint16_t bt_bap_pac_get_context(struct bt_bap_pac *pac); + +struct bt_bap_pac_qos *bt_bap_pac_get_qos(struct bt_bap_pac *pac); + uint8_t bt_bap_stream_get_type(struct bt_bap_stream *stream); struct bt_bap_stream *bt_bap_pac_get_stream(struct bt_bap_pac *pac); From patchwork Wed Sep 27 21:40:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67B9FE7109E for ; Wed, 27 Sep 2023 21:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbjI0Vkb (ORCPT ); Wed, 27 Sep 2023 17:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjI0Vka (ORCPT ); Wed, 27 Sep 2023 17:40:30 -0400 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34DDD191 for ; Wed, 27 Sep 2023 14:40:27 -0700 (PDT) Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57b706f604aso5812007eaf.0 for ; Wed, 27 Sep 2023 14:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850826; x=1696455626; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YSqrbmz8Eq3eGURMTY5TQ64HOx9T7355kkPHfm/hu4M=; b=EBBi8ncy1jKMG5Q1FhJRMh1WvJFomFMtClCX3Hjl0LW2wsriWvAm3qoCMcIpHOI0io Vzl1OqG239c/gffzPfc5e002y1dEY/w4+y0Q/uayLAd4q3BkO2w8uY+aaUat+erGgu7e BepYOMPMDwHuJ+RMPrjDngKoYkcZUv9/oPewvzTyVDkbw9sOWrLERt3h3+bOtCl4ZVC3 fmUxTyO8mHaxvzR58O0FefCGXvchKJ4aCPADeED48arwTb7sI0zNGaXJmon42BAIydoa xPJu5xhis1id0uyB6Vxt2dYGrh/jm8C3E9OFvpAYkoNxhN+wkagzHd3GRy09kH9q4ryR DKtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850826; x=1696455626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YSqrbmz8Eq3eGURMTY5TQ64HOx9T7355kkPHfm/hu4M=; b=Sw3kME/TwCfPsJDmKZoKJM4AyjSJGLxEH5lN0HsZXDxvwe5qzkyPuuOXl7RDDS5eNS 3RZkWoXXtlnm4dIHj2o/p4jBs6mSw6ZgujejdCs4gBQLFARJa56YJdlIdvCL/0o9bpib SRaKgsvC8s2Z+YIgNMMQPHQ76NB42FJn9WnMl3qnK79xeDxOYyZTvYdnCUIdwW3nqQ8m WZh5vriejnWaJodQ+rtygyhhUO10JMh8ueU1MIiZo7Nikbr36HkTBueg3Z8/o9lPPnAw S/KO4mKDV/wjahAdktsArYH5uwsg7YdGQFq+izX0lwKGgfm7ddSUODVm09W3FaW2mVTL uHNQ== X-Gm-Message-State: AOJu0YwYE/6w7lw3w4tAbYZm5RNsf+vN6vUQu5Xr1gRepN0rBHiYEdeD AXQKJGUw2xeAro+EuF9ijW+TNWbWIe3NL3gX X-Google-Smtp-Source: AGHT+IHy1qlx9fPK4aIwYju5R9zUWCna7mImKGI3Vovg6os7kJS7Dms/idg+LgzJiiVP3pozSweB5Q== X-Received: by 2002:a05:6358:89b:b0:143:8eb4:cf36 with SMTP id m27-20020a056358089b00b001438eb4cf36mr3355388rwj.5.1695850825576; Wed, 27 Sep 2023 14:40:25 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:24 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 10/12] bap: Add support for missing MediaEndpoint properties Date: Wed, 27 Sep 2023 14:40:01 -0700 Message-ID: <20230927214003.1873224-11-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for Location, SupportedContext, Context and QoS properties. --- profiles/audio/bap.c | 409 ++++++++++++++++++++++++++++--------------- 1 file changed, 272 insertions(+), 137 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index ed02db40be8c..18872329d4ac 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -263,6 +263,88 @@ static gboolean get_device(const GDBusPropertyTable *property, return TRUE; } +static gboolean get_locations(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bap_ep *ep = data; + uint32_t locations = bt_bap_pac_get_locations(ep->rpac); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &locations); + + return TRUE; +} + +static gboolean get_supported_context(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bap_ep *ep = data; + uint16_t context = bt_bap_pac_get_supported_context(ep->rpac); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &context); + + return TRUE; +} + +static gboolean get_context(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bap_ep *ep = data; + uint16_t context = bt_bap_pac_get_context(ep->rpac); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &context); + + return TRUE; +} + +static gboolean qos_exists(const GDBusPropertyTable *property, void *data) +{ + struct bap_ep *ep = data; + struct bt_bap_pac_qos *qos; + + qos = bt_bap_pac_get_qos(ep->rpac); + if (!qos) + return FALSE; + + return TRUE; +} + +static gboolean get_qos(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct bap_ep *ep = data; + struct bt_bap_pac_qos *qos; + DBusMessageIter dict; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &dict); + + qos = bt_bap_pac_get_qos(ep->rpac); + if (!qos) + return FALSE; + + dict_append_entry(&dict, "Framing", DBUS_TYPE_BYTE, &qos->framing); + dict_append_entry(&dict, "PHY", DBUS_TYPE_BYTE, &qos->phy); + dict_append_entry(&dict, "Retransmissions", DBUS_TYPE_BYTE, &qos->rtn); + dict_append_entry(&dict, "MaximumLatency", DBUS_TYPE_UINT16, + &qos->latency); + dict_append_entry(&dict, "MimimumDelay", DBUS_TYPE_UINT32, + &qos->pd_min); + dict_append_entry(&dict, "MaximumDelay", DBUS_TYPE_UINT32, + &qos->pd_max); + dict_append_entry(&dict, "PreferredMimimumDelay", DBUS_TYPE_UINT32, + &qos->ppd_min); + dict_append_entry(&dict, "PreferredMaximumDelay", DBUS_TYPE_UINT32, + &qos->ppd_max); + + dbus_message_iter_close_container(iter, &dict); + + return TRUE; +} + static const GDBusPropertyTable ep_properties[] = { { "UUID", "s", get_uuid, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, @@ -272,6 +354,14 @@ static const GDBusPropertyTable ep_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Device", "o", get_device, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "Locations", "u", get_locations, NULL, NULL, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "SupportedContext", "q", get_supported_context, NULL, NULL, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "Context", "q", get_context, NULL, NULL, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "QoS", "a{sv}", get_qos, NULL, qos_exists, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { } }; @@ -388,16 +478,182 @@ static bool parse_base(void *data, size_t len, util_debug_func_t func, return true; } -static int parse_properties(DBusMessageIter *props, struct iovec **caps, +static int parse_io_qos(const char *key, int var, DBusMessageIter *iter, + struct bt_bap_io_qos *qos) +{ + if (!strcasecmp(key, "Interval")) { + if (var != DBUS_TYPE_UINT32) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->interval); + } else if (!strcasecmp(key, "PHY")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->phy); + } else if (!strcasecmp(key, "SDU")) { + if (var != DBUS_TYPE_UINT16) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->sdu); + } else if (!strcasecmp(key, "Retransmissions")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->rtn); + } else if (!strcasecmp(key, "Latency")) { + if (var != DBUS_TYPE_UINT16) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->latency); + } + + return 0; +} + +static int parse_ucast_qos(const char *key, int var, DBusMessageIter *iter, + struct bt_bap_qos *qos) +{ + if (!strcasecmp(key, "CIG")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->ucast.cig_id); + } else if (!strcasecmp(key, "CIS")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->ucast.cis_id); + } else if (!strcasecmp(key, "Framing")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->ucast.framing); + } else if (!strcasecmp(key, "PresentationDelay")) { + if (var != DBUS_TYPE_UINT32) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->ucast.delay); + } else if (!strcasecmp(key, "TargetLatency")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->ucast.target_latency); + } else { + int err; + + err = parse_io_qos(key, var, iter, &qos->ucast.io_qos); + if (err) + return err; + } + + return 0; +} + +static int parse_bcast_qos(const char *key, int var, DBusMessageIter *iter, + struct bt_bap_qos *qos) +{ + if (!strcasecmp(key, "Encryption")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.encryption); + } else if (!strcasecmp(key, "Options")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.options); + } else if (!strcasecmp(key, "Skip")) { + if (var != DBUS_TYPE_UINT16) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.skip); + } else if (!strcasecmp(key, "SyncTimeout")) { + if (var != DBUS_TYPE_UINT16) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.sync_timeout); + } else if (!strcasecmp(key, "SyncType")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.sync_cte_type); + } else if (!strcasecmp(key, "SyncFactor")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.sync_factor); + } else if (!strcasecmp(key, "MSE")) { + if (var != DBUS_TYPE_BYTE) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.mse); + } else if (!strcasecmp(key, "Timeout")) { + if (var != DBUS_TYPE_UINT16) + return -EINVAL; + + dbus_message_iter_get_basic(iter, &qos->bcast.timeout); + } else if (!strcasecmp(key, "BCode")) { + if (var != DBUS_TYPE_ARRAY) + return -EINVAL; + + parse_array(iter, &qos->bcast.bcode); + } else { + int err; + + err = parse_io_qos(key, var, iter, &qos->bcast.io_qos); + if (err) + return err; + } + + return 0; +} + +static int parse_qos(DBusMessageIter *iter, struct bt_bap_qos *qos, + struct iovec **base) +{ + DBusMessageIter array; + const char *key; + int (*parser)(const char *key, int var, DBusMessageIter *iter, + struct bt_bap_qos *qos); + + if (*base) + parser = parse_bcast_qos; + else + parser = parse_ucast_qos; + + dbus_message_iter_recurse(iter, &array); + + while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) { + DBusMessageIter value, entry; + int var, err; + + dbus_message_iter_recurse(&array, &entry); + dbus_message_iter_get_basic(&entry, &key); + + dbus_message_iter_next(&entry); + dbus_message_iter_recurse(&entry, &value); + + var = dbus_message_iter_get_arg_type(&value); + + err = parser(key, var, &value, qos); + if (err) { + DBG("Failed parsing %s", key); + return err; + } + + dbus_message_iter_next(&array); + } + + return 0; +} + +static int parse_configuration(DBusMessageIter *props, struct iovec **caps, struct iovec **metadata, struct iovec **base, struct bt_bap_qos *qos) { const char *key; - struct bt_bap_io_qos io_qos; - uint8_t framing = 0; - bool broadcast = false; - memset(&io_qos, 0, sizeof(io_qos)); while (dbus_message_iter_get_arg_type(props) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter value, entry; int var; @@ -422,149 +678,26 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, if (parse_array(&value, metadata)) goto fail; - } else if (!strcasecmp(key, "CIG")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->ucast.cig_id); - } else if (!strcasecmp(key, "BIG")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->bcast.big); - } else if (!strcasecmp(key, "CIS")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->ucast.cis_id); - } else if (!strcasecmp(key, "BIS")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->bcast.bis); - } else if (!strcasecmp(key, "Interval")) { - if (var != DBUS_TYPE_UINT32) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.interval); - } else if (!strcasecmp(key, "Framing")) { - dbus_bool_t val; - - if (var != DBUS_TYPE_BOOLEAN) - goto fail; - - dbus_message_iter_get_basic(&value, &val); - - framing = val; - } else if (!strcasecmp(key, "PHY")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.phy); - } else if (!strcasecmp(key, "SDU")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.sdu); - } else if (!strcasecmp(key, "Retransmissions")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.rtn); - } else if (!strcasecmp(key, "Latency")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, &io_qos.latency); - } else if (!strcasecmp(key, "Delay")) { - if (var != DBUS_TYPE_UINT32) - goto fail; - - dbus_message_iter_get_basic(&value, &qos->ucast.delay); - } else if (!strcasecmp(key, "TargetLatency")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->ucast.target_latency); - } else if (!strcasecmp(key, "Encryption")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.encryption); - broadcast = true; - } else if (!strcasecmp(key, "Options")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.options); - } else if (!strcasecmp(key, "Skip")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.skip); - } else if (!strcasecmp(key, "SyncTimeout")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.sync_timeout); - } else if (!strcasecmp(key, "SyncCteType")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.sync_cte_type); - - } else if (!strcasecmp(key, "SyncInterval")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.sync_factor); - } else if (!strcasecmp(key, "MSE")) { - if (var != DBUS_TYPE_BYTE) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.mse); - } else if (!strcasecmp(key, "Timeout")) { - if (var != DBUS_TYPE_UINT16) - goto fail; - - dbus_message_iter_get_basic(&value, - &qos->bcast.timeout); - } else if (!strcasecmp(key, "BCode")) { + } else if (!strcasecmp(key, "QoS")) { if (var != DBUS_TYPE_ARRAY) goto fail; - parse_array(&value, &qos->bcast.bcode); + + if (parse_qos(&value, qos, base)) + goto fail; } dbus_message_iter_next(props); } - if (broadcast) { + if (*base) { uint32_t presDelay; uint8_t numSubgroups, numBis; struct bt_bap_codec codec; - memcpy(&qos->bcast.io_qos, &io_qos, sizeof(io_qos)); - qos->bcast.framing = framing; - - if (!base) - return 0; - if (!(*base)) - *base = new0(struct iovec, 1); util_iov_memcpy(*base, (*caps)->iov_base, (*caps)->iov_len); parse_base((*caps)->iov_base, (*caps)->iov_len, bap_debug, &presDelay, &numSubgroups, &numBis, &codec, caps, NULL); - } else { - memcpy(&qos->ucast.io_qos, &io_qos, sizeof(io_qos)); - qos->ucast.framing = framing; } return 0; @@ -686,9 +819,9 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, ep->qos.ucast.cis_id = BT_ISO_QOS_CIS_UNSET; } - if (parse_properties(&props, &ep->caps, &ep->metadata, + if (parse_configuration(&props, &ep->caps, &ep->metadata, &ep->base, &ep->qos) < 0) { - DBG("Unable to parse properties"); + DBG("Unable to parse configuration"); return btd_error_invalid_args(msg); } @@ -855,7 +988,7 @@ static bool match_data_bap_data(const void *data, const void *match_data) static const GDBusMethodTable ep_methods[] = { { GDBUS_EXPERIMENTAL_ASYNC_METHOD("SetConfiguration", GDBUS_ARGS({ "endpoint", "o" }, - { "properties", "a{sv}" } ), + { "Configuration", "a{sv}" } ), NULL, set_configuration) }, { }, }; @@ -931,11 +1064,13 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, switch (bt_bap_pac_get_type(rpac)) { case BT_BAP_BCAST_SINK: err = asprintf(&ep->path, "%s/pac_%s%d", - adapter_get_path(adapter), suffix, i); + adapter_get_path(adapter), suffix, i); + ep->base = new0(struct iovec, 1); break; case BT_BAP_BCAST_SOURCE: err = asprintf(&ep->path, "%s/pac_%s%d", device_get_path(device), suffix, i); + ep->base = new0(struct iovec, 1); break; } From patchwork Wed Sep 27 21:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B148CE7F14F for ; Wed, 27 Sep 2023 21:40:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjI0Vkc (ORCPT ); Wed, 27 Sep 2023 17:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjI0Vkb (ORCPT ); Wed, 27 Sep 2023 17:40:31 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3462A193 for ; Wed, 27 Sep 2023 14:40:29 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3af608eb367so736134b6e.2 for ; Wed, 27 Sep 2023 14:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850827; x=1696455627; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KV4ZorwYJLjRQxEs+/Y5/kmw2P0hzFQxubwf3sPfIIU=; b=FbKpRMYnl5+SdDtJUSmbgb+V0ViyAawcvYoo7J0UmUu465IQQzKXazVHFozTATuZyy /lI+nuHYbOqDxNSWzIr8AKSVVe6b+0sIBpAFzYFqMWJDlTgpvTYt2KfX5ZV3eHd8kht/ E96wn0N1l+lxHf2Tti24fGHU4+bHMhXjubqz2qO4kqo+0kEtM1Fe1ZIv8UwAgsGMNTfT 25NQbGfqnd/c/NPHinBChuEcdZhvcDycBdcvFocM2/6FjrP0Ja0kQ8qkT6+ym6wXEyQc yGayU4oCkyQmJabn+oQ2DVJq7jom5JVbviDEJGVi11lDyDLXYlYB3nLyDmDLGrvlDCVb 7x6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850827; x=1696455627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KV4ZorwYJLjRQxEs+/Y5/kmw2P0hzFQxubwf3sPfIIU=; b=RP++ToWsKaQzeqPnF4KItFBV4cELrwtXQcfzhNkCGpk2cV+R31W8NEtblDaNZFNJX5 EnrlBKdE0QY6SJZE/5IYJyb5rbAVO2SUuARhgMhPVpD58oAHvMcLlfuIPVHtac99eiwV UCwJNWKk53cys8nceWDcknNuSx+blV6aiwvhdiJDj/1sl+PHxhNJ2Up49kgoYVSR6xng yZ2jmzVngLVxABSP5aJ5jOL3K4uPdeCrz0V3QCv2uSPgBV6VfmcbMw7bObwZTCGr4RgT sDegpjHIdBc4TnWGlo0LmN+3Wy05HY0VYSpwtduRJ/AGydQq1J25CcCe+J5N5TsuwMaz Zg8A== X-Gm-Message-State: AOJu0YxlHuvspkEwsj4P2FBKvfrRTSQxUJLu3PiAiDW9faq2UL1OdsxV iVHIxNJbNvWJOmDAa6H/3Cigl1oyDCGFbxNm X-Google-Smtp-Source: AGHT+IGiGOqdDsxErvM5ajlZy9d1IbNNfH/rPVe28j0NnF0EfGMpHXdllAOqyQqDibydt2Xn8z7X4Q== X-Received: by 2002:a05:6808:905:b0:3a8:f3e7:d696 with SMTP id w5-20020a056808090500b003a8f3e7d696mr3424775oih.45.1695850827585; Wed, 27 Sep 2023 14:40:27 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:26 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 11/12] client: Make endpoint.show print ISO specific capabilities Date: Wed, 27 Sep 2023 14:40:02 -0700 Message-ID: <20230927214003.1873224-12-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This makes endpoint.show print Locations, SupportedContext, Context and Qos capabilities. --- client/player.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/player.c b/client/player.c index 6953eff28543..d1809f24fd27 100644 --- a/client/player.c +++ b/client/player.c @@ -2142,6 +2142,10 @@ static void cmd_show_endpoint(int argc, char *argv[]) print_property(proxy, "Capabilities"); print_property(proxy, "Device"); print_property(proxy, "DelayReporting"); + print_property(proxy, "Locations"); + print_property(proxy, "SupportedContext"); + print_property(proxy, "Context"); + print_property(proxy, "QoS"); return bt_shell_noninteractive_quit(EXIT_SUCCESS); } From patchwork Wed Sep 27 21:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 13401711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C965FE80A8A for ; Wed, 27 Sep 2023 21:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjI0Vkd (ORCPT ); Wed, 27 Sep 2023 17:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229969AbjI0Vkc (ORCPT ); Wed, 27 Sep 2023 17:40:32 -0400 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDDE212A for ; Wed, 27 Sep 2023 14:40:30 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7741b18a06aso730369885a.1 for ; Wed, 27 Sep 2023 14:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695850829; x=1696455629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UZDbId/Oq6bQoYjYM1BCQT82RB8NkOnAtSqUmB0Kd0w=; b=nSn/QFh3oJUqNf/SVdBIfrnZuJrkdXW2fFP+ZWn1k0jNm2MzrL5arolTn7g9bdNGge F8+uR5nEH6KefXRWPyZNUKMHu2nhQjtWDF9URlhYLOKVK8XYlkRbRHMCbm3JkMBiclov VVH8oDt3GcRVBxugnZOFTzgXd4cZnZ+q2/EtbM3FuNGhrIqEYnlONAMyhi7B/y6HOr4G bknrIa5dCgD2jW4hZSyrS0u83f1Vej8AYkw6WpuHUQ+BftdOlN6Gx6Tr3k/dQAxIcMCG YW7BKKNzsgf/AIiucw3BKYC2zjDaeBmtsFeWgRf8d0DdLkolGF8lsgoGrXDvT8lcqCPx xufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695850829; x=1696455629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UZDbId/Oq6bQoYjYM1BCQT82RB8NkOnAtSqUmB0Kd0w=; b=r3PDTjLH0ZYI/AVM5Czejod07izh4Cbuxtpvf4EIXxMYEHbahLfJNzGJ69kyzzAYBe yLTc4RVN7jpzv+a6XaJlQA0goBof/WepEN1ZzKh6PfeEDa1Fg7EilzV7wtWsKnR5mKU2 IXg17T4aU5mKxn8FH+bWHj8a9E8GoVU/OPTXGMQ5gJ2JojLrJ5ZKYdWix2MY0eXnTAmA QC+VQIWcFUIHL6TsWOIExY3j3Rmgpd+pYm1yui5m8hsnzpP2KwTjQ74cyMAkD7NIMRTc o/Cv/bb0wWQ7uT4azb+9i1fzXITNjYjNehkUG4/f2uS8Mif8knhE7w8jXxo9axKN1XA6 4N/A== X-Gm-Message-State: AOJu0Yy/Q8o/zadFetwImPYj0vW6jHOX5e5F54EV6K9Vo68DVMnfhmCr nvTk8EmaOGuw0XlESDcv5p2SpzaY+sQc0xTO X-Google-Smtp-Source: AGHT+IEWT7/Y2regfcxchE/qqtqxhAlngMHkAJUXyUMxUWRAx2FZno/9rPTHJhzxbRnhvuMVZXPkIw== X-Received: by 2002:a05:620a:448f:b0:774:226b:c327 with SMTP id x15-20020a05620a448f00b00774226bc327mr4183872qkp.67.1695850829165; Wed, 27 Sep 2023 14:40:29 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id s26-20020aa78d5a000000b00672ea40b8a9sm12546004pfe.170.2023.09.27.14.40.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:40:28 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 12/12] bap: Fix freeing value of dbus_message_iter_get_fixed_array Date: Wed, 27 Sep 2023 14:40:03 -0700 Message-ID: <20230927214003.1873224-13-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927214003.1873224-1-luiz.dentz@gmail.com> References: <20230927214003.1873224-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz The value returned by dbus_message_iter_get_fixed_array is a reference and shall not be freed: 'The returned value is by reference and should not be freed.' --- profiles/audio/bap.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 18872329d4ac..48a1a4f86f8d 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -365,19 +365,17 @@ static const GDBusPropertyTable ep_properties[] = { { } }; -static int parse_array(DBusMessageIter *iter, struct iovec **iov) +static int parse_array(DBusMessageIter *iter, struct iovec *iov) { DBusMessageIter array; if (!iov) return 0; - if (!(*iov)) - *iov = new0(struct iovec, 1); - dbus_message_iter_recurse(iter, &array); - dbus_message_iter_get_fixed_array(&array, &(*iov)->iov_base, - (int *)&(*iov)->iov_len); + dbus_message_iter_get_fixed_array(&array, &iov->iov_base, + (int *)&iov->iov_len); + return 0; } @@ -594,10 +592,15 @@ static int parse_bcast_qos(const char *key, int var, DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &qos->bcast.timeout); } else if (!strcasecmp(key, "BCode")) { + struct iovec iov; + if (var != DBUS_TYPE_ARRAY) return -EINVAL; - parse_array(iter, &qos->bcast.bcode); + parse_array(iter, &iov); + + util_iov_free(qos->bcast.bcode, 1); + qos->bcast.bcode = util_iov_dup(&iov, 1); } else { int err; @@ -653,6 +656,9 @@ static int parse_configuration(DBusMessageIter *props, struct iovec **caps, struct bt_bap_qos *qos) { const char *key; + struct iovec iov; + + memset(&iov, 0, sizeof(iov)); while (dbus_message_iter_get_arg_type(props) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter value, entry; @@ -670,14 +676,20 @@ static int parse_configuration(DBusMessageIter *props, struct iovec **caps, if (var != DBUS_TYPE_ARRAY) goto fail; - if (parse_array(&value, caps)) + if (parse_array(&value, &iov)) goto fail; + + util_iov_free(*caps, 1); + *caps = util_iov_dup(&iov, 1); } else if (!strcasecmp(key, "Metadata")) { if (var != DBUS_TYPE_ARRAY) goto fail; - if (parse_array(&value, metadata)) + if (parse_array(&value, &iov)) goto fail; + + util_iov_free(*metadata, 1); + *metadata = util_iov_dup(&iov, 1); } else if (!strcasecmp(key, "QoS")) { if (var != DBUS_TYPE_ARRAY) goto fail; @@ -1202,6 +1214,7 @@ static void select_cb(struct bt_bap_pac *pac, int err, struct iovec *caps, goto done; } + util_iov_free(ep->caps, 1); ep->caps = util_iov_dup(caps, 1); if (metadata && metadata->iov_base && metadata->iov_len) {