Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1050486pxb; Thu, 17 Feb 2022 22:42:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9lW2eryquPAl3HoqvMYzWs3CWFL0Xhh6up+M9fbTkNk8raEaMgkjz9Zx9DYSDw1XSEx21 X-Received: by 2002:aa7:91ca:0:b0:4e1:fe3:5da6 with SMTP id z10-20020aa791ca000000b004e10fe35da6mr6503500pfa.85.1645166575401; Thu, 17 Feb 2022 22:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645166575; cv=none; d=google.com; s=arc-20160816; b=rAAokhazMsjc3ZycS7s71NW4XoJ7WgnAL/M8vitwAa8YHR2OrEN7zo5UP1s5H36p1q R0DJcx9ZVna5Gz7scEOb4XimJq1EK0bxWZpHDJO6kJxQOyCwY1ElV5/aQcesSxt9bq2Z BmDr0g39bA9Jw0Fyr4pW04v9VcE9x2xCyz3QwHyHKXqSFlZXfYqXFe5Ma6LtYay/6rJX xS9VB/sVvJDxadc0x5gAWgyLomxzKycIExtrgSzPIunDgxWiDLgq20Aj7kuNLX7ceK0/ dCnMe/PJDIR8pVeCznudMkRKHqGFws/xgzfwkrH+xdOnE+CAV4QhRAbbrsBSBTo1UgQU bwSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=fupfdMI+9t/5gCLniUSsO/QvwxO+V6rgnaHhk7OLVlM=; b=1D1t0nPlZcNOd/t3a04mDs59IO/Q7FBVubopAPN00mMWgo6clcq45zED2izXBlwGuB KzkqwlW628nDN828DdEcssVhMJFm39WdQiAx4qs2OvU4RMMrCjNKfqOaIDaHTH4JlLbZ zWGEx/5b4QwvuQr6zU583bx8yLUW9urFaGgV4iJMNVf2eR9DPNGX0Od2s+cmJRNxs0lM X+5i7SB438O4rVUl25c7T26DTbFfYWH4qo5dLSI+pxOftFnuCs5Tx9QRMZcgtTrAxmfB 5BaFYGXZkrXNSp66c6FynCjWB83tXpQ2gYDV5yXZVNYGJhSO4/Yklw3atW4BxvEY21qT vESw== 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:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16si23846319plx.445.2022.02.17.22.42.23; Thu, 17 Feb 2022 22:42:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiBRG3F (ORCPT + 99 others); Fri, 18 Feb 2022 01:29:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbiBRG3E (ORCPT ); Fri, 18 Feb 2022 01:29:04 -0500 Received: from mx1.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E88B1B7186 for ; Thu, 17 Feb 2022 22:28:46 -0800 (PST) Received: from [192.168.0.2] (ip5f5aebcf.dynamic.kabel-deutschland.de [95.90.235.207]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id D1E5E61E6478B; Fri, 18 Feb 2022 07:28:43 +0100 (CET) Message-ID: Date: Fri, 18 Feb 2022 07:28:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH BlueZ] main.conf: Fix parsing of mode options Content-Language: en-US To: Luiz Augusto von Dentz References: <20220218021605.3126182-1-luiz.dentz@gmail.com> Cc: linux-bluetooth@vger.kernel.org From: Paul Menzel In-Reply-To: <20220218021605.3126182-1-luiz.dentz@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Dear Luiz, Am 18.02.22 um 03:16 schrieb Luiz Augusto von Dentz: > From: Luiz Augusto von Dentz > > This replace the of g_key_file_get_integer which is limited to only Do you mean “This replaces the use of”? Maybe just: Replace g_key_file_get_integer, limited to only decimal values, with … > decimal values to g_key_file_get_string and then use strtol to convert > the string value to integer. Maybe give an example config file line with a hex assignment: X=0x… > Fixes: https://github.com/bluez/bluez/issues/293 > --- > src/main.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/src/main.c b/src/main.c > index bf9d398e4..a448320c1 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -354,13 +354,22 @@ static void parse_mode_config(GKeyFile *config, const char *group, > > for (i = 0; i < params_len; ++i) { > GError *err = NULL; > - int val = g_key_file_get_integer(config, group, > - params[i].val_name, &err); > + char *str; > + > + str = g_key_file_get_string(config, group, params[i].val_name, > + &err); > if (err) { > DBG("%s", err->message); > g_clear_error(&err); > } else { > - info("%s=%d", params[i].val_name, val); > + char *endptr = NULL; > + int val; > + > + val = strtol(str, &endptr, 0); > + if (!endptr || *endptr != '\0') > + continue; > + > + info("%s=%s(%d)", params[i].val_name, str, val); > > val = MAX(val, params[i].min); > val = MIN(val, params[i].max); Kind regards, Paul