hameg-hmo: Use the host's endianess to read analog channel data via SCPI

Configure the scope to the host's native endianess before downloading
acquisition data from analog channels. This unbreaks operation on those
models which default to a representation which differs from the host.
This commit is contained in:
Gerhard Sittig 2016-12-30 23:46:27 +01:00
parent d1ad8b10bc
commit 65a6794ea1
3 changed files with 12 additions and 2 deletions

View File

@ -568,6 +568,11 @@ SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi)
case SR_CHANNEL_ANALOG:
g_snprintf(command, sizeof(command),
(*model->scpi_dialect)[SCPI_CMD_GET_ANALOG_DATA],
#ifdef WORDS_BIGENDIAN
"MSBF",
#else
"LSBF",
#endif
ch->index + 1);
break;
case SR_CHANNEL_LOGIC:

View File

@ -31,7 +31,8 @@ static const char *hameg_scpi_dialect[] = {
[SCPI_CMD_SET_COUPLING] = ":CHAN%d:COUP %s",
[SCPI_CMD_GET_SAMPLE_RATE] = ":ACQ:SRAT?",
[SCPI_CMD_GET_SAMPLE_RATE_LIVE] = ":%s:DATA:POINTS?",
[SCPI_CMD_GET_ANALOG_DATA] = ":FORM REAL,32;:CHAN%d:DATA?",
[SCPI_CMD_GET_ANALOG_DATA] = ":FORM:BORD %s;" \
":FORM REAL,32;:CHAN%d:DATA?",
[SCPI_CMD_GET_VERTICAL_DIV] = ":CHAN%d:SCAL?",
[SCPI_CMD_SET_VERTICAL_DIV] = ":CHAN%d:SCAL %s",
[SCPI_CMD_GET_DIG_POD_STATE] = ":POD%d:STAT?",
@ -821,7 +822,11 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
encoding.unitsize = sizeof(float);
encoding.is_signed = TRUE;
encoding.is_float = TRUE;
#ifdef WORDS_BIGENDIAN
encoding.is_bigendian = TRUE;
#else
encoding.is_bigendian = FALSE;
#endif
/* TODO: Use proper 'digits' value for this device (and its modes). */
encoding.digits = 2;
encoding.is_digits_decimal = FALSE;

View File

@ -29,7 +29,7 @@
#define LOG_PREFIX "hameg-hmo"
#define MAX_INSTRUMENT_VERSIONS 10
#define MAX_COMMAND_SIZE 31
#define MAX_COMMAND_SIZE 48
struct scope_config {
const char *name[MAX_INSTRUMENT_VERSIONS];