@@ -332,7 +332,7 @@ static void _transfer_start(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt, u32
|
||||
_flush_endpoint(bulk_ctxt->bulk_in);
|
||||
}
|
||||
else if (bulk_ctxt->bulk_in_status == USB2_ERROR_XFER_NOT_ALIGNED)
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#EP IN缓冲区未对齐!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#EP IN缓冲区未对齐");
|
||||
|
||||
if (sync_timeout)
|
||||
bulk_ctxt->bulk_in_buf_state = BUF_STATE_EMPTY;
|
||||
@@ -364,7 +364,7 @@ static void _transfer_out_big_read(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctx
|
||||
|
||||
if (bulk_ctxt->bulk_out_status == USB_ERROR_XFER_ERROR)
|
||||
{
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#EP OUT传输!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#EP OUT传输");
|
||||
_flush_endpoint(bulk_ctxt->bulk_out);
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ static int _scsi_read(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
}
|
||||
if (lba_offset >= ums->lun.num_sectors)
|
||||
{
|
||||
ums->set_text(ums->label, "#FF8000 警告:#读 - 超出范围!主机通知。");
|
||||
ums->set_text(ums->label, "#FF8000 警告:#读取 - 超出范围!已通知主机。");
|
||||
ums->lun.sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -515,7 +515,7 @@ static int _scsi_read(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
// If an error occurred, report it and its position.
|
||||
if (!amount)
|
||||
{
|
||||
ums->set_text(ums->label, "#FFDD00 错误:# SDMMC读!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:# SDMMC读取!");
|
||||
ums->lun.sense_data = SS_UNRECOVERED_READ_ERROR;
|
||||
ums->lun.sense_data_info = lba_offset;
|
||||
ums->lun.info_valid = 1;
|
||||
@@ -553,7 +553,7 @@ static int _scsi_write(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
|
||||
if (ums->lun.ro)
|
||||
{
|
||||
ums->set_text(ums->label, "#FF8000 警告:#写 - 只读!主机通知。");
|
||||
ums->set_text(ums->label, "#FF8000 警告:#写入 - 只读!已通知主机。");
|
||||
ums->lun.sense_data = SS_WRITE_PROTECTED;
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -577,7 +577,7 @@ static int _scsi_write(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
// Check that starting LBA is not past the end sector offset.
|
||||
if (lba_offset >= ums->lun.num_sectors)
|
||||
{
|
||||
ums->set_text(ums->label, "#FF8000 警告:#写 - 超出范围!主机通知。");
|
||||
ums->set_text(ums->label, "#FF8000 警告:#写入 - 超出范围!已通知主机。");
|
||||
ums->lun.sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -599,7 +599,7 @@ static int _scsi_write(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
|
||||
if (usb_lba_offset >= ums->lun.num_sectors)
|
||||
{
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#写 - 超出最后扇区!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#写入 - 超出最后扇区!");
|
||||
ums->lun.sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
ums->lun.sense_data_info = usb_lba_offset;
|
||||
ums->lun.info_valid = 1;
|
||||
@@ -627,7 +627,7 @@ static int _scsi_write(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
ums->lun.sense_data_info = lba_offset;
|
||||
ums->lun.info_valid = 1;
|
||||
|
||||
s_printf(txt_buf, "#FFDD00 错误:#写 - 通讯失败 %d!", bulk_ctxt->bulk_out_status);
|
||||
s_printf(txt_buf, "#FFDD00 错误:#写入 - 通讯失败 %d!", bulk_ctxt->bulk_out_status);
|
||||
ums->set_text(ums->label, txt_buf);
|
||||
break;
|
||||
}
|
||||
@@ -665,7 +665,7 @@ DPRINTF("file write %X @ %X\n", amount, lba_offset);
|
||||
// If an error occurred, report it and its position.
|
||||
if (!amount)
|
||||
{
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#SDMMC写!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#SDMMC写入!");
|
||||
ums->lun.sense_data = SS_WRITE_ERROR;
|
||||
ums->lun.sense_data_info = lba_offset;
|
||||
ums->lun.info_valid = 1;
|
||||
@@ -676,7 +676,7 @@ DPRINTF("file write %X @ %X\n", amount, lba_offset);
|
||||
// Did the host decide to stop early?
|
||||
if (bulk_ctxt->bulk_out_length_actual < bulk_ctxt->bulk_out_length)
|
||||
{
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#写空!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#空写入");
|
||||
ums->short_packet_received = 1;
|
||||
break;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ static int _scsi_verify(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
u32 lba_offset = get_array_be_to_le32(&ums->cmnd[2]);
|
||||
if (lba_offset >= ums->lun.num_sectors)
|
||||
{
|
||||
ums->set_text(ums->label, "#FF8000 警告:#验证 - 超出范围!主机通知。");
|
||||
ums->set_text(ums->label, "#FF8000 警告:#校验 - 超出范围!已通知主机。");
|
||||
ums->lun.sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -1060,7 +1060,7 @@ static int _scsi_start_stop(usbd_gadget_ums_t *ums)
|
||||
// Check if we are allowed to unload the media.
|
||||
if (ums->lun.prevent_medium_removal)
|
||||
{
|
||||
ums->set_text(ums->label, "#C7EA46 状态:#卸载尝试被阻止");
|
||||
ums->set_text(ums->label, "#C7EA46 状态:#卸载尝试已被阻止");
|
||||
ums->lun.sense_data = SS_MEDIUM_REMOVAL_PREVENTED;
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -1468,7 +1468,7 @@ static int _finish_reply(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
{
|
||||
_set_ep_stall(bulk_ctxt->bulk_out);
|
||||
rc = _set_ep_stall(bulk_ctxt->bulk_in);
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#方向不明。两端EP都停了!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#方向不明。两端EP已暂停!");
|
||||
} // Else do nothing.
|
||||
break;
|
||||
|
||||
@@ -1489,7 +1489,7 @@ static int _finish_reply(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
{
|
||||
_transfer_start(ums, bulk_ctxt, bulk_ctxt->bulk_in, USB_XFER_SYNCED_DATA);
|
||||
rc = _set_ep_stall(bulk_ctxt->bulk_in);
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#数据残留。EP IN停止!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#数据残留。EP IN已停止!");
|
||||
}
|
||||
else
|
||||
rc = _pad_with_zeros(ums, bulk_ctxt);
|
||||
@@ -1633,7 +1633,7 @@ static int _received_cbw(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||
{
|
||||
_set_ep_stall(bulk_ctxt->bulk_out);
|
||||
_set_ep_stall(bulk_ctxt->bulk_in);
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#CBW未知 - 两端EP都停了!");
|
||||
ums->set_text(ums->label, "#FFDD00 错误:#CBW未知 - 两端EP已停止!");
|
||||
}
|
||||
|
||||
return UMS_RES_INVALID_ARG;
|
||||
@@ -1826,7 +1826,7 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||
xusb_device_get_ops(&usb_ops);
|
||||
}
|
||||
|
||||
usbs->set_text(usbs->label, "#C7EA46 状态:#开启USB");
|
||||
usbs->set_text(usbs->label, "#C7EA46 状态:#USB已开启");
|
||||
|
||||
if (usb_ops.usb_device_init())
|
||||
{
|
||||
@@ -1857,7 +1857,7 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||
ums.set_text = usbs->set_text;
|
||||
ums.system_maintenance = usbs->system_maintenance;
|
||||
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#挂载磁盘");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#磁盘挂载中");
|
||||
|
||||
// Initialize sdmmc.
|
||||
if (usbs->type == MMC_SD)
|
||||
@@ -1888,18 +1888,18 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||
ums.lun.storage = &emmc_storage;
|
||||
}
|
||||
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#等待连接");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#连接等待中");
|
||||
|
||||
// Initialize Control Endpoint.
|
||||
if (usb_ops.usb_device_enumerate(USB_GADGET_UMS))
|
||||
goto usb_enum_error;
|
||||
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#等待LUN");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#LUN等待中");
|
||||
|
||||
if (usb_ops.usb_device_class_send_max_lun(0)) // One device for now.
|
||||
goto usb_enum_error;
|
||||
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#开启UMS");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#UMS已开启");
|
||||
|
||||
// If partition sectors are not set get them from hardware.
|
||||
if (!ums.lun.num_sectors)
|
||||
@@ -1920,7 +1920,7 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||
{
|
||||
// Check if we are allowed to unload the media.
|
||||
if (ums.lun.prevent_medium_removal)
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#卸载尝试被阻止");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#卸载尝试已被阻止");
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -1952,13 +1952,13 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||
} while (ums.state != UMS_STATE_TERMINATED);
|
||||
|
||||
if (ums.lun.prevent_medium_removal)
|
||||
ums.set_text(ums.label, "#FFDD00 错误:#磁盘不安全弹出");
|
||||
ums.set_text(ums.label, "#FFDD00 错误:#磁盘已未安全弹出");
|
||||
else
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#磁盘弹出");
|
||||
ums.set_text(ums.label, "#C7EA46 状态:#磁盘已弹出");
|
||||
goto exit;
|
||||
|
||||
usb_enum_error:
|
||||
ums.set_text(ums.label, "#FFDD00 错误:#超时或取消!");
|
||||
ums.set_text(ums.label, "#FFDD00 错误:#超时或已取消!");
|
||||
res = 1;
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user