/* Step 2 of the initialization of a USB MSC device Decode the setup request GET_MAX_LUN and allocs LUN structures.  */
static void uhi_msc_enable_step2(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
/* Step 2 of the initialization of a USB MSC device Decode the setup request GET_MAX_LUN and allocs LUN structures.  */
static void uhi_msc_enable_step2(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
{
	UNUSED(add);
	if (status == UHD_TRANS_NOERROR) {
		if (payload_trans) {
			uhi_msc_dev_sel->nb_lun++;
		} else {
			uhi_msc_dev_sel->nb_lun = 1;
		}
	} else if (status == UHD_TRANS_STALL) {
		uhi_msc_dev_sel->nb_lun = 1;
	} else {
		b_uhi_msc_free = true;
		return;
	}
	uhi_msc_dev_sel->lun = malloc(uhi_msc_dev_sel->nb_lun*sizeof(uhi_msc_lun_t));
	if (uhi_msc_dev_sel->lun == NULL) {
		Assert(false);
		b_uhi_msc_free = true;
		return;
	}
	uhi_msc_lun_num_sel = (uint8_t) - 1;
	uhi_msc_enable_step3();
}