diff --git a/src/hardware/colead-slm/protocol.c b/src/hardware/colead-slm/protocol.c index 182c77bb..d68e8f50 100644 --- a/src/hardware/colead-slm/protocol.c +++ b/src/hardware/colead-slm/protocol.c @@ -92,80 +92,79 @@ static void process_packet(const struct sr_dev_inst *sdi) * weighting. */ mode = devc->buf[2] & 0x0f; switch (mode) { - case 0x0: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0x1: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0x2: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_C \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0x3: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_C \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0x4: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0x5: - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0x6: - analog.mqflags |= SR_MQFLAG_SPL_PCT_OVER_ALARM \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0x7: - analog.mqflags |= SR_MQFLAG_SPL_PCT_OVER_ALARM \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0x8: - /* 10-second mean, but we don't have MQ flags to express it. */ - analog.mqflags |= SR_MQFLAG_SPL_LAT \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0x9: - /* Mean over a time period between 11 seconds and 24 hours. - * Which is so silly that there's no point in expressing - * either this or the previous case. */ - analog.mqflags |= SR_MQFLAG_SPL_LAT \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_F; - break; - case 0xa: - /* 10-second mean. */ - analog.mqflags |= SR_MQFLAG_SPL_LAT \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0xb: - /* Mean over a time period between 11 seconds and 24 hours. */ - analog.mqflags |= SR_MQFLAG_SPL_LAT \ - | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ - | SR_MQFLAG_SPL_TIME_WEIGHT_S; - break; - case 0xc: - /* Internal calibration on 1kHz sine at 94dB, not useful - * to anything but the device. */ - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT; - break; - case 0xd: - /* Internal calibration on 1kHz sine at 94dB, not useful - * to anything but the device. */ - analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT; - break; - default: - sr_dbg("unknown configuration 0x%.2x", mode); - return; - break; + case 0x0: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0x1: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0x2: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_C \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0x3: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_C \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0x4: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0x5: + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0x6: + analog.mqflags |= SR_MQFLAG_SPL_PCT_OVER_ALARM \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0x7: + analog.mqflags |= SR_MQFLAG_SPL_PCT_OVER_ALARM \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0x8: + /* 10-second mean, but we don't have MQ flags to express it. */ + analog.mqflags |= SR_MQFLAG_SPL_LAT \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0x9: + /* Mean over a time period between 11 seconds and 24 hours. + * Which is so silly that there's no point in expressing + * either this or the previous case. */ + analog.mqflags |= SR_MQFLAG_SPL_LAT \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_F; + break; + case 0xa: + /* 10-second mean. */ + analog.mqflags |= SR_MQFLAG_SPL_LAT \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0xb: + /* Mean over a time period between 11 seconds and 24 hours. */ + analog.mqflags |= SR_MQFLAG_SPL_LAT \ + | SR_MQFLAG_SPL_FREQ_WEIGHT_A \ + | SR_MQFLAG_SPL_TIME_WEIGHT_S; + break; + case 0xc: + /* Internal calibration on 1kHz sine at 94dB, not useful + * to anything but the device. */ + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT; + break; + case 0xd: + /* Internal calibration on 1kHz sine at 94dB, not useful + * to anything but the device. */ + analog.mqflags |= SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT; + break; + default: + sr_dbg("unknown configuration 0x%.2x", mode); + return; } packet.type = SR_DF_ANALOG; diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index a3deecc3..b26b2605 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -212,7 +212,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) } ag->num_samples = last_end; break; - case PATTERN_SINE: frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; @@ -231,7 +230,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) ag->num_samples = num_samples; break; - case PATTERN_TRIANGLE: frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; @@ -246,7 +244,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate) ag->num_samples = num_samples; break; - case PATTERN_SAWTOOTH: frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 5e1f6643..6fd89795 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -518,30 +518,30 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd ret = SR_OK; switch (key) { - case SR_CONF_SAMPLERATE: - arg = g_variant_get_uint64(data); - for (i = 0; i < ARRAY_SIZE(samplerates); i++) { - if (samplerates[i] == arg) { - devc->cur_samplerate = arg; - break; - } + case SR_CONF_SAMPLERATE: + arg = g_variant_get_uint64(data); + for (i = 0; i < ARRAY_SIZE(samplerates); i++) { + if (samplerates[i] == arg) { + devc->cur_samplerate = arg; + break; } - if (i == ARRAY_SIZE(samplerates)) - ret = SR_ERR_ARG; - break; - case SR_CONF_LIMIT_SAMPLES: - devc->limit_samples = g_variant_get_uint64(data); - break; - case SR_CONF_CAPTURE_RATIO: - devc->capture_ratio = g_variant_get_uint64(data); - if (devc->capture_ratio > 100) { - devc->capture_ratio = 0; - ret = SR_ERR; - } else - ret = SR_OK; - break; - default: - ret = SR_ERR_NA; + } + if (i == ARRAY_SIZE(samplerates)) + ret = SR_ERR_ARG; + break; + case SR_CONF_LIMIT_SAMPLES: + devc->limit_samples = g_variant_get_uint64(data); + break; + case SR_CONF_CAPTURE_RATIO: + devc->capture_ratio = g_variant_get_uint64(data); + if (devc->capture_ratio > 100) { + devc->capture_ratio = 0; + ret = SR_ERR; + } else + ret = SR_OK; + break; + default: + ret = SR_ERR_NA; } return ret; diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index e7d7fc88..6f96d504 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -568,22 +568,27 @@ static void decode_rs_2x_TR2(uint8_t rs, struct dev_context *devc) case SR_MQ_CURRENT: if (devc->scale1000 == -1) /* mA */ switch (range) { - case 0: case 1: /* 100, 300 µA */ + case 0: + case 1: /* 100, 300 µA */ devc->scale *= pow(10.0, -6); break; - case 2: case 3: /* 1, 3 mA */ + case 2: + case 3: /* 1, 3 mA */ devc->scale *= pow(10.0, -5); break; - case 4: case 5: /* 10, 30 mA */ + case 4: + case 5: /* 10, 30 mA */ devc->scale *= pow(10.0, -4); break; - case 6: case 7: /* 100, 300 mA */ + case 6: + case 7: /* 100, 300 mA */ devc->scale *= pow(10.0, -3); break; } else /* A */ switch (range) { - case 0: case 1: /* 1, 3 A */ + case 0: + case 1: /* 1, 3 A */ devc->scale *= pow(10.0, -5); break; case 2: /* 10 A */ diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 7f90b834..4e3c6886 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -649,7 +649,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_ERR_ARG; if (!cg) { - switch (key) { + switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); @@ -683,7 +683,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_ERR_NA; } } else { - switch (key) { + switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(uint32_t)); diff --git a/src/hardware/motech-lps-30x/protocol.c b/src/hardware/motech-lps-30x/protocol.c index 86959ba5..c8ac58ac 100644 --- a/src/hardware/motech-lps-30x/protocol.c +++ b/src/hardware/motech-lps-30x/protocol.c @@ -77,7 +77,10 @@ static void process_line(struct sr_dev_inst *sdi) case 1: /* Waiting for data reply to request */ /* Convert numbers */ switch (devc->acq_req) { - case AQ_U1: case AQ_U2: case AQ_I1: case AQ_I2: + case AQ_U1: + case AQ_U2: + case AQ_I1: + case AQ_I2: if (sr_atod(devc->buf, &dbl) != SR_OK) { sr_err("Failed to convert '%s' to double, errno=%d %s", devc->buf, errno, strerror(errno)); diff --git a/src/hardware/sysclk-lwla/protocol.c b/src/hardware/sysclk-lwla/protocol.c index ce922374..91cb3231 100644 --- a/src/hardware/sysclk-lwla/protocol.c +++ b/src/hardware/sysclk-lwla/protocol.c @@ -107,8 +107,12 @@ static int capture_setup(const struct sr_dev_inst *sdi) /* Set bits to select external TRG input edge. */ if (devc->cfg_trigger_source == TRIGGER_EXT_TRG) switch (devc->cfg_trigger_slope) { - case EDGE_POSITIVE: trigger_mask |= (uint64_t)1 << 35; break; - case EDGE_NEGATIVE: trigger_mask |= (uint64_t)1 << 34; break; + case EDGE_POSITIVE: + trigger_mask |= (uint64_t)1 << 35; + break; + case EDGE_NEGATIVE: + trigger_mask |= (uint64_t)1 << 34; + break; } command[19] = LWLA_WORD_0(trigger_mask);