forked from Ivasoft/DSView
update: 'libsigrokdecode4DS' project used new log lib
This commit is contained in:
@@ -150,8 +150,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#ifdef DEBUG_INFO
|
||||
if (XLOG_LEVEL_DBG > logLevel){
|
||||
dsv_log_level(XLOG_LEVEL_DBG); // on develop mode, set the default log ldevel
|
||||
if (XLOG_LEVEL_INFO > logLevel){
|
||||
dsv_log_level(XLOG_LEVEL_INFO); // on develop mode, set the default log ldevel
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -195,7 +195,7 @@ bool bHighScale = true;
|
||||
|
||||
//----------------------run
|
||||
dsv_info("----------------- version: %s-----------------", DS_VERSION_STRING);
|
||||
dsv_dbg("Qt:%s", QT_VERSION_STR);
|
||||
dsv_info("Qt:%s", QT_VERSION_STR);
|
||||
|
||||
AppControl *control = AppControl::Instance();
|
||||
AppConfig::Instance().LoadAll(); //load app config
|
||||
|
||||
@@ -69,6 +69,7 @@ void AppControl::Destroy(){
|
||||
bool AppControl::Init()
|
||||
{
|
||||
sr_log_set_context(dsv_log_context());
|
||||
srd_log_set_context(dsv_log_context());
|
||||
|
||||
// Initialise libsigrok
|
||||
if (sr_init(&sr_ctx) != SR_OK)
|
||||
@@ -81,8 +82,6 @@ bool AppControl::Init()
|
||||
QString resdir = GetResourceDir();
|
||||
sr_set_firmware_resource_dir(resdir.toUtf8().data());
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
//able run debug with qtcreator
|
||||
QString pythonHome = "c:/python";
|
||||
@@ -99,7 +98,7 @@ bool AppControl::Init()
|
||||
QString dir = GetDecodeScriptDir();
|
||||
strcpy(path, dir.toUtf8().data());
|
||||
|
||||
dsv_dbg("decode script path: \"%s\"", dir.toUtf8().data());
|
||||
dsv_info("decode script path: \"%s\"", dir.toUtf8().data());
|
||||
|
||||
// Initialise libsigrokdecode
|
||||
if (srd_init(path) != SRD_OK)
|
||||
|
||||
@@ -508,7 +508,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
||||
//struct srd_push_param push_param;
|
||||
|
||||
if( i >= decode_end){
|
||||
dsv_dbg("%s", "decode data index have been end");
|
||||
dsv_info("%s", "decode data index have been end");
|
||||
}
|
||||
|
||||
while(i < decode_end && !_no_memory && !status->_bStop)
|
||||
@@ -580,7 +580,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
||||
_error_message = QString::fromLocal8Bit(error);
|
||||
}
|
||||
|
||||
dsv_dbg("%s%llu", "send to decoder times:", entry_cnt);
|
||||
dsv_info("%s%llu", "send to decoder times: ", entry_cnt);
|
||||
|
||||
if (error)
|
||||
g_free(error);
|
||||
@@ -608,7 +608,7 @@ void DecoderStack::execute_decode_stack()
|
||||
// Get the intial sample count
|
||||
_sample_count = _snapshot->get_sample_count();
|
||||
|
||||
dsv_dbg("%s%llu", "decoder sample count:", _sample_count);
|
||||
dsv_info("%s%llu", "decoder sample count: ", _sample_count);
|
||||
|
||||
// Create the decoders
|
||||
for(auto &dec : _stack)
|
||||
|
||||
@@ -199,12 +199,12 @@ void DevInst::start()
|
||||
|
||||
void DevInst::run()
|
||||
{
|
||||
dsv_dbg("%s", "session run loop start");
|
||||
dsv_info("%s", "session run loop start");
|
||||
int ret = sr_session_run();
|
||||
if (ret != SR_OK){
|
||||
dsv_err("%s", "start session error!");
|
||||
}
|
||||
dsv_dbg("%s", "session run loop end");
|
||||
dsv_info("%s", "session run loop end");
|
||||
}
|
||||
|
||||
void DevInst::stop()
|
||||
|
||||
@@ -362,12 +362,12 @@ void ProtocolDock::on_add_protocol()
|
||||
bool ProtocolDock::add_protocol_by_id(QString id, bool silent, std::list<pv::data::decode::Decoder*> &sub_decoders)
|
||||
{
|
||||
if (_session->is_device_re_attach() == true){
|
||||
dsv_dbg("%s", "Keep current decoders, cancel add new.");
|
||||
dsv_info("%s", "Keep current decoders, cancel add new.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_session->get_device()->dev_inst()->mode != LOGIC) {
|
||||
dsv_dbg("%s", "Protocol Analyzer\nProtocol Analyzer is only valid in Digital Mode!");
|
||||
dsv_info("%s", "Protocol Analyzer\nProtocol Analyzer is only valid in Digital Mode!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ xlog_context* dsv_log_context()
|
||||
void dsv_log_level(int l)
|
||||
{
|
||||
xlog_set_level(log_ctx, l);
|
||||
dsv_dbg("%s%d", "set log level: ", l);
|
||||
dsv_info("%s%d", "set log level: ", l);
|
||||
}
|
||||
|
||||
void dsv_log_enalbe_logfile()
|
||||
@@ -70,6 +70,6 @@ void dsv_log_enalbe_logfile()
|
||||
|
||||
xlog_add_receiver_from_file(log_ctx, lf.toUtf8().data(), 0);
|
||||
|
||||
dsv_dbg("%s\"%s\"", "store log to file: ", lf.toUtf8().data());
|
||||
dsv_info("%s\"%s\"", "store log to file: ", lf.toUtf8().data());
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ void MainWindow::update_device_list()
|
||||
|
||||
if (ldFileName != ""){
|
||||
if (QFile::exists(ldFileName)){
|
||||
dsv_dbg("auto load file:%s", ldFileName.toUtf8().data());
|
||||
dsv_info("auto load file:%s", ldFileName.toUtf8().data());
|
||||
on_load_file(ldFileName);
|
||||
}
|
||||
else{
|
||||
@@ -976,7 +976,7 @@ bool MainWindow::load_session_json(QJsonDocument json, bool file_dev, bool bDeco
|
||||
}
|
||||
|
||||
if (sessionObj["Version"].toInt() < BASE_SESSION_VERSION){
|
||||
dsv_dbg("%s", "session file version is error!");
|
||||
dsv_err("%s", "session file version is error!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1459,7 +1459,7 @@ void MainWindow::switchLanguage(int language)
|
||||
retranslateUi();
|
||||
}
|
||||
else{
|
||||
dsv_dbg("%s%d", "Unknown language code:", language);
|
||||
dsv_err("%s%d", "Unknown language code:", language);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,9 +168,9 @@ void SigSession::set_device(DevInst *dev_inst)
|
||||
}
|
||||
|
||||
if (_dev_inst->is_file())
|
||||
dsv_dbg("%s\"%s\"", "Switch to file: ", dev_name.toUtf8().data());
|
||||
dsv_info("%s\"%s\"", "Switch to file: ", dev_name.toUtf8().data());
|
||||
else
|
||||
dsv_dbg("%s\"%s\"", "Switch to device: ", dev_name.toUtf8().data());
|
||||
dsv_info("%s\"%s\"", "Switch to device: ", dev_name.toUtf8().data());
|
||||
|
||||
try {
|
||||
_dev_inst->use(this);
|
||||
@@ -439,7 +439,7 @@ void SigSession::start_capture(bool instant)
|
||||
{
|
||||
// Check that a device instance has been selected.
|
||||
if (!_dev_inst) {
|
||||
dsv_dbg("%s", "No device selected");
|
||||
dsv_err("%s", "No device selected");
|
||||
capture_state_changed(SigSession::Stopped);
|
||||
return;
|
||||
}
|
||||
@@ -709,7 +709,7 @@ void SigSession::init_signals()
|
||||
clear_all_decoder();
|
||||
}
|
||||
else{
|
||||
dsv_dbg("%s", "Device loose contact");
|
||||
dsv_err("%s", "Device loose contact");
|
||||
}
|
||||
|
||||
// Detect what data types we will receive
|
||||
@@ -1265,7 +1265,7 @@ void SigSession::hotplug_proc()
|
||||
if (!_dev_inst)
|
||||
return;
|
||||
|
||||
dsv_dbg("%s", "Hotplug thread start!");
|
||||
dsv_info("%s", "Hotplug thread start!");
|
||||
|
||||
try {
|
||||
while(_session && !_bHotplugStop) {
|
||||
@@ -1273,12 +1273,12 @@ void SigSession::hotplug_proc()
|
||||
sr_hotplug_wait_timout(_sr_ctx);
|
||||
|
||||
if (_hot_attach) {
|
||||
dsv_dbg("%s", "process event: DreamSourceLab hardware attached!");
|
||||
dsv_info("%s", "process event: DreamSourceLab hardware attached!");
|
||||
_callback->device_attach();
|
||||
_hot_attach = false;
|
||||
}
|
||||
if (_hot_detach) {
|
||||
dsv_dbg("%s", "process event: DreamSourceLab hardware detached!");
|
||||
dsv_info("%s", "process event: DreamSourceLab hardware detached!");
|
||||
_callback->device_detach();
|
||||
_hot_detach = false;
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ void SigSession::hotplug_proc()
|
||||
dsv_err("%s", "Interrupt exception for hotplug thread was thrown.");
|
||||
}
|
||||
|
||||
dsv_dbg("%s", "Hotplug thread exit!");
|
||||
dsv_info("%s", "Hotplug thread exit!");
|
||||
}
|
||||
|
||||
void SigSession::register_hotplug_callback()
|
||||
@@ -1884,7 +1884,7 @@ void SigSession::set_stop_scale(float scale)
|
||||
if ((*it) == trace){
|
||||
(*it)->decoder()->stop_decode_work();
|
||||
_decode_tasks.erase(it);
|
||||
dsv_dbg("%s", "remove a waiting decode task");
|
||||
dsv_info("%s", "remove a waiting decode task");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1973,7 +1973,7 @@ void SigSession::set_stop_scale(float scale)
|
||||
//the decode task thread proc
|
||||
void SigSession::decode_task_proc()
|
||||
{
|
||||
dsv_dbg("%s", "------->decode thread start");
|
||||
dsv_info("%s", "------->decode thread start");
|
||||
auto task = get_top_decode_task();
|
||||
|
||||
while (task != NULL)
|
||||
@@ -1983,7 +1983,7 @@ void SigSession::set_stop_scale(float scale)
|
||||
}
|
||||
|
||||
if (task->_delete_flag){
|
||||
dsv_dbg("%s", "destroy a decoder in task thread");
|
||||
dsv_info("%s", "destroy a decoder in task thread");
|
||||
|
||||
DESTROY_QT_LATER(task);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
@@ -1995,7 +1995,7 @@ void SigSession::set_stop_scale(float scale)
|
||||
task = get_top_decode_task();
|
||||
}
|
||||
|
||||
dsv_dbg("%s", "------->decode thread end");
|
||||
dsv_info("%s", "------->decode thread end");
|
||||
_bDecodeRunning = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user