mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
Fix issue #87: Hangs at 100% on Arch Linux
This commit is contained in:
parent
79fdd36d5a
commit
45abe48a91
@ -160,11 +160,16 @@ bool StoreSession::save_start()
|
||||
_error = tr("Generate temp file failed.");
|
||||
return false;
|
||||
} else {
|
||||
sr_session_save_init(_file_name.toLocal8Bit().data(),
|
||||
int ret = sr_session_save_init(_file_name.toLocal8Bit().data(),
|
||||
meta_file.toLocal8Bit().data(),
|
||||
decoders_file.toLocal8Bit().data());
|
||||
_thread = boost::thread(&StoreSession::save_proc, this, snapshot);
|
||||
return !_has_error;
|
||||
if (ret != SR_OK) {
|
||||
_error = tr("Failed to create zip file. Please check write permission of this path.");
|
||||
return false;
|
||||
} else {
|
||||
_thread = boost::thread(&StoreSession::save_proc, this, snapshot);
|
||||
return !_has_error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +244,7 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
{
|
||||
GSList *l;
|
||||
GVariant *gvar;
|
||||
FILE *meta;
|
||||
FILE *meta = NULL;
|
||||
struct sr_channel *probe;
|
||||
int probecnt;
|
||||
char *s;
|
||||
@ -262,6 +267,11 @@ QString StoreSession::meta_gen(boost::shared_ptr<data::Snapshot> snapshot)
|
||||
|
||||
const sr_dev_inst *sdi = _session.get_device()->dev_inst();
|
||||
meta = fopen(metafile.toLocal8Bit().data(), "wb");
|
||||
if (meta == NULL) {
|
||||
qDebug() << "Failed to create temp meta file.";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(meta, "[version]\n");
|
||||
if (sdi->mode == DSO)
|
||||
fprintf(meta, "version = %d\n", 1); // should be updated in next version
|
||||
|
@ -2532,7 +2532,7 @@ static unsigned int get_number_of_transfers(struct DSL_context *devc)
|
||||
total_buffer_time * to_bytes_per_ms(devc));
|
||||
/* Total buffer size should be able to hold about 500ms of data. */
|
||||
//n = 500 * to_bytes_per_ms(devc) / get_buffer_size(devc);
|
||||
n = ceil(total_size * 1.0 / get_buffer_size(devc));
|
||||
n = ceil(total_size * 1.0f / get_buffer_size(devc));
|
||||
|
||||
if (n > NUM_SIMUL_TRANSFERS)
|
||||
return NUM_SIMUL_TRANSFERS;
|
||||
@ -2620,15 +2620,12 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
struct timeval tv;
|
||||
struct drv_context *drvc;
|
||||
struct DSL_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
int ret;
|
||||
|
||||
(void)fd;
|
||||
(void)revents;
|
||||
|
||||
drvc = di->priv;
|
||||
devc = sdi->priv;
|
||||
usb = sdi->conn;
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0;
|
||||
libusb_handle_events_timeout_completed(drvc->sr_ctx->libusb_ctx, &tv, &completed);
|
||||
@ -2638,19 +2635,7 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
}
|
||||
|
||||
if (devc->status == DSL_FINISH) {
|
||||
if (libusb_try_lock_events(drvc->sr_ctx->libusb_ctx) == 0) {
|
||||
if (libusb_event_handling_ok(drvc->sr_ctx->libusb_ctx)) {
|
||||
/* Stop GPIF acquisition */
|
||||
usb = ((struct sr_dev_inst *)devc->cb_data)->conn;
|
||||
if ((ret = command_stop_acquisition (usb->devhdl)) != SR_OK)
|
||||
sr_err("%s: Sent acquisition stop command failed!", __func__);
|
||||
else
|
||||
sr_info("%s: Sent acquisition stop command!", __func__);
|
||||
|
||||
remove_sources(devc);
|
||||
}
|
||||
libusb_unlock_events(drvc->sr_ctx->libusb_ctx);
|
||||
}
|
||||
remove_sources(devc);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -2841,6 +2826,7 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
|
||||
struct DSL_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
int ret;
|
||||
|
||||
devc = sdi->priv;
|
||||
usb = sdi->conn;
|
||||
@ -2848,6 +2834,12 @@ static int dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
if (!devc->abort) {
|
||||
devc->abort = TRUE;
|
||||
command_wr_reg(usb->devhdl, bmFORCE_RDY, EEWP_ADDR);
|
||||
} else if (devc->status == DSL_FINISH) {
|
||||
/* Stop GPIF acquisition */
|
||||
if ((ret = command_stop_acquisition (usb->devhdl)) != SR_OK)
|
||||
sr_err("%s: Sent acquisition stop command failed!", __func__);
|
||||
else
|
||||
sr_info("%s: Sent acquisition stop command!", __func__);
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
|
@ -2352,7 +2352,7 @@ static unsigned int get_number_of_transfers(struct DSL_context *devc)
|
||||
{
|
||||
unsigned int n;
|
||||
/* Total buffer size should be able to hold about 100ms of data. */
|
||||
n = total_buffer_time * to_bytes_per_ms(devc) / get_buffer_size(devc);
|
||||
n = ceil(total_buffer_time * 1.0f * to_bytes_per_ms(devc) / get_buffer_size(devc));
|
||||
|
||||
if (n > NUM_SIMUL_TRANSFERS)
|
||||
return NUM_SIMUL_TRANSFERS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user