]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Use the host's endianess to read analog channel data via SCPI
authorGerhard Sittig <redacted>
Fri, 30 Dec 2016 22:46:27 +0000 (23:46 +0100)
committerGerhard Sittig <redacted>
Sat, 7 Jan 2017 20:36:53 +0000 (21:36 +0100)
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.

src/hardware/hameg-hmo/api.c
src/hardware/hameg-hmo/protocol.c
src/hardware/hameg-hmo/protocol.h

index 92f5ab673a96fa4d48f94c7509465b90dd513f37..ead97cd4cef46eb48c4a28007d0bf3783c1c79d4 100644 (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:
index 528d7b04295dac4eda31220d537c71ac614e35af..97eb77aaac5ddce714e3d43ec1db41ad2767a790 100644 (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;
index 6219ed635ef048fc014bb43200f1b3b2a79ebd15..92c9b6754e2affd59d28a38e99088f48f8027a0a 100644 (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];