summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorJan Drzewiecki <jonie@icpnet.pl>2010-08-31 00:37:28 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-08-31 00:41:35 +0200
commit5e267ea5a36de0b2a9a8965ca93dd45bbd6b1a8b (patch)
tree2b0e508be44b29eeac81a439e6308c4fa9d523e4 /extras
parent2458db3edd8d66827b34978ff471dff8f879e9ab (diff)
cdrom_id: Fix DVD blank detection for sloppy firmware
Reportedly, many CD drive firmwares will only consider the MSB in a READ command, thus if we request 17 blocks to be read, we'll actually only get 16 in many cases, and thus miss out the interesting sector #17. This would lead to falsely considering nonempty DVDs as blank. Fetch 32 blocks now, which should work everywhere. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/cdrom_id/cdrom_id.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index 8480d7b334..0153af6633 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -590,7 +590,7 @@ static int cd_media_info(struct udev *udev, int fd)
* always "complete", DVD-RAM are "other" or "complete" if the disc is
* write protected; we need to check the contents if it is blank */
if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) {
- unsigned char buffer[17 * 2048];
+ unsigned char buffer[32 * 2048];
unsigned char result, len;
int block, offset;
@@ -661,7 +661,7 @@ static int cd_media_info(struct udev *udev, int fd)
scsi_cmd_init(udev, &sc, buffer, sizeof(buffer));
scsi_cmd_set(udev, &sc, 0, 0x28);
scsi_cmd_set(udev, &sc, 5, 0);
- scsi_cmd_set(udev, &sc, 8, 17);
+ scsi_cmd_set(udev, &sc, 8, 32);
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer));
if ((err != 0)) {