Cancel reopening the device at the start of acquisition

This commit is contained in:
dreamsourcelabTAI 2023-02-02 16:00:24 +08:00
parent a505cdfc31
commit b3b320d979
2 changed files with 11 additions and 7 deletions

View File

@ -289,7 +289,6 @@ namespace pv
if (_device_agent.have_instance() && _device_agent.is_hardware())
{
Snapshot *data = get_signal_snapshot();
dsv_info("have data:%d", data->have_data());
return data->have_data();
}
return false;

View File

@ -715,13 +715,17 @@ SR_API int ds_start_collect()
// Create new session.
sr_session_new();
ret = open_device_instance(di); // open device
if (ret != SR_OK)
if (di->status != SR_ST_ACTIVE)
{
sr_err("%s", "Open device error!");
return ret;
ret = open_device_instance(di); // open device
if (ret != SR_OK)
{
sr_err("%s", "Open device error!");
return ret;
}
}
lib_ctx.collect_thread = g_thread_new("collect_run_proc", collect_run_proc, NULL);
return SR_OK;
@ -1347,7 +1351,7 @@ static void usb_hotplug_process_proc()
{
sr_info("%s", "Hotplug thread start!");
int cur_trans_id = DEV_TRANS_NONE;
int cur_trans_id = 0;
while (!lib_ctx.lib_exit_flag)
{
@ -1376,7 +1380,8 @@ static void usb_hotplug_process_proc()
lib_ctx.is_waitting_reconnect = 0;
}
}
// The event command is changed.
if (lib_ctx.transaction_id != cur_trans_id)
{
cur_trans_id = lib_ctx.transaction_id;