xserver: Branch 'master' - 4 commits
Daniel Stone
daniels at kemper.freedesktop.org
Tue Jul 31 17:33:02 PDT 2007
Xi/opendev.c | 4 ----
config/dbus-core.c | 6 +++++-
hw/xfree86/common/xf86Config.c | 32 +++++++++++++++++++++++++++++++-
hw/xfree86/common/xf86Privstr.h | 3 +++
hw/xfree86/common/xf86Xinput.c | 33 +++++++++++++++++++--------------
5 files changed, 58 insertions(+), 20 deletions(-)
New commits:
diff-tree 0e0174d45ecbeb7b6dddc4af53da9d6211038e0e (from cd8e99e56ec5d02026e401cc15e0f8d75f2a4727)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Aug 1 03:30:07 2007 +0300
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.
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 48c178b..3c29497 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 flags
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 7ca0669..09ebb07 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 79422f7..e45d44c 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -312,6 +312,7 @@ NewInputDeviceRequest (InputOption *opti
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 *opti
goto unwind;
}
}
+
if (strcasecmp(option->key, "name") == 0 ||
strcasecmp(option->key, "identifier") == 0) {
if (idev->identifier) {
@@ -353,6 +355,17 @@ NewInputDeviceRequest (InputOption *opti
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 *opti
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;
diff-tree cd8e99e56ec5d02026e401cc15e0f8d75f2a4727 (from 0a31db14b7c7c21ef550dbcc73a9f649f3613cbe)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Aug 1 03:29:12 2007 +0300
Input: Don't enable devices when we open them
Thanks to Xi's braindead design, it's otherwise impossible to query input
devices without enabling them. Hurrah.
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 4b7b6a6..0b0671d 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -98,7 +98,6 @@ int
ProcXOpenDevice(ClientPtr client)
{
xInputClassInfo evbase[numInputClasses];
- Bool enableit = FALSE;
int j = 0;
int status = Success;
xOpenDeviceReply rep;
@@ -121,7 +120,6 @@ ProcXOpenDevice(ClientPtr client)
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
return Success;
}
- enableit = TRUE;
}
OpenInputDevice(dev, client, &status);
@@ -129,8 +127,6 @@ ProcXOpenDevice(ClientPtr client)
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
return Success;
}
- if (enableit && dev->inited && dev->startup)
- (void)EnableDevice(dev);
rep.repType = X_Reply;
rep.RepType = X_OpenDevice;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index dca4e32..79422f7 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -204,17 +204,6 @@ OpenInputDevice(DeviceIntPtr dev,
if (!dev->inited)
ActivateDevice(dev);
- if (!dev->public.on) {
- if (EnableDevice(dev)) {
- dev->startup = FALSE;
- }
- else {
- ErrorF("couldn't enable device %s\n", dev->name);
- *status = BadDevice;
- return;
- }
- }
-
*status = Success;
}
diff-tree 0a31db14b7c7c21ef550dbcc73a9f649f3613cbe (from 89f628394f7d831f2ba1e45c5884c3983bef6031)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Aug 1 02:54:14 2007 +0300
Config: D-Bus core: Fix hook removal
Make sure we properly initialise the entire hook when adding it, and
bust out when we're done removing.
diff --git a/config/dbus-core.c b/config/dbus-core.c
index 008e21a..2888159 100644
--- a/config/dbus-core.c
+++ b/config/dbus-core.c
@@ -200,6 +200,8 @@ config_dbus_core_add_hook(struct config_
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next)
;
+
+ hook->next = NULL;
*prev = hook;
/* If we're already connected, call the connect hook. */
@@ -215,8 +217,10 @@ config_dbus_core_remove_hook(struct conf
struct config_dbus_core_hook **prev;
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
- if (*prev == hook)
+ if (*prev == hook) {
*prev = hook->next;
+ break;
+ }
}
}
diff-tree 89f628394f7d831f2ba1e45c5884c3983bef6031 (from aec0d06469a2fa7440fdd5ee03dc256a68704e77)
Author: Daniel Stone <daniel at fooishbar.org>
Date: Wed Aug 1 02:08:02 2007 +0300
XFree86: Input: Fix whitespace
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index f8feeef..dca4e32 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -338,7 +338,7 @@ NewInputDeviceRequest (InputOption *opti
* test if the module is already loaded first */
drv = xf86LookupInputDriver(option->value);
if (!drv)
- if(xf86LoadOneModule(option->value, NULL))
+ if (xf86LoadOneModule(option->value, NULL))
drv = xf86LookupInputDriver(option->value);
if (!drv) {
xf86Msg(X_ERROR, "No input driver matching `%s'\n",
@@ -365,7 +365,7 @@ NewInputDeviceRequest (InputOption *opti
}
}
}
- if(!idev->driver || !idev->identifier) {
+ if (!idev->driver || !idev->identifier) {
xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n");
rval = BadRequest;
goto unwind;
More information about the xorg-commit
mailing list