Re: [PATCH BlueZ v3 1/5] player: Add reconfiguration prompt for broadcast source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am sorry if what I say is wrong... but for me, the label done is unnecessary.

+static void endpoint_is_reconfigure_cfg(const char *input, void *user_data)
+{
+       struct endpoint_config *cfg = user_data;
+       int value;
+       char *endptr = NULL;
+
+       if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) {
+               cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
/// this command "goto done" is unnecessary, because if the if()
statement is executed
///the else is not execute, and the chunk of code, that the label done
coverage, go to execute
+               goto done;
+       } else {
+               value = strtol(input, &endptr, 0);
+
+               if (!endptr || *endptr != '\0' || value > UINT8_MAX) {
+                       bt_shell_printf("Invalid argument: %s\n", input);
+                       return bt_shell_noninteractive_quit(EXIT_FAILURE);
+               }
+
+               if (value == 0x0)
+                       cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
+               else
+                       cfg->ep->iso_stream = value;
+       }
+
/// this label done, is unnecessary, because if the if() executes, the
else does not execute.
/// then, the chunk that the label done is include, already execute
without "goto done;"
+done:
+       bt_shell_prompt_input(cfg->ep->path,
+               "BIG (auto/value):",
+               config_endpoint_iso_group, cfg);
+}


this chunk of code, can rrepalced for this:
+static void endpoint_is_reconfigure_cfg(const char *input, void *user_data)
+{
+       struct endpoint_config *cfg = user_data;
+       int value;
+       char *endptr = NULL;
+
+       if (!strcasecmp(input, "n") || !strcasecmp(input, "no"))
+               cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
+       else {
+               value = strtol(input, &endptr, 0);
+
+               if (!endptr || *endptr != '\0' || value > UINT8_MAX) {
+                       bt_shell_printf("Invalid argument: %s\n", input);
+                       return bt_shell_noninteractive_quit(EXIT_FAILURE);
+               }
+
+               if (value == 0x0)
+                       cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
+               else
+                       cfg->ep->iso_stream = value;
+       }
+
+       bt_shell_prompt_input(cfg->ep->path,
+               "BIG (auto/value):",
+               config_endpoint_iso_group, cfg);
+}
+


Em sex., 15 de mar. de 2024 às 12:02, Silviu Florian Barbulescu
<silviu.barbulescu@xxxxxxx> escreveu:
>
> endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 48_4_1
> [/local/endpoint/ep0] BIS Index for reconfiguration? (value(1-31)/no): n
> [/local/endpoint/ep0] BIG (auto/value): 0
> [/local/endpoint/ep0] Enter channel location (value/no): 1
> [/local/endpoint/ep0] Enter Metadata (value/no): n
> ---
>  client/player.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/client/player.c b/client/player.c
> index 8081ddc13..c754af33d 100644
> --- a/client/player.c
> +++ b/client/player.c
> @@ -3659,6 +3659,35 @@ static void config_endpoint_iso_group(const char *input, void *user_data)
>         }
>  }
>
> +static void endpoint_is_reconfigure_cfg(const char *input, void *user_data)
> +{
> +       struct endpoint_config *cfg = user_data;
> +       int value;
> +       char *endptr = NULL;
> +
> +       if (!strcasecmp(input, "n") || !strcasecmp(input, "no")) {
> +               cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
> +               goto done;
> +       } else {
> +               value = strtol(input, &endptr, 0);
> +
> +               if (!endptr || *endptr != '\0' || value > UINT8_MAX) {
> +                       bt_shell_printf("Invalid argument: %s\n", input);
> +                       return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +               }
> +
> +               if (value == 0x0)
> +                       cfg->ep->iso_stream = BT_ISO_QOS_STREAM_UNSET;
> +               else
> +                       cfg->ep->iso_stream = value;
> +       }
> +
> +done:
> +       bt_shell_prompt_input(cfg->ep->path,
> +               "BIG (auto/value):",
> +               config_endpoint_iso_group, cfg);
> +}
> +
>  static void endpoint_set_config_bcast(struct endpoint_config *cfg)
>  {
>         cfg->ep->bcode = g_new0(struct iovec, 1);
> @@ -3674,8 +3703,8 @@ static void endpoint_set_config_bcast(struct endpoint_config *cfg)
>         }
>
>         bt_shell_prompt_input(cfg->ep->path,
> -               "BIG (auto/value):",
> -               config_endpoint_iso_group, cfg);
> +               "BIS Index for reconfiguration? (value(1-31)/no):",
> +               endpoint_is_reconfigure_cfg, cfg);
>  }
>
>  static void cmd_config_endpoint(int argc, char *argv[])
> --
> 2.39.2
>
>





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux