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.
|
// The current device changed.
|
||||||
_callback->trigger_message(DSV_MSG_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;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ds_get_last_error() == SR_ERR_FIRMWARE_NOT_EXIST)
|
switch (lastError)
|
||||||
{
|
{
|
||||||
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_FIRMWARE_NOT_EXIST),
|
case SR_ERR_DEVICE_FIRMWARE_VERSION_LOW:{
|
||||||
"Firmware not exist!");
|
QString strMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_TO_RECONNECT_FOR_FIRMWARE),
|
||||||
_callback->delay_prop_msg(strMsg);
|
"Please reconnect the device!");
|
||||||
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),
|
|
||||||
"Device is busy!");
|
|
||||||
if (old_dev != NULL_HANDLE)
|
|
||||||
MsgBox::Show(strMsg);
|
|
||||||
else
|
|
||||||
_callback->delay_prop_msg(strMsg);
|
_callback->delay_prop_msg(strMsg);
|
||||||
return false;
|
ret = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
ret = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
ret = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
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)
|
bool SigSession::set_file(QString name)
|
||||||
|
@ -354,6 +354,10 @@
|
|||||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||||
"text": "设备被其它程序占用,切换失败!"
|
"text": "设备被其它程序占用,切换失败!"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "IDS_MSG_DEVICE_NO_DRIVER",
|
||||||
|
"text": "设备的驱动可能未安装!"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||||
"text": "未启用通道!"
|
"text": "未启用通道!"
|
||||||
|
@ -355,6 +355,10 @@
|
|||||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||||
"text": "The device is 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",
|
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||||
"text": "No channels enabled!"
|
"text": "No channels enabled!"
|
||||||
|
@ -335,7 +335,11 @@ static int hw_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
|
|||||||
if (ret != LIBUSB_SUCCESS){
|
if (ret != LIBUSB_SUCCESS){
|
||||||
sr_err("%s:%d, Failed to open device: %s, handle:%p",
|
sr_err("%s:%d, Failed to open device: %s, handle:%p",
|
||||||
__func__, __LINE__, libusb_error_name(ret), dev_handel);
|
__func__, __LINE__, libusb_error_name(ret), dev_handel);
|
||||||
ds_set_last_error(SR_ERR_DEVICE_IS_EXCLUSIVE);
|
|
||||||
|
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;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
//sr_info("------------Open returns the libusb_device_handle: %p, struct:%p", usb->devhdl, usb);
|
//sr_info("------------Open returns the libusb_device_handle: %p, struct:%p", usb->devhdl, usb);
|
||||||
|
@ -80,7 +80,8 @@ enum {
|
|||||||
SR_ERR_FIRMWARE_NOT_EXIST = 10, /**< The firmware file is not exist.*/
|
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_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_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
|
* Note: When adding entries here, don't forget to also update the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user