Reliable CD Ejection - Unix

This is a discussion on Reliable CD Ejection - Unix ; Simple problem. I want to eject a CD from a drive. After plenty of tooling around the only reliable way I could do this is to utilize the raw device number (or block device number). I'm using the Solaris SUNWcdrw ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Reliable CD Ejection

  1. Reliable CD Ejection

    Simple problem. I want to eject a CD from a drive. After plenty of
    tooling around the only reliable way I could do this is to utilize the
    raw device number (or block device number).

    I'm using the Solaris SUNWcdrw package to burn disks so I decided to use
    it to extract the raw device number using 'cdrw -l'. Ex: Parse out
    "/dev/rdsk/c0d0t0s0" and do a /usr/bin/eject on that device.
    The problem is 'cdrw -l' doesn't always give me the raw device number.
    Sometimes it gives me the logical name 'cdrom0'. Fortunately I'm working
    on a closed system so I could parse out the /etc/mnttab file to get the
    block device for the /cdrom mount point but this would never work in a
    real world situation.

    Finally my question. How can I always reliably eject a CD from its drive?

    Thanks.

  2. Re: Reliable CD Ejection

    On Dec 7, 3:48 pm, Bender wrote:
    > Simple problem. I want to eject a CD from a drive. After plenty of
    > tooling around the only reliable way I could do this is to utilize the
    > raw device number (or block device number).
    >
    > I'm using the Solaris SUNWcdrw package to burn disks so I decided to use
    > it to extract the raw device number using 'cdrw -l'. Ex: Parse out
    > "/dev/rdsk/c0d0t0s0" and do a /usr/bin/eject on that device.
    > The problem is 'cdrw -l' doesn't always give me the raw device number.
    > Sometimes it gives me the logical name 'cdrom0'. Fortunately I'm working
    > on a closed system so I could parse out the /etc/mnttab file to get the
    > block device for the /cdrom mount point but this would never work in a
    > real world situation.
    >
    > Finally my question. How can I always reliably eject a CD from its drive?


    If there is more than one CD drive on the system, how will you know
    which one to eject?

  3. Re: Reliable CD Ejection

    fjblurt@yahoo.com wrote:
    > On Dec 7, 3:48 pm, Bender wrote:
    >> Simple problem. I want to eject a CD from a drive. After plenty of
    >> tooling around the only reliable way I could do this is to utilize the
    >> raw device number (or block device number).
    >>
    >> I'm using the Solaris SUNWcdrw package to burn disks so I decided to use
    >> it to extract the raw device number using 'cdrw -l'. Ex: Parse out
    >> "/dev/rdsk/c0d0t0s0" and do a /usr/bin/eject on that device.
    >> The problem is 'cdrw -l' doesn't always give me the raw device number.
    >> Sometimes it gives me the logical name 'cdrom0'. Fortunately I'm working
    >> on a closed system so I could parse out the /etc/mnttab file to get the
    >> block device for the /cdrom mount point but this would never work in a
    >> real world situation.
    >>
    >> Finally my question. How can I always reliably eject a CD from its drive?

    >
    > If there is more than one CD drive on the system, how will you know
    > which one to eject?


    That situation I can guarantee against or at least give the user an
    option. After poking around it looks like some ioctl calls with
    CDROMEJECT should do the trick but still...

    How do I discover the CD device names?

+ Reply to Thread