From e42cf2a8d04d0641985a7f522183d8b13dc126a6 Mon Sep 17 00:00:00 2001 From: yunyaobaihong <896458252@qq.com> Date: Mon, 15 May 2023 14:00:05 +0800 Subject: [PATCH 1/2] demo path --- DSView/pv/mainwindow.cpp | 8 ++++---- DSView/pv/sigsession.cpp | 2 +- DSView/pv/toolbars/samplingbar.cpp | 2 +- libsigrok4DSL/hardware/demo/demo.c | 15 +++++++++------ libsigrok4DSL/hardware/demo/demo.h | 6 +++--- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index 8af1de6d..d4320268 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -117,7 +117,7 @@ namespace pv _is_auto_switch_device = false; _is_save_confirm_msg = false; - _pattern_mode = "RANDOM"; + _pattern_mode = "random"; setup_ui(); @@ -1779,7 +1779,7 @@ namespace pv { _view->auto_set_max_scale(); - if(_pattern_mode != "RANDOM") + if(_pattern_mode != "random") { StoreSession ss(_session); QJsonArray deArray = get_decoder_json_from_file(_device_agent->path()); @@ -1833,7 +1833,7 @@ namespace pv if(_device_agent->get_work_mode() == LOGIC) { - if(_pattern_mode != "RANDOM") + if(_pattern_mode != "random") { _device_agent->update(); StoreSession ss(_session); @@ -1948,7 +1948,7 @@ namespace pv _protocol_widget->del_all_protocol(); - if(_pattern_mode != "RANDOM") + if(_pattern_mode != "random") { StoreSession ss(_session); QJsonArray deArray = get_decoder_json_from_file(_device_agent->path()); diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index 325498ca..f9f5dfe1 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -528,7 +528,7 @@ namespace pv QString rand_mode = g_variant_get_string(gvar,NULL); g_variant_unref(gvar); - if (rand_mode != "RANDOM"){ + if (rand_mode != "random"){ set_operation_mode(OPT_SINGLE); } } diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index 49630f55..cccf36c9 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -1275,7 +1275,7 @@ namespace pv QString rand_mode = g_variant_get_string(gvar,NULL); g_variant_unref(gvar); - bool is_rand = rand_mode.toUpper() == "RANDOM"; + bool is_rand = rand_mode.toUpper() == "random"; _action_loop->setVisible(is_rand); if (!is_rand){ diff --git a/libsigrok4DSL/hardware/demo/demo.c b/libsigrok4DSL/hardware/demo/demo.c index a20af9ab..a3ab84ad 100644 --- a/libsigrok4DSL/hardware/demo/demo.c +++ b/libsigrok4DSL/hardware/demo/demo.c @@ -207,7 +207,8 @@ static int get_pattern_mode_from_file(uint8_t device_mode) strcpy(dir_str,DS_RES_PATH); strcat(dir_str,"../"); - strcat(dir_str,"demo-file/"); + strcat(dir_str,"demo/"); + sr_info("%s",dir_str); if(device_mode == LOGIC) strcat(dir_str,"logic/"); @@ -227,10 +228,10 @@ static int get_pattern_mode_from_file(uint8_t device_mode) { if (FALSE == g_file_test(filename,G_FILE_TEST_IS_DIR)) { - if(strstr(filename,".dsl") != NULL) + if(strstr(filename,".demo") != NULL) { - char *tmp_file_name = g_try_malloc0(strlen(filename)-strlen(".dsl")+1); - snprintf(tmp_file_name, strlen(filename)-strlen(".dsl")+1 , "%s", filename); + char *tmp_file_name = g_try_malloc0(strlen(filename)-strlen(".demo")+1); + snprintf(tmp_file_name, strlen(filename)-strlen(".demo")+1 , "%s", filename); if(device_mode == LOGIC) pattern_strings_logic[index] = tmp_file_name; else if(device_mode == DSO) @@ -276,6 +277,7 @@ static int scan_dsl_file(struct sr_dev_inst *sdi) sample_generator = PATTERN_RANDOM; sdi->mode = LOGIC; reset_dsl_path(sdi,LOGIC,PATTERN_RANDOM); + sr_info("path:%s",sdi->path); } } @@ -288,7 +290,7 @@ static int reset_dsl_path(struct sr_dev_inst *sdi,uint8_t device_mode ,uint8_t p char *str = g_try_malloc0(500); strcpy(str,DS_RES_PATH); strcat(str,"../"); - strcat(str,"demo-file/"); + strcat(str,"demo/"); if (pattern_mode != PATTERN_RANDOM) { @@ -318,7 +320,7 @@ static int reset_dsl_path(struct sr_dev_inst *sdi,uint8_t device_mode ,uint8_t p default: break; } - strcat(str,".dsl"); + strcat(str,".demo"); } if(pattern_mode != PATTERN_RANDOM) @@ -2305,6 +2307,7 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi) } else { + sr_info("%s",sdi->path); archive = unzOpen64(sdi->path); if (NULL == archive) { diff --git a/libsigrok4DSL/hardware/demo/demo.h b/libsigrok4DSL/hardware/demo/demo.h index 1482d700..8a2b84be 100644 --- a/libsigrok4DSL/hardware/demo/demo.h +++ b/libsigrok4DSL/hardware/demo/demo.h @@ -31,9 +31,9 @@ enum DEMO_PATTERN { PATTERN_DEFAULT = 1, }; -static char *pattern_strings_logic[100] = {"RANDOM"}; -static char *pattern_strings_dso[100] = {"RANDOM"}; -static char *pattern_strings_analog[100] = {"RANDOM"}; +static char *pattern_strings_logic[100] = {"random"}; +static char *pattern_strings_dso[100] = {"random"}; +static char *pattern_strings_analog[100] = {"random"}; static int pattern_logic_count = 1; static int pattern_dso_count= 1; static int pattern_analog_count= 1; From 94ee83e2266c56f364d68514a5f1ef9de55076ef Mon Sep 17 00:00:00 2001 From: yunyaobaihong <896458252@qq.com> Date: Mon, 15 May 2023 14:07:46 +0800 Subject: [PATCH 2/2] demo file --- .../{demo_sawtooth_analog.dsl => sawtooth.demo} | Bin .../demo/analog/{demo_sine_analog.dsl => sine.demo} | Bin .../analog/{demo_square_analog.dsl => square.demo} | Bin .../{demo_triangle_analog.dsl => triangle.demo} | Bin .../dso/{demo_sawtooth_dso.dsl => sawtooth.demo} | Bin DSView/demo/dso/{demo_sine_dso.dsl => sine.demo} | Bin .../demo/dso/{demo_square_dso.dsl => square.demo} | Bin .../dso/{demo_triangle_dso.dsl => triangle.demo} | Bin DSView/demo/logic/{demo_uart.dsl => demo.demo} | Bin DSView/demo/logic/{demo_eeprom.dsl => eeprom.demo} | Bin DSView/demo/logic/{demo_spi.dsl => spi.demo} | Bin libsigrok4DSL/hardware/demo/demo.c | 5 ----- 12 files changed, 5 deletions(-) rename DSView/demo/analog/{demo_sawtooth_analog.dsl => sawtooth.demo} (100%) rename DSView/demo/analog/{demo_sine_analog.dsl => sine.demo} (100%) rename DSView/demo/analog/{demo_square_analog.dsl => square.demo} (100%) rename DSView/demo/analog/{demo_triangle_analog.dsl => triangle.demo} (100%) rename DSView/demo/dso/{demo_sawtooth_dso.dsl => sawtooth.demo} (100%) rename DSView/demo/dso/{demo_sine_dso.dsl => sine.demo} (100%) rename DSView/demo/dso/{demo_square_dso.dsl => square.demo} (100%) rename DSView/demo/dso/{demo_triangle_dso.dsl => triangle.demo} (100%) rename DSView/demo/logic/{demo_uart.dsl => demo.demo} (100%) rename DSView/demo/logic/{demo_eeprom.dsl => eeprom.demo} (100%) rename DSView/demo/logic/{demo_spi.dsl => spi.demo} (100%) diff --git a/DSView/demo/analog/demo_sawtooth_analog.dsl b/DSView/demo/analog/sawtooth.demo similarity index 100% rename from DSView/demo/analog/demo_sawtooth_analog.dsl rename to DSView/demo/analog/sawtooth.demo diff --git a/DSView/demo/analog/demo_sine_analog.dsl b/DSView/demo/analog/sine.demo similarity index 100% rename from DSView/demo/analog/demo_sine_analog.dsl rename to DSView/demo/analog/sine.demo diff --git a/DSView/demo/analog/demo_square_analog.dsl b/DSView/demo/analog/square.demo similarity index 100% rename from DSView/demo/analog/demo_square_analog.dsl rename to DSView/demo/analog/square.demo diff --git a/DSView/demo/analog/demo_triangle_analog.dsl b/DSView/demo/analog/triangle.demo similarity index 100% rename from DSView/demo/analog/demo_triangle_analog.dsl rename to DSView/demo/analog/triangle.demo diff --git a/DSView/demo/dso/demo_sawtooth_dso.dsl b/DSView/demo/dso/sawtooth.demo similarity index 100% rename from DSView/demo/dso/demo_sawtooth_dso.dsl rename to DSView/demo/dso/sawtooth.demo diff --git a/DSView/demo/dso/demo_sine_dso.dsl b/DSView/demo/dso/sine.demo similarity index 100% rename from DSView/demo/dso/demo_sine_dso.dsl rename to DSView/demo/dso/sine.demo diff --git a/DSView/demo/dso/demo_square_dso.dsl b/DSView/demo/dso/square.demo similarity index 100% rename from DSView/demo/dso/demo_square_dso.dsl rename to DSView/demo/dso/square.demo diff --git a/DSView/demo/dso/demo_triangle_dso.dsl b/DSView/demo/dso/triangle.demo similarity index 100% rename from DSView/demo/dso/demo_triangle_dso.dsl rename to DSView/demo/dso/triangle.demo diff --git a/DSView/demo/logic/demo_uart.dsl b/DSView/demo/logic/demo.demo similarity index 100% rename from DSView/demo/logic/demo_uart.dsl rename to DSView/demo/logic/demo.demo diff --git a/DSView/demo/logic/demo_eeprom.dsl b/DSView/demo/logic/eeprom.demo similarity index 100% rename from DSView/demo/logic/demo_eeprom.dsl rename to DSView/demo/logic/eeprom.demo diff --git a/DSView/demo/logic/demo_spi.dsl b/DSView/demo/logic/spi.demo similarity index 100% rename from DSView/demo/logic/demo_spi.dsl rename to DSView/demo/logic/spi.demo diff --git a/libsigrok4DSL/hardware/demo/demo.c b/libsigrok4DSL/hardware/demo/demo.c index a3ab84ad..86344612 100644 --- a/libsigrok4DSL/hardware/demo/demo.c +++ b/libsigrok4DSL/hardware/demo/demo.c @@ -208,7 +208,6 @@ static int get_pattern_mode_from_file(uint8_t device_mode) strcpy(dir_str,DS_RES_PATH); strcat(dir_str,"../"); strcat(dir_str,"demo/"); - sr_info("%s",dir_str); if(device_mode == LOGIC) strcat(dir_str,"logic/"); @@ -277,7 +276,6 @@ static int scan_dsl_file(struct sr_dev_inst *sdi) sample_generator = PATTERN_RANDOM; sdi->mode = LOGIC; reset_dsl_path(sdi,LOGIC,PATTERN_RANDOM); - sr_info("path:%s",sdi->path); } } @@ -1816,7 +1814,6 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi) int index; int bit = get_bit(vdev->timebase); - sr_info("bit per circle(double channels):%d",bit); void* tmp_buf = g_try_malloc0(bit); for(int i = 0 ; i < bit ; i++) { @@ -2307,7 +2304,6 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi) } else { - sr_info("%s",sdi->path); archive = unzOpen64(sdi->path); if (NULL == archive) { @@ -2384,7 +2380,6 @@ static int load_virtual_device_session(struct sr_dev_inst *sdi) for (j = 0; keys[j]; j++) { val = g_key_file_get_string(kf, sections[i], keys[j], NULL); - sr_info("keys:%s , val:%s", keys[j],val); if (!strcmp(keys[j], "device mode")) {