mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Cath the error about driver have not installed
This commit is contained in:
parent
d17440a862
commit
7b0d79d6c4
@ -257,42 +257,53 @@ namespace pv
|
||||
// The current device changed.
|
||||
_callback->trigger_message(DSV_MSG_CURRENT_DEVICE_CHANGED);
|
||||
|
||||
if (ds_get_last_error() == SR_ERR_DEVICE_FIRMWARE_VERSION_LOW)
|
||||
int lastError = ds_get_last_error();
|
||||
bool ret = true;
|
||||
|
||||
switch (lastError)
|
||||
{
|
||||
case SR_ERR_DEVICE_FIRMWARE_VERSION_LOW:{
|
||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_TO_RECONNECT_FOR_FIRMWARE),
|
||||
"Please reconnect the device!");
|
||||
_callback->delay_prop_msg(strMsg);
|
||||
return false;
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ds_get_last_error() == SR_ERR_FIRMWARE_NOT_EXIST)
|
||||
{
|
||||
case SR_ERR_FIRMWARE_NOT_EXIST:{
|
||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_FIRMWARE_NOT_EXIST),
|
||||
"Firmware not exist!");
|
||||
_callback->delay_prop_msg(strMsg);
|
||||
return false;
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ds_get_last_error() == SR_ERR_DEVICE_USB_IO_ERROR)
|
||||
{
|
||||
case 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;
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ds_get_last_error() == SR_ERR_DEVICE_IS_EXCLUSIVE)
|
||||
{
|
||||
case SR_ERR_DEVICE_IS_EXCLUSIVE:{
|
||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DEVICE_BUSY_SWITCH_FAILED),
|
||||
"Device is busy!");
|
||||
if (old_dev != NULL_HANDLE)
|
||||
MsgBox::Show(strMsg);
|
||||
else
|
||||
_callback->delay_prop_msg(strMsg);
|
||||
return false;
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
case SR_ERR_DEVICE_NO_DRIVER:
|
||||
{
|
||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DEVICE_NO_DRIVER),
|
||||
"No driver!");
|
||||
_callback->delay_prop_msg(strMsg);
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SigSession::set_file(QString name)
|
||||
|
@ -354,6 +354,10 @@
|
||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||
"text": "设备被其它程序占用,切换失败!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_NO_DRIVER",
|
||||
"text": "设备的驱动可能未安装!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||
"text": "未启用通道!"
|
||||
|
@ -355,6 +355,10 @@
|
||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||
"text": "The device is busy, switch failed!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_NO_DRIVER",
|
||||
"text": "The device driver may not be installed!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||
"text": "No channels enabled!"
|
||||
|
@ -335,6 +335,10 @@ static int hw_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
|
||||
if (ret != LIBUSB_SUCCESS){
|
||||
sr_err("%s:%d, Failed to open device: %s, handle:%p",
|
||||
__func__, __LINE__, libusb_error_name(ret), dev_handel);
|
||||
|
||||
if (ret == LIBUSB_ERROR_NOT_SUPPORTED)
|
||||
ds_set_last_error(SR_ERR_DEVICE_NO_DRIVER);
|
||||
else
|
||||
ds_set_last_error(SR_ERR_DEVICE_IS_EXCLUSIVE);
|
||||
return SR_ERR;
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ 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.*/
|
||||
SR_ERR_DEVICE_USB_IO_ERROR = 13, /**< The usb io error.*/
|
||||
SR_ERR_DEVICE_NO_DRIVER = 14, /**< The device have no driver.*/
|
||||
|
||||
/*
|
||||
* Note: When adding entries here, don't forget to also update the
|
||||
|
Loading…
x
Reference in New Issue
Block a user