aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2016-12-30 23:46:27 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2017-01-07 21:36:53 +0100
commit65a6794ea1fef5064e7d47403a7bbbed76c3058b (patch)
treeebd700332415835d2b4cd4273a00951d914a1c87
parentd1ad8b10bc9a928cb7b636bcf206ea59736a8658 (diff)
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.
-rw-r--r--src/hardware/hameg-hmo/api.c5
-rw-r--r--src/hardware/hameg-hmo/protocol.c7
-rw-r--r--src/hardware/hameg-hmo/protocol.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c
index 92f5ab6..ead97cd 100644
--- a/src/hardware/hameg-hmo/api.c
+++ b/src/hardware/hameg-hmo/api.c
@@ -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:
diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c
index 528d7b0..97eb77a 100644
--- a/src/hardware/hameg-hmo/protocol.c
+++ b/src/hardware/hameg-hmo/protocol.c
@@ -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;
diff --git a/src/hardware/hameg-hmo/protocol.h b/src/hardware/hameg-hmo/protocol.h
index 6219ed6..92c9b67 100644
--- a/src/hardware/hameg-hmo/protocol.h
+++ b/src/hardware/hameg-hmo/protocol.h
@@ -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];