[Kde-hardware-devel] Solid device action predicates

Kevin Ottens ervin at kde.org
Wed Jul 8 02:23:46 CEST 2009


On Thursday 2 July 2009 22:15:07 Ozan Çağlayan wrote:
> Where can I find the complete reference of the predicate rules used in
> solid device action files?

It's currently missing. And for sure it'd deserve a page on techbase. 
Unfortunately no one stepped up for it yet, and I'm lacking the time and 
motivation to do it myself.

The syntax is quite simple though, there's not that many constructs:
 * "[ termA OR termB ]" or "[ termA AND termB ]" for logical combinations;
 * "Interface.property == value" to match a given value for a given property 
if the given Interface is supported by the device;
 * "Interface.property & value" to match a given value but using the binary 
AND operator (checking if property has the value flag set).

And then the | operator that you ask for below:

> I'm seeing different usages of different
> operators in many projects but I can't get the expected results when I
> evaluate them using solid-hardware. One such example is the pipe operator:
>
> $ solid-hardware query "foo.bar == 'PropertyX|PropertyY'"

Those are enums/flags values, so the syntax closely follow the C++ one by 
using a binary OR operator (pipe operator in C/C++).

> looking at it, one can think that | acts like an OR operator between
> PropertyX and PropertyY but that doesn't work in that way, so I wonder
> what's the aim of that operator.

It exactly acts like an OR operator, but the binary one so foo.bar == 'X|Y' 
means that foo.bar should have both X and Y.

Regards.
-- 
Kévin 'ervin' Ottens, http://ervin.ipsquad.net
"Ni le maître sans disciple, Ni le disciple sans maître,
Ne font reculer l'ignorance."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20090708/21e5ceda/attachment.sig 


More information about the Kde-hardware-devel mailing list