Is there any module to get the cdrom infomation?

O

O

I want to check whether a cdrom node under /dev actually exists.

Win32::AdminMisc

GetDrives([$Type])

This will return an array of drive roots. If no parameters are passed
then the list will be all drives (cdroms, floppy, fixed, net, etc.).
If you specify $Type the list will only contain drive roots that are
of the specified type.
The types are:

DRIVE_FIXED
DRIVE_REMOVABLE
DRIVE_REMOTE
DRIVE_CDROM
DRIVE_RAMDISK

Example:

@Drives = Win32::AdminMisc::GetDrives();
@CDROMs = Win32::AdminMisc::GetDrives( DRIVE_CDROM );
 
J

Joost Diepenmaat

lofenee said:
I want to check whether a cdrom node under /dev actually exists.

Well, the *node* exists if "-e $path_to_node" returns true. Do you
also care if there is an actual drive there or if there's a readable
drive in the disc?

I'm assuming linux behaviour, here.
 
R

RedGrittyBrick

Joost said:
Well, the *node* exists if "-e $path_to_node" returns true. Do you
also care if there is an actual drive there or if there's a readable
drive in the disc?

I'm assuming linux behaviour, here.

In which case reading 'files' like /proc/ide/hdc/model might help.
 
C

cmic

Hello

I want to check whether a cdrom node under /dev actually exists.

maybe ioctl could help ?
(quick and dirty, sorry ...)

.....
open(CDROM, "< /dev/cdrom");
$media = ioctl(CDROM, 0x5327, $status='');
close(CDROM);

if($media eq 101) {
#media is present whith info
....
}

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top