[flashrom] [PATCH] Make the laptop warning less scary if unsure

Idwer Vollering vidwer at gmail.com
Thu Aug 25 14:56:56 CEST 2011


2011/8/20 Stefan Tauner <stefan.tauner at student.tuwien.ac.at>:
> Telling the user to use "force_I_want_a_brick" if it is not even a
> laptop, is a bit over-the-top. Introduce a new laptop parameter
> "this_is_not_a_laptop" that allows to force operation, but only if
> the detection is not sure.
>
> ---
>
> complicates the whole thing a bit. could do without the extra
> variable and new part of the if condition, if we allow the
> this_is_not_a_laptop parameter to always work, not only if the
> laptop detection is uncertain. it will be undocumented and only
> visible to the user together with the warning anyway...

I was curious whether the currently present overriding parameter works
in combination with the parameter in this patch, and it does: $ sudo
./flashrom -V -p internal:laptop=force_I_want_a_brick -p
internal:laptop=this_is_not_a_laptop
flashrom v0.9.4-r1418 on FreeBSD 9.0-BETA1 (i386), built with libpci
3.1.7, GCC 4.2.2 20070831 prerelease [FreeBSD], little endian
(etcetera)

Do you think this behaviour is desired?

>
> Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
> ---
>  internal.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/internal.c b/internal.c
> index 846cf1e..5ff605e 100644
> --- a/internal.c
> +++ b/internal.c
> @@ -139,6 +139,7 @@ int internal_init(void)
>        int ret = 0;
>  #endif
>        int force_laptop = 0;
> +       int not_a_laptop = 0;
>        char *arg;
>
>        arg = extract_programmer_param("boardenable");
> @@ -170,9 +171,11 @@ int internal_init(void)
>        free(arg);
>
>        arg = extract_programmer_param("laptop");
> -       if (arg && !strcmp(arg,"force_I_want_a_brick")) {
> +       if (arg && !strcmp(arg,"force_I_want_a_brick"))
>                force_laptop = 1;
> -       } else if (arg && !strlen(arg)) {
> +       else if (arg && !strcmp(arg,"this_is_not_a_laptop"))
> +               not_a_laptop = 1;
> +       else if (arg && !strlen(arg)) {
>                msg_perr("Missing argument for laptop.\n");
>                free(arg);
>                return 1;
> @@ -237,7 +240,7 @@ int internal_init(void)
>                        msg_perr("WARNING! You may be running flashrom on an unsupported laptop. We could\n"
>                                 "not detect this for sure because your vendor has not setup the SMBIOS\n"
>                                 "tables correctly. You can enforce execution by adding\n"
> -                                "'-p internal:laptop=force_I_want_a_brick' to the command line, but\n"
> +                                "'-p internal:laptop=this_is_not_a_laptop' to the command line, but\n"
>                                 "please read the following warning if you are not sure.\n\n");
>                }
>                msg_perr("Laptops, notebooks and netbooks are difficult to support and we\n"
> @@ -251,9 +254,8 @@ int internal_init(void)
>                         "You have been warned.\n"
>                         "========================================================================\n");
>
> -               if (force_laptop) {
> -                       msg_perr("Proceeding anyway because user specified "
> -                                "laptop=force_I_want_a_brick\n");
> +               if (force_laptop || (not_a_laptop && (is_laptop != 1))) {
> +                       msg_perr("Proceeding anyway because user forced us to.\n");
>                } else {
>                        msg_perr("Aborting.\n");
>                        exit(1);
> --
> 1.7.1
>
>
> _______________________________________________
> flashrom mailing list
> flashrom at flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>




More information about the flashrom mailing list