public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] main.conf: Fix parsing of mode options
@ 2022-02-18  2:16 Luiz Augusto von Dentz
  2022-02-18  3:27 ` [BlueZ] " bluez.test.bot
  2022-02-18  6:28 ` [PATCH BlueZ] " Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-18  2:16 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This replace the of g_key_file_get_integer which is limited to only
decimal values to g_key_file_get_string and then use strtol to convert
the string value to integer.

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);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ] main.conf: Fix parsing of mode options
  2022-02-18  2:16 [PATCH BlueZ] main.conf: Fix parsing of mode options Luiz Augusto von Dentz
@ 2022-02-18  3:27 ` bluez.test.bot
  2022-02-18 21:22   ` Luiz Augusto von Dentz
  2022-02-18  6:28 ` [PATCH BlueZ] " Paul Menzel
  1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2022-02-18  3:27 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=615612

---Test result---

Test Summary:
CheckPatch                    PASS      1.55 seconds
GitLint                       PASS      0.99 seconds
Prep - Setup ELL              PASS      52.63 seconds
Build - Prep                  PASS      0.81 seconds
Build - Configure             PASS      10.55 seconds
Build - Make                  PASS      1511.36 seconds
Make Check                    PASS      12.99 seconds
Make Check w/Valgrind         PASS      545.06 seconds
Make Distcheck                PASS      281.59 seconds
Build w/ext ELL - Configure   PASS      10.64 seconds
Build w/ext ELL - Make        PASS      1467.66 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] main.conf: Fix parsing of mode options
  2022-02-18  2:16 [PATCH BlueZ] main.conf: Fix parsing of mode options Luiz Augusto von Dentz
  2022-02-18  3:27 ` [BlueZ] " bluez.test.bot
@ 2022-02-18  6:28 ` Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2022-02-18  6:28 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Dear Luiz,


Am 18.02.22 um 03:16 schrieb Luiz Augusto von Dentz:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BlueZ] main.conf: Fix parsing of mode options
  2022-02-18  3:27 ` [BlueZ] " bluez.test.bot
@ 2022-02-18 21:22   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-18 21:22 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

Hi,

On Thu, Feb 17, 2022 at 7:27 PM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=615612
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      1.55 seconds
> GitLint                       PASS      0.99 seconds
> Prep - Setup ELL              PASS      52.63 seconds
> Build - Prep                  PASS      0.81 seconds
> Build - Configure             PASS      10.55 seconds
> Build - Make                  PASS      1511.36 seconds
> Make Check                    PASS      12.99 seconds
> Make Check w/Valgrind         PASS      545.06 seconds
> Make Distcheck                PASS      281.59 seconds
> Build w/ext ELL - Configure   PASS      10.64 seconds
> Build w/ext ELL - Make        PASS      1467.66 seconds
> Incremental Build with patchesPASS      0.00 seconds
>
>
>
> ---
> Regards,
> Linux Bluetooth
>

Pushed.
-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-18 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18  2:16 [PATCH BlueZ] main.conf: Fix parsing of mode options Luiz Augusto von Dentz
2022-02-18  3:27 ` [BlueZ] " bluez.test.bot
2022-02-18 21:22   ` Luiz Augusto von Dentz
2022-02-18  6:28 ` [PATCH BlueZ] " Paul Menzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox