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

Jarion Stevens jarions at ...761...
Fri Jan 7 18:28:42 CET 2005


This might not be the best way but you could read /etc/fstab to get a 
list of mount points, parse out the ones that look like *cdrom* or 
*cdrw* or *dvd*, etc., and then remove the duplicates from your list.  
Then, read /etc/mtab for the list of mounted devices and compare. 


José L. Redrejo Rodríguez wrote:

>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.
>
>
>
>-------------------------------------------------------
>The SF.Net email is sponsored by: Beat the post-holiday blues
>Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
>It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user
>  
>





More information about the User mailing list