XFree86: Allow disabling of HAL
If NoAutoAddDevices is given as a server flag, then no devices will be added from HAL events at all. If NoAutoEnableDevices is given, then the devices will be added (and the DevicePresenceNotify sent), but not enabled, thus leaving policy up to the client.
This commit is contained in:
parent
cd8e99e56e
commit
0e0174d45e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user