Re: [usb-storage] [Merging ATA passthru] on integrating SMART/ATA-Security in usb-storage driver

Matthew Dharm
2005-11-07T16:59:55Z

[-- Attachment #1: Type: text/plain, Size: 2754 bytes --]

On Sun, Nov 06, 2005 at 03:52:13PM -0800, Patrick Mansfield wrote:
> Black listing would cover more cases than adding back the SG_IO flag.
>
> Black listing USB devices is somewhat bad/tricky, since they often don't
> show up with registered vendor + model names, and use somewhat generic
> names, for example I have an xd reader that has vendor "Generic", model
> "STORAGE DEVICE".
>
> So either the hardware is stupid, or usb-storage generates those names and
> maybe everything is OK (simple search finds nothing in usb storage code).

The hardware is stupid. Really, I'm not that stupid, even on my worst day.

It's worse than that, actually. I've seen devices where the VID/PID is
that of the USB/IDE bridge vendor, and the INQUIRY gives "Generic".
There's really no way to programmatically distinguish one device from
another with high reliability.

> We do have some of those name in the current scsi devinfo table ... I haven't
> looked for details on them or tried to figure out if they hurt any
> devices.
>
> Other potential methods besides black list based on vendor + model:
>
> 1) If (big if, i.e. unlikely) USB devices in general don't need
> the LUN in the cdb, we could black list all USB to skip the storing of it.

Nope. It's pretty common to see 5/6/7-in-one media readers which are
multi-LUN.

> The majority of the (single LUN) USB devices probably never look
> at the field, so perhaps we could refine the above to:
>
> 2) Black list all usb devices that don't have multiple LUNs, assuming the
> never check the cdb for a LUN value.

Iffy. Some single-LUN devices look at the LUN field, some don't. I'd say
it's about a 60/40 split.

> I don't know if you can tell (in usb code) if usb mass storage is
> multi-lun or not without scanning for the other LUNs (normal SCSI devices
> would have to be scanned or sent a REPORT LUNS, and even then, they could
> show up with more LUNs in the future).

For the vast majority of USB storage devices (but not all), you can
determine this pretty well. BBB devices support a GetMaxLUN command --
usb-storage uses it to set an internal variable, but it could be passed
elsewhere.

> 3) black list via usb storage based on usb id's, kind of like the handling
> in usb slave_configure for USB_VENDOR_ID_GENESYS, though a more general
> method would be better.

See my response to #1 above. Vendors are, apparently, stupid -- at least
when it comes to making sure devices distinguish themselves in a nice
manner.

Matt

--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver

We can customize our colonels.
-- Tux
User Friendly, 12/1/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]