The error message for USB io error!

This commit is contained in:
dreamsourcelabTAI 2023-06-19 19:10:07 +08:00
parent 252e00667b
commit 7307b16dee
5 changed files with 28 additions and 2 deletions

View File

@ -268,6 +268,14 @@ namespace pv
return false;
}
if (ds_get_last_error() == SR_ERR_DEVICE_USB_IO_ERROR)
{
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DEVICE_USB_IO_ERROR),
"USB io error!");
_callback->delay_prop_msg(strMsg);
return false;
}
if (ds_get_last_error() == SR_ERR_DEVICE_IS_EXCLUSIVE)
{
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DEVICE_BUSY_SWITCH_FAILED),

View File

@ -373,5 +373,9 @@
{
"id": "IDS_MSG_FIRMWARE_NOT_EXIST",
"text": "错误: 固件文件不存在!"
},
{
"id": "IDS_MSG_DEVICE_USB_IO_ERROR",
"text": "Error: USB读写错误!"
}
]

View File

@ -374,5 +374,9 @@
{
"id": "IDS_MSG_FIRMWARE_NOT_EXIST",
"text": "Error: Firmware file is not exist!"
},
{
"id": "IDS_MSG_DEVICE_USB_IO_ERROR",
"text": "Error: USB IO error!"
}
]

View File

@ -327,7 +327,8 @@ static int hw_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
sr_info("Open usb device instance, handle: %p", dev_handel);
if (libusb_open(dev_handel, &usb->devhdl) != 0){
ret = libusb_open(dev_handel, &usb->devhdl);
if (ret != LIBUSB_SUCCESS){
sr_err("Failed to open device: %s, handle:%p",
libusb_error_name(ret), dev_handel);
return SR_ERR;
@ -1915,7 +1916,15 @@ SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboo
ret = dsl_wr_reg(sdi, CTR0_ADDR, bmNONE); // dessert clear
/* Check HDL version */
ret = dsl_hdl_version(sdi, &hw_info);
if ((ret != SR_OK) || (hw_info != DSL_HDL_VERSION)) {
if ((ret != SR_OK)) {
sr_err("%s: Failed to get FPGA bin version!", __func__);
ds_set_last_error(SR_ERR_DEVICE_USB_IO_ERROR);
sdi->status = SR_ST_INACTIVE;
return SR_ERR;
}
if (hw_info != DSL_HDL_VERSION) {
sr_err("%s: HDL verison incompatible!", __func__);
ds_set_last_error(SR_ERR_DEVICE_FIRMWARE_VERSION_LOW);
sdi->status = SR_ST_INCOMPATIBLE;

View File

@ -80,6 +80,7 @@ enum {
SR_ERR_FIRMWARE_NOT_EXIST = 10, /**< The firmware file is not exist.*/
SR_ERR_DEVICE_IS_EXCLUSIVE = 11, /**< The device is exclusive by other process.*/
SR_ERR_DEVICE_FIRMWARE_VERSION_LOW = 12, /**< The firmware version is too low.*/
SR_ERR_DEVICE_USB_IO_ERROR = 13, /**< THe use io error.*/
/*
* Note: When adding entries here, don't forget to also update the