* [PATCH] DVD-R capability flag set incorrectly, /proc formatting fix
@ 2004-02-09 23:26 John McKell
2004-02-10 8:52 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: John McKell @ 2004-02-09 23:26 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-scsi
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.
In linux-2.6.2 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.
---John McKell, Iomega Corp
diff -Nurp linux-2.6.2/drivers/scsi/sr.c linux/drivers/scsi/sr.c
--- linux-2.6.2/drivers/scsi/sr.c 2004-02-03 20:43:19.000000000 -0700
+++ linux/drivers/scsi/sr.c 2004-02-09 13:59:10.000000000 -0700
@@ -795,10 +795,9 @@ static void get_capabilities(struct scsi
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;
diff -Nurp linux-2.6.2/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c
--- linux-2.6.2/drivers/cdrom/cdrom.c 2004-02-05 14:30:46.000000000 -0700
+++ linux/drivers/cdrom/cdrom.c 2004-02-09 13:58:21.000000000 -0700
@@ -2740,13 +2740,13 @@ int cdrom_sysctl_info(ctl_table *ctl, in
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");
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] DVD-R capability flag set incorrectly, /proc formatting fix
2004-02-09 23:26 [PATCH] DVD-R capability flag set incorrectly, /proc formatting fix John McKell
@ 2004-02-10 8:52 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2004-02-10 8:52 UTC (permalink / raw)
To: John McKell; +Cc: linux-scsi
On Mon, Feb 09 2004, John McKell wrote:
> 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.
>
> In linux-2.6.2 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.
>
> ---John McKell, Iomega Corp
>
> diff -Nurp linux-2.6.2/drivers/scsi/sr.c linux/drivers/scsi/sr.c
> --- linux-2.6.2/drivers/scsi/sr.c 2004-02-03 20:43:19.000000000 -0700
> +++ linux/drivers/scsi/sr.c 2004-02-09 13:59:10.000000000 -0700
> @@ -795,10 +795,9 @@ static void get_capabilities(struct scsi
> 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;
Good spotting, that's surely a bug!
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-10 8:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-09 23:26 [PATCH] DVD-R capability flag set incorrectly, /proc formatting fix John McKell
2004-02-10 8:52 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox