forked from Ivasoft/DSView
Able to popup the error message about the usb speed is too low
This commit is contained in:
@@ -1952,7 +1952,11 @@ namespace pv
|
||||
|
||||
case DS_EV_INACTIVE_DEVICE_DETACH:
|
||||
_callback->trigger_message(DSV_MSG_DEVICE_LIST_UPDATED); // Update list only.
|
||||
break;
|
||||
break;
|
||||
|
||||
case DS_EV_DEVICE_SPEED_NOT_MATCH:
|
||||
_callback->trigger_message(DS_EV_DEVICE_SPEED_NOT_MATCH);
|
||||
break;
|
||||
|
||||
default:
|
||||
dsv_err("%s", "Error!Unknown device event.");
|
||||
@@ -2112,6 +2116,13 @@ namespace pv
|
||||
|
||||
case DSV_MSG_COLLECT_END:
|
||||
break;
|
||||
|
||||
case DS_EV_DEVICE_SPEED_NOT_MATCH:
|
||||
{
|
||||
QString strMsg(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DEVICE_SPEED_TOO_LOW), "Speed too low!"));
|
||||
_callback->delay_prop_msg(strMsg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,5 +365,9 @@
|
||||
{
|
||||
"id": "IDS_MSG_TO_CLEAR_LOG",
|
||||
"text": "您确定要清除日志文件?"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_SPEED_TOO_LOW",
|
||||
"text": "错误, 设备连接的USB端口速度太低!"
|
||||
}
|
||||
]
|
||||
@@ -366,5 +366,9 @@
|
||||
{
|
||||
"id": "IDS_MSG_TO_CLEAR_LOG",
|
||||
"text": "Are you sure to clear log file?"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_SPEED_TOO_LOW",
|
||||
"text": "Error, The speed of the USB port that \nthe device connected is too low!"
|
||||
}
|
||||
]
|
||||
@@ -197,9 +197,11 @@ static GSList *scan(GSList *options)
|
||||
uint8_t address;
|
||||
int isProduct;
|
||||
int num;
|
||||
int is_speed_not_match;
|
||||
|
||||
drvc = di->priv;
|
||||
num = 0;
|
||||
is_speed_not_match = 0;
|
||||
|
||||
if (options != NULL)
|
||||
sr_info("%s", "Scan DSCope device with options.");
|
||||
@@ -264,16 +266,19 @@ static GSList *scan(GSList *options)
|
||||
usb_speed = libusb_get_device_speed(device_handle);
|
||||
if ((usb_speed != LIBUSB_SPEED_HIGH) && (usb_speed != LIBUSB_SPEED_SUPER)){
|
||||
sr_info("scan(): The idVendor is right, but the usb speed is too low, speed type:%d", usb_speed);
|
||||
is_speed_not_match = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; supported_DSCope[j].vid; j++) {
|
||||
for (j = 0; supported_DSCope[j].vid; j++)
|
||||
{
|
||||
if (des.idVendor == supported_DSCope[j].vid &&
|
||||
des.idProduct == supported_DSCope[j].pid &&
|
||||
usb_speed == supported_DSCope[j].usb_speed) {
|
||||
prof = &supported_DSCope[j];
|
||||
break;
|
||||
des.idProduct == supported_DSCope[j].pid){
|
||||
if (usb_speed == supported_DSCope[j].usb_speed) {
|
||||
prof = &supported_DSCope[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,6 +385,10 @@ static GSList *scan(GSList *options)
|
||||
|
||||
sr_info("Fond new DSCope device count: %d", num);
|
||||
|
||||
if (is_speed_not_match){
|
||||
post_message_callback(DS_EV_DEVICE_SPEED_NOT_MATCH);
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
|
||||
@@ -283,9 +283,11 @@ static GSList *scan(GSList *options)
|
||||
uint8_t address;
|
||||
int isProduct;
|
||||
int num;
|
||||
int is_speed_not_match;
|
||||
|
||||
drvc = di->priv;
|
||||
num = 0;
|
||||
is_speed_not_match = 0;
|
||||
|
||||
if (options != NULL)
|
||||
sr_info("%s", "Scan DSLogic device with options.");
|
||||
@@ -351,17 +353,20 @@ static GSList *scan(GSList *options)
|
||||
usb_speed = libusb_get_device_speed(device_handle);
|
||||
if ((usb_speed != LIBUSB_SPEED_HIGH) && (usb_speed != LIBUSB_SPEED_SUPER)){
|
||||
sr_info("scan(): The idVendor is right, but the usb speed is too low, speed type:%d", usb_speed);
|
||||
is_speed_not_match = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check manufactory id and product id, and speed type. */
|
||||
prof = NULL;
|
||||
for (j = 0; supported_DSLogic[j].vid; j++) {
|
||||
for (j = 0; supported_DSLogic[j].vid; j++)
|
||||
{
|
||||
if (des.idVendor == supported_DSLogic[j].vid &&
|
||||
des.idProduct == supported_DSLogic[j].pid &&
|
||||
usb_speed == supported_DSLogic[j].usb_speed) {
|
||||
prof = &supported_DSLogic[j];
|
||||
break;
|
||||
des.idProduct == supported_DSLogic[j].pid){
|
||||
if (usb_speed == supported_DSLogic[j].usb_speed) {
|
||||
prof = &supported_DSLogic[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,6 +471,10 @@ static GSList *scan(GSList *options)
|
||||
|
||||
sr_info("Fond new DSLogic device count: %d", num);
|
||||
|
||||
if (is_speed_not_match){
|
||||
post_message_callback(DS_EV_DEVICE_SPEED_NOT_MATCH);
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
|
||||
@@ -1636,4 +1636,10 @@ static struct libusb_device* get_new_detached_usb_device()
|
||||
return dev;
|
||||
}
|
||||
|
||||
SR_PRIV int post_message_callback(int msg)
|
||||
{
|
||||
send_event(msg);
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
/**-------------------private function end---------------*/
|
||||
|
||||
@@ -415,6 +415,8 @@ SR_PRIV int current_device_acquisition_stop();
|
||||
|
||||
SR_PRIV int lib_extern_init(struct sr_context *ctx);
|
||||
|
||||
SR_PRIV int post_message_callback(int msg);
|
||||
|
||||
/*--- hwdriver.c ------------------------------------------------------------*/
|
||||
|
||||
SR_PRIV int sr_config_get(const struct sr_dev_driver *driver,
|
||||
|
||||
@@ -1304,6 +1304,8 @@ SR_API void ds_log_level(int level);
|
||||
|
||||
#define DS_EV_COLLECT_TASK_END_BY_ERROR 106
|
||||
|
||||
#define DS_EV_DEVICE_SPEED_NOT_MATCH 107
|
||||
|
||||
enum DS_DEVICE_EVENT_TYPE
|
||||
{
|
||||
DS_EV_NEW_DEVICE_ATTACH = 1,
|
||||
|
||||
Reference in New Issue
Block a user