[Kde-hardware-devel] How to determine what drive an Optical Disc is in

Chris Gow sniffy at rogers.com
Thu Jan 31 13:22:39 CET 2008

On Thursday 31 January 2008 03:22:05 Kevin Ottens wrote:
> Le mercredi 30 janvier 2008, Chris Gow a écrit :
> > If I have a Solid::OpticalDisc object, how do I find out what
> > device/drive it is mounted in?
> >
> > Solid::Device *d = new Solid::Device(someValidDeviceID);
> > Solid::OpticalDisc *opticalDisc = d->as<Solid::OpticalDisc>();
> >
> > QString mountedAt = /* eg. /dev/cdrom or some such */
> [I assume you meant "/media/cdrom", not "/dev/cdrom" which is not a
> mountpoint]
Actually, I think either would do. But given my mistake, how can I determine 
what device the CD is in?
> You have to use the StorageAccess interface on the same device object,
> which would give:
> Solid::StorageAccess *access = d->as<Solid::StorageAccess>();
> QString mountedAt = access->filePath();
Ok, on my system (Kubuntu 7.10, KDE 4.0.0), I get the following:

access->filePath() returns ""
access->isAccessable() returns false
access->setup() returns true
access->setupDone() contains errors: 
Error Data  QVariant(QByteArray, "mount: block device /dev/scd0 is 
write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/scd0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

I also get a number of empty return values when I deal with the OpticalDisc 
object too. Not sure if it is a packaging problem, or because the CD isn't 
mounted the methods don't return values. 


-- chris

More information about the Kde-hardware-devel mailing list