Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp5527360lfu; Mon, 28 Mar 2022 16:01:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg2aQxflwCPA52BQfh1+1Hc2LV4pMIIpCxEyWo1+VFtM+qVPzZxT2SvTIgk7vTIi1+iIbO X-Received: by 2002:a17:903:22c2:b0:154:565b:b273 with SMTP id y2-20020a17090322c200b00154565bb273mr28285259plg.115.1648508501154; Mon, 28 Mar 2022 16:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648508501; cv=none; d=google.com; s=arc-20160816; b=YwI9kj8yK2f/ViH9+1HGfzSvKaKnu9GJzVPNfYro1Hw2L3Qx9eUt8T2BlI7e19bIJP ygeOJGmrqdMAWmwg/ZBmUMYad+ebY4D8IGTbusgCHDrwJ0EO5x5hYgJZWy5JIE9TfdIg AK5cEAlXX1IFzBThM4iVSHCavBXZwHcNVIMO8KCE2bG2NsNqrOueyW3KsJ2nvXZNp+nc M44YuAZnEqdhb2M4iPF/MEo2oDTwnFStvgJGKEeaHSAVXyFapy5YC6fbqOvGKomp0WPR KcI+Bqjr27Mvr3nkRaiodyefQo0UZriX34Ozl+iQ8xt4CJ/NMSqKshTEJHRzT2eOnG6U EEWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=qUnZZkpAtCGYhG0xquYVq1FLXPsLmtJdyg3Y9Tk5yE8=; b=uWGaS1ekmCiB5n1sSgLXz3ASbFrHlh4f3dxn910d2TXDmb0jL1Png1shrIsCvBRRv8 UW+9Rd3FaLJsgRlvm1ReV01WetABwXsy9wZ340rrPuRvozaRdr8mfI9M9hvvHILExuy7 SobNJu0vr35ubAb3oAVgzVEyMlyA5Yc6o/vnG9Gkqqzjou8fGviwe9KhN6ua2cvqrDhw SJo/lFpVkEWgIflk3H862CHh38OtOqrarBEFIF9My2Kkm5vGK64yf+eQ7K7xhTEfYCkL wqCdaIiud11wupd9KzqDrnJniHKNYMDhosayCvIVHkaxE9P+NWfybt7Chj5fmRx1P2G/ av3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O6rtRJzL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id na16-20020a17090b4c1000b001bd14e030e2si931927pjb.186.2022.03.28.16.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 16:01:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O6rtRJzL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B1E19292BA7; Mon, 28 Mar 2022 15:00:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229480AbiC1V1Z (ORCPT + 99 others); Mon, 28 Mar 2022 17:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbiC1V1Y (ORCPT ); Mon, 28 Mar 2022 17:27:24 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3580366BD for ; Mon, 28 Mar 2022 14:25:33 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id u13so2043681ilv.6 for ; Mon, 28 Mar 2022 14:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=qUnZZkpAtCGYhG0xquYVq1FLXPsLmtJdyg3Y9Tk5yE8=; b=O6rtRJzLicCYIbgWpE6qYGUJ8O9F+YBEwnifJ2/uyKkEX4bBr1GcjN/WkKlcwNvop4 EXXYq5qeqWplVwjO9kA6lbP+gpNyN+/2nnYm7qLdE/3FXsha4IgRM3idEDvrFOUJlkhU Jmip6ZxK4evrwJQQdp2iiaMaSQXeuooRYjN9CBTA8HeK6WTS6YSl0UcsmJ/gLCCZHwXa Io1NlKt0x5VZVc5xTnij2QRyvpB97pXFclfeZdX86I80inZxL7Dg/C9HwcGQaLtdQ9Zr 20+37Ih11CQWErwHhBPaD01YyyNKuNEOVSJ0iiOkdl8x4Gqkwm/2xRUlCg6VNcRIDpgf TIwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=qUnZZkpAtCGYhG0xquYVq1FLXPsLmtJdyg3Y9Tk5yE8=; b=XEyqReTFeW327iFofAMXUi46y62XT0/qtZ6Fcapk5dQDoxT2iUad+jI6cZEpV5c6q2 4aN6tMSPnTzG2hKXgGDWw1PHhBcrj0iK3QRUZNOnao5H21lk+srkfPTYhppV2R235lvd OtRRw2bPvAYBE/vGVwVHl11zV2jjpnxY326/qk4DDGkN7EhFs3S0wniVV2Onlw8bbGwv x5rWiOecDYJhziSXfo1aDYfMQue0Vyu/JgxkfAKGnjH9PhR2hly0H8iWMHVl7X49O0oI 6QZQuh/vR5c7JnpGgn1kYoE/9viVy0rV46Y7Lew2o+VoSb9mLe8e79h0vaksBmOMd65/ 1S9w== X-Gm-Message-State: AOAM532gnGAUb6r4YDoHr47DuENbQs9WxFtchk3hu7icjd3EUQYNoggV ys8NFzWWXnJZgBoSDUUPBliO0DRGU8c= X-Received: by 2002:a92:ca06:0:b0:2c6:250d:bc53 with SMTP id j6-20020a92ca06000000b002c6250dbc53mr7095580ils.253.1648502719777; Mon, 28 Mar 2022 14:25:19 -0700 (PDT) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id n3-20020a056e0208e300b002c9c9974c48sm925030ilt.36.2022.03.28.14.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:25:19 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] shell: Make bt_shell_add_submenu set main menu if none has been set Date: Mon, 28 Mar 2022 14:25:17 -0700 Message-Id: <20220328212518.1890451-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz If not main menu has been set when calling bt_shell_add_submenu then turns it on it main menu. --- src/shared/shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/shell.c b/src/shared/shell.c index 0d82bc282..7ba264b99 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1248,6 +1248,9 @@ bool bt_shell_add_submenu(const struct bt_shell_menu *menu) if (!menu) return false; + if (!data.main) + return bt_shell_set_menu(menu); + if (!data.submenus) data.submenus = queue_new(); -- 2.35.1