Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2100013pxb; Fri, 25 Mar 2022 11:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJFH0OxXoOqVdqKiSNQ7W81y8Ll+4pbw4WJnDBUh50tfBoiYRnDDKEmh80BHkNMtmmy+2n X-Received: by 2002:a05:6a00:1824:b0:4fa:8730:c986 with SMTP id y36-20020a056a00182400b004fa8730c986mr11330845pfa.43.1648231496934; Fri, 25 Mar 2022 11:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648231496; cv=none; d=google.com; s=arc-20160816; b=MjPl98pc06iWOSwjh+YEubKF1Aj4U3rz9dNVlGwdIHwRs1RQwKfwCzKFZwAroEr8w2 5pj0b1LAl34l5uSrU5gzw3DaecXQDeSCLXeLZuJq7VYnA6qLtPb9QT+ALtJ60liQxOws QBrMw/FUlKs2+b6pn8VBRgN/koD3tDPdyC5rKww7vYN2IdpXihUAqvuMBCj0LR4bZXn/ dq/49ALqz55Hy9v4uEthjckInBZM0GllBlr037/dfLTiOabmFRouWjHVf6quk+DFgAyv f+O1x3U1xKINUQV4rOHGxvomV2VNObBtwN4zy5KFfYxDQntINjuDo88Knn40Nz6Vt7I1 KsBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=Bv4c/nnU8F2GItDn/JrJrPn/euH6Yk3HTw7sDxClIsw=; b=G4jK6k2G11Y2bjXTRV0pw6x+5OgDSmkWfaVxYQE8jUM/JezG6gZDeaLzkKLEoC0g15 q7NzrxHrWItXbCweS8TcLwhnFJKUbfR44w12gX9ThZyeTJb3UsaeU68ohcN/dJ1ILApS yO1VZ2zMh4g8zjRLy1WYYIs7aBJqTvZBrTpuUcmLAbgZkApya57AioH0xrgtWQSnlVia EBCeSROKx+qHlODam29ytYfk0pC/2/FzSU8xlfh2g8W8U+8NlVD0S6okB34PWj5nYZMw cSjeYO5g7OxzzCpXX2LNNEqS9IFdGm8sNo+JCRDlCN7fsmz4D0KT1NnYh81HR3GpIhct zAoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o12-20020a056a00214c00b004fa3a8dffd0si3288247pfk.135.2022.03.25.11.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:04:56 -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; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C7A512D092; Fri, 25 Mar 2022 10:39:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351434AbiCYPFx convert rfc822-to-8bit (ORCPT + 99 others); Fri, 25 Mar 2022 11:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237981AbiCYPFx (ORCPT ); Fri, 25 Mar 2022 11:05:53 -0400 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E1FC690CFA for ; Fri, 25 Mar 2022 08:04:18 -0700 (PDT) Received: from smtpclient.apple (p4ff9fa3c.dip0.t-ipconnect.de [79.249.250.60]) by mail.holtmann.org (Postfix) with ESMTPSA id 88542CECE4; Fri, 25 Mar 2022 16:04:17 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [PATCH BlueZ v4 4/9] adapter: Don't use DBG in mgmt_debug From: Marcel Holtmann In-Reply-To: <20220323224003.3736525-5-luiz.dentz@gmail.com> Date: Fri, 25 Mar 2022 16:04:17 +0100 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <20220323224003.3736525-1-luiz.dentz@gmail.com> <20220323224003.3736525-5-luiz.dentz@gmail.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Hi Luiz, > mgmt_debug callback is used to print debug strings from mgmt instances > which includes the file and function names so using DBG would add yet > another set of file and function prefixes which makes the logs > confusing. > --- > src/adapter.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/src/adapter.c b/src/adapter.c > index 97ce26f8e..9f003346d 100644 > --- a/src/adapter.c > +++ b/src/adapter.c > @@ -10327,9 +10327,7 @@ static void read_version_complete(uint8_t status, uint16_t length, > > static void mgmt_debug(const char *str, void *user_data) > { > - const char *prefix = user_data; > - > - info("%s%s", prefix, str); > + DBG_IDX(0xffff, "%s", str); > } > > int adapter_init(void) > @@ -10342,8 +10340,7 @@ int adapter_init(void) > return -EIO; > } > > - if (getenv("MGMT_DEBUG")) > - mgmt_set_debug(mgmt_primary, mgmt_debug, "mgmt: ", NULL); > + mgmt_set_debug(mgmt_primary, mgmt_debug, NULL, NULL); > > DBG("sending read version command"); oh what now. If you touch this, then please do it in a way that you print it properly to the btmon traces as well with the correct index. Look, the MGMT_DEBUG thing is meant for debugging aid. That is why it enabled tracing. If you want to print errors or warning that otherwise are hidden, just print them. And make sure they end up in btmon as well. This is all hacking around the real solution. It is a bandaid for a bandaid. Regards Marcel