From 9c9a47210a6c7146f29fd6d05b6f46955a3bee5a Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 12 Jun 2007 11:59:16 -0400 Subject: [PATCH] Move the mode option handling to the Init stage. (Sorta ugly placement wise, but the other segfaults.) --- src/evdev_axes.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/evdev_axes.c b/src/evdev_axes.c index 60bfde7..e967c61 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -726,18 +726,6 @@ EvdevAxisAbsNew1(InputInfoPtr pInfo) } } - s = xf86SetStrOption(pInfo->options, "Mode", "Absolute"); - if (!strcasecmp(s, "Absolute")) { - pInfo->dev->valuator->mode = Absolute; - xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s); - } else if (!strcasecmp(s, "Relative")) { - pInfo->dev->valuator->mode = Relative; - xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s); - } else { - pInfo->dev->valuator->mode = Absolute; - xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s); - } - return Success; } @@ -861,6 +849,7 @@ EvdevAxesInit (DeviceIntPtr device) evdevAxesRec *axes = state->axes; AbsoluteClassRec *dev_abs; int i; + const char *s; if (!axes || !axes->axes) return Success; @@ -874,6 +863,23 @@ EvdevAxesInit (DeviceIntPtr device) 0)) return !Success; + + /* + * This has to go in Init, because until now there is no valuator struct + * allocated. + */ + s = xf86SetStrOption(pInfo->options, "Mode", "Absolute"); + if (!strcasecmp(s, "Absolute")) { + pInfo->dev->valuator->mode = Absolute; + xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s); + } else if (!strcasecmp(s, "Relative")) { + pInfo->dev->valuator->mode = Relative; + xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s); + } else { + pInfo->dev->valuator->mode = Absolute; + xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s); + } + /* * Yes, we want to do this for relative devices too. * Some of the settings are useful for both.