[Gambas-user] CD-rom device & media detection

José L. Redrejo Rodríguez jredrejo at ...96...
Fri Jan 7 17:17:05 CET 2005


El vie, 07-01-2005 a las 07:10 -0800, Dave sharples
<technoferret at ...598...> escribió:

> Hi all,
> 
> I'm reasonably new to gambas having come from VB6 and for my first
> *real* app I need to somehow detect and list the CD drives in a system
> and also detect if they have any media in them.
> 
> Not being a linux geek either I am completely stumped as to how to go
> about this.
> 
> If someone could point me in the right direction as to which function I
> should use or any reading that would help I would be greatful.
> 
> Cheers
> Dave
> 
> 


Well, to detect where the drives are, there are some ways, you can
search for the CD-ROM string inside a "dmesg" command, or install kudzu
and read the /etc/sysconfig/hwconf after executing "kudzu -q"

Or if the system is properly configured, just look at the /etc/fstab
file.

Then, to detect if there is a cd inside the driver it will depends on
the kind of system: if supermount or submount patches are applied to the
kernel you just have to look if the directories where fstab says the
drives are have anything inside. If no supermount is being used you will
have to mount the drives and see if there is any error message.

Regards.





More information about the User mailing list