From: Jens Axboe <axboe@suse.de>
To: Pat LaVarre <p.lavarre@ieee.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2.4] rewritable USB DVD-RAM vs. mode sense op choice
Date: Mon, 23 Aug 2004 17:48:51 +0200 [thread overview]
Message-ID: <20040823154850.GC2301@suse.de> (raw)
In-Reply-To: <1092673789.4297.7.camel@patlinux.iomegacorp.com>
On Mon, Aug 16 2004, Pat LaVarre wrote:
> Jens A:
>
> 2.4.26 and 2.4.27 strace of dd of=, mount -w, etc. chokes via EROFS for
> USB DVD-RAM. 2.4.25 I have not tried.
>
> This small patch substitutes the MMC op x5A "MODE SENSE (10)" for the op
> x1A that in t10.org PDT x05 is vendor-specific. Such consideration
> persuades a standard DVD-RAM drive to admit it rewrites DVD-RAM discs.
>
> Revising the CDB alone of course does not suffice: we also have to step
> past a different size of data in header.
>
> Pat LaVarre
>
> diff -urp linux-2.4.27/drivers/scsi/sr.c linux-2.4.27-pel/drivers/scsi/sr.c
> --- linux-2.4.27/drivers/scsi/sr.c 2003-06-13 08:51:36.000000000 -0600
> +++ linux-2.4.27-pel/drivers/scsi/sr.c 2004-08-16 10:08:37.000000000 -0600
> @@ -691,7 +691,7 @@ void get_sectorsize(int i)
>
> void get_capabilities(int i)
> {
> - unsigned char cmd[6];
> + unsigned char cmd[16];
> unsigned char *buffer;
> int rc, n;
>
> @@ -713,12 +713,12 @@ void get_capabilities(int i)
> printk(KERN_ERR "sr: out of memory.\n");
> return;
> }
> - cmd[0] = MODE_SENSE;
> + memset(cmd, '\0', sizeof cmd);
memset(cmd, 0, sizeof(cmd));
> + cmd[0] = MODE_SENSE_10;
> cmd[1] = (scsi_CDs[i].device->scsi_level <= SCSI_2) ?
> ((scsi_CDs[i].device->lun << 5) & 0xe0) : 0;
> cmd[2] = 0x2a;
> - cmd[4] = 128;
> - cmd[3] = cmd[5] = 0;
> + cmd[8] = 128;
> rc = sr_do_ioctl(i, cmd, buffer, 128, 1, SCSI_DATA_READ, NULL);
This gives me a bad vibe - I'm assuming your device is failing the
6-byte mode sense? This has to work with devices that don't support
MODE_SENSE_10, if you want it to work for you as well, then make the
MODE_SENSE_10 a fall back when MODE_SENSE fails. You cannot rely on the
change you made.
--
Jens Axboe
next prev parent reply other threads:[~2004-08-23 15:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-16 16:29 [PATCH 2.4] rewritable USB DVD-RAM vs. mode sense op choice Pat LaVarre
2004-08-23 15:48 ` Jens Axboe [this message]
2004-08-23 16:46 ` Pat LaVarre
2004-08-23 17:12 ` Jens Axboe
2004-08-23 17:24 ` Pat LaVarre
2004-08-23 22:45 ` Pat LaVarre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040823154850.GC2301@suse.de \
--to=axboe@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=p.lavarre@ieee.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.