]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hantek-dso/dso.c
Build: Set local include directories in Makefile.am
[libsigrok.git] / src / hardware / hantek-dso / dso.c
index 766157484c4aa1c96b04bb4c936d06597973ec64..27ef63c1e864b35385973c9750237bbaa3f62ef7 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "libsigrok.h"
-#include "libsigrok-internal.h"
-#include "dso.h"
 #include <string.h>
 #include <glib.h>
 #include <libusb.h>
+#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
+#include "dso.h"
+
+#define NUM_CHANNELS 2
 
 extern struct sr_dev_driver hantek_dso_driver_info;
 
@@ -109,7 +111,7 @@ err:
 SR_PRIV int dso_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
-       struct drv_context *drvc = hantek_dso_driver_info.priv;
+       struct drv_context *drvc = hantek_dso_driver_info.context;
        struct sr_usb_dev_inst *usb;
        struct libusb_device_descriptor des;
        libusb_device **devlist;
@@ -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",