Welcome to LQ.
What distibution are you using?
To detect CD drive on the system ,you can try this
Check for directory /proc/ide/hda,hdb,hdc,hdd
If directory present , look for file 'media' inside directory.
$ cat /proc/ide/hda/media
This will tell you what type of device that ide is.[It will have cdrom for a Cddrive]
A scan on all four ide`s media files [hda.hdb,hdc,hdd] can find out the number of cddrives in the system.
Also see the 'model' file for the Modelname of the media.
If you need a command to check for media try
$ hdparm -i /dev/hda [or hdb,hdc,hdd ]
This gives information about the ide.