aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/config/udev.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-01 09:05:15 +0200
committermarha <marha@users.sourceforge.net>2011-08-01 09:05:15 +0200
commitf87ad0cdc41af88f134475ab50b0d604004d9cdc (patch)
tree72e8cd139cf22d66d77c6a52f72b3d5c11c330f3 /xorg-server/config/udev.c
parent28257038c4f13ac26127d536c14c922aa036efed (diff)
downloadvcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.tar.gz
vcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.tar.bz2
vcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.zip
mesa xserver pixman xkeyboard-config git update 1 aug 2011
Diffstat (limited to 'xorg-server/config/udev.c')
-rw-r--r--xorg-server/config/udev.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index 9ac34ee50..e7383dc36 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -251,14 +251,12 @@ wakeup_handler(pointer data, int err, pointer read_mask)
return;
action = udev_device_get_action(udev_device);
if (action) {
- if (!strcmp(action, "add"))
- device_added(udev_device);
- else if (!strcmp(action, "remove"))
- device_removed(udev_device);
- else if (!strcmp(action, "change")) {
+ if (!strcmp(action, "add") || !strcmp(action, "change")) {
device_removed(udev_device);
device_added(udev_device);
}
+ else if (!strcmp(action, "remove"))
+ device_removed(udev_device);
}
udev_device_unref(udev_device);
}
@@ -283,6 +281,9 @@ config_udev_init(void)
if (!udev_monitor)
return 0;
+ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
+
if (udev_monitor_enable_receiving(udev_monitor)) {
ErrorF("config/udev: failed to bind the udev monitor\n");
return 0;
@@ -291,11 +292,20 @@ config_udev_init(void)
enumerate = udev_enumerate_new(udev);
if (!enumerate)
return 0;
+
+ udev_enumerate_add_match_subsystem(enumerate, "input");
+ udev_enumerate_add_match_subsystem(enumerate, "tty");
+
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(device, devices) {
const char *syspath = udev_list_entry_get_name(device);
struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
+
+ /* Device might be gone by the time we try to open it */
+ if (!udev_device)
+ continue;
+
device_added(udev_device);
udev_device_unref(udev_device);
}