forked from Ivasoft/DSView
Merge remote-tracking branch 'source/dev-1.3' into demo
This commit is contained in:
@@ -415,7 +415,8 @@ void DecoderStack::do_decode_work()
|
|||||||
_decoder_status->clear(); //clear old items
|
_decoder_status->clear(); //clear old items
|
||||||
|
|
||||||
if (!_options_changed)
|
if (!_options_changed)
|
||||||
{
|
{
|
||||||
|
dsv_err("ERROR:Decoder options have not changed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_options_changed = false;
|
_options_changed = false;
|
||||||
@@ -452,17 +453,25 @@ void DecoderStack::do_decode_work()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_snapshot == NULL)
|
if (_snapshot == NULL)
|
||||||
return;
|
{
|
||||||
|
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_WORK_ERROR),
|
||||||
|
"One or more required channels have not been specified");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_session->is_realtime_refresh() == false && _snapshot->empty())
|
if (_session->is_realtime_refresh() == false && _snapshot->empty())
|
||||||
{
|
{
|
||||||
|
dsv_err("ERROR:Decode data is empty.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the samplerate
|
// Get the samplerate
|
||||||
_samplerate = _snapshot->samplerate();
|
_samplerate = _snapshot->samplerate();
|
||||||
if (_samplerate == 0.0)
|
if (_samplerate == 0.0)
|
||||||
|
{
|
||||||
|
dsv_err("ERROR:Decode data got an invalid sample rate.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
execute_decode_stack();
|
execute_decode_stack();
|
||||||
}
|
}
|
||||||
@@ -508,7 +517,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
|||||||
//struct srd_push_param push_param;
|
//struct srd_push_param push_param;
|
||||||
|
|
||||||
if( i >= decode_end){
|
if( i >= decode_end){
|
||||||
dsv_info("%s", "decode data index have been end");
|
dsv_info("%s", "decode data index have been to end");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const uint8_t *> chunk;
|
std::vector<const uint8_t *> chunk;
|
||||||
@@ -558,12 +567,14 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
|||||||
if (sig_index == -1) {
|
if (sig_index == -1) {
|
||||||
chunk.push_back(NULL);
|
chunk.push_back(NULL);
|
||||||
chunk_const.push_back(0);
|
chunk_const.push_back(0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (_snapshot->has_data(sig_index)) {
|
if (_snapshot->has_data(sig_index)) {
|
||||||
auto data_ptr = _snapshot->get_decode_samples(i, chunk_end, sig_index);
|
auto data_ptr = _snapshot->get_decode_samples(i, chunk_end, sig_index);
|
||||||
chunk.push_back(data_ptr);
|
chunk.push_back(data_ptr);
|
||||||
chunk_const.push_back(_snapshot->get_sample(i, sig_index));
|
chunk_const.push_back(_snapshot->get_sample(i, sig_index));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_DATA_ERROR),
|
_error_message = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DECODERSTACK_DECODE_DATA_ERROR),
|
||||||
"At least one of selected channels are not enabled.");
|
"At least one of selected channels are not enabled.");
|
||||||
return;
|
return;
|
||||||
@@ -622,13 +633,13 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
|
|||||||
if (!bError && bEndTime){
|
if (!bError && bEndTime){
|
||||||
srd_session_end(session, &error);
|
srd_session_end(session, &error);
|
||||||
|
|
||||||
if (error)
|
if (error != NULL)
|
||||||
_error_message = QString::fromLocal8Bit(error);
|
_error_message = QString::fromLocal8Bit(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
dsv_info("%s%llu", "send to decoder times: ", entry_cnt);
|
dsv_info("%s%llu", "send to decoder times: ", entry_cnt);
|
||||||
|
|
||||||
if (error)
|
if (error != NULL)
|
||||||
g_free(error);
|
g_free(error);
|
||||||
|
|
||||||
if (!_session->is_closed())
|
if (!_session->is_closed())
|
||||||
@@ -692,14 +703,16 @@ void DecoderStack::execute_decode_stack()
|
|||||||
_stask_stauts);
|
_stask_stauts);
|
||||||
|
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
if (srd_session_start(session, &error) == SRD_OK)
|
if (srd_session_start(session, &error) == SRD_OK){
|
||||||
//need a lot time
|
//need a lot time
|
||||||
decode_data(decode_start, decode_end, session);
|
decode_data(decode_start, decode_end, session);
|
||||||
else
|
}
|
||||||
|
else if (error != NULL){
|
||||||
_error_message = QString::fromLocal8Bit(error);
|
_error_message = QString::fromLocal8Bit(error);
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy the session
|
// Destroy the session
|
||||||
if (error) {
|
if (error != NULL) {
|
||||||
g_free(error);
|
g_free(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ void DsoSnapshot::clear()
|
|||||||
free_envelop();
|
free_envelop();
|
||||||
init_all();
|
init_all();
|
||||||
_have_data = false;
|
_have_data = false;
|
||||||
|
_envelope_en = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DsoSnapshot::free_data()
|
void DsoSnapshot::free_data()
|
||||||
@@ -141,7 +142,8 @@ void DsoSnapshot::first_payload(const sr_datafeed_dso &dso, uint64_t total_sampl
|
|||||||
|
|
||||||
if (total_sample_count != _total_sample_count
|
if (total_sample_count != _total_sample_count
|
||||||
|| channel_num != _channel_num
|
|| channel_num != _channel_num
|
||||||
|| channel_changed){
|
|| channel_changed
|
||||||
|
|| isFile){
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::lock_guard<std::mutex> lock(_mutex);
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession *session) :
|
|||||||
_dist_layout->setVerticalSpacing(5);
|
_dist_layout->setVerticalSpacing(5);
|
||||||
_dist_layout->addWidget(_dist_add_btn, 0, 0);
|
_dist_layout->addWidget(_dist_add_btn, 0, 0);
|
||||||
_dist_layout->addWidget(new QLabel(_widget), 0, 1, 1, 3);
|
_dist_layout->addWidget(new QLabel(_widget), 0, 1, 1, 3);
|
||||||
_dist_layout->addWidget(new QLabel(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"), _widget), 0, 4);
|
_add_dec_label = new QLabel(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"), _widget);
|
||||||
|
_dist_layout->addWidget(_add_dec_label, 0, 4);
|
||||||
_dist_layout->addWidget(new QLabel(_widget), 0, 5, 1, 2);
|
_dist_layout->addWidget(new QLabel(_widget), 0, 5, 1, 2);
|
||||||
_dist_layout->setColumnStretch(1, 50);
|
_dist_layout->setColumnStretch(1, 50);
|
||||||
_dist_layout->setColumnStretch(6, 100);
|
_dist_layout->setColumnStretch(6, 100);
|
||||||
@@ -171,6 +172,7 @@ void MeasureDock::retranslateUi()
|
|||||||
_channel_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel"));
|
_channel_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel"));
|
||||||
_edge_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_RIS_OR_FAL_EDGE), "Rising/Falling/Edges"));
|
_edge_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_RIS_OR_FAL_EDGE), "Rising/Falling/Edges"));
|
||||||
_time_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"));
|
_time_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TIME_SAMPLES), "Time/Samples"));
|
||||||
|
_add_dec_label->setText(_time_label->text());
|
||||||
|
|
||||||
_w_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_W), "W: "));
|
_w_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_W), "W: "));
|
||||||
_p_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_P), "P: "));
|
_p_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_P), "P: "));
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ private:
|
|||||||
QLabel *_period_label;
|
QLabel *_period_label;
|
||||||
QLabel *_freq_label;
|
QLabel *_freq_label;
|
||||||
QLabel *_duty_label;
|
QLabel *_duty_label;
|
||||||
|
QLabel *_add_dec_label;
|
||||||
|
|
||||||
QGridLayout *_dist_layout;
|
QGridLayout *_dist_layout;
|
||||||
QGroupBox *_dist_groupBox;
|
QGroupBox *_dist_groupBox;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "../deviceagent.h"
|
#include "../deviceagent.h"
|
||||||
#include "../view/logicsignal.h"
|
#include "../view/logicsignal.h"
|
||||||
#include "../ui/langresource.h"
|
#include "../ui/langresource.h"
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QRegExpValidator>
|
||||||
|
|
||||||
namespace pv {
|
namespace pv {
|
||||||
namespace dock {
|
namespace dock {
|
||||||
@@ -587,6 +589,7 @@ void TriggerDock::setup_adv_tab()
|
|||||||
const QString mask = "N N N N N N N N N N N N N N N N";
|
const QString mask = "N N N N N N N N N N N N N N N N";
|
||||||
QRegularExpression value_rx("[10XRFCxrfc ]+");
|
QRegularExpression value_rx("[10XRFCxrfc ]+");
|
||||||
QValidator *value_validator = new QRegularExpressionValidator(value_rx, _stage_tabWidget);
|
QValidator *value_validator = new QRegularExpressionValidator(value_rx, _stage_tabWidget);
|
||||||
|
|
||||||
for (int i = 0; i < TriggerStages; i++) {
|
for (int i = 0; i < TriggerStages; i++) {
|
||||||
DsComboBox *_logic_comboBox = new DsComboBox(_stage_tabWidget);
|
DsComboBox *_logic_comboBox = new DsComboBox(_stage_tabWidget);
|
||||||
_logic_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_OR), "Or"));
|
_logic_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_OR), "Or"));
|
||||||
@@ -756,21 +759,27 @@ void TriggerDock::setup_adv_tab()
|
|||||||
|
|
||||||
_serial_data_label = new QLabel(_serial_groupBox);
|
_serial_data_label = new QLabel(_serial_groupBox);
|
||||||
_serial_data_comboBox = new DsComboBox(_serial_groupBox);
|
_serial_data_comboBox = new DsComboBox(_serial_groupBox);
|
||||||
for(int i = 0; i < _cur_ch_num; i++)
|
|
||||||
|
for(int i = 0; i < _cur_ch_num; i++){
|
||||||
_serial_data_comboBox->addItem(QString::number(i));
|
_serial_data_comboBox->addItem(QString::number(i));
|
||||||
|
}
|
||||||
|
|
||||||
_serial_value_label = new QLabel(_serial_groupBox);
|
_serial_value_label = new QLabel(_serial_groupBox);
|
||||||
_serial_value_lineEdit = new QLineEdit("X X X X X X X X X X X X X X X X", _serial_groupBox);
|
_serial_value_lineEdit = new QLineEdit("X X X X X X X X X X X X X X X X", _serial_groupBox);
|
||||||
_serial_value_lineEdit->setFont(font);
|
_serial_value_lineEdit->setFont(font);
|
||||||
_serial_value_lineEdit->setValidator(value_validator);
|
|
||||||
_serial_value_lineEdit->setMaxLength(TriggerProbes * 2 - 1);
|
_serial_value_lineEdit->setMaxLength(TriggerProbes * 2 - 1);
|
||||||
_serial_value_lineEdit->setInputMask(mask);
|
_serial_value_lineEdit->setInputMask(mask);
|
||||||
_serial_value_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
_serial_value_lineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
|
||||||
_serial_bits_comboBox = new DsComboBox(_serial_groupBox);
|
QRegularExpression value_rx2("[10Xx ]+");
|
||||||
for(int i = 1; i <= 16; i++)
|
QValidator *value_validator2 = new QRegularExpressionValidator(value_rx2, _stage_tabWidget);
|
||||||
_serial_bits_comboBox->addItem(QString::number(i));
|
_serial_value_lineEdit->setValidator(value_validator2);
|
||||||
|
|
||||||
|
_serial_bits_comboBox = new DsComboBox(_serial_groupBox);
|
||||||
|
|
||||||
|
for(int i = 1; i <= 16; i++){
|
||||||
|
_serial_bits_comboBox->addItem(QString::number(i));
|
||||||
|
}
|
||||||
|
|
||||||
QVBoxLayout *serial_layout = new QVBoxLayout();
|
QVBoxLayout *serial_layout = new QVBoxLayout();
|
||||||
QGridLayout *serial_glayout = new QGridLayout();
|
QGridLayout *serial_glayout = new QGridLayout();
|
||||||
|
|||||||
@@ -453,11 +453,14 @@ void DsoSignal::set_trig_ratio(double ratio, bool delta_change)
|
|||||||
_trig_value = ratio2value(delta + 0.5);
|
_trig_value = ratio2value(delta + 0.5);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (delta < 0.06f)
|
||||||
|
delta = 0.06f;
|
||||||
|
if (delta > 0.945f)
|
||||||
|
delta = 0.945f;
|
||||||
|
|
||||||
_trig_value = ratio2value(delta);
|
_trig_value = ratio2value(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
int margin = TrigMargin;
|
|
||||||
_trig_value = std::min(std::max(_trig_value, margin), (ratio2value(1) - margin));
|
|
||||||
if (delta_change)
|
if (delta_change)
|
||||||
_trig_delta = get_trig_vrate() - get_zero_ratio();
|
_trig_delta = get_trig_vrate() - get_zero_ratio();
|
||||||
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
session->get_device()->set_config(_probe, NULL, SR_CONF_TRIGGER_VALUE,
|
||||||
|
|||||||
@@ -1474,7 +1474,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
|||||||
|
|
||||||
if (!bCheckFile)
|
if (!bCheckFile)
|
||||||
{
|
{
|
||||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1521,7 +1521,7 @@ static int receive_data_logic_decoder(int fd, int revents, const struct sr_dev_i
|
|||||||
// Read the data to buffer.
|
// Read the data to buffer.
|
||||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1763,7 +1763,14 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
for (ch_index = 0; ch_index < chan_num; ch_index++)
|
for (ch_index = 0; ch_index < chan_num; ch_index++)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
bCheckFile = 0;
|
bCheckFile = 0;
|
||||||
|
=======
|
||||||
|
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||||
|
send_error_packet(sdi, vdev, &packet);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
>>>>>>> source/dev-1.3
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -1845,8 +1852,52 @@ static int receive_data_dso(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
unzCloseCurrentFile(vdev->archive);
|
unzCloseCurrentFile(vdev->archive);
|
||||||
pack_buffer->block_read_positions[ch_index] = 0; // Reset the read position.
|
pack_buffer->block_read_positions[ch_index] = 0; // Reset the read position.
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
vdev->cur_block++;
|
vdev->cur_block++;
|
||||||
pack_buffer->block_chan_read_pos = 0;
|
pack_buffer->block_chan_read_pos = 0;
|
||||||
|
=======
|
||||||
|
|
||||||
|
// Read the data to buffer.
|
||||||
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
|
{
|
||||||
|
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||||
|
send_error_packet(sdi, vdev, &packet);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = unzReadCurrentFile(vdev->archive, pack_buffer->block_bufs[ch_index], pack_buffer->block_data_len);
|
||||||
|
if (-1 == ret)
|
||||||
|
{
|
||||||
|
sr_err("read zip inner file error:\"%s\"", file_name);
|
||||||
|
send_error_packet(sdi, vdev, &packet);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
unzCloseCurrentFile(vdev->archive);
|
||||||
|
pack_buffer->block_read_positions[ch_index] = 0; // Reset the read position.
|
||||||
|
}
|
||||||
|
vdev->cur_block++;
|
||||||
|
pack_buffer->block_chan_read_pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_wr = (uint8_t*)pack_buffer->post_buf + pack_buffer->post_len;
|
||||||
|
p_rd = (uint8_t*)pack_buffer->block_bufs[read_chan_index] + pack_buffer->block_read_positions[read_chan_index];
|
||||||
|
*p_wr = *p_rd;
|
||||||
|
|
||||||
|
pack_buffer->post_len++;
|
||||||
|
pack_buffer->block_read_positions[read_chan_index]++;
|
||||||
|
|
||||||
|
if (pack_buffer->block_read_positions[read_chan_index] % byte_align == 0
|
||||||
|
|| pack_buffer->block_read_positions[read_chan_index] == pack_buffer->block_data_len)
|
||||||
|
{
|
||||||
|
read_chan_index++;
|
||||||
|
|
||||||
|
if (pack_buffer->block_read_positions[read_chan_index] == pack_buffer->block_data_len){
|
||||||
|
sr_info("Block read end.");
|
||||||
|
if (vdev->cur_block < vdev->num_blocks){
|
||||||
|
sr_err("%s", "The block data is not align.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
>>>>>>> source/dev-1.3
|
||||||
}
|
}
|
||||||
|
|
||||||
p_wr = (uint8_t*)pack_buffer->post_buf + pack_buffer->post_len;
|
p_wr = (uint8_t*)pack_buffer->post_buf + pack_buffer->post_len;
|
||||||
@@ -2129,13 +2180,13 @@ static int receive_data_analog(int fd, int revents, const struct sr_dev_inst *sd
|
|||||||
|
|
||||||
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ static const char *probeMapUnits[] = {
|
|||||||
"m/s",
|
"m/s",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void free_temp_buffer(struct session_vdev *vdev);
|
||||||
|
|
||||||
static int trans_data(struct sr_dev_inst *sdi)
|
static int trans_data(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
// translate for old format
|
// translate for old format
|
||||||
@@ -298,13 +300,13 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
|
|||||||
|
|
||||||
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
if (unzLocateFile(vdev->archive, file_name, 0) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -483,7 +485,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
if (sdi->mode == LOGIC)
|
if (sdi->mode == LOGIC)
|
||||||
vdev->packet_buffer->post_buf_len = 8 * chan_num * 1000;
|
vdev->packet_buffer->post_buf_len = 8 * chan_num * 1000;
|
||||||
else
|
else
|
||||||
vdev->packet_buffer->post_buf_len = chan_num * 1000;
|
vdev->packet_buffer->post_buf_len = chan_num * 10000;
|
||||||
|
|
||||||
vdev->packet_buffer->post_buf = g_try_malloc0(vdev->packet_buffer->post_buf_len + 1);
|
vdev->packet_buffer->post_buf = g_try_malloc0(vdev->packet_buffer->post_buf_len + 1);
|
||||||
if (vdev->packet_buffer->post_buf == NULL){
|
if (vdev->packet_buffer->post_buf == NULL){
|
||||||
@@ -495,7 +497,10 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
pack_buffer->post_len;
|
pack_buffer->post_len;
|
||||||
pack_buffer->block_buf_len = 0;
|
pack_buffer->block_buf_len = 0;
|
||||||
pack_buffer->block_data_len = 0;
|
pack_buffer->block_data_len = 0;
|
||||||
pack_buffer->block_chan_read_pos = 0;
|
pack_buffer->block_chan_read_pos = 0;
|
||||||
|
|
||||||
|
if (sdi->mode == DSO)
|
||||||
|
vdev->num_blocks = 1; // Only one data file.
|
||||||
}
|
}
|
||||||
pack_buffer = vdev->packet_buffer;
|
pack_buffer = vdev->packet_buffer;
|
||||||
|
|
||||||
@@ -534,7 +539,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
|
|
||||||
if (!bCheckFile)
|
if (!bCheckFile)
|
||||||
{
|
{
|
||||||
sr_err("cant't locate zip inner file:\"%s\"", file_name);
|
sr_err("can't locate zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -581,7 +586,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
// Read the data to buffer.
|
// Read the data to buffer.
|
||||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:\"%s\"", file_name);
|
sr_err("can't open zip inner file:\"%s\"", file_name);
|
||||||
send_error_packet(sdi, vdev, &packet);
|
send_error_packet(sdi, vdev, &packet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -650,7 +655,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
dso.mqflags = SR_MQFLAG_AC;
|
dso.mqflags = SR_MQFLAG_AC;
|
||||||
dso.num_samples = pack_buffer->post_len / chan_num;
|
dso.num_samples = pack_buffer->post_len / chan_num;
|
||||||
dso.data = pack_buffer->post_buf;
|
dso.data = pack_buffer->post_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data back.
|
// Send data back.
|
||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
@@ -663,6 +668,7 @@ static int receive_data_logic_dso_v2(int fd, int revents, const struct sr_dev_in
|
|||||||
ds_data_forward(sdi, &packet);
|
ds_data_forward(sdi, &packet);
|
||||||
sr_session_source_remove(-1);
|
sr_session_source_remove(-1);
|
||||||
close_archive(vdev);
|
close_archive(vdev);
|
||||||
|
free_temp_buffer(vdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -755,35 +761,44 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_temp_buffer(struct session_vdev *vdev)
|
||||||
|
{
|
||||||
|
struct session_packet_buffer *pack_buf;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
assert(vdev);
|
||||||
|
|
||||||
|
pack_buf = vdev->packet_buffer;
|
||||||
|
|
||||||
|
if (pack_buf != NULL)
|
||||||
|
{
|
||||||
|
g_safe_free(pack_buf->post_buf);
|
||||||
|
|
||||||
|
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
||||||
|
if (pack_buf->block_bufs[i] != NULL){
|
||||||
|
g_free(pack_buf->block_bufs[i]);
|
||||||
|
pack_buf->block_bufs[i] = NULL;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_safe_free(vdev->packet_buffer);
|
||||||
|
g_safe_free(vdev->buf);
|
||||||
|
g_safe_free(vdev->logic_buf);
|
||||||
|
}
|
||||||
|
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct session_vdev *vdev;
|
struct session_vdev *vdev;
|
||||||
int i;
|
|
||||||
struct session_packet_buffer *pack_buf;
|
|
||||||
|
|
||||||
if (sdi && sdi->priv)
|
if (sdi && sdi->priv)
|
||||||
{
|
{
|
||||||
vdev = sdi->priv;
|
vdev = sdi->priv;
|
||||||
|
free_temp_buffer(vdev);
|
||||||
if (vdev->packet_buffer != NULL){
|
|
||||||
pack_buf = vdev->packet_buffer;
|
|
||||||
|
|
||||||
g_safe_free(pack_buf->post_buf);
|
|
||||||
|
|
||||||
for (i = 0; i < SESSION_MAX_CHANNEL_COUNT; i++){
|
|
||||||
if (pack_buf->block_bufs[i] != NULL){
|
|
||||||
g_free(pack_buf->block_bufs[i]);
|
|
||||||
pack_buf->block_bufs[i] = NULL;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_safe_free(vdev->packet_buffer);
|
|
||||||
g_safe_free(vdev->buf);
|
|
||||||
g_safe_free(vdev->logic_buf);
|
|
||||||
g_safe_free(sdi->priv);
|
g_safe_free(sdi->priv);
|
||||||
|
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
@@ -1369,13 +1384,13 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
|
|||||||
{
|
{
|
||||||
if (unzLocateFile(vdev->archive, "data", 0) != UNZ_OK)
|
if (unzLocateFile(vdev->archive, "data", 0) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't locate zip inner file:\"%s\"", "data");
|
sr_err("can't locate zip inner file:\"%s\"", "data");
|
||||||
close_archive(vdev);
|
close_archive(vdev);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
if (unzOpenCurrentFile(vdev->archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:\"%s\"", "data");
|
sr_err("can't open zip inner file:\"%s\"", "data");
|
||||||
close_archive(vdev);
|
close_archive(vdev);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
@@ -1473,7 +1488,7 @@ SR_PRIV int sr_new_virtual_device(const char *filename, struct sr_dev_inst **out
|
|||||||
}
|
}
|
||||||
if (unzOpenCurrentFile(archive) != UNZ_OK)
|
if (unzOpenCurrentFile(archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
sr_err("cant't open zip inner file:'header',%s", filename);
|
sr_err("can't open zip inner file:'header',%s", filename);
|
||||||
unzClose(archive);
|
unzClose(archive);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user