* Auto-detect what device to use if none is specified

* Replace references to mcd0 with acd0 (doc only)
* Remove references to the "c" partition (doc only - code was already fixed)
This commit is contained in:
Eivind Eklund 2003-11-17 14:02:04 +00:00
parent b2183f9769
commit f76c341dd4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122855
2 changed files with 33 additions and 18 deletions

View File

@ -19,7 +19,7 @@ The device is a name such
as
.Pa cd0
or
.Pa mcd0 .
.Pa acd0 .
.Pp
If no
.Ar command
@ -37,15 +37,28 @@ Verbose mode.
Print as much information as possible.
.It Fl f Ar device
Specify a device, such as
.Pa /dev/cd0c
.Pa /dev/cd0
or
.Pa mcd0 .
.Pa acd0 .
Both absolute path and relative to
.Pa /dev
filename are possible.
Suffix
.Pa c
is added to the device name if needed.
The
.Fl f
option overrides
.Ev CDROM .
If neither
.Ev CDROM
nor the
.Fl f
option is specified,
.Nm
tries opening first
.Pa /dev/cdrom ,
then
.Pa /dev/cd0 ,
and finally
.Pa /dev/acd0 .
.El
.Pp
The available commands are listed below.

View File

@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$");
#define ASTS_ERROR 0x14 /* Audio play operation stopped due to error */
#define ASTS_VOID 0x15 /* No current audio status to return */
#ifndef DEFAULT_CD_DRIVE
# define DEFAULT_CD_DRIVE "/dev/cd0"
#ifdef DEFAULT_CD_DRIVE
# error "Setting DEFAULT_CD_DRIVE is no longer supported"
#endif
#define CMD_DEBUG 1
@ -226,11 +226,6 @@ int main (int argc, char **argv)
if (! cdname)
cdname = use_cdrom_instead("CDPLAY");
if (! cdname) {
cdname = DEFAULT_CD_DRIVE;
warnx("no CD device name specified, defaulting to %s", cdname);
}
if (argc > 0) {
char buf[80], *p;
int len;
@ -1237,14 +1232,21 @@ int open_cd ()
if (fd > -1)
return (1);
if (*cdname == '/') {
snprintf (devbuf, MAXPATHLEN, "%s", cdname);
if (cdname) {
if (*cdname == '/') {
snprintf (devbuf, MAXPATHLEN, "%s", cdname);
} else {
snprintf (devbuf, MAXPATHLEN, "%s%s", _PATH_DEV, cdname);
}
fd = open (devbuf, O_RDONLY);
} else {
snprintf (devbuf, MAXPATHLEN, "%s%s", _PATH_DEV, cdname);
fd = open("/dev/cdrom", O_RDONLY);
if (fd < 0 && errno == ENOENT)
fd = open("/dev/cd0", O_RDONLY);
if (fd < 0 && errno == ENOENT)
fd = open("/dev/acd0", O_RDONLY);
}
fd = open (devbuf, O_RDONLY);
if (fd < 0) {
if (errno == ENXIO) {
/* ENXIO has an overloaded meaning here.