From patchwork Mon Aug 19 19:50:59 2024 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: 820707 Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DFC21DC496 for ; Mon, 19 Aug 2024 19:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097068; cv=none; b=OYsK2d93Lhhg992MVE1xWyzVY1dzv9abp0bcA2mY+kh3rX80maBM1AXIi0KGJ8jXMFmrkj3oo2qBIiMgjMGtpbEbsELrzdcbqLR492R1CVf5o6riz0zmKSSs3S/CHgihloDmdXk2N8vSJIe+gxjyTWg3pdqBo7W6gBLTAXwtqSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097068; c=relaxed/simple; bh=HnlKHD0HC4cMw07mdog3UQROwEa4DzmXONgtT/JU1KY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=LuAy3S4TF5UGWI9BNT1oPg2G/70C3eHvBsjxuh5eDXha3152yHJKkWODIOADq4IcFnkmDjVi0REYgBrKNAYxOzrpP4GtWTIeRaJFUUn7UdLOf/QAO6x3u2WemUCCjn8R390MYUyj44drGm7DL280m0Rzvrs5XyPGw0B93xKTTzM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bygVdLUo; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bygVdLUo" Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-4928da539c3so1409578137.1 for ; Mon, 19 Aug 2024 12:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724097065; x=1724701865; 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=aQL4t95YTldwE0dZdSxtJhqYuIz/dJCVm21ENWvE8Cg=; b=bygVdLUoxurwdnh440OY9U//+bKzkc1iNh2OO6TFZvVCTvHRLY6F2cYIzZR280caFd MYdQz9RGpVRCc+9mL7Q3o7bYD1DY+ypyFRK7s9zRcl70b+rghGA01Ojyg0myP64iIqiR E7Js9zU8dHEXXdfHvkcPe7sTxGQnNijoIVv8udyLefuccAD9tIxD7ZFkrR3Lf2u87o5O szfiqnN8oEmof8Zu+sAZVcvoNvDfK17ODubuWHxh8PWDgSuwG/3bQK0Uz6xFu1lTQvtM hPkkVvT/e0IPPg6UqhUL0e+CMxDL8QWOKbRS+FJGT9tBZldVav/UPK8r8TuTyTfZuwng 1Tmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724097065; x=1724701865; 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=aQL4t95YTldwE0dZdSxtJhqYuIz/dJCVm21ENWvE8Cg=; b=s4x7WSTEnCBAUpw9Z3baywl0DXpt3OMThcnokRIWjmplfryT8hg2JGbGFW3CRq/W4F TnYYt4Zk6CLvdeZCHuXDi8+PoqDFOD+8pkptCmEq8ryxfR65n0bbfL3uzMX7JDiL0hzV LfZvdg7JT3JOIuCHg4cMpWRwsisjJdYTcHgDiT01H52I49fB2lOcYLVN90jEHrmeDtZX +arQgQoOAzvNlMwI7FuQA33jf61ZJd8EiZyiaVO8//CV/W1rjbRljtUrcrA8V8RwMGmF 9RjdjOOzuAlJrWTSuGAJhVbfL31laoLisBeOZvvWac0XCrzZ+c/YFKSwQqiwrgygOyem u8OA== X-Gm-Message-State: AOJu0YzJdHXPLvatIJajNQumCh8LVvljyhyISqs4NuyTJJnQjM6FPC7R 13NPhay61vIHBC0vXH6o53EtPxsVQeYQXCg0H60JuAfgBx+CZlSqpmwAag== X-Google-Smtp-Source: AGHT+IECzGcHK2gC26nm2O4tKuYjQ5Y1Jx3/xTJotXL8THL0RE1o2sWeWw4fhHLtU2kzby6ZkBl96Q== X-Received: by 2002:a05:6102:508b:b0:493:b113:95b8 with SMTP id ada2fe7eead31-497798c78abmr11078370137.12.1724097064700; Mon, 19 Aug 2024 12:51:04 -0700 (PDT) Received: from lvondent-mobl5.. (syn-107-146-107-067.res.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-842fb70fdebsm1274530241.4.2024.08.19.12.51.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 12:51:04 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 1/4] client/player: Add support for entering metadata via endpoint.presets Date: Mon, 19 Aug 2024 15:50:59 -0400 Message-ID: <20240819195102.37393-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.46.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz --- client/player.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/client/player.c b/client/player.c index f1cd909663eb..a52575479299 100644 --- a/client/player.c +++ b/client/player.c @@ -1228,6 +1228,7 @@ static const struct capabilities { struct codec_preset { char *name; const struct iovec data; + const struct iovec meta; struct bt_bap_qos qos; uint8_t target_latency; uint32_t chan_alloc; @@ -2069,7 +2070,10 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep, } /* Copy metadata */ - cfg->meta = util_iov_dup(ep->meta, 1); + if (preset->meta.iov_len) + cfg->meta = util_iov_dup(&preset->meta, 1); + else + cfg->meta = util_iov_dup(ep->meta, 1); if (ep->broadcast) qos = &preset->qos.bcast.io_qos; @@ -4205,7 +4209,8 @@ static void cmd_presets_endpoint(int argc, char *argv[]) if (argc > 4) { struct codec_preset *alt_preset; - struct iovec *iov = (void *)&default_preset->data; + struct iovec *caps = (void *)&default_preset->data; + struct iovec *meta = (void *)&default_preset->meta; /* Check if and alternative preset was given */ alt_preset = preset_find_name(preset, argv[4]); @@ -4218,14 +4223,37 @@ static void cmd_presets_endpoint(int argc, char *argv[]) return; } - iov->iov_base = str2bytearray(argv[4], &iov->iov_len); - if (!iov->iov_base) { - bt_shell_printf("Invalid configuration %s\n", - argv[4]); - return bt_shell_noninteractive_quit( + /* Check if Codec Configuration was entered */ + if (strlen(argv[4])) { + caps->iov_base = str2bytearray(argv[4], + &caps->iov_len); + if (!caps->iov_base) { + bt_shell_printf("Invalid configuration " + "%s\n", + argv[4]); + return bt_shell_noninteractive_quit( EXIT_FAILURE); + } } + /* Check if metadata was entered */ + if (argc > 5) { + meta->iov_base = str2bytearray(argv[5], + &meta->iov_len); + if (!meta->iov_base) { + bt_shell_printf("Invalid metadata %s\n", + argv[5]); + return bt_shell_noninteractive_quit( + EXIT_FAILURE); + } + } + + /* If configuration was left empty then ask the + * parameters. + */ + if (!caps->iov_base || !caps->iov_len) + goto enter_cc; + bt_shell_prompt_input("QoS", "Enter Target Latency " "(Low, Balance, High):", custom_target_latency, @@ -4236,6 +4264,7 @@ static void cmd_presets_endpoint(int argc, char *argv[]) } else print_presets(preset); +enter_cc: if (default_preset && default_preset->custom) { bt_shell_prompt_input("Codec", "Enter frequency (Khz):", custom_frequency, default_preset); @@ -4265,7 +4294,8 @@ static const struct bt_shell_menu endpoint_menu = { cmd_config_endpoint, "Configure Endpoint", endpoint_generator }, - { "presets", " [preset] [config]", + { "presets", " [preset] [codec config] " + "[metadata]", cmd_presets_endpoint, "List or add presets", uuid_generator }, From patchwork Mon Aug 19 19:51:00 2024 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: 820416 Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B1031DC494 for ; Mon, 19 Aug 2024 19:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097069; cv=none; b=cRIP0jIk0EfxhhAv1MNSDhpH0AMyyKU8YWv20r2iHeH4SprbpZCF9oSj88GeJbFX37jA7yuFqkIqw8IHBooRI+jeTpELEeRrohdSHQhfryM/Gg1562EhlJYd3QQ3VAuaN3mezpEPQDwHg0gdOVLPnl1rkWfOMXzC0wx6lebrqJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097069; c=relaxed/simple; bh=nxNYVWXINzhbAn74SGYRcjRaCgYiTeCql+pW8VeaNBc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ocl0zxYr8FhwqmRT986xnDk8yUz/Y3B+DSRX9deskJyyiKPfVfWbwon+TJm6BBKpbiqFqLuEzKzOHOWkaU+WtIAcoFeyk1PEeVu2wc2Dlowrz/5i+KbGAFSA4O+jO83Qv2TiB7UjXJBvI4q8NlKo1AKKmfDeUEKG71yPxXIR940= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Df0EBPRS; arc=none smtp.client-ip=209.85.222.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Df0EBPRS" Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-84303532b90so1283527241.3 for ; Mon, 19 Aug 2024 12:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724097066; x=1724701866; 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=XWzVjAyVwLfGV2kU8BKXoXLbxsCiB8cJzAziqxNN2xg=; b=Df0EBPRSGwCF21uzZnVcnVDOozC6/W+Zkp0YrfpvUrBVTiRipvVHT0gsVRMC9UnQrp U9fiQWR84BTDHiEqwWZLZFal1JE8rqhw3vriZGARCbhdFRVmO4bSOUx1hesOQLBBomHW KTeZv19mQXKKDuLqwX8ZAA+hEInYnNJzwa9xkNtk7hXiKryb1qsH74DWERofh7UBmtMk UxJwBy4dHhESTmZBZDLwuNx4xaQJ0jYIL1Jus7o33HgrHt8y3V40f/ETdiqD+STV+IC9 QWh65mgDtpGuYYCQgIZ31kx5wTI5OUjG4fBK+cUUIliYjFFxGShtXtnSO3sqVzL1TT7V sAlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724097066; x=1724701866; 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=XWzVjAyVwLfGV2kU8BKXoXLbxsCiB8cJzAziqxNN2xg=; b=bvZaxRXXgS92hZBKYxHI0MJ4IO4Y4DRJ+AHzy6ySz8ImWrXtWc5Ynl+huw9bwCuszM FILvQJQaboFEL1TkuDFA6FVq2dvjl3j2q6rcUY4vjYGlEGIe+WFqHTCGwecxYjl4bcvP saEG1GuC/rIxgFwUcIzI/i+G6QwrZ6MWuf3VLTWg5gjOWBElciVwSU/FrAnk+LAJQEEV ozPQzlGV0PHKeU3qqFepicCMyNNHylfzG2jnbPqcPb1gDiw908wNoUZDn/IhEcnXeELT YJzgMj3A0/8x28+4TPle23dTyJ/fYf7M9V8SgLFxpbW4DvgkeApKT9c0MzUvLh+b4vmO +N2A== X-Gm-Message-State: AOJu0YytMGazby3UHiQalmtVnIdWXP1t11ovgQj7aSZr2rjEV+r7Z91P GkOVJBDyga1xd9NTT9qcCMar6+GthVaib1BO+OzJ50m7mFwk/3VS9xp4Ew== X-Google-Smtp-Source: AGHT+IELizK7R+1vXCyi0jIghGAsZ92j8G/nVuF53lh0KgLP1Omlf22sEFE/xLv9mIl+CCrcDwYk4g== X-Received: by 2002:a05:6102:3593:b0:494:829:835b with SMTP id ada2fe7eead31-4977990760amr14370924137.9.1724097065773; Mon, 19 Aug 2024 12:51:05 -0700 (PDT) Received: from lvondent-mobl5.. (syn-107-146-107-067.res.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-842fb70fdebsm1274530241.4.2024.08.19.12.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 12:51:05 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 2/4] client/player: Make endpoint.presets accept endpoint object Date: Mon, 19 Aug 2024 15:51:00 -0400 Message-ID: <20240819195102.37393-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240819195102.37393-1-luiz.dentz@gmail.com> References: <20240819195102.37393-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This makes endpoint.presets accept local endpoints rather than just UUIDs: [bluetooth]# endpoint.presets /local/endpoint/ep0 32_1_1 --- client/player.c | 65 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/client/player.c b/client/player.c index a52575479299..cfaf1137c92e 100644 --- a/client/player.c +++ b/client/player.c @@ -118,6 +118,7 @@ struct endpoint { struct queue *transports; DBusMessage *msg; struct preset *preset; + struct codec_preset *codec_preset; bool broadcast; struct iovec *bcode; }; @@ -2101,13 +2102,23 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep, return reply; } +static struct codec_preset *endpoint_find_codec_preset(struct endpoint *ep, + const char *name) +{ + if (ep->codec_preset && + (!name || !strcmp(ep->codec_preset->name, name))) + return ep->codec_preset; + + return preset_find_name(ep->preset, name); +} + static void select_properties_response(const char *input, void *user_data) { struct endpoint *ep = user_data; struct codec_preset *p; DBusMessage *reply; - p = preset_find_name(ep->preset, input); + p = endpoint_find_codec_preset(ep, input); if (p) { reply = endpoint_select_properties_reply(ep, ep->msg, p); goto done; @@ -2149,7 +2160,7 @@ static DBusMessage *endpoint_select_properties(DBusConnection *conn, return NULL; } - p = preset_find_name(ep->preset, NULL); + p = endpoint_find_codec_preset(ep, NULL); if (!p) return NULL; @@ -4192,28 +4203,42 @@ static void cmd_presets_endpoint(int argc, char *argv[]) { struct preset *preset; struct codec_preset *default_preset = NULL; + struct endpoint *ep = NULL; preset = find_presets_name(argv[1], argv[2]); if (!preset) { - bt_shell_printf("No preset found\n"); - return bt_shell_noninteractive_quit(EXIT_FAILURE); - } - - if (argc > 3) { - default_preset = codec_preset_add(preset, argv[3]); - if (!default_preset) { - bt_shell_printf("Preset %s not found\n", argv[3]); + ep = endpoint_find(argv[1]); + if (!ep) { + bt_shell_printf("No preset found\n"); return bt_shell_noninteractive_quit(EXIT_FAILURE); } - preset->default_preset = default_preset; + preset = ep->preset; + argv++; + argc--; + } else { + argv += 2; + argc -= 2; + } - if (argc > 4) { + if (argc > 1) { + default_preset = codec_preset_add(preset, argv[1]); + if (!default_preset) { + bt_shell_printf("Preset %s not found\n", argv[1]); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (ep) + ep->codec_preset = default_preset; + else + preset->default_preset = default_preset; + + if (argc > 2) { struct codec_preset *alt_preset; struct iovec *caps = (void *)&default_preset->data; struct iovec *meta = (void *)&default_preset->meta; /* Check if and alternative preset was given */ - alt_preset = preset_find_name(preset, argv[4]); + alt_preset = preset_find_name(preset, argv[2]); if (alt_preset) { default_preset->alt_preset = alt_preset; bt_shell_prompt_input(default_preset->name, @@ -4224,21 +4249,21 @@ static void cmd_presets_endpoint(int argc, char *argv[]) } /* Check if Codec Configuration was entered */ - if (strlen(argv[4])) { - caps->iov_base = str2bytearray(argv[4], + if (strlen(argv[2])) { + caps->iov_base = str2bytearray(argv[2], &caps->iov_len); if (!caps->iov_base) { bt_shell_printf("Invalid configuration " "%s\n", - argv[4]); + argv[2]); return bt_shell_noninteractive_quit( EXIT_FAILURE); } } /* Check if metadata was entered */ - if (argc > 5) { - meta->iov_base = str2bytearray(argv[5], + if (argc > 3) { + meta->iov_base = str2bytearray(argv[3], &meta->iov_len); if (!meta->iov_base) { bt_shell_printf("Invalid metadata %s\n", @@ -4294,8 +4319,8 @@ static const struct bt_shell_menu endpoint_menu = { cmd_config_endpoint, "Configure Endpoint", endpoint_generator }, - { "presets", " [preset] [codec config] " - "[metadata]", + { "presets", "/ [codec[:company]] [preset] " + "[codec config] [metadata]", cmd_presets_endpoint, "List or add presets", uuid_generator }, From patchwork Mon Aug 19 19:51:01 2024 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: 820706 Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0D0D1DD397 for ; Mon, 19 Aug 2024 19:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097070; cv=none; b=WUAHSN8NLv6L1qDPPHdgyM2zkFwb39+MDhEJCG+ZCNS7Otr/NTWydbeCy22kWSv2Ebn3yD4WhnUWPP9CXYzqdw+1oikSz/SS1x3X79WbnM0DknJg6N4SnnocuOY56ZocQ2FSULR/NCHAudAg08LWOGlASjOZkDoQMs0tYkujY/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097070; c=relaxed/simple; bh=I2ZTKyQE5M4FdCo+xXhLz6C8P93bb6u6+3bcuUwgkH4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RJi8B0ZKKKSSHLY9sZ0GCn761z3ErOJsNQ20nLUt+19DNnfWmb22CKaKkqxdUCd6Q3ZXIxu1ijOnRBiDwtZJb8jbKPaxhkdCG4MLSEQeWMbn/B8aITiBdSEspxBIKufSFOxfWu2v66ShCBFhtM2T0ooxtj7tidsYnIuVbKsZ4Hc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cWmSkSKU; arc=none smtp.client-ip=209.85.217.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cWmSkSKU" Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-49297fca3c2so1691929137.1 for ; Mon, 19 Aug 2024 12:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724097067; x=1724701867; 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=NQYoBSzVThb7g5HLHLf+c0ty/SjotPghKRIte8zUGhQ=; b=cWmSkSKU2rfVEWQ4yXeD1h3c+YtR+VsrL6yxLYODHVcbjExpyiX0hzPvROicanp/IJ tOVsh+1mYcramIG8Rtr565S6U+FmFiK1APeSNTEMCmJyh9bd13UZJaGXPj1D2Y4Ps8U1 Jjzj/tP+i8NY4JwgDIZ3QSbbRCFaB+Z1R9qsxk56gH0k4oDXoyPe8t5h9S/Jwes4XgYH l1/Hw7KhgZzyajdZJwCFUsCaHl0PgkDapwKlAFBs/J1YkrlNXFwIpdtGu8KO8tBe2rtg o92ZUzobibevmaViaTC0jUjECz25GFrX9E/rftHFcw3uZKER4vnTS0AQoqrKcckws/Jr cvBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724097067; x=1724701867; 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=NQYoBSzVThb7g5HLHLf+c0ty/SjotPghKRIte8zUGhQ=; b=rpMvzyzP7u0piwDhUEn9RfzqfOgbmcwZjawwjrJpmVchla92cHTJkgjdvdrMxU0/mF KcBE3m2KIhm5qi9Sr6JNe2AhuNMNHduGl5ZY9dJnABfOHrTNckO+BZBIm0aMmAKi0pzS AmIY0H4uNk/qcpvYhlwXcZQbC/J3gePOa5FGOPoAURNnL/eo1Rqe4XTjEw/FILgomCSm VYP34LK0XL+Z8s4tBdFnQsS/A387rK3k9nr85Ss0zs0btCO2xAt5ijXfg1hSjGLFIP4f 9W2oFtG1QFifJEV46GX5t5AbTysyPSZe2rf+ngCtflcnWvXjxjYjoNe8FCC55aM1lQfF 1gVg== X-Gm-Message-State: AOJu0YxIihYnKJm+hSwpWKl5QND5NK6Zkl943+AZVpXWPnrkDmhy/s7J 7Qb/LF0XlXVgaohyhSMmxECGcx0XGIcjwhmW1cm8w9MHBHUoybZL6WQpnw== X-Google-Smtp-Source: AGHT+IHH3D9Y3yuVn+dk3uzRE+Bm6Jdu5vE4uUIQPOVlU7iU3mLnsgeTmdlTr6cG5LSs3sOCVnGqnA== X-Received: by 2002:a67:f312:0:b0:493:e585:6ce3 with SMTP id ada2fe7eead31-497799b5e22mr9485469137.31.1724097066944; Mon, 19 Aug 2024 12:51:06 -0700 (PDT) Received: from lvondent-mobl5.. (syn-107-146-107-067.res.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-842fb70fdebsm1274530241.4.2024.08.19.12.51.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 12:51:06 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 3/4] client/player: Make endpoint.show print local preset Date: Mon, 19 Aug 2024 15:51:01 -0400 Message-ID: <20240819195102.37393-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240819195102.37393-1-luiz.dentz@gmail.com> References: <20240819195102.37393-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This makes command endpoint.show print preset set with endpoint.presets: >endpoint.show /local/endpoint/ep2 Endpoint /local/endpoint/ep2 UUID 00002bc9-0000-1000-8000-00805f9b34fb Codec 0x06 (6) Capabilities.#0: len 0x03 type 0x01 Capabilities.Sampling Frequencies: 0x00ff Capabilities.Sampling Frequency: 8 Khz (0x0001) Capabilities.Sampling Frequency: 11.25 Khz (0x0002) Capabilities.Sampling Frequency: 16 Khz (0x0004) Capabilities.Sampling Frequency: 22.05 Khz (0x0008) Capabilities.Sampling Frequency: 24 Khz (0x0010) Capabilities.Sampling Frequency: 32 Khz (0x0020) Capabilities.Sampling Frequency: 44.1 Khz (0x0040) Capabilities.Sampling Frequency: 48 Khz (0x0080) Capabilities.#1: len 0x02 type 0x02 Capabilities.Frame Duration: 0x03 Capabilities.Frame Duration: 7.5 ms (0x01) Capabilities.Frame Duration: 10 ms (0x02) Capabilities.#2: len 0x05 type 0x04 Capabilities.Frame Length: 26 (0x001a) - 240 (0x00f0) Capabilities.#3: len 0x02 type 0x03 Capabilities.Audio Channel Count: 0x01 Capabilities.Audio Channel Count: 1 channel (0x01) Preset 32_1_1 Configuration.#0: len 0x02 type 0x01 Configuration.Sampling Frequency: 32 Khz (0x06) Configuration.#1: len 0x02 type 0x02 Configuration.Frame Duration: 7.5 ms (0x00) Configuration.#2: len 0x03 type 0x04 Configuration.Frame Length: 60 (0x003c) Locations 0x00000002 (2) --- client/player.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/player.c b/client/player.c index cfaf1137c92e..5644b0d616c9 100644 --- a/client/player.c +++ b/client/player.c @@ -2797,13 +2797,26 @@ static void print_capabilities(GDBusProxy *proxy) print_codec(uuid, codec, &caps, &meta); } +static void print_preset(struct codec_preset *codec, uint8_t codec_id) +{ + bt_shell_printf("\tPreset %s\n", codec->name); + + if (codec_id == LC3_ID) + print_lc3_cfg(codec->data.iov_base, codec->data.iov_len); +} + static void print_local_endpoint(struct endpoint *ep) { bt_shell_printf("Endpoint %s\n", ep->path); bt_shell_printf("\tUUID %s\n", ep->uuid); bt_shell_printf("\tCodec 0x%02x (%u)\n", ep->codec, ep->codec); + if (ep->caps) print_codec(ep->uuid, ep->codec, ep->caps, ep->meta); + + if (ep->codec_preset) + print_preset(ep->codec_preset, ep->codec); + if (ep->locations) bt_shell_printf("\tLocations 0x%08x (%u)\n", ep->locations, ep->locations); From patchwork Mon Aug 19 19:51:02 2024 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: 820415 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8AB31DF67B for ; Mon, 19 Aug 2024 19:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097072; cv=none; b=clD/F59dtdWenAXbtsQ38T+TlGl1uTUaxXN3Hhd/aqXGSwItUmzuCoj/T5BZGiQcoS11HlDBODzUnOi0aT0wPl4WmEZxmbgQodYpifb0q2tg8ByQ7E0DCCiTpFJXLZKkcxeGdq6bl6a6wI6qz05bcOTONULB/mexhrig4I6yr/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724097072; c=relaxed/simple; bh=7KPnfnidrY8ueUprYZEHt0DXgK7ZqUKwII+GLUeg9xw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SoQu3HM2yC8qpNixQgDIiMh0qAfdt0nJ6lC06sClVUhMKf284ByO49T/l7RaEKjmg8cjYlrT+QxETKAThQZD32OjQweo0vV8XlqTy8IPr4+JHOxNx0WTnU/s8oDpdXJYRvmPMCMMRFmpPBOklresCkoDZxE/FP7OmvWk7KvFKdY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EbBkZIJ8; arc=none smtp.client-ip=209.85.217.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EbBkZIJ8" Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-4928fa870a9so1386882137.2 for ; Mon, 19 Aug 2024 12:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724097069; x=1724701869; 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=r9huLJOFfcgn9eV+dzwtlWRoRu4uNcnHLi9VckJwzKo=; b=EbBkZIJ8qTgpnqv1Ep7Fogjf/2rx3KH8hXKlDQ7ugp2EIrDEifP9rMxKKx9AzCjo4+ EhzSQ6PthBOZ+Zbtqzj5TjEzZYlMgB0oTYPG2F26n+XZglNPURHqOymWyIdOE2p2WsL/ rabo4MyuXyxLWEq/f6sifVxiJla12ev+OAeoVe6kfLqgvAqoad2mJxBDSHR5LH7sjq4a WzYPFN1TKcbjlu3jJjm9mCLPkYZMWc20B9LSEkUq1U6BSsZvYaOdZTre8//XXYRnWzLo XCo0DqdWzlH+/zZ7wOHOVFGNhjG+mvTB+rdTrLg6zu5kr7J6kovQs5WTyW96PsR2rmkZ /Y5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724097069; x=1724701869; 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=r9huLJOFfcgn9eV+dzwtlWRoRu4uNcnHLi9VckJwzKo=; b=Dh3Z/PHBxZWgbLAAjHQmXCLgZBzP0w1Y1mVPm0QggkDNTdm+gNX7Ooh2JZ8uxsXHDK XydkB0C/hrll0jnZ/afM9BC6uRk7oG6qRwYFUhn8c52K8YNFgOZf9OlJ3YGOlYnByVJt mNIVJ9Cy9ZnMTeCdolFKyA9wobYyvMUb/1VUKKgSokgHUkQJIINaTMl3kRQB+NPgnwm7 h+ILMGLgiZVMPmQXMUPMjHgA+B/GcbxOoqj7cYAAIh2MTYuUXbXgoIqdLNk5Z4krV2eK fH8rFqdcpkmKKv4gDXGn02caQXCWblW60qcZdfjO2d5MEyLr3l5P0npddZnLBv5TOCz+ izaw== X-Gm-Message-State: AOJu0Yz+/mHQ0GqCXLFTDgMIzOcDfycpCwnWeaes3PyHeYT5gEwMKplR Ucpf9MXKtQxDnyPne9vwGXSJEOO6wr3mmvEqvo88HKqLd/IcnTPm4vv1NQ== X-Google-Smtp-Source: AGHT+IEC/xpnBBIeYdcf2Xj7nMAnbLjKQph7RA4J4K6yjxwE7S5LgG5mfLCf9Tw0tMEoKoukghY81A== X-Received: by 2002:a05:6102:cca:b0:493:3cde:e46 with SMTP id ada2fe7eead31-4977995cc25mr10345980137.13.1724097068798; Mon, 19 Aug 2024 12:51:08 -0700 (PDT) Received: from lvondent-mobl5.. (syn-107-146-107-067.res.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-842fb70fdebsm1274530241.4.2024.08.19.12.51.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 12:51:07 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1 4/4] client/player: Print endpoint preset with endpoint.presets Date: Mon, 19 Aug 2024 15:51:02 -0400 Message-ID: <20240819195102.37393-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240819195102.37393-1-luiz.dentz@gmail.com> References: <20240819195102.37393-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz If just the endpoint objects is passed to endpoint.presets then just print it instead of the listing the presets available for the UUID: [bluetooth]# endpoint.presets /local/endpoint/ep2 Preset 32_1_1 Configuration.#0: len 0x02 type 0x01 Configuration.Sampling Frequency: 32 Khz (0x06) Configuration.#1: len 0x02 type 0x02 Configuration.Frame Duration: 7.5 ms (0x00) Configuration.#2: len 0x03 type 0x04 Configuration.Frame Length: 60 (0x003c) --- client/player.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/player.c b/client/player.c index 5644b0d616c9..46863b1f4493 100644 --- a/client/player.c +++ b/client/player.c @@ -4299,7 +4299,9 @@ static void cmd_presets_endpoint(int argc, char *argv[]) return; } - } else + } else if (ep && (ep->codec_preset)) + print_preset(ep->codec_preset, ep->codec); + else print_presets(preset); enter_cc: