[PATCH setxkbmap; 2nd try] Few messages added for easier troubleshooting.

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 27 16:53:20 PST 2011


On Mon, Feb 28, 2011 at 03:35:25AM +0300, Van de Bugger wrote:
> If setxkbmap fails to load rules file, it is not possible to find
> out where setxkbmap looks for it. Increasing verbosity level does
> not help:
> 
>     $ ./setxkbmap -v 10
>     Setting verbose level to 10
>     locale is C
>     Couldn't find rules file (evdev)
> 
> The problem fixed by adding two messages: before loading file and
> after successful loading. Messages are displayed if verbosity level
> is 8 or higher:
> 
>     $ ./setxkbmap -v 10
>     Setting verbose level to 10
>     locale is C
>     Trying to load rules file ./rules/evdev...
>     Trying to load rules file /usr/local/share/X11/xkb/rules/evdev...
>     Couldn't find rules file (evdev)
> 
> Signed-off-by: Van de Bugger <van.de.bugger at gmail.com>
> ---
> 
> Changes after review:
> 
>     1. Extra semicolon removed.
> 

applied, thanks.

Cheers,
  Peter

>  setxkbmap.c |   18 ++++++++++++++++--
>  1 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/setxkbmap.c b/setxkbmap.c
> index 04c3fdf..88adea7 100644
> --- a/setxkbmap.c
> +++ b/setxkbmap.c
> @@ -186,6 +186,7 @@ FILE *findFileInPath(char *name);
>  Bool addStringToOptions(char *opt_str, list_t *opts);
>  char *stringFromOptions(char *orig, list_t *newOpts);
>  Bool applyConfig(char *name);
> +XkbRF_RulesPtr tryLoadRules(char *name, char *locale, Bool wantDesc, Bool wantRules);
>  Bool applyRules(void);
>  Bool applyComponentNames(void);
>  void printKeymap(void);
> @@ -804,6 +805,19 @@ applyConfig(char *name)
>      return True;
>  }
>  
> +XkbRF_RulesPtr
> +tryLoadRules(char *name, char *locale, Bool wantDesc, Bool wantRules)
> +{
> +    XkbRF_RulesPtr rules = NULL;
> +    VMSG1(7, "Trying to load rules file %s...\n", name);
> +    rules = XkbRF_Load(name, locale, wantDesc, wantRules);
> +    if (rules)
> +    {
> +        VMSG(7, "Success.\n");
> +    }
> +    return rules;
> +}
> +
>  /**
>   * If any of model, layout, variant or options is specified, then compile the
>   * options into the
> @@ -839,7 +853,7 @@ applyRules(void)
>  
>          if (rfName[0] == '/')
>          {
> -            rules = XkbRF_Load(rfName, settings.locale.value, True, True);
> +            rules = tryLoadRules(rfName, settings.locale.value, True, True);
>          }
>          else
>          {
> @@ -854,7 +868,7 @@ applyRules(void)
>                            inclPath.item[i], rfName);
>                      continue;
>                  }
> -                rules = XkbRF_Load(buf, settings.locale.value, True, True);
> +                rules = tryLoadRules(buf, settings.locale.value, True, True);
>              }
>          }
>          if (!rules)
> -- 
> 1.7.4
> 
> 


More information about the xorg-devel mailing list