From b3b320d97936938679cb96f3cb4ed8dd7c3b831c Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Thu, 2 Feb 2023 16:00:24 +0800 Subject: [PATCH] Cancel reopening the device at the start of acquisition --- DSView/pv/sigsession.cpp | 1 - libsigrok4DSL/lib_main.c | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index ecd6ccb2..21483416 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -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; diff --git a/libsigrok4DSL/lib_main.c b/libsigrok4DSL/lib_main.c index 714d5a4c..c8805bcf 100644 --- a/libsigrok4DSL/lib_main.c +++ b/libsigrok4DSL/lib_main.c @@ -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;