X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhantek-dso%2Fdso.c;h=156efd9333f32e4c37e3320744258f589be6d5ec;hb=07ffa5b315caab0d6d703e04f09035bc0f2b3ee4;hp=814db59839785139211b9347dc5d155a94aec00e;hpb=0c5f2abc6697504b5d760dfa56cc90bea180198f;p=libsigrok.git
diff --git a/src/hardware/hantek-dso/dso.c b/src/hardware/hantek-dso/dso.c
index 814db598..156efd93 100644
--- a/src/hardware/hantek-dso/dso.c
+++ b/src/hardware/hantek-dso/dso.c
@@ -19,12 +19,14 @@
* along with this program. If not, see .
*/
-#include "libsigrok.h"
-#include "libsigrok-internal.h"
-#include "dso.h"
#include
#include
#include
+#include "libsigrok.h"
+#include "libsigrok-internal.h"
+#include "dso.h"
+
+#define NUM_CHANNELS 2
extern struct sr_dev_driver hantek_dso_driver_info;
@@ -185,7 +187,7 @@ SR_PRIV void dso_close(struct sr_dev_inst *sdi)
usb = sdi->conn;
- if (usb->devhdl == NULL)
+ if (!usb->devhdl)
return;
sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
@@ -225,7 +227,7 @@ static int get_channel_offsets(const struct sr_dev_inst *sdi)
* since that's how voltage offsets are submitted back to the DSO.
* Convert to host order now, so we can use them natively.
*/
- for (chan = 0; chan < 2; chan++) {
+ for (chan = 0; chan < NUM_CHANNELS; chan++) {
for (v = 0; v < 9; v++) {
devc->channel_levels[chan][v][0] =
g_ntohs(devc->channel_levels[chan][v][0]);
@@ -236,7 +238,7 @@ static int get_channel_offsets(const struct sr_dev_inst *sdi)
if (sr_log_loglevel_get() >= SR_LOG_DBG) {
gs = g_string_sized_new(128);
- for (chan = 0; chan < 2; chan++) {
+ for (chan = 0; chan < NUM_CHANNELS; chan++) {
g_string_printf(gs, "CH%d:", chan + 1);
for (v = 0; v < 9; v++) {
g_string_append_printf(gs, " %.4x-%.4x",