summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2010-06-10 06:11:10 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2010-06-11 09:30:07 +1000
commit645679c1523eee7028f3244cee57936b93326a2a (patch)
tree60f11e77c5ba92189012f7f7aba814cf042c1012 /config
parentd1b4beecbc16448282dcc825dd5c354e96e48eca (diff)
xfree86: Match devices based on PnP ID
Serial input devices lack properties such as product or vendor name. This makes matching InputClass sections difficult. Add a MatchPnPID entry to test against the PnP ID of the device. The entry supports a shell pattern match on platforms that support fnmatch(3). For example: MatchPnPID "WACf*" A match type for non-path pattern matching, match_pattern, has been added. The difference between this and match_path_pattern is the FNM_PATHNAME flag in fnmatch(3). Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'config')
-rw-r--r--config/hal.c9
-rw-r--r--config/udev.c3
2 files changed, 11 insertions, 1 deletions
diff --git a/config/hal.c b/config/hal.c
index e0ff842ad..806102041 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -129,7 +129,7 @@ static void
device_added(LibHalContext *hal_ctx, const char *udi)
{
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
- char *hal_tags;
+ char *hal_tags, *parent;
InputOption *options = NULL, *tmpo = NULL;
InputAttributes attrs = {0};
DeviceIntPtr dev = NULL;
@@ -182,6 +182,12 @@ device_added(LibHalContext *hal_ctx, const char *udi)
if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL))
attrs.flags |= ATTR_TOUCHSCREEN;
+ parent = get_prop_string(hal_ctx, udi, "info.parent");
+ if (parent) {
+ attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+ free(parent);
+ }
+
options = calloc(sizeof(*options), 1);
if (!options){
LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
@@ -384,6 +390,7 @@ unwind:
free(attrs.product);
free(attrs.vendor);
free(attrs.device);
+ free(attrs.pnp_id);
if (attrs.tags) {
char **tag = attrs.tags;
while (*tag) {
diff --git a/config/udev.c b/config/udev.c
index 5d001de5e..f7ed4b2de 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -99,6 +99,9 @@ device_added(struct udev_device *udev_device)
name = udev_device_get_property_value(parent, "NAME");
LOG_PROPERTY(ppath, "NAME", name);
}
+
+ attrs.pnp_id = udev_device_get_sysattr_value(parent, "id");
+ LOG_SYSATTR(ppath, "id", attrs.pnp_id);
}
if (!name)
name = "(unnamed)";