Re: [PATCH 2/2] usb-storage: Add new no_read_disc_info quirk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 29, 2010 at 12:59:05PM +0200, Hans de Goede wrote:
> Appotech ax3003 (the larger brother of the ax203) based devices are even
> more buggy then the ax203. They will go of into lala land when ever they
> see a READ_DISC_INFO scsi command. So add a new US_FL which filters out
> READ_DISC_INFO scsi commands.
> 
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index e9f9954..76708da 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -58,6 +58,7 @@
>  #include <linux/kthread.h>
>  #include <linux/mutex.h>
>  #include <linux/utsname.h>
> +#include <linux/cdrom.h>
>  
>  #include <scsi/scsi.h>
>  #include <scsi/scsi_cmnd.h>
> @@ -332,6 +333,17 @@ static int usb_stor_control_thread(void * __us)
>  			us->srb->result = SAM_STAT_GOOD;
>  		}
>  
> +		/* Some cdrom faking devices cannot handle READ_DISC_INFO */
> +		else if ((us->srb->cmnd[0] == GPCMD_READ_DISC_INFO) &&
> +			    (us->fflags & US_FL_NO_READ_DISC_INFO)) {
> +			memset(us->srb->sense_buffer, 0, 18);
> +			us->srb->sense_buffer[0] = 0x70;  /* current error */
> +			us->srb->sense_buffer[2] = ILLEGAL_REQUEST;
> +			us->srb->sense_buffer[7] = 0x0a;  /* additional len */
> +			us->srb->sense_buffer[12] = 0x20; /* ASC */
> +			us->srb->result = SAM_STAT_CHECK_CONDITION;
> +		}
> +
>  		/* we've got a command, let's do it! */
>  		else {
>  			US_DEBUG(usb_stor_show_command(us->srb));

This approach seems like a bad idea.  Trying to interpret command bytes
in-flight is always problematic, and I prefer to avoid it as much as
possible.

It would be much cleaner to do this with a flag in the sdev, like we do
with various MODE_SENSE commands, capacity heuristics, and a few other
commands.  usb-storage will set a bit in a SCSI structure, and the
high-level SCSI driver (in this case, sr_mod) will check that bit before
issuing the offending command.

Thus, we can re-use this bit for sbp2 or any other transports which might
need it.  If Windows really doesn't use this command, then it is likely we
will see this problem on other interfaces.

Matt

-- 
Matthew Dharm                              Home: mdharm-usb@xxxxxxxxxxxxxxxxxx 
Maintainer, Linux USB Mass Storage Driver

P:  How about "Web Designer"?
DP: I'd like a name that people won't laugh at.
					-- Pitr and Dust Puppy
User Friendly, 12/6/1997

Attachment: pgpf14ERvvtBs.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux