Charles Steinkuehler wrote:
> 
> > > The next version will likely use /dev/cdrom, and intelligently make that
> > > a symlink to the first found CD-Rom.
> >
> > I wrote a shell script that returns all found IDE cdroms by scanning
> > through /proc/ide - interested?
> 
> Sure!

Here it is:

#!/bin/sh

# Copyright 2001 David Douthitt; All Rights Reserved.
#
# Copyright terms in /root/license and are identical to the "MIT
License".

unset FND
for i in /proc/ide/ide[0-9]/hd[a-z] ; do
        [ "$(cat $i/media)" = "cdrom" ] && echo -n "${i##*/} " && FND=1
done

[ -z "$FND" ] && exit 1
echo
exit 0

...note that this returns a 0 if it finds CDROMS and a 1 if not...

> I'm not sure if it works everywhere, but on all the systems I've got,
> there's a field in /proc/scsi/scsi that indicates what sort of device you're
> talking to (see samples, below...I've seen CD-ROM, Direct-Access (hdd),
> Sequential-Access (tape drive), and processor (my RAID controller)), so
> something like:
> 
> [ -n "`sed -n /CD-ROM/p /proc/scsi/scsi`" ] && ln -s /dev/scd0 /dev/cdrom

Does grep in Dachstein have a -q option?

grep -q CD-ROM /proc/scsi/scsi && ln /dev/sr0 /dev/cdrom

> Ought to work...

The Linux source code has this in drivers/scsi/scsi.c:

const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] =
{
    "Direct-Access    ",
    "Sequential-Access",
    "Printer          ",
    "Processor        ",
    "WORM             ",
    "CD-ROM           ",
    "Scanner          ",
    "Optical Device   ",
    "Medium Changer   ",
    "Communications   ",
    "Unknown          ",
    "Unknown          ",
    "Unknown          ",
    "Enclosure        ",
};

So I guess it should work, eh?

But how do you know WHICH SCSI device it is?

>From what I am reading in the kernel docs, /dev/scd0 should always be
the first CDROM - and should be equivalent to /dev/sr0 - and /dev/cdrom
should be a HARD link to /dev/sr0.  This is different from IDE - where
there may or may not be a drive at /dev/hda or whatever...

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to