diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -36,6 +36,8 @@ * with all of the DVD flags. So we just include our own, aren't * we so nice... */ +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ +#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ #define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ /* capability flags used with the uniform CD-ROM driver */ @@ -115,14 +117,21 @@ int main(int argc, char *argv[]) fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { info("unable to open '%s'", node); - rc = 1; + rc = 2; goto exit; } + result = ioctl(fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS); + if (result < 0) { + info("CDROM_SET_OPTIONS failed for '%s'", node); + rc = 3; + goto close; + } + result = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (result < 0) { info("CDROM_GET_CAPABILITY failed for '%s'", node); - rc = 3; + rc = 4; goto close; }