Skip to content

USBD MSC does not support more than 2 luns #4

@xu-yingjing

Description

@xu-yingjing

Hello,

In the function MSC_BOT_CBW_Decode() of the file usbd_msc_bot.c, there is the following judgment:

  if ((USBD_LL_GetRxDataSize(pdev, MSCOutEpAdd) != USBD_BOT_CBW_LENGTH) ||
      (hmsc->cbw.dSignature != USBD_BOT_CBW_SIGNATURE) ||
      (hmsc->cbw.bLUN > 1U) || (hmsc->cbw.bCBLength < 1U) ||
      (hmsc->cbw.bCBLength > 16U))
  {
    SCSI_SenseCode(pdev, hmsc->cbw.bLUN, ILLEGAL_REQUEST, INVALID_CDB);

    hmsc->bot_status = USBD_BOT_STATUS_ERROR;
    MSC_BOT_Abort(pdev);
  }
  else
  {
    /* ... */
  }

As shown in the above code, when (hmsc->cbw.bLUN > 1U) is established, it will be judged as an illegal request. Therefore, the legal value of hmsc->cbw.bLUN can only be 0 or 1. For this reason, USBD MSC can only support a maximum of 2 luns.

Why not add a MSC configuration macro definition in the file usbd_conf_template.h to configure the maximum number of luns supported?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestinternal bug trackerIssue confirmed and logged into the internal bug tracking systemmwMW-related issue or pull-requestspotted before customerSpotted internally before being pointed out by the user but not yet fixed or publishedusbUniversal Serial BuswontfixThis will not be worked on

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions