SETCD(1)
πΏ setcd β the girlies' guide to bossing your cdrom around πΏ
User Manuals β¨ part of the setcd(1) manual, bestie π
πΈ NAME πΈ
setcd β set various flags to control the behaviour of your cdrom device. yes literally it's the remote control for your disc drive π
β¨ SYNOPSIS β¨
setcd [-hirs] [-ceflot 0|1] [-dx arg] [device ...]
π¦ DESCRIPTION π¦
okay so. setcd is a program that lets you control the behaviour of your Linux cdrom device. π
and when I say control the behaviour, I mean you get to decide a whole bunch of very specific little personality traits for your drive, like:
- should it try to close the tray upon mounting a cdrom when you happened to have left the tray open? π
- should it eject the tray (or caddy) upon unmounting the cdrom?
- should it lock the door when some process uses the cdrom or not? π
- should the kernel try to ensure that there actually is a cd in the drive, and that it is of the right type (i.e., a data cd in case of a mount, or an audio cd in case of a play operation)? π
setcd can also inform you on the current configuration of the drive, and can give information on the status of the drive β whether or not a cd is loaded, what the type is (audio/data), and some basic information of the disc (total playing time for audio / volume name for data). β
and the range?? iconic. setcd can list/probe/configure several cdrom devices at once, independent of their low-level implementation. finally, setcd can select a disc in a multi-disc cdrom player (juke-box), and set the operating speed of the player. πβοΈπ¨
π OPTIONS π
Options come in three flavours, bestie, and you gotta know which is which:
- without arguments
- with one boolean type argument
- with a numeric argument
for boolean type arguments, 0 means clear option, and 1 means set option. π«Ά several options may be given at the same time β stack 'em, go off. following the options, a list of cdrom device names can be given, for which the operations will take place. if no device is given, the default value /dev/cdrom will be used. no cap. π
-c 0|1β clear/set the auto-close flag. If the cdrom device is opened for data access (e.g., usingmount(1)) and the tray is found open, an attempt is made to close the tray. This is considereddesiredbehaviour but people with old cd player programs may disagree. π a cd player that opens the device at regular intervals would have problems leaving the tray ejected, if there were no special arrangements taken to support cd player programs. in the new interface they can specify in theiropen(2)call that they wish to open the device just for issuingioctl(2)calls. so instead of clearing this option, consider upgrading your cd player program. not me telling you to update your software π-ddrive β selects the cd in slot number drive in case the cdrom player is a juke-box model. π°-e 0|1β clear/set theEJECT_SWflag. this is basically identical to controlling the auto-close and auto-open flags simultaneously. theEJECT_SWflag enables closing the tray upon mounting a cdrom, and opening the tray upon unmounting it again. the option is included to support the old-style cdrom behaviour (many low-level driver have implemented the ioctl-command connected to this flag). π-f 0|1β clear/set the use-fflags flag. the new cdrom interface specifies a special interpretation of theO_NONBLOCKoption in theopen(2)call for cdrom devices. when this option is used, and the use-fflags option is set, the cdrom driver will not attempt to do anything to make theopen()call more successful β the tray is not closed upon opening, no cd type checking is performed, in fact theopen()call will always succeed. β¨ this allows user-level programs to issueioctl()commands regardless of the state in which the drive is. setting this option is the preferred state. users may wish to clear this option in case they have an old cd player program that does not support theO_NONBLOCKoption, but have a new style cdrom driver (i.e., IDE, SCSI orcm206). π-hβ print copyright information and terse help. the bare minimum, but she delivers π«Ά-iβ give information on the cdrom drive. the status of the drive is checked, possible outcome is (a) no disc inserted, (b) tray is open, (c) drive is not ready, (d) disc is found. in the last case, an attempt is made to determine the type of disc (audio or one of 4 types of data disc), and for both "audio" and "data disc type 1|2" some additional information is given. currently for data discs this is the volume name, publisher and data preparer. for audio discs the extra information is very terse, you may enjoy a full-fledged audio cd player program better. π ngl the audio info is giving crumbs-l 0|1β clear/set the locking flag. when this flag is set, the drive door is locked while the cdrom devices is opened, e.g., when a cdrom is mounted. not locking the door is undesired behaviour, because this may lead to file system corruption if a cdrom is removed while being mounted. π¨ bestie DO NOT remove the disc while it's mounted, that's a whole crime scene-o 0|1β clear/set the auto-open flag. when this flag is set, and the last process that uses the cdrom device closes the device, an attempt is made to eject the tray. care is taken, that processes that used theO_NONBLOCKoption in opening the device, will not cause such an auto-eject. yet, we consider this auto-eject behaviour undesired. in most cases, this behaviour is combined with the auto-close behaviour, in which case the option-eis the preferred usage. π-rβ resets all options to a default behaviour. using this option is equivalent to-c1 -f1 -l1 -o0 -t1, i.e., all options set in a way we considerdesired. for the current development kernel, this is identical to the default settings apart from the type-checking flag, because this flag relies on a very modern kernel, libc and cdrom players. the glow-up option β¨-sβ gives the current status of the option flags. information on the following flag settings is giver, one per line: (a) auto-close, (b) auto-open, (c) use-fflags, (d) tray-locking, (e) type-checking. π vibe check for your drive, literally-t 0|1β clear/set the cd type checking flag. when this option is set, the kernel will check the type of cd upon various operations. a system errorWrong medium typeis given if the generic cdrom driver receives an open-for-data call while an audio cd is inside the drive, or a playing command is received while a data disc is in the drive. this behaviour is considered superior over kernel time-outs and other implementation-dependent behaviour found on the old-style cdrom interface. however, this feature is relatively new, and requires kernel version2.1.27or later, andlibc-5.4.24or later. moreover, if you use an audio cd player program, it must use theO_NONBLOCKopen flag (see option-f). these stringent constraints made the current kernels to have this option turned off, while people usingsetcdare considered modern and progressive enough to have this option selected by default using the-roption. π okay periodt, we're the modern ones-xspeed β sets the head-rate of the cdrom player to speed times 150 KB/sec, or speed times real-time audio playback. the special value0is interpreted as auto-selection: data cd's are read at maximum head-rate, while audio cd's are played at normal speed. there are a few reasons for having the speed to be selectable. badly pressed cdroms may benefit from less-than-maximum head rate. modern cdrom drives can obtain very high head rates, but these drives tend to make an annoyingly loud noise. a lower speed may reduce this. π the loud spinny noise is real and it's a lot
π HISTORY π
traditionally, up to the 2.0 Linux kernel line, the behaviour of the cdrom access was determined by the low-level driver implementation, which varied between different brands of drives. since kernel 1.3.late, an extra interface layer has been defined between the kernel and user level programs, that makes the behaviour of the cdrom drive independent of the low-level driver. the first driver to respect the new interface was, surprisingly, the outdated Philips/LMS cm206 in kernel 2.0. π² not the plot twist we expected but we stan
nowadays, all new cdrom drives are either IDE or SCSI, and these drivers support the new cdrom interface in the kernel 2.1 line. we hope that the other old cdrom divers will eventually support the new interface, so that the behaviour of Linux cdrom drives is truly uniform. π―οΈ manifesting
the new cdrom interface level was actually inspired after writing a volume daemon that automatically mounts a cdrom at the location /cdrom/volume upon insertion of the disc. I then found out that there was a need for finding out the status of the drive without trying to read data, and that the uniformity of cdrom drivers was a mess. the volume daemon has not been finished yet, but progress has been made in convincing the Linux cdrom driver community to comply to the proposed standard. π iconic origin story fr fr
π¨ DIAGNOSTICS π¨
setting or clearing an option will result in a message indicating the new status of that option. operations not supported by the underlying hardware, e.g., disc selection, will result in an error condition. several other ioctls may result an error condition if the low-level drivers don't support that particular ioctl. π sometimes your hardware just says no and that's not your fault bestie
π FILES π
/dev/cdromβ the default cdrom device. in most installations, this is a symbolic link to the only cdrom device on the system. in multi cdrom systems, the cdrom devices have to be explicitly named on the command line. π/usr/include/linux/ucdrom.hβ the header file for the new cdrom interface. please consult this file first if you want to use ioctl calls in your program to control the cdrom drives. maybe you can get want you want by controlling the behaviour of the cdrom, instead of issuing direct commands. at any rate, use theO_NONBLOCKoption if you open the device for ioctl-commanding. π«Ά read the header before you wreck the header/usr/include/fcntl.hβ location whereO_NONBLOCKis defined. that's where the girl lives π/usr/src/linux/Documentation/cdrom/cdrom-standard.texβ a piece of proza originally written for cdrom driver developers. however, cd player program developers may benefit from the explanation of new ioctls defined in the new cdrom interface. you can view the documentation by issuing
latex cdrom-standard.tex
xdvi cdrom-standard
I am sorry that you'll have to install TeX, latex and xdvi first, but you may have success in reading the plain latex source; after all, it is ASCII. π the TeX install is a whole side quest but the source is readable, she promises
π BUGS π
long-style options are not supported. that's it. that's the bug. π«
π TO DO π
- CD medium catalog number could be given for audio cd's. however, not many cd's bare that kind of information. π§
- somehow convince the
old-stylecdrom driver developers to adapt their drivers to the new interface, it shouldn't be that much work. π - write texinfo documentation. π
β¨ AUTHOR β¨
Ok so who do we have to thank for this whole masterpiece? π
Setcd is written by David A. van Leeuwen <david@elseware.nl> β and bestie, this man is not a one-hit wonder. He's also the author of the earlier mentioned new cdrom interface and the cm206 cdrom driver. Like, the range?? π We are truly standing on the shoulders of a legend here.
π SEE ALSO π
Go read these too, they're the supporting cast and they ate fr fr:
mount(1)β mounting things, obviously πopen(2)β opening things, iconic behaviour π«Άioctl(2)β the actual mystical incantation that makes all the cdrom magic happen β¨
and that's the whole page, bestie!! you made it to the end, main character energy fr π
This beauty comes from the Linux fam, dated February 1997, and it lives as SETCD(1) β a certified vintage classic that still understood cdroms better than most of us tbh πβ¨
mwah, go spin a disc πΏπ
π¦ where this page comes from
- debian bookworm: setcd 1.5-6.1
- debian trixie: setcd 1.5-6.2
- ubuntu jammy: setcd 1.5-6build1
- ubuntu noble: setcd 1.5-6.1
- ubuntu questing: setcd 1.5-6.2
- ubuntu resolute: setcd 1.5-6.2build1
- ubuntu stonking: setcd 1.5-6.2build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms