Re: [PATCH] mass storage : emulation of sat scsi_pass_thru with ATACB

From: Matthew Dharm
Date: Sun Mar 09 2008 - 14:46:13 EST


On Sun, Mar 09, 2008 at 09:21:40AM +0100, matthieu castet wrote:
> Hum, may be to avoid confusion with a new protocol handler, I can add my
> hook in usb_stor_control_thread with a new flag.
>
> Something like :
> [...]
> /* Handle those devices which need us to fake
> * their inquiry data */
> else if ((us->srb->cmnd[0] == INQUIRY) &&
> (us->flags & US_FL_FIX_INQUIRY)) {
> [...]
> else if (( (us->srb->cmnd[0] == ATA_12) || (us->srb->cmnd[0] ==
> ATA_16)) &&
> (us->flags & US_FL_CYPRESS_ATACB)) {
> US_DEBUGP("emulating ATA pass thru\n");
> call to emulate_pass_thru_with_atacb code
> }
>
> /* we've got a command, let's do it! */
> else {
> US_DEBUG(usb_stor_show_command(us->srb));
> us->proto_handler(us->srb, us);
> }
>
> Does it sound better ?

Somewhat better. I still like a separate protocol handler better.

I guess I see this as being more like the ISD200 case. In that code, it
attempts to identify the device as ATA or ATAPI. If it's ATAPI, it
switches back to the transparent scsi protocol handler. Here, we're just
talking about doing it on a command-by-command basis, instead of a one-time
selection. But there is no confusion that the ISD200 code handles all
commands; but it does implement a new 'protocol' (a way to transport
commands to/from the device), which is exactly what you're doing.

Matt

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

I'm seen in many forms. Now open your mouth. It's caffeine time.
-- Cola Man to Greg
User Friendly, 10/28/1998

Attachment: pgp00000.pgp
Description: PGP signature