s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
9.2. CDROM driver (sr or scd)CDROM and DVD drives (and WORM devices) are accessible via the sr upper level device driver. While is "sr" is the device driver name, "sr_mod" is its module name. The device file name is either /dev/sr<n> or /dev/scd<n>. Following is a diagram illustrating the CDROM subsystem of which sr is a part: The architecture of the CD-ROM subsystem. This diagram glosses over some of the differences between the protocol stacks. CDROM device names are not maintained by the uniform CDROM layer but rather by each individual protocol stack. In the case of the SCSI subsystem, device names are maintained by the sr driver while the IDE subsystem maintains device names with its central "ide" driver (i.e. not by the ide-cd driver). USB and IEEE1394 cd devices names are maintained by their respective stacks. This may partially explain why the /dev/cdrom is often a symbolic link to the appropriate subsystem's device name. Two types of SCSI devices are accessible via the sr driver:
The sr driver is capable of recognizing 256 CDROM/DVD drives when it is loaded at kernel boot time or later as a module. However, once it is loaded, it will only recognize a fixed number of additional drives. The number of additional drives that can be accommodated is set by the kernel configuration parameter CONFIG_SR_EXTRA_DEVS whose default value is 2. 9.2.2. sr module parametersDoing a test to find out if a cdrom drive supports XA mode (mode 2) triggers firmware bugs on some drives. Consequently the check for XA mode support is turned off by default. The following module parameter is provided:
9.2.3. sr proc interfaceAll the following files are readable by all and produce ASCII output when read:
As an example, the auto eject feature can be turned on by the superuser with the command echo "1" > /proc/sys/dev/cdrom/autoeject. This will cause cdroms to be ejected from the drive when unmounted. 9.2.4. ATAPI cdromsMany Linux users have no SCSI devices (or adapters) in their systems. They become a little perplexed as to why cd writer software (e.g. cdrecord and cdrdao) and cd music reading programs (e.g. cdparanoia) use the Linux SCSI subsystem. The answer is that these programs need lower level access to these devices. ATAPI (ATA Packet Interface) is essentially a SCSI command set sent over an ATA [1] transport. Currently both cdrecord and cdparanoia interface to the SCSI generic driver (sg) and, in the case of ATAPI cd devices, use the ide-scsi pseudo device driver to access the hardware. This may change in the future as in the 2.4 series kernels a packet interface ioctl has been added to the uniform cdrom layer (see the diagram in the CDROM section above). [2] The default action of the IDE subsystem in Linux is to claim all ATA devices for its drivers. In the case of an ATAPI cd writer, it will be claimed by the ide-cd driver. Once this has happened, the SCSI subsystem is unable to get control over an ATAPI device. The ide-scsi (pseudo lower level SCSI) driver can only register ATAPI devices in the SCSI subsystem that have not already been claimed by IDE subsystem. To change this default action, parameters need to be passed to the IDE subsystem that instruct it not to register a given device. Let us assume that a cd writer is connected to the second IDE controller in the slave position (i.e. /dev/hdd). One of the following two techniques may [3] be used:
To find out if the above worked, the output of cat /proc/scsi/scsi can be checked. Perhaps a simpler method is to observe the "drive name:" line of cat /proc/sys/dev/cdrom/info for "sr" entries. The following output is from my system:
Once an ATAPI cd writer at /dev/hdd has been registered by the SCSI subsystem, then cdroms should be mounted via the "sr" device name and cd players should also use the "sr" device. Strangely the hdparm command should still use the /dev/hdd device file. Notes
|