[Kde-hardware-devel] How to get Solid::Device having device path only

Rafał Miłecki zajec5 at gmail.com
Thu Sep 17 12:23:59 CEST 2009


W dniu 17 września 2009 07:18 użytkownik Ben Cooksley
<sourtooth at gmail.com> napisał:
> 2009/9/17 Rafał Miłecki <zajec5 at gmail.com>:
>> Could you help me getting Solid::Device when I have device path (ex.
>> /dev/sdb1) only? Is this possible?
>>
>> I guess I've to use findDevicesFromQuery with some magic predicate,
>> but don't know that predicate. Tried to browse results from
>> http://lxr.kde.org/ident?i=listFromQuery but it didn't help.
>
> You may wish to look at the Device Actions editor in System Settings,
> which provides an interface to create Solid Predicates. It knows about
> all possible combinations for devices. The types Storage Access,
> Storage Drive and Storage Volume are likely to be most helpful, in
> particular their properties.

Nice editor, thanks.

> Please make sure to use Trunk, since it is more enhanced compared to
> the previous version.
> Storage Access appears to have a property "File Path" which seems to
> be what you are looking for.

Not really. Please, check documentation:
http://api.kde.org/4.x-api/kdelibs-apidocs/solid/html/classSolid_1_1StorageAccess.html#a377fcaa84c9e1961cfe460a659159e6c
"the absolute path to the mount point if the volume is mounted,
QString() otherwise"
so File Path is not what I am looking for (/dev/*).

> However you may find that the Udi will be of more help

I know it's best solution, but we would need to create new protocol
like -kde-solid-udi://[udi here]. And moreover desktop device files
doesn't use udi. It's like this:
[Desktop Entry]
Dev=/dev/sdb1

-- 
Rafał


More information about the Kde-hardware-devel mailing list