public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Michael Hunold <hunold@convergence.de>
Cc: Jeff Chua <jeffchua@silk.corp.fedex.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: GetASF failed on DVD authentication
Date: Fri, 2 Jan 2004 17:18:13 +0100	[thread overview]
Message-ID: <20040102161813.GA21852@suse.de> (raw)
In-Reply-To: <3FF5986C.8060806@convergence.de>

On Fri, Jan 02 2004, Michael Hunold wrote:
> Helloo
> 
> On 02.01.2004 15:25, Jeff Chua schrieb:
> >On Fri, 2 Jan 2004, Jens Axboe wrote:
> 
> >USB drive is a Pioneer DVR-SK11B-J. It's reported as ...
> >
> >scsi0 : SCSI emulation for USB Mass Storage devices
> >  Vendor: PIONEER   Model: DVD-RW  DVR-K11   Rev: 1.00
> >  Type:   CD-ROM                             ANSI SCSI revision: 02
> >
> >I've tried at least 2 other USB drives (Plextor PX-208U, and Sony CRX85U),
> >and both of these drives also exhibit the same problem.
> 
> >>>Linux version is 2.4.24-pre3.
> 
> >scsi0 : SCSI emulation for USB Mass Storage devices
> >  Vendor: PIONEER   Model: DVD-RW  DVR-K11   Rev: 1.00
> >  Type:   CD-ROM                             ANSI SCSI revision: 02
> >Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
> >sr0: scsi-1 drive
> 
> IMHO the problem is inside SCSI drive recognition system, which can be 
> found in "drivers/scsi/sr.c".
> 
> The function "get_capabilities()" tries to find out which type of drive 
> you have.
> 
> ---------------------------schnipp--------------------------------------
>     rc = sr_do_ioctl(i, cmd, buffer, 128, 1, SCSI_DATA_READ, NULL);
> 
>     if (rc) {
>         /* failed, drive doesn't have capabilities mode page */
>         scsi_CDs[i].cdi.speed = 1;
>         scsi_CDs[i].cdi.mask |= (CDC_CD_R | CDC_CD_RW | CDC_DVD_R |
>                      CDC_DVD | CDC_DVD_RAM |
>                      CDC_SELECT_DISC | CDC_SELECT_SPEED);
>         scsi_free(buffer, 512);
>         printk("sr%i: scsi-1 drive\n", i);
>         return;
>     }
> ---------------------------schnipp--------------------------------------
> 
> For my SCSI-2/USB drive, the above SCSI_DATA_READ command fails. As you 
> can see, in this case the driver thinks that your drive is SCSI-1, ie. a 
> CD-drive only. So DVD ioctls like the AGID commands will be filtered in 
> the lower levels, because a CD-driver does not understand them anyway.
> 
> Unfortunately, the driver only knows SCSI-1 and SCSI-3, so SCSI-2 DVD 
> driver are out of luck here and get downgraded to SCSI-1 CD-ROM stuff.
> 
> The patch below unmasks the DVD drive bit, ie. even if the kernel 
> misdetects your driver, it will allow DVD ioctls to be passed to your drive.
> 
> This is not a safe fix, but "it works for me"(tm). I don't know how to 
> really fix it; probably adding proper SCSI-2 support.
> 
> >Thanks,
> >Jeff
> 
> CU
> Michael.

> diff -ur linux-2.4.21/drivers/scsi/sr.c linux-2.4.21.patched/drivers/scsi/sr.c
> --- linux-2.4.21/drivers/scsi/sr.c	2003-06-13 16:51:36.000000000 +0200
> +++ linux-2.4.21.patched/drivers/scsi/sr.c	2003-08-27 23:52:32.000000000 +0200
> @@ -725,7 +725,7 @@
>  		/* failed, drive doesn't have capabilities mode page */
>  		scsi_CDs[i].cdi.speed = 1;
>  		scsi_CDs[i].cdi.mask |= (CDC_CD_R | CDC_CD_RW | CDC_DVD_R |
> -					 CDC_DVD | CDC_DVD_RAM |
> +					 /* USB-DVD-SCSI-2 hack: */ /* CDC_DVD | */  CDC_DVD_RAM |
>  					 CDC_SELECT_DISC | CDC_SELECT_SPEED);
>  		scsi_free(buffer, 512);
>  		printk("sr%i: scsi-1 drive\n", i);

Better yet, kill the silly checks instead.

===== drivers/cdrom/cdrom.c 1.41 vs edited =====
--- 1.41/drivers/cdrom/cdrom.c	Sat Sep 27 16:24:59 2003
+++ edited/drivers/cdrom/cdrom.c	Fri Jan  2 17:17:47 2004
@@ -2094,8 +2094,6 @@
 	case DVD_READ_STRUCT: {
 		dvd_struct *s;
 		int size = sizeof(dvd_struct);
-		if (!CDROM_CAN(CDC_DVD))
-			return -ENOSYS;
 		if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL)
 			return -ENOMEM;
 		cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 
@@ -2115,8 +2113,6 @@
 
 	case DVD_AUTH: {
 		dvd_authinfo ai;
-		if (!CDROM_CAN(CDC_DVD))
-			return -ENOSYS;
 		cdinfo(CD_DO_IOCTL, "entering DVD_AUTH\n"); 
 		IOCTL_IN(arg, dvd_authinfo, ai);
 		if ((ret = dvd_do_auth (cdi, &ai)))


-- 
Jens Axboe


  reply	other threads:[~2004-01-02 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02  8:28 GetASF failed on DVD authentication Jeff Chua
2004-01-02 10:39 ` Jens Axboe
2004-01-02 14:25   ` Jeff Chua
2004-01-02 14:38     ` Jens Axboe
2004-01-02 16:12     ` Michael Hunold
2004-01-02 16:18       ` Jens Axboe [this message]
2004-01-02 16:30         ` Jens Axboe
2004-01-03  0:35           ` Jeff Chua
2004-01-03  0:55             ` Jeff Chua
2004-01-03  1:48           ` Jeff Chua
2004-01-03  1:45       ` Jeff Chua

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=20040102161813.GA21852@suse.de \
    --to=axboe@suse.de \
    --cc=hunold@convergence.de \
    --cc=jeffchua@silk.corp.fedex.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox