Index: b/doc/spec/hal-spec-fdi-files.xml =================================================================== --- a/doc/spec/hal-spec-fdi-files.xml 2007-04-12 21:22:36.000000000 -0400 +++ b/doc/spec/hal-spec-fdi-files.xml 2007-04-19 15:23:51.000000000 -0400 @@ -100,6 +100,12 @@ + is_ascii - matches only when a string property + contain only ASCII characters. Can be used with 'true' or 'false'. + + + + is_absolute_path - matches only when a string property represents an absolute path (the path doesn't have to exist). Can be used with 'true' or 'false'. @@ -107,65 +113,92 @@ - is_ascii - matches only when a string property - contain only ASCII characters. Can be used with 'true' or 'false'. + sibling_contains - can only be used with string and + strlist (string list). + For a string key this matches when a sibling item contains the + (sub-)string in the same property. For a string list, this is if a string + matches an item in the list. - compare_lt - can be used on int, uint64, double - and string properties to compare with a constant. - Matches when the given property is less than the given constant - using the default ordering. + contains - can only be used with string and + strlist (string list). + For a string key this matches when the property contains the given + (sub-)string. For a string list this match if the given string match + a item of the list. - compare_le - like compare_lt - but matches when less than or equal. + contains_ncase - like contains + but the property and the given key are converted to lowercase before check. - compare_gt - like compare_lt - but matches when greater than. + contains_not - can only be used with strlist (string list) + and string properties. + For a string list this match if the given string not match any of the + item of the list (or the property is not set for the device). For a string + this match of the property not contains the (sub-)string. You can use this + attribute to construct if/else blocks together with e.g. contains. - compare_ge - like compare_lt - but matches when greater than or equal. + prefix - can only be used with string properties. + Matches if property begins with the key. - compare_ne - like compare_lt - but matches when not equal. + prefix_ncase - like prefix but the + property and the given key are converted to lowercase before the check. - contains - can only be used with string and - strlist (string list). - For a string key this matches when the property contains the given - (sub-)string. For a string list this match if the given string match - a item of the list. + suffix - can only be used with string properties. + Matches if property ends with the key. - contains_not - can only be used with strlist (string list) - and string properties. - For a string list this match if the given string not match any of the - item of the list (or the property is not set for the device). For a string - this match of the property not contains the (sub-)string. You can use this - attribute to construct if/else blocks together with e.g. contains. + suffix_ncase - like suffix but the + property and the given key are converted to lowercase before the check. - contains_ncase - like contains - but the property and the given key are converted to lowercase before check. + compare_lt - can be used on int, uint64, double + and string properties to compare with a constant. + Matches when the given property is less than the given constant + using the default ordering. + + + + + compare_le - like compare_lt + but matches when less than or equal. + + + + + compare_gt - like compare_lt + but matches when greater than. + + + + + compare_ge - like compare_lt + but matches when greater than or equal. + + + + + compare_ne - like compare_lt + but matches when not equal. Index: b/hald/device_info.c =================================================================== --- a/hald/device_info.c 2007-04-12 21:22:36.000000000 -0400 +++ b/hald/device_info.c 2007-04-19 15:32:52.000000000 -0400 @@ -71,6 +71,8 @@ return "uint64"; case MATCH_BOOL: return "bool"; + case MATCH_DOUBLE: + return "double"; case MATCH_EXISTS: return "exists"; case MATCH_EMPTY: @@ -85,6 +87,8 @@ return "contains"; case MATCH_CONTAINS_NCASE: return "contains_ncase"; + case MATCH_CONTAINS_NOT: + return "contains_not"; case MATCH_PREFIX: return "prefix"; case MATCH_PREFIX_NCASE: @@ -105,8 +109,6 @@ return "compare_ne"; case MATCH_UNKNOWN: return "unknown match type"; - case MATCH_CONTAINS_NOT: - return "contains_not"; } return "invalid match type"; } @@ -331,6 +333,17 @@ return TRUE; } + case MATCH_DOUBLE: + { + double val = atof (value); + + if (hal_device_property_get_type (d, prop_to_check) != HAL_PROPERTY_TYPE_DOUBLE) + return FALSE; + if (hal_device_property_get_double (d, prop_to_check) != val) + return FALSE; + return TRUE; + } + case MATCH_EXISTS: { dbus_bool_t should_exist = TRUE; Index: b/hald/rule.h =================================================================== --- a/hald/rule.h 2007-03-07 16:52:19.000000000 -0500 +++ b/hald/rule.h 2007-04-20 14:10:31.000000000 -0400 @@ -79,7 +79,8 @@ MATCH_COMPARE_GE, MATCH_SIBLING_CONTAINS, MATCH_COMPARE_NE, - MATCH_CONTAINS_NOT + MATCH_CONTAINS_NOT, + MATCH_DOUBLE } match_type; /* a "rule" structure that is a generic node of the fdi file */