summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-10-05 14:59:51 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-10-05 14:59:51 +0200
commit678df8a461c7573bf423a39be383bc7b70d943df (patch)
treee27f181133165c4281f2575b9cf9b0fe311755c6 /extras
parent13e0fca5dff286921a8df0cd737e6e1224e53275 (diff)
cdrom_id: Fall back to CDROM_DRIVE_STATUS if all MMC commands fail
Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older (pre-MMC2) "READ DISC INFORMATION" command. In that case, check if cd_media_compat() detected that there is a disc present, and assume that we have a CD-ROM medium.
Diffstat (limited to 'extras')
-rw-r--r--extras/cdrom_id/cdrom_id.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index 0153af6633..e7a3e40a85 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -364,8 +364,14 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
if ((err != 0)) {
info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
- info(udev, "no current profile, assuming no media\n");
- return -1;
+ if (cd_media == 1) {
+ info(udev, "no current profile, but disc is present; assuming CD-ROM\n");
+ cd_media_cd_rom = 1;
+ return 0;
+ } else {
+ info(udev, "no current profile, assuming no media\n");
+ return -1;
+ }
};
cd_media = 1;