rigol-ds: Minor whitespace fixes.
This commit is contained in:
parent
04e8e01ec6
commit
c2b394d562
|
@ -493,13 +493,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_probe_group *probe_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
uint64_t samplerate;
|
||||||
|
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
/* If a probe group is specified, it must be a valid one. */
|
/* If a probe group is specified, it must be a valid one. */
|
||||||
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
|
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
|
||||||
{
|
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid probe group specified.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
@ -520,12 +520,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
if (devc->data_source == DATA_SOURCE_LIVE) {
|
if (devc->data_source == DATA_SOURCE_LIVE) {
|
||||||
uint64_t samplerate = analog_frame_size(sdi) /
|
samplerate = analog_frame_size(sdi) /
|
||||||
(devc->timebase * devc->model->num_horizontal_divs);
|
(devc->timebase * devc->model->num_horizontal_divs);
|
||||||
*data = g_variant_new_uint64(samplerate);
|
*data = g_variant_new_uint64(samplerate);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
|
@ -551,8 +551,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
/* If a probe group is specified, it must be a valid one. */
|
/* If a probe group is specified, it must be a valid one. */
|
||||||
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
|
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
|
||||||
{
|
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid probe group specified.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
@ -881,8 +880,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
} else {
|
} else {
|
||||||
if (devc->enabled_analog_probes) {
|
if (devc->enabled_analog_probes) {
|
||||||
if (devc->data_source == DATA_SOURCE_MEMORY)
|
if (devc->data_source == DATA_SOURCE_MEMORY) {
|
||||||
{
|
|
||||||
/* Apparently for the DS2000 the memory
|
/* Apparently for the DS2000 the memory
|
||||||
* depth can only be set in Running state -
|
* depth can only be set in Running state -
|
||||||
* this matches the behaviour of the UI. */
|
* this matches the behaviour of the UI. */
|
||||||
|
|
|
@ -182,8 +182,7 @@ static int rigol_ds_trigger_wait(const struct sr_dev_inst *sdi)
|
||||||
* If timebase < 50 msecs/DIV just sleep about one sweep time except
|
* If timebase < 50 msecs/DIV just sleep about one sweep time except
|
||||||
* for really fast sweeps.
|
* for really fast sweeps.
|
||||||
*/
|
*/
|
||||||
if (devc->timebase < 0.0499)
|
if (devc->timebase < 0.0499) {
|
||||||
{
|
|
||||||
if (devc->timebase > 0.99e-6) {
|
if (devc->timebase > 0.99e-6) {
|
||||||
/*
|
/*
|
||||||
* Timebase * num hor. divs * 85(%) * 1e6(usecs) / 100
|
* Timebase * num hor. divs * 85(%) * 1e6(usecs) / 100
|
||||||
|
@ -370,13 +369,11 @@ static int rigol_ds_read_header(struct sr_scpi_dev_inst *scpi)
|
||||||
/* Read the hashsign and length digit. */
|
/* Read the hashsign and length digit. */
|
||||||
tmp = sr_scpi_read_data(scpi, start, 2);
|
tmp = sr_scpi_read_data(scpi, start, 2);
|
||||||
start[2] = '\0';
|
start[2] = '\0';
|
||||||
if (tmp != 2)
|
if (tmp != 2) {
|
||||||
{
|
|
||||||
sr_err("Failed to read first two bytes of data block header.");
|
sr_err("Failed to read first two bytes of data block header.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (start[0] != '#' || !isdigit(start[1]) || start[1] == '0')
|
if (start[0] != '#' || !isdigit(start[1]) || start[1] == '0') {
|
||||||
{
|
|
||||||
sr_err("Received invalid data block header start '%s'.", start);
|
sr_err("Received invalid data block header start '%s'.", start);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -385,13 +382,11 @@ static int rigol_ds_read_header(struct sr_scpi_dev_inst *scpi)
|
||||||
/* Read the data length. */
|
/* Read the data length. */
|
||||||
tmp = sr_scpi_read_data(scpi, length, len);
|
tmp = sr_scpi_read_data(scpi, length, len);
|
||||||
length[len] = '\0';
|
length[len] = '\0';
|
||||||
if (tmp != len)
|
if (tmp != len) {
|
||||||
{
|
|
||||||
sr_err("Failed to read %d bytes of data block length.", len);
|
sr_err("Failed to read %d bytes of data block length.", len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (parse_int(length, &len) != SR_OK)
|
if (parse_int(length, &len) != SR_OK) {
|
||||||
{
|
|
||||||
sr_err("Received invalid data block length '%s'.", length);
|
sr_err("Received invalid data block length '%s'.", length);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -428,19 +423,16 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
||||||
switch (devc->wait_event) {
|
switch (devc->wait_event) {
|
||||||
case WAIT_NONE:
|
case WAIT_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_TRIGGER:
|
case WAIT_TRIGGER:
|
||||||
if (rigol_ds_trigger_wait(sdi) != SR_OK)
|
if (rigol_ds_trigger_wait(sdi) != SR_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (rigol_ds_channel_start(sdi) != SR_OK)
|
if (rigol_ds_channel_start(sdi) != SR_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_BLOCK:
|
case WAIT_BLOCK:
|
||||||
if (rigol_ds_block_wait(sdi) != SR_OK)
|
if (rigol_ds_block_wait(sdi) != SR_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_STOP:
|
case WAIT_STOP:
|
||||||
if (rigol_ds_stop_wait(sdi) != SR_OK)
|
if (rigol_ds_stop_wait(sdi) != SR_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -449,7 +441,6 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
||||||
if (rigol_ds_channel_start(sdi) != SR_OK)
|
if (rigol_ds_channel_start(sdi) != SR_OK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sr_err("BUG: Unknown event target encountered");
|
sr_err("BUG: Unknown event target encountered");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue