diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-04-23 15:04:16 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2009-04-23 15:04:16 +0200 |
commit | d6f0b22d574c6a5e5f3430be3fc619d4b2f46cd5 (patch) | |
tree | 0399602fa6e6afdafc0b77c22d2275bfa1052868 /extras | |
parent | 8c3ae78546a535cc9288a190680fb1eb88c6ea7e (diff) |
cdrom_id: skip media tests if CDROM_DRIVE_STATUS != CDS_DISC_OK
Diffstat (limited to 'extras')
-rw-r--r-- | extras/cdrom_id/cdrom_id.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 371d6a2dbd..0d873ae8e5 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -197,6 +197,16 @@ static int cd_capability_compat(struct udev *udev, int fd) return 0; } +static int cd_media_compat(struct udev *udev, int fd) +{ + if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { + info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); + return -1; + } + cd_media = 1; + return 0; +} + static int cd_inquiry(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char inq[128]; @@ -569,7 +579,11 @@ int main(int argc, char *argv[]) goto exit; } - /* check drive */ + /* check for media */ + if (cd_media_compat(udev, fd) < 0) + goto print; + + /* check if drive talks MMC */ if (cd_inquiry(udev, fd) < 0) goto print; |