[PATCH kdrive/ephyr v7 5/9] kdrive: add options to set default XKB properties

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 9 07:49:35 UTC 2016


On Tue, Feb 09, 2016 at 05:40:26AM -0200, Laércio de Sousa wrote:
> Em 9 de fev de 2016 02:24, "Peter Hutterer" <peter.hutterer at who-t.net>
> escreveu:
> >
> > On Fri, Dec 11, 2015 at 11:43:10AM -0200, Laércio de Sousa wrote:
> > > This patch introduces convenient command-line options -xkbrules,
> > > -xkbmodel, -xkblayout, -xkbvariant, and -xkboptions, to set default
> > > values for these properties.
> > >
> > > These options can be handful in cases where corresponding values can't
> > > be taken from devices' udev properties, and compile-time default
> > > values don't match user locale.
> > >
> > > Signed-off-by: Laércio de Sousa <
> laerciosousa at sme-mogidascruzes.sp.gov.br>
> > > ---
> > >  hw/kdrive/src/kdrive.c | 40 ++++++++++++++++++++++++++++++++++++++++
> > >  hw/kdrive/src/kinput.c | 16 +++++++++++-----
> > >  2 files changed, 51 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
> > > index 8930ace..1578458 100644
> > > --- a/hw/kdrive/src/kdrive.c
> > > +++ b/hw/kdrive/src/kdrive.c
> > > @@ -85,6 +85,11 @@ char *kdSwitchCmd;
> > >  DDXPointRec kdOrigin;
> > >  Bool kdHasPointer = FALSE;
> > >  Bool kdHasKbd = FALSE;
> > > +const char *kdGlobalXkbRules = NULL;
> > > +const char *kdGlobalXkbModel = NULL;
> > > +const char *kdGlobalXkbLayout = NULL;
> > > +const char *kdGlobalXkbVariant = NULL;
> > > +const char *kdGlobalXkbOptions = NULL;
> > >
> > >  static Bool kdCaughtSignal = FALSE;
> > >
> > > @@ -451,6 +456,11 @@ KdUseMsg(void)
> > >          ("-mouse driver [,n,,options]    Specify the pointer driver
> and its options (n is the number of buttons)\n");
> > >      ErrorF
> > >          ("-keybd driver [,,options]      Specify the keyboard driver
> and its options\n");
> > > +    ErrorF("-xkbrules        Set default XkbRules value (can be
> overriden by -keybd options)\n");
> > > +    ErrorF("-xkbmodel        Set default XkbModel value (can be
> overriden by -keybd options)\n");
> > > +    ErrorF("-xkblayout       Set default XkbLayout value (can be
> overriden by -keybd options)\n");
> > > +    ErrorF("-xkbvariant      Set default XkbVariant value (can be
> overriden by -keybd options)\n");
> > > +    ErrorF("-xkboptions      Set default XkbOptions value (can be
> overriden by -keybd options)\n");
> > >      ErrorF("-zaphod          Disable cursor screen switching\n");
> > >      ErrorF("-2button         Emulate 3 button mouse\n");
> > >      ErrorF("-3button         Disable 3 button mouse emulation\n");
> > > @@ -559,6 +569,36 @@ KdProcessArgument(int argc, char **argv, int i)
> > >          sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) {
> > >          return 1;
> > >      }
> > > +    if (!strcmp(argv[i], "-xkbrules")) {
> > > +        if (i + 1 >= argc)
> > > +            UseMsg();
> >
> > afaict UseMsg() doesn't actually exist, so you're accessing invalid memory
> > here.
> Many other kdrive-related command-line options call UseMsg() as well ---
> which in turn calls KdUseMsg().

urgh, sorry, typo: this should've read "exit", not "exist". All the other ones
work because they don't access the args after the UseMsg() call.

Cheers,
   Peter


More information about the xorg-devel mailing list