Is there any module to get the cdrom infomation?

Discussion in 'Perl Misc' started by lofenee, Jul 29, 2008.

  1. lofenee

    lofenee Guest

    I want to check whether a cdrom node under /dev actually exists.
     
    lofenee, Jul 29, 2008
    #1
    1. Advertising

  2. lofenee

    npc Guest

    On Tue, 29 Jul 2008 10:35:29 +0800, lofenee wrote:

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


    search cpan for 'cdrom.' there appear to be several.

    perldoc -q cpan
     
    npc, Jul 29, 2008
    #2
    1. Advertising

  3. lofenee

    O Guest

    On Jul 29, 2:35 pm, "lofenee" <> wrote:
    > 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 );
     
    O, Jul 29, 2008
    #3
  4. "lofenee" <> writes:

    > 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.

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
     
    Joost Diepenmaat, Jul 29, 2008
    #4
  5. O <> wrote:
    > On Jul 29, 2:35 pm, "lofenee" <> wrote:
    > > I want to check whether a cdrom node under /dev actually exists.


    > Win32::AdminMisc


    > GetDrives([$Type])


    Do you guys on Windows nowadays also have a /dev directory with
    device files?
    Just curious, Jens
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, Jul 29, 2008
    #5
  6. Joost Diepenmaat wrote:
    > "lofenee" <> writes:
    >
    >> 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.
    >


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

    --
    RGB
     
    RedGrittyBrick, Jul 30, 2008
    #6
  7. lofenee

    cmic Guest

    Hello

    On 29 juil, 04:35, "lofenee" <> wrote:
    > 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
    --
    michel marcon aka cmic
     
    cmic, Jul 30, 2008
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wgan
    Replies:
    7
    Views:
    606
    Roedy Green
    Jul 8, 2004
  2. Zeng Dinghao
    Replies:
    1
    Views:
    452
    Howard
    Mar 11, 2005
  3. =?Utf-8?B?S2VtaW4=?=
    Replies:
    0
    Views:
    374
    =?Utf-8?B?S2VtaW4=?=
    Jun 11, 2006
  4. Kemin
    Replies:
    0
    Views:
    443
    Kemin
    Jun 12, 2006
  5. Burton Nigel

    get infomation of printers from OS

    Burton Nigel, Apr 24, 2007, in forum: Ruby
    Replies:
    0
    Views:
    89
    Burton Nigel
    Apr 24, 2007
Loading...

Share This Page