summaryrefslogtreecommitdiff
path: root/hw/xfree86/parser
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2010-06-07 20:39:58 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2010-06-11 09:44:40 +1000
commit66b21b2f455a1dfbc92f7caa571dcff3f3765808 (patch)
tree36acf155b4a34421d5694e7e0d8864b7719e9088 /hw/xfree86/parser
parenta71bdff47d4cc80da6ceeb548db1dcc8e8b59702 (diff)
xfree86: Match devices based on current driver setting
Often we want to apply a driver specific option to a set of devices and don't care how the driver was selected for that device. The MatchDriver entry can be used to match the current driver string: MatchDriver "evdev|mouse" Option "Emulate3Buttons" "yes" The driver string is a case sensitive match. 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 'hw/xfree86/parser')
-rw-r--r--hw/xfree86/parser/InputClass.c21
-rw-r--r--hw/xfree86/parser/xf86Parser.h1
-rw-r--r--hw/xfree86/parser/xf86tokens.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index f2b46bb1c..ce611d990 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -50,6 +50,7 @@ xf86ConfigSymTabRec InputClassTab[] =
{MATCH_OS, "matchos"},
{MATCH_PNPID, "matchpnpid"},
{MATCH_USBID, "matchusbid"},
+ {MATCH_DRIVER, "matchdriver"},
{MATCH_TAG, "matchtag"},
{MATCH_IS_KEYBOARD, "matchiskeyboard"},
{MATCH_IS_POINTER, "matchispointer"},
@@ -91,6 +92,7 @@ xf86parseInputClassSection(void)
list_init(&ptr->match_os);
list_init(&ptr->match_pnpid);
list_init(&ptr->match_usbid);
+ list_init(&ptr->match_driver);
list_init(&ptr->match_tag);
while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
@@ -153,6 +155,12 @@ xf86parseInputClassSection(void)
add_group_entry(&ptr->match_usbid,
xstrtokenize(val.str, TOKEN_SEP));
break;
+ case MATCH_DRIVER:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchDriver");
+ add_group_entry(&ptr->match_driver,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
case MATCH_TAG:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchTag");
@@ -283,6 +291,13 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
*cur);
fprintf(cf, "\"\n");
}
+ list_for_each_entry(group, &ptr->match_driver, entry) {
+ fprintf(cf, "\tMatchDriver \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
list_for_each_entry(group, &ptr->match_tag, entry) {
fprintf(cf, "\tMatchTag \"");
for (cur = group->values; *cur; cur++)
@@ -363,6 +378,12 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
free(*list);
free(group);
}
+ list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
list_del(&group->entry);
for (list = group->values; *list; list++)
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index 26d9a5b33..337ad0718 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -357,6 +357,7 @@ typedef struct
struct list match_os;
struct list match_pnpid;
struct list match_usbid;
+ struct list match_driver;
struct list match_tag;
xf86TriState is_keyboard;
xf86TriState is_pointer;
diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h
index 23460dd73..c16a8f551 100644
--- a/hw/xfree86/parser/xf86tokens.h
+++ b/hw/xfree86/parser/xf86tokens.h
@@ -282,6 +282,7 @@ typedef enum {
MATCH_OS,
MATCH_PNPID,
MATCH_USBID,
+ MATCH_DRIVER,
MATCH_TAG,
MATCH_IS_KEYBOARD,
MATCH_IS_POINTER,