From patchwork Mon May 1 22:44:07 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: 13228361 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 03A8CC77B7C for ; Mon, 1 May 2023 22:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjEAWoR (ORCPT ); Mon, 1 May 2023 18:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbjEAWoQ (ORCPT ); Mon, 1 May 2023 18:44:16 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D3D269E for ; Mon, 1 May 2023 15:44:14 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1aaed87d8bdso14005445ad.3 for ; Mon, 01 May 2023 15:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682981053; x=1685573053; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jbBtSA3uJsZp0zrHUcdg57fcZO6mCxmi7bK41/B7hrc=; b=I4QVOndMmqfL06+Ir5F6E9DSWlg1lSJMZbyXrw9z2S5ddR2niCuD2dZBas4KP23h5x H/u7VpoKmcVgc9Hrfi5xAlKlnfB0XoVqZKQLtlglSRAYj3ekVPL47eeB4QgqA3H2ESmc deMetqWHh503COBKMOpaVzqBEYNO/AuaR4cY2WBxxAzUWZH/nYpEKJDjTK9g2AeuCohM x3a05QjcDTSeluFL3X5BnrViRXrPOZQfs6urPevn/wSXpGLeSzj6cNUe+Me3Mfp1qAbf a8hNZBUHQmFBooKiSH/tk6A1UA7XaJiLLuKqvvu1QwvrxDa4wo+Ove8EO5cJhLzbyteR ztiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682981053; x=1685573053; 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=jbBtSA3uJsZp0zrHUcdg57fcZO6mCxmi7bK41/B7hrc=; b=YbkDgiXZfXecsKNMp+wAfwP7yT2Dcwh579SIU8nyW0Aesi8Bjsbks8ytz1t8OdtJWZ rX7wGNPODWT3DJ6YMDNxx5eVHMR2fvGd2vgvfTal2XFiHVjv6gTTTFSFioGtq3Eq657m iKatJhIZt46cLVmymBaibjIbQk/MIptXgMfL/CKvlof9PYIsB2wyTNgItTd+NeT7iUx+ xBDsrA+c6zulJ0E0j55M6ZXIxvMrRhrL/vJXQ8VCSRoDTsTytl+WzTtWqOKWPMbiPQS6 rllGvLuv8+3HpFEgo4bt37Gs27npceiguLWmn+c54Y1ePKsDVhpbzY8gpgx2ZbWFGG67 scRw== X-Gm-Message-State: AC+VfDwEv5oMFsipiGrM8XSIiFX6ODjrs9IAsEE1u1pJj1mvwT8Jf/4m CJipDzqTZSiAIb0YAA6q4VkKx2S9A1E= X-Google-Smtp-Source: ACHHUZ552EW8vFy3LzfrtOlIEq+/YU3y4+Wb3WDMFxDsXSdOe2HOKVGMTaRtzPno7amcTD3KHeMEvQ== X-Received: by 2002:a17:902:b210:b0:1a6:a8dd:4aeb with SMTP id t16-20020a170902b21000b001a6a8dd4aebmr15453792plr.23.1682981052985; Mon, 01 May 2023 15:44:12 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001a6756a36f6sm18279806plq.101.2023.05.01.15.44.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 15:44:12 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 1/4] client/player: Add support for Metadata in BAP Profile Date: Mon, 1 May 2023 15:44:07 -0700 Message-Id: <20230501224410.1119023-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Abhay Maheta This adds support for Metadata in BAP profile. In order to register zero Metadata, 0 shall be entered when prompted. [bluetooth]# endpoint.register 00002bc9-0000-1000-8000-00805f9b34fb 0x06 [/local/endpoint/ep0] Enter Metadata (value/no): n [/local/endpoint/ep0] Auto Accept (yes/no): y [/local/endpoint/ep0] CIG (auto/value): a [/local/endpoint/ep0] CIS (auto/value): a Capabilities: 03 01 ff 00 02 02 03 02 03 03 05 04 1e 00 f0 00 ................ Endpoint /local/endpoint/ep0 registered --- client/player.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/client/player.c b/client/player.c index 5572cc566e79..cc35721d85b7 100644 --- a/client/player.c +++ b/client/player.c @@ -70,6 +70,7 @@ struct endpoint { uint16_t cid; uint16_t vid; struct iovec *caps; + struct iovec *meta; bool auto_accept; bool acquiring; uint8_t cig; @@ -1582,6 +1583,7 @@ struct endpoint_config { GDBusProxy *proxy; struct endpoint *ep; struct iovec *caps; + struct iovec *meta; uint8_t target_latency; const struct codec_qos *qos; }; @@ -1592,6 +1594,7 @@ static void append_properties(DBusMessageIter *iter, DBusMessageIter dict; struct codec_qos *qos = (void *)cfg->qos; const char *key = "Capabilities"; + const char *meta = "Metadata"; dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "{sv}", &dict); @@ -1602,6 +1605,15 @@ static void append_properties(DBusMessageIter *iter, DBUS_TYPE_BYTE, &cfg->caps->iov_base, cfg->caps->iov_len); + if (cfg->meta->iov_len) { + g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &meta, + DBUS_TYPE_BYTE, &cfg->meta->iov_base, + cfg->meta->iov_len); + + bt_shell_printf("Metadata:\n"); + bt_shell_hexdump(cfg->meta->iov_base, cfg->meta->iov_len); + } + if (!qos) goto done; @@ -1699,6 +1711,9 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep, iov_append(&cfg->caps, preset->data.iov_base, preset->data.iov_len); cfg->target_latency = preset->target_latency; + /* Copy metadata */ + iov_append(&cfg->meta, cfg->ep->meta->iov_base, cfg->ep->meta->iov_len); + if (preset->qos.phy) /* Set QoS parameters */ cfg->qos = &preset->qos; @@ -1847,6 +1862,12 @@ static void endpoint_free(void *data) g_free(ep->caps); } + if (ep->meta) { + if (ep->meta->iov_base) + g_free(ep->meta->iov_base); + g_free(ep->meta); + } + if (ep->msg) dbus_message_unref(ep->msg); @@ -1917,10 +1938,38 @@ static gboolean endpoint_vendor_exists(const GDBusPropertyTable *property, return ep->cid && ep->vid; } +static gboolean endpoint_get_metadata(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct endpoint *ep = data; + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array); + + dbus_message_iter_append_fixed_array(&array, DBUS_TYPE_BYTE, + &ep->meta->iov_base, + ep->meta->iov_len); + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + +static gboolean endpoint_metadata_exists(const GDBusPropertyTable *property, + void *data) +{ + struct endpoint *ep = data; + + return ep->meta ? TRUE : FALSE; +} + static const GDBusPropertyTable endpoint_properties[] = { { "UUID", "s", endpoint_get_uuid, NULL, NULL }, { "Codec", "y", endpoint_get_codec, NULL, NULL }, { "Capabilities", "ay", endpoint_get_capabilities, NULL, NULL }, + { "Metadata", "ay", endpoint_get_metadata, NULL, + endpoint_metadata_exists }, { "Vendor", "u", endpoint_get_vendor, NULL, endpoint_vendor_exists }, { } }; @@ -1930,6 +1979,7 @@ static void register_endpoint_setup(DBusMessageIter *iter, void *user_data) struct endpoint *ep = user_data; DBusMessageIter dict; const char *key = "Capabilities"; + const char *meta = "Metadata"; dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &ep->path); @@ -1955,6 +2005,15 @@ static void register_endpoint_setup(DBusMessageIter *iter, void *user_data) bt_shell_hexdump(ep->caps->iov_base, ep->caps->iov_len); } + if (ep->meta) { + g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &meta, + DBUS_TYPE_BYTE, &ep->meta->iov_base, + ep->meta->iov_len); + + bt_shell_printf("Metadata:\n"); + bt_shell_hexdump(ep->meta->iov_base, ep->meta->iov_len); + } + dbus_message_iter_close_container(iter, &dict); } @@ -2072,6 +2131,30 @@ static void endpoint_auto_accept(const char *input, void *user_data) bt_shell_prompt_input(ep->path, "CIG (auto/value):", endpoint_cig, ep); } +static void endpoint_set_metadata(const char *input, void *user_data) +{ + struct endpoint *ep = user_data; + + if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) { + free(ep->meta->iov_base); + ep->meta = NULL; + goto done; + } + + if (!ep->meta) + ep->meta = g_new0(struct iovec, 1); + + ep->meta->iov_base = str2bytearray((char *) input, &ep->meta->iov_len); + if (!ep->meta->iov_base) { + free(ep->meta); + ep->meta = NULL; + } + +done: + bt_shell_prompt_input(ep->path, "Auto Accept (yes/no):", + endpoint_auto_accept, ep); +} + static void endpoint_set_capabilities(const char *input, void *user_data) { struct endpoint *ep = user_data; @@ -2091,8 +2174,8 @@ static void endpoint_set_capabilities(const char *input, void *user_data) ep->caps->iov_len = 0x00; } - bt_shell_prompt_input(ep->path, "Auto Accept (yes/no):", - endpoint_auto_accept, ep); + bt_shell_prompt_input(ep->path, "Enter Metadata (value/no):", + endpoint_set_metadata, ep); } static char *uuid_generator(const char *text, int state) From patchwork Mon May 1 22:44:08 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: 13228362 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 29EFEC77B73 for ; Mon, 1 May 2023 22:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229822AbjEAWoS (ORCPT ); Mon, 1 May 2023 18:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjEAWoR (ORCPT ); Mon, 1 May 2023 18:44:17 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 355BE26BC for ; Mon, 1 May 2023 15:44:16 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-51b0f9d7d70so2719850a12.1 for ; Mon, 01 May 2023 15:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682981055; x=1685573055; 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=/8jc43J+oF1ouWCuHyNTyI0g5hAkSGiD9T2/GzAsXmw=; b=LofhnNgiKPM3xWsLImMXbIXokQsdeK1B3A/0JRJcm6/fOmq8Jw0226dRkY7sL/hSa3 Kzau2FSJL9cTL3hgPFgcDveofzrYPZHUr+lyOAzL6Hn6/o3uqsMWAPfVQYixMFD8ht/l skN0iaesAbyDrCXBUABQ8kBCdt7OvlIG+D84J0YwcXBjzQBEapN3sr9FB6uj04v0HdNC EQ2DmrcTX0vvWQL9+7GVGN2uaafYF3WCzgO1YFxcJUfKu1FCxJhlDpe1CMt2yBULHhY+ pfyi6oqh9cyoXUb2A2r6jk9DUtyjcWX01DEXXFMtBXNmL+NHH8nI0/DRVctubX9HJbYj DG7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682981055; x=1685573055; 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=/8jc43J+oF1ouWCuHyNTyI0g5hAkSGiD9T2/GzAsXmw=; b=LREUK3BooJ8dfrw9sX4mRoKVIzu55efaBszqBqzZvanlnkCVTsT5Ej5WELYswMZE7T ln0YGMFiNkiB1SnxeGXg4iZGgdmr1aUbyO4X8lIEEwyfqsKaBEEbOJJGi0x5uc4kexoK Ku2MVWFC18wS812F0w+vetVPX6RAaCMy6m/DyCK8BUyamUKTlGFh6BJ2f3uCRaRHE2Dj MM0FgSmFXl1PP0cUrVEI57uUHvLWguCCkID5miVlJ4kG+zRlU+wYR3QJncbSQw+pY8ar AQP8E9m4DGOc1le7jjmrS/vmmzoHBU7ZvjHHCEb1HA2tG9jUXzeRtw5dYIY2h+GNn3IM b17Q== X-Gm-Message-State: AC+VfDz8anxP1571PkgQA4s+0o6rSgo5LrEJ/KK5/jjyYa/Qe9qpEjzY xsJJb/zq5B+gW8l98BHo6D4/iqBoV3I= X-Google-Smtp-Source: ACHHUZ74KT3cQQAIbeHnxM615HaHGpSQ0jgNCFYTLBen8eAwwHeHKOVwdvVhzJ3e1nDeYaB40DMr9Q== X-Received: by 2002:a17:903:1103:b0:1aa:f5dd:2d63 with SMTP id n3-20020a170903110300b001aaf5dd2d63mr6040159plh.1.1682981054894; Mon, 01 May 2023 15:44:14 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001a6756a36f6sm18279806plq.101.2023.05.01.15.44.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 15:44:13 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 2/4] client/player: Fix crash when RegisterEndpoint fails Date: Mon, 1 May 2023 15:44:08 -0700 Message-Id: <20230501224410.1119023-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230501224410.1119023-1-luiz.dentz@gmail.com> References: <20230501224410.1119023-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 If RegisterEndpoint fails when there are multiple adapters it would attempt to free the same endpoint multiple times. --- client/player.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/player.c b/client/player.c index cc35721d85b7..7719076c8cfa 100644 --- a/client/player.c +++ b/client/player.c @@ -2028,9 +2028,11 @@ static void register_endpoint_reply(DBusMessage *message, void *user_data) bt_shell_printf("Failed to register endpoint: %s\n", error.name); dbus_error_free(&error); - local_endpoints = g_list_remove(local_endpoints, ep); - g_dbus_unregister_interface(dbus_conn, ep->path, + if (g_list_find(local_endpoints, ep)) { + local_endpoints = g_list_remove(local_endpoints, ep); + g_dbus_unregister_interface(dbus_conn, ep->path, BLUEZ_MEDIA_ENDPOINT_INTERFACE); + } return bt_shell_noninteractive_quit(EXIT_FAILURE); } From patchwork Mon May 1 22:44:09 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: 13228363 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 6D906C77B7C for ; Mon, 1 May 2023 22:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230443AbjEAWoU (ORCPT ); Mon, 1 May 2023 18:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjEAWoT (ORCPT ); Mon, 1 May 2023 18:44:19 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D371FDD for ; Mon, 1 May 2023 15:44:17 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1a66e7a52d3so22700855ad.0 for ; Mon, 01 May 2023 15:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682981056; x=1685573056; 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=7OBlP1yWmSe/KeQ1+ZXJpMbLGfwR1ADwCzc1rSW6r9g=; b=m6LP4j7gqpPpI4ITZMrAd4tOA+Gcigj194u6n0OPftKVXZd+gN3Zl3ztTlrBPO1wft Gp9wAjRuAg0DdNYo82XwvZ7xdGdKRcV0Y2e2c6OJ1ZREwWwSFBd9DE8QtbdyVKZSZp5g Jj9irV2WCslwZNUIrMD1udR09b4sE5CieDaJX54ItbbEy7i426GU/XrJkwax7V6FAL9q q+RvTSIjvLvuIpQhqlNkmpqBBCq+lSRB0LVAYt0sz9zmly3XPSQz9QLBj5yzFRkGetDn IL+eE0e4f5e98xium4nNjFb2JsuDJgzW02y0UlEkdyEP8BmQExcyr4kHBOv5AuQvZT/M FoJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682981056; x=1685573056; 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=7OBlP1yWmSe/KeQ1+ZXJpMbLGfwR1ADwCzc1rSW6r9g=; b=Wh9nhoCjNVVaE7fSdXpuFcooombQ1aYTedUsEaK5DXN9TGCjgeEaKgKXSBytoVx1yw ALhR2GZSLQRuicluY4CPlgBfFGrSJ9zFQlANmTCfX9nVt6WHJkOrnx2Wr+tkjNG4xRTT M/o51OxDQZhBt1odLamuSiCqXg03WOJRgFtUyjkPoGSeSCjuhn8oFYrTWheu5xxkalZM 41SFeXI5kVMBPcmrlHehO2JOXtVCkTze3XUJKMkT4D8b1lQJZOHdzmro5498spDvsY8x XhUdaXWKy/SibtCpYzIeILLvmqhnzTpgdpIK9CPZuENqK8xHIjydIbPACxZ1KSs1Qn48 PK/A== X-Gm-Message-State: AC+VfDyy49DOu/x4GYsrjRU+/i6H5GBXlEMs5NQUK5f5Q1CPjUClhdaw fE/FbvJ3USkX8Fa0VY29lJk3cjD9B58= X-Google-Smtp-Source: ACHHUZ4oysU9Hfyx8pgfkNZ2CN2lKJxWZjC+kmaNFTyEUgDzuIOSuInVKqxcE0/YQ/FpABoZeUa/Yw== X-Received: by 2002:a17:903:246:b0:19f:2328:beee with SMTP id j6-20020a170903024600b0019f2328beeemr17613227plh.11.1682981056583; Mon, 01 May 2023 15:44:16 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001a6756a36f6sm18279806plq.101.2023.05.01.15.44.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 15:44:15 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 3/4] shared/shell: Fix not releasing prompt Date: Mon, 1 May 2023 15:44:09 -0700 Message-Id: <20230501224410.1119023-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230501224410.1119023-1-luiz.dentz@gmail.com> References: <20230501224410.1119023-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 fixes not releasing prompt when queueing a line to be executed since it can be considered as user input if the init script is attempting to enter it as response to prompt input. --- src/shared/shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/shell.c b/src/shared/shell.c index 8b8b253d0bcf..757e16199ddf 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1295,6 +1295,9 @@ static int bt_shell_queue_exec(char *line) /* Queue if already executing */ if (data.line) { + /* Check if prompt is being held then release using the line */ + if (!bt_shell_release_prompt(line)) + return 0; queue_push_tail(data.queue, strdup(line)); return 0; } From patchwork Mon May 1 22:44:10 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: 13228364 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 7F744C77B73 for ; Mon, 1 May 2023 22:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231610AbjEAWoV (ORCPT ); Mon, 1 May 2023 18:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231428AbjEAWoU (ORCPT ); Mon, 1 May 2023 18:44:20 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B091FDD for ; Mon, 1 May 2023 15:44:19 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a6762fd23cso25481045ad.3 for ; Mon, 01 May 2023 15:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682981058; x=1685573058; 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=+OoodNuFC9rdA2+izagBZMWlqnDFcXypL0rVTicRmfg=; b=qA6OX2KRDjBgPMBu+U12yhgE5tY9+LDBfEsIJFyVi8O0NUWrgnKLwm0qlo3ya38pvm 8yjxYxx8di5cOAwor2yUopU2nW5TQKSR9xhZDnj9FtZoeBojGaRAHDfShnHrmjPjIQET 0kNWJzSEgQZSqWfnFoQExRcwcWRlfwM7Ux0CcVnjKqtQfnyOLP1RnDx4Yxg0xQQTZli2 XblpSZ8U+nTzmF7XoTCPw7Yjb1I2kA29nT8Dm7tmaelEkDPYnfsYUO7zvbj5FwWaErqD O3Jfc52fLx++UHsDmJyfuvXScCl09BIVI5pw7we/qmeH+oJw8xf8HYe50E4cOjw8iJ0c W8gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682981058; x=1685573058; 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=+OoodNuFC9rdA2+izagBZMWlqnDFcXypL0rVTicRmfg=; b=EN5apEMEnrZf3NoLRIu1vVtv6hF4nfToHDSOlEnoZHTSaFZWLFM8FiA1ac+Vo+h5Fc xoNHZPD1BCrAJ/lWhDG7QcjJ5eSKziDCa6oODP02zFB5MbKubHN8/APGDBgXr1CMhLDp ic4x2r7reBbRn6LR2z9EoaGsagBijFC3sRUc/MXM701olEwQZWLkmvUN260I6xkFodyJ Y4UdfFaVjqN3TsjLOnyujlE+3xWH0bakfnOMwrtJcUSMm8uRVSzbA9ov33ZiVIKPlPuI XY4rTh0HXF/ZT/daG0F6Zgco3IYmfSY4ZfmzeND+C0anE9dD91NqZ/VuMpNiQAM/KZbC 6Fag== X-Gm-Message-State: AC+VfDz5Bw9CjSevXU3fNbB51cFtwjxdxTH/IoAmaLa4N3tc5NHSzNVN M4MHuIk87z5yJ4vSiwLett31sLZce8g= X-Google-Smtp-Source: ACHHUZ5PDSwZ6KuAL1B49gE5Cswncf4PECO1Wtldw6mUS8pbxXQYLqwKyJOIva95gOn8mwz4IFmzqw== X-Received: by 2002:a17:903:294c:b0:1ab:ab1:f8aa with SMTP id li12-20020a170903294c00b001ab0ab1f8aamr204584plb.17.1682981058215; Mon, 01 May 2023 15:44:18 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001a6756a36f6sm18279806plq.101.2023.05.01.15.44.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 15:44:17 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 4/4] shared/shell: Fix smatch warning Date: Mon, 1 May 2023 15:44:10 -0700 Message-Id: <20230501224410.1119023-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230501224410.1119023-1-luiz.dentz@gmail.com> References: <20230501224410.1119023-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 fixes the following warning: src/shared/shell.c:615:21: warning: non-ANSI function declaration of function 'bt_shell_usage' --- src/shared/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index 757e16199ddf..db79c882ca3a 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -612,7 +612,7 @@ void bt_shell_hexdump(const unsigned char *buf, size_t len) util_hexdump(' ', buf, len, print_string, NULL); } -void bt_shell_usage() +void bt_shell_usage(void) { if (!data.exec) return;