summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-02-10 15:36:50 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-02-11 19:25:49 +1000
commitc6d9bc092c84ad5c68083a126aa7577baa42cef7 (patch)
tree20f64f4503d0bdef7b3c3773bd71a23bbbb90a69 /config
parent3ac43df5d4a25d6e0058b327fa05a1c1436b4794 (diff)
Add tag matching to input attributes.
Tags may be a list of comma-separated strings that match against a MatchTag InputClass section. If any of the tags specified for a device match against the MatchTag of the section, this match is evaluated true and passed on to the next match condition. Tags are specified as "input.tags" (hal) or "ID_INPUT.tags" (udev), the value of the tags is case-sensitive and require an exact match (not a substring match). i.e. "quirk" will not match "QUIRK", "need_quirk" or "quirk_needed". Example configuration: udev: ENV{ID_INPUT.tags}="foo,bar" hal: <merge key="input.tags" type="string">foo,bar</merge> xorg.conf: Section "InputClass" Identifier "foobar quirks" MatchTag "foo|foobar" Option "Foobar" "on" EndSection Where the xorg.conf section matches against any device with the tag "foo" or tag "foobar" set. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/hal.c9
-rw-r--r--config/udev.c10
2 files changed, 19 insertions, 0 deletions
diff --git a/config/hal.c b/config/hal.c
index 1b01eccaa..d3daa84cd 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -164,6 +164,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
attrs.product = xstrdup(name);
attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor");
+ attrs.tags = xstrtokenize(get_prop_string(hal_ctx, udi, "input.tags"), ",");
if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL))
attrs.flags |= ATTR_KEYBOARD;
@@ -391,6 +392,14 @@ unwind:
xfree(attrs.product);
xfree(attrs.vendor);
xfree(attrs.device);
+ if (attrs.tags) {
+ char **tag = attrs.tags;
+ while (*tag) {
+ xfree(*tag);
+ tag++;
+ }
+ xfree(attrs.tags);
+ }
if (xkb_opts.layout)
xfree(xkb_opts.layout);
diff --git a/config/udev.c b/config/udev.c
index 3ef0d7fb3..432ab85e9 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -84,6 +84,7 @@ device_added(struct udev_device *udev_device)
add_option(&options, "path", path);
add_option(&options, "device", path);
attrs.device = path;
+ attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");
config_info = Xprintf("udev:%s", syspath);
if (!config_info)
@@ -150,6 +151,15 @@ device_added(struct udev_device *udev_device)
xfree(tmpo);
}
+ if (attrs.tags) {
+ char **tag = attrs.tags;
+ while (*tag) {
+ xfree(*tag);
+ tag++;
+ }
+ xfree(attrs.tags);
+ }
+
return;
}