diff options
author | marha <marha@users.sourceforge.net> | 2010-01-05 08:57:42 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-01-05 08:57:42 +0000 |
commit | 4b1326f06330c00501dd84100ed3a1987e2fa631 (patch) | |
tree | 6675ebcf771a6fdfeb9a2164f08811407731482e /xorg-server/hw/xfree86/common | |
parent | 7397e255c2e82618ab55ef2c81636c8e688b1225 (diff) | |
parent | 163827567b71b0763a4c1a7104159cd08b5c2d95 (diff) | |
download | vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.tar.gz vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.tar.bz2 vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.zip |
svn merge ^/branches/released
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86AutoConfig.c | 3 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Config.c | 211 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Globals.c | 3 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Init.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Module.h | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Option.c | 25 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Priv.h | 1 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.c | 119 |
8 files changed, 250 insertions, 129 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c index a6199b0e8..1c4595e36 100644 --- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c +++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c @@ -272,7 +272,8 @@ xf86AutoConfig(void) for (cp = builtinConfig; *cp; cp++) xf86ErrorFVerb(3, "\t%s", *cp); xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); - + + xf86initConfigFiles(); xf86setBuiltinConfig(builtinConfig); ret = xf86HandleConfigFile(TRUE); FreeConfig(); diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index 6fbf61346..1abc182da 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -95,6 +95,23 @@ extern DeviceAssocRec mouse_assoc; "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif +#ifndef ROOT_CONFIGDIRPATH +#define ROOT_CONFIGDIRPATH "%A," "%R," \ + "/etc/X11/%R," "%P/etc/X11/%R," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif +#ifndef USER_CONFIGDIRPATH +#define USER_CONFIGDIRPATH "/etc/X11/%S," "%P/etc/X11/%S," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -1444,12 +1461,19 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) } if (xf86Info.allowEmptyInput && !(foundPointer && foundKeyboard)) { -#ifdef CONFIG_HAL - xf86Msg(X_INFO, "The server relies on HAL to provide the list of " +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) + const char *config_backend; +#if defined(CONFIG_HAL) + config_backend = "HAL"; +#else + config_backend = "udev"; +#endif + xf86Msg(X_INFO, "The server relies on %s to provide the list of " "input devices.\n\tIf no devices become available, " - "reconfigure HAL or disable AutoAddDevices.\n"); + "reconfigure %s or disable AutoAddDevices.\n", + config_backend, config_backend); #else - xf86Msg(X_INFO, "HAL is disabled and no input devices were configured.\n" + xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n" "\tTry disabling AllowEmptyInput.\n"); #endif } @@ -1471,6 +1495,45 @@ static OptionInfoRec LayoutOptions[] = { {0}, FALSE }, }; +static Bool +configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp) +{ + XF86ConfInputrefPtr irp; + IDevPtr *indp; + int count = 0; + + /* + * Count the number of input devices. + */ + irp = layout->lay_input_lst; + while (irp) { + count++; + irp = (XF86ConfInputrefPtr)irp->list.next; + } + DebugF("Found %d input devices in the layout section %s\n", + count, layout.lay_identifier); + indp = xnfcalloc((count + 1), sizeof(IDevPtr)); + indp[count] = NULL; + irp = layout->lay_input_lst; + count = 0; + while (irp) { + indp[count] = xnfalloc(sizeof(IDevRec)); + if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { + while(count--) + xfree(indp[count]); + xfree(indp); + return FALSE; + } + indp[count]->extraOptions = irp->iref_option_lst; + count++; + irp = (XF86ConfInputrefPtr)irp->list.next; + } + servlayoutp->inputs = indp; + + return TRUE; +} + + /* * figure out which layout is active, which screens are used in that layout, * which drivers and monitors are used in these screens @@ -1481,14 +1544,12 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, { XF86ConfAdjacencyPtr adjp; XF86ConfInactivePtr idp; - XF86ConfInputrefPtr irp; int count = 0; int scrnum; XF86ConfLayoutPtr l; MessageType from; screenLayoutPtr slp; GDevPtr gdp; - IDevPtr* indp; int i = 0, j; if (!servlayoutp) @@ -1639,45 +1700,6 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, } } -#ifdef LAYOUT_DEBUG - ErrorF("Layout \"%s\"\n", conf_layout->lay_identifier); - for (i = 0; i < count; i++) { - ErrorF("Screen: \"%s\" (%d):\n", slp[i].screen->id, - slp[i].screen->screennum); - switch (slp[i].where) { - case PosObsolete: - ErrorF("\tObsolete format: \"%s\" \"%s\" \"%s\" \"%s\"\n", - slp[i].top, slp[i].bottom, slp[i].left, slp[i].right); - break; - case PosAbsolute: - if (slp[i].x == -1) - if (slp[i].screen->screennum == 0) - ErrorF("\tImplicitly left-most\n"); - else - ErrorF("\tImplicitly right of screen %d\n", - slp[i].screen->screennum - 1); - else - ErrorF("\t%d %d\n", slp[i].x, slp[i].y); - break; - case PosRightOf: - ErrorF("\tRight of \"%s\"\n", slp[i].refscreen->id); - break; - case PosLeftOf: - ErrorF("\tLeft of \"%s\"\n", slp[i].refscreen->id); - break; - case PosAbove: - ErrorF("\tAbove \"%s\"\n", slp[i].refscreen->id); - break; - case PosBelow: - ErrorF("\tBelow \"%s\"\n", slp[i].refscreen->id); - break; - case PosRelative: - ErrorF("\t%d %d relative to \"%s\"\n", slp[i].x, slp[i].y, - slp[i].refscreen->id); - break; - } - } -#endif /* * Count the number of inactive devices. */ @@ -1701,37 +1723,13 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, count++; idp = (XF86ConfInactivePtr)idp->list.next; } - /* - * Count the number of input devices. - */ - count = 0; - irp = conf_layout->lay_input_lst; - while (irp) { - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } - DebugF("Found %d input devices in the layout section %s\n", - count, conf_layout->lay_identifier); - indp = xnfcalloc((count + 1), sizeof(IDevPtr)); - indp[count] = NULL; - irp = conf_layout->lay_input_lst; - count = 0; - while (irp) { - indp[count] = xnfalloc(sizeof(IDevRec)); - if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { - while(count--) - xfree(indp[count]); - xfree(indp); - return FALSE; - } - indp[count]->extraOptions = irp->iref_option_lst; - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } + + if (!configInputDevices(conf_layout, servlayoutp)) + return FALSE; + servlayoutp->id = conf_layout->lay_identifier; servlayoutp->screens = slp; servlayoutp->inactives = gdp; - servlayoutp->inputs = indp; servlayoutp->options = conf_layout->lay_option_lst; from = X_DEFAULT; @@ -1743,12 +1741,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, * the only active screen. */ static Bool -configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) +configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, + XF86ConfigPtr xf86configptr) { MessageType from; XF86ConfScreenPtr s; screenLayoutPtr slp; IDevPtr *indp; + XF86ConfLayoutRec layout; if (!servlayoutp) return FALSE; @@ -1784,10 +1784,19 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) servlayoutp->screens = slp; servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec)); servlayoutp->options = NULL; - /* Set up an empty input device list, then look for some core devices. */ - indp = xnfalloc(sizeof(IDevPtr)); - *indp = NULL; - servlayoutp->inputs = indp; + + memset(&layout, 0, sizeof(layout)); + layout.lay_identifier = servlayoutp->id; + if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) { + if (!configInputDevices(&layout, servlayoutp)) + return FALSE; + from = X_DEFAULT; + } else { + /* Set up an empty input device list, then look for some core devices. */ + indp = xnfalloc(sizeof(IDevPtr)); + *indp = NULL; + servlayoutp->inputs = indp; + } return TRUE; } @@ -2428,34 +2437,53 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) { ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - const char *filename; - char *searchpath; - MessageType from = X_DEFAULT; + const char *filename, *dirname; + char *filesearch, *dirsearch; + MessageType filefrom = X_DEFAULT; + MessageType dirfrom = X_DEFAULT; char *scanptr; Bool singlecard = 0; Bool implicit_layout = FALSE; if (!autoconfig) { - if (getuid() == 0) - searchpath = ROOT_CONFIGPATH; - else - searchpath = USER_CONFIGPATH; + if (getuid() == 0) { + filesearch = ROOT_CONFIGPATH; + dirsearch = ROOT_CONFIGDIRPATH; + } else { + filesearch = USER_CONFIGPATH; + dirsearch = USER_CONFIGDIRPATH; + } if (xf86ConfigFile) - from = X_CMDLINE; + filefrom = X_CMDLINE; + if (xf86ConfigDir) + dirfrom = X_CMDLINE; - filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); + xf86initConfigFiles(); + filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT); + dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT); if (filename) { - xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); + xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename); xf86ConfigFile = xnfstrdup(filename); } else { if (xf86ConfigFile) xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n", xf86ConfigFile); - return CONFIG_NOFILE; } + if (dirname) { + xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n", + dirname); + xf86ConfigDir = xnfstrdup(dirname); + } else { + if (xf86ConfigDir) + xf86Msg(X_ERROR, + "Unable to locate/open config directory: \"%s\"\n", + xf86ConfigDir); + } + if (!filename && !dirname) + return CONFIG_NOFILE; } - + if ((xf86configptr = xf86readConfigFile ()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); return CONFIG_PARSE_ERROR; @@ -2481,7 +2509,8 @@ xf86HandleConfigFile(Bool autoconfig) "No Layout section. Using the first Screen section.\n"); } if (!configImpliedLayout(&xf86ConfigLayout, - xf86configptr->conf_screen_lst)) { + xf86configptr->conf_screen_lst, + xf86configptr)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c index 98f828483..8b483f35c 100644 --- a/xorg-server/hw/xfree86/common/xf86Globals.c +++ b/xorg-server/hw/xfree86/common/xf86Globals.c @@ -132,7 +132,7 @@ xf86InfoRec xf86Info = { .kbdCustomKeycodes = FALSE, .disableRandR = FALSE, .randRFrom = X_DEFAULT, -#ifdef CONFIG_HAL +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) .allowEmptyInput = TRUE, .autoAddDevices = TRUE, .autoEnableDevices = TRUE @@ -143,6 +143,7 @@ xf86InfoRec xf86Info = { #endif }; const char *xf86ConfigFile = NULL; +const char *xf86ConfigDir = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; MessageType xf86ModPathFrom = X_DEFAULT; const char *xf86LogFile = DEFAULT_LOGPREFIX; diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 3b25c89a6..670744802 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -1387,6 +1387,19 @@ ddxProcessArgument(int argc, char **argv, int i) xf86ConfigFile = argv[i + 1]; return 2; } + if (!strcmp(argv[i], "-configdir")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { + FatalError("\nInvalid argument for %s\n" + "\tFor non-root users, the file specified with %s must be\n" + "\ta relative path and must not contain any \"..\" elements.\n" + "\tUsing default "__XCONFIGDIR__" search path.\n\n", + argv[i], argv[i]); + } + xf86ConfigDir = argv[i + 1]; + return 2; + } if (!strcmp(argv[i],"-flipPixels")) { xf86FlipPixels = TRUE; @@ -1670,6 +1683,8 @@ ddxUseMsg(void) } ErrorF("-config file specify a configuration file, relative to the\n"); ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); + ErrorF("-configdir dir specify a configuration directory, relative to the\n"); + ErrorF(" "__XCONFIGDIR__" search path, only root can use absolute\n"); ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-logverbose [n] verbose log messages\n"); ErrorF("-quiet minimal startup messages\n"); diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h index 8e5d5cfb5..bbf5786c9 100644 --- a/xorg-server/hw/xfree86/common/xf86Module.h +++ b/xorg-server/hw/xfree86/common/xf86Module.h @@ -83,7 +83,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(7, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(8, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(9, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(3, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c index ad8d1c426..a2868bf21 100644 --- a/xorg-server/hw/xfree86/common/xf86Option.c +++ b/xorg-server/hw/xfree86/common/xf86Option.c @@ -42,6 +42,7 @@ #include "xf86.h" #include "xf86Xinput.h" #include "xf86Optrec.h" +#include "xf86Parser.h" static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, Bool markUsed); @@ -456,29 +457,7 @@ xf86ShowUnusedOptions(int scrnIndex, pointer options) static Bool GetBoolValue(OptionInfoPtr p, const char *s) { - if (*s == '\0') { - p->value.bool = TRUE; - } else { - if (xf86NameCmp(s, "1") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "on") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "true") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "yes") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "0") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "off") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "false") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "no") == 0) - p->value.bool = FALSE; - else - return FALSE; - } - return TRUE; + return xf86getBoolValue(&p->value.bool, s); } static Bool diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h index 3bb15718c..0612c9c4e 100644 --- a/xorg-server/hw/xfree86/common/xf86Priv.h +++ b/xorg-server/hw/xfree86/common/xf86Priv.h @@ -46,6 +46,7 @@ * The global state of these things is held in xf86InfoRec (when appropriate). */ extern _X_EXPORT const char *xf86ConfigFile; +extern _X_EXPORT const char *xf86ConfigDir; extern _X_EXPORT Bool xf86AllowMouseOpenFail; #ifdef XF86VIDMODE extern _X_EXPORT Bool xf86VidModeDisabled; diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index f637cfe19..57db056d8 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -57,9 +57,11 @@ #include <X11/Xatom.h> #include "xf86.h" #include "xf86Priv.h" +#include "xf86Config.h" #include "xf86Xinput.h" #include "XIstubs.h" #include "xf86Optrec.h" +#include "xf86Parser.h" #include "mipointer.h" #include "xf86InPriv.h" #include "compiler.h" @@ -74,6 +76,11 @@ #include "exglobals.h" #include "eventstr.h" +#include <string.h> /* InputClassMatches */ +#ifdef HAVE_FNMATCH_H +#include <fnmatch.h> +#endif + #include "extnsionst.h" #include "windowstr.h" /* screenIsSaved */ @@ -466,6 +473,85 @@ AddOtherInputDevices(void) { } +/* + * Classes without any Match statements match all devices. Otherwise, all + * statements must match. + */ +static Bool +InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs) +{ + if (iclass->match_product && + (!attrs->product || !strstr(attrs->product, iclass->match_product))) + return False; + if (iclass->match_vendor && + (!attrs->vendor || !strstr(attrs->vendor, iclass->match_vendor))) + return False; + if (iclass->match_device && +#ifdef HAVE_FNMATCH_H + (!attrs->device || + fnmatch(iclass->match_device, attrs->device, 0) != 0)) +#else + (!attrs->device || !strstr(attrs->device, iclass->match_device))) +#endif + return False; + if (iclass->is_keyboard.set && + iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD)) + return False; + if (iclass->is_pointer.set && + iclass->is_pointer.val != !!(attrs->flags & ATTR_POINTER)) + return False; + if (iclass->is_joystick.set && + iclass->is_joystick.val != !!(attrs->flags & ATTR_JOYSTICK)) + return False; + if (iclass->is_tablet.set && + iclass->is_tablet.val != !!(attrs->flags & ATTR_TABLET)) + return False; + if (iclass->is_touchpad.set && + iclass->is_touchpad.val != !!(attrs->flags & ATTR_TOUCHPAD)) + return False; + if (iclass->is_touchscreen.set && + iclass->is_touchscreen.val != !!(attrs->flags & ATTR_TOUCHSCREEN)) + return False; + return True; +} + +/* + * Merge in any InputClass configurations. Each InputClass section can + * add to the original device configuration as well as any previous + * InputClass sections. + */ +static int +MergeInputClasses(IDevPtr idev, InputAttributes *attrs) +{ + XF86ConfInputClassPtr cl; + XF86OptionPtr classopts; + + for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) { + if (!InputClassMatches(cl, attrs)) + continue; + + xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n", + idev->identifier, cl->identifier); + if (cl->driver && !idev->driver) { + idev->driver = xstrdup(cl->driver); + if (!idev->driver) { + xf86Msg(X_ERROR, "Could not allocate memory while merging " + "InputClass configuration"); + return BadAlloc; + } + } + + classopts = xf86optionListDup(cl->option_lst); + if (idev->commonOptions) + idev->commonOptions = xf86optionListMerge(classopts, + idev->commonOptions); + else + idev->commonOptions = classopts; + } + + return Success; +} + /** * Create a new input device, activate and enable it. * @@ -568,7 +654,8 @@ unwind: } int -NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest (InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { IDevRec *idev = NULL; InputOption *option = NULL; @@ -605,9 +692,9 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) } } - /* Right now, the only automatic config we know of is HAL. */ if (strcmp(option->key, "_source") == 0 && - strcmp(option->value, "server/hal") == 0) { + (strcmp(option->value, "server/hal") == 0 || + strcmp(option->value, "server/udev") == 0)) { is_auto = 1; if (!xf86Info.autoAddDevices) { rval = BadMatch; @@ -615,6 +702,23 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) } } } + + for (option = options; option; option = option->next) { + /* Steal option key/value strings from the provided list. + * We need those strings, the InputOption list doesn't. */ + idev->commonOptions = xf86addNewOption(idev->commonOptions, + option->key, option->value); + option->key = NULL; + option->value = NULL; + } + + /* Apply InputClass settings */ + if (attrs) { + rval = MergeInputClasses(idev, attrs); + if (rval != Success) + goto unwind; + } + if (!idev->driver || !idev->identifier) { xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n"); rval = BadRequest; @@ -626,15 +730,6 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) return BadMatch; } - for (option = options; option; option = option->next) { - /* Steal option key/value strings from the provided list. - * We need those strings, the InputOption list doesn't. */ - idev->commonOptions = xf86addNewOption(idev->commonOptions, - option->key, option->value); - option->key = NULL; - option->value = NULL; - } - rval = xf86NewInputDevice(idev, pdev, (!is_auto || (is_auto && xf86Info.autoEnableDevices))); if (rval == Success) |