[Kde-hardware-devel] Solid device action predicates
Ozan Çağlayan
ozan at pardus.org.tr
Wed Jul 8 09:11:10 CEST 2009
Kevin Ottens wrote On 08-07-2009 03:23:
>
> 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.
>
So looking at k3b's one which checks for a blank medium:
[[StorageVolume.ignored == false AND OpticalDisc.blank == true ] AND
OpticalDisc.discType == 'CdRecordable|CdRewritable']
It expects both CdRecordable and CdRewritable for the discType property,
right? But a recordable cd has only the first one and a rewriteable has
the second. So it seems like a misusage of that operator?
Or another example:
$ solid-hardware details /org/freedesktop/Hal/devices/acpi_CPU0
udi = '/org/freedesktop/Hal/devices/acpi_CPU0'
parent = '/org/freedesktop/Hal/devices/computer' (string)
vendor = '' (string)
product = 'AMD Athlon(tm) 64 X2 Dual Core Processor 4800+' (string)
Processor.number = 0 (0x0) (int)
Processor.maxSpeed = '0' (string)
Processor.canChangeFrequency = false (bool)
Processor.instructionSets = 'IntelMmx|IntelSse|IntelSse2|Amd3DNow'
(0x27) (flag)
Say that I'm trying to filter processors having only IntelMmx
instruction set. According to your reply, using & makes sense:
$ solid-hardware query "Processor.instructionSets & 'IntelMmx'"
udi = '/org/freedesktop/Hal/devices/acpi_CPU0'
udi = '/org/freedesktop/Hal/devices/acpi_CPU1'
Seems working but try a stupid one:
$ solid-hardware query "Processor.instructionSets & 'foobar'"
udi = '/org/freedesktop/Hal/devices/acpi_CPU0'
udi = '/org/freedesktop/Hal/devices/acpi_CPU1'
It matches too!
And now with the '|' :
$ solid-hardware query "Processor.instructionSets == 'IntelMmx|IntelSse'"
$ solid-hardware query "Processor.instructionSets ==
'IntelMmx|IntelSse|IntelSse2'"
$ solid-hardware query "Processor.instructionSets ==
'IntelMmx|IntelSse|IntelSse2|Amd3DNow'"
udi = '/org/freedesktop/Hal/devices/acpi_CPU0'
udi = '/org/freedesktop/Hal/devices/acpi_CPU1'
It only matches if I check again the whole flag set. So what's the point
in here? It really behaves like I'm checking the instructionSets
property against a string which contains "X|Y|Z|W" having | characters
in it. No?
I'm really confused about the syntax/semantics of the predicates.
Thanks!
Ozan Caglayan
More information about the Kde-hardware-devel
mailing list