Commit graph

4 commits

Author SHA1 Message Date
Jaroslav Kysela
1b14643384 ucm: add If.Condition.RegexMatch
If.1 {
	Condition {
		Type RegexMatch
		String "something to match"
		Regex ".*(thing)"
	}
	...
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
7ccaa08693 ucm: evaluate nested If blocks also in True/False blocks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
b7d74c6977 ucm: add If.Condition.String to match strings and substrings
Case insensitive string match:

If.1 {
	Condition {
		Type String
		String1 "aa"
		String2 "bb"
	}
	True {
		...
	}
}

Substring is present (case sensitive):

If.1 {
	Condition {
		Type String
		Haystack "White Horse"
		Needle "Horse"
	}
	True {
		...
	}
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:40 +01:00
Jaroslav Kysela
8a36e38dc4 ucm: add If condition block
The syntax is simple:

If./any-if-identificator/ {
  Condition {
    Type /type_here/
    /optional defines/
  }
  True {
    /block used when condition is evaluated as true/
  }
  False {
    /block used when condition is evaluated as false/
  }
}

The Type "ControlExists" is implemented:

Condition {
  Type ControlExists
  Device "hw:${CardId}"
  Control "iface=CARD,name='Headphone Jack'"
}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 15:00:37 +01:00