]> git.hungrycats.org Git - linux/commitdiff
[PATCH] DVD-R capability flag set incorrectly, /proc formatting fix
authorJens Axboe <axboe@suse.de>
Tue, 10 Feb 2004 00:45:59 +0000 (16:45 -0800)
committerJens Axboe <axboe@suse.de>
Tue, 10 Feb 2004 00:45:59 +0000 (16:45 -0800)
From John McKell <mckellj@iomega.com>:

  This patch for scsi/sr.c and cdrom/cdrom.c persuades
  /proc/sys/dev/cdrom/info to report that connecting a drive via USB
  rather than ATAPI in fact does not make it able to write DVD-R.

  Without this patch, when sr0 and hdd are the same type of device
  connected via USB and ATAPI respectively, I see:

$ cat /proc/sys/dev/cdrom/info:
drive name:             sr1     sr0     hdd
...
Can write CD-R:         1       0       0
Can write CD-RW:        1       0       0
Can read DVD:           0       0       0
Can write DVD-R:        1       1       0
Can write DVD-RAM:      0       0       0
Can read MRW:           0               0               0
Can write MRW:          0               0               0

  With this patch applied, instead I see:

$ cat /proc/sys/dev/cdrom/info:
drive name:             sr1     sr0     hdd
...
Can write CD-R:         1       0       0
Can write CD-RW:        1       0       0
Can read DVD:           0       0       0
Can write DVD-R:        0       0       0
Can write DVD-RAM:      0       0       0
Can read MRW:           0       0       0
Can write MRW:          0       0       0

  The sr1 device in particular is an ordinary CD-RW that in fact cannot
  write DVD-R.

  While messing with this code, I also thought to tweak the /proc
  formatting to align the tabbed columns.

drivers/cdrom/cdrom.c
drivers/scsi/sr.c

index a90e036155766690c4b4d5d95f8fce4ccb218602..79974e6af42e079b205f0dc73a40c11ba286fde9 100644 (file)
@@ -2766,13 +2766,13 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
        for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
            pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_DVD_RAM) != 0);
 
-       pos += sprintf(info+pos, "\nCan read MRW:");
+       pos += sprintf(info+pos, "\nCan read MRW:\t");
        for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
-           pos += sprintf(info+pos, "\t\t%d", CDROM_CAN(CDC_MRW) != 0);
+           pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_MRW) != 0);
 
-       pos += sprintf(info+pos, "\nCan write MRW:");
+       pos += sprintf(info+pos, "\nCan write MRW:\t");
        for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
-           pos += sprintf(info+pos, "\t\t%d", CDROM_CAN(CDC_MRW_W) != 0);
+           pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_MRW_W) != 0);
 
        strcpy(info+pos,"\n\n");
                
index 520cce3005b1a5587cb9fdda5785ea561ceb7553..a07a69c0c5cfdd9ae3c35253fdb819584587a4bd 100644 (file)
@@ -798,10 +798,9 @@ static void get_capabilities(struct scsi_cd *cd)
        if ((buffer[n + 2] & 0x8) == 0)
                /* not a DVD drive */
                cd->cdi.mask |= CDC_DVD;
-       if ((buffer[n + 3] & 0x20) == 0) {
+       if ((buffer[n + 3] & 0x20) == 0) 
                /* can't write DVD-RAM media */
                cd->cdi.mask |= CDC_DVD_RAM;
-       } else
        if ((buffer[n + 3] & 0x10) == 0)
                /* can't write DVD-R media */
                cd->cdi.mask |= CDC_DVD_R;