On Mon, 13 Oct 2014 07:14:39 -0700
Matthew Dharm <mdharm-...@one-eyed-alien.net> wrote:

> Is there a constant we can pull from a SCSI header, instead of having
> a "magic number" in the code?

I don't know, but it would probably be in a USB-related header; isn't the
4-bits-for-LUN a USB mass storage bulk only thing?

I guess you could add a couple of new defines, something like
    #define BOT_LUNbits 4
    #define BOT_LUNmask ((1 << BOT_LUNbits) - 1)

In the patch I posted the condition could be
    <= BOT_LUNmask
or
    & ~BOT_LUNmask

They could also be used in usb_Stor_Bulk_transport() like this:
        bcb->Lun = srb->device->lun;
        if (us->fflags & US_FL_SCM_MULT_TARG)
                bcb->Lun |= srb->device->id << BOT_LUNbits;
        bcb->Length = srb->cmd_len;
        ...
        usb_stor_dbg(us, "Bulk Command S 0x%x T 0x%x L %d F %d Trg %d LUN %d CL 
%d\n",
                     le32_to_cpu(bcb->Signature), bcb->Tag,
                     le32_to_cpu(bcb->DataTransferLength), bcb->Flags,
                     (bcb->Lun >> BOT_LUNbits), (bcb->Lun & BOT_LUNmask),
                     bcb->Length);

Though IMO it would be clearer in the call to usb_stor_dbg to use
    srb->device->id   instead of  (bcb->Lun >> BOT_LUNbits)
and
    srb->device->lun  instead of  (bcb->Lun & BOT_LUNmask)


Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to