diff options
Diffstat (limited to 'hw/xfree86')
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 32 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Privstr.h | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 18 |
3 files changed, 51 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 48c178b7d..3c29497e3 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -777,7 +777,9 @@ typedef enum { FLAG_AIGLX, FLAG_IGNORE_ABI, FLAG_ALLOW_EMPTY_INPUT, - FLAG_USE_DEFAULT_FONT_PATH + FLAG_USE_DEFAULT_FONT_PATH, + FLAG_AUTO_ADD_DEVICES, + FLAG_AUTO_ENABLE_DEVICES, } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -855,6 +857,10 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, + {0}, TRUE }, + { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, + {0}, TRUE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -918,6 +924,30 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); } + if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { + xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, + &xf86Info.autoAddDevices); + from = X_CONFIG; + } + else { + xf86Info.autoAddDevices = TRUE; + from = X_DEFAULT; + } + xf86Msg(from, "%sutomatically adding devices\n", + xf86Info.autoAddDevices ? "A" : "Not a"); + + if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) { + xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES, + &xf86Info.autoEnableDevices); + from = X_CONFIG; + } + else { + xf86Info.autoEnableDevices = TRUE; + from = X_DEFAULT; + } + xf86Msg(from, "%sutomatically enabling devices\n", + xf86Info.autoEnableDevices ? "A" : "Not a"); + /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 7ca0669a5..09ebb0717 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -138,6 +138,9 @@ typedef struct { Bool allowEmptyInput; /* Allow the server to start with no input * devices. */ + Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */ + Bool autoEnableDevices; /* Whether to enable, or let the client + * control. */ } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 79422f725..e45d44c02 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -312,6 +312,7 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) InputOption *option = NULL; DeviceIntPtr dev = NULL; int rval = Success; + int is_auto = 0; idev = xcalloc(sizeof(*idev), 1); if (!idev) @@ -341,6 +342,7 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) goto unwind; } } + if (strcasecmp(option->key, "name") == 0 || strcasecmp(option->key, "identifier") == 0) { if (idev->identifier) { @@ -353,6 +355,17 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) goto unwind; } } + + /* Right now, the only automatic config we know of is HAL. */ + if (strcmp(option->key, "_source") == 0 && + strcmp(option->value, "server/hal") == 0) { + if (!xf86Info.autoAddDevices) { + rval = BadMatch; + goto unwind; + } + + is_auto = 1; + } } if (!idev->driver || !idev->identifier) { xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n"); @@ -395,7 +408,10 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) dev = pInfo->dev; ActivateDevice(dev); - if (dev->inited && dev->startup && xf86Screens[0]->vtSema) + /* Enable it if it's properly initialised, we're currently in the VT, and + * either it's a manual request, or we're automatically enabling devices. */ + if (dev->inited && dev->startup && xf86Screens[0]->vtSema && + (!is_auto || xf86Info.autoEnableDevices)) EnableDevice(dev); *pdev = dev; |