]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/dso.c
sr/drivers: change driver dev_open/dev_close calls to use sdi
[libsigrok.git] / hardware / hantek-dso / dso.c
index 75832c8aa4e98806a9dd35dea971259c7714a4dd..98a326c0cb4fe363a62e51afdfed5652a41477aa 100644 (file)
@@ -19,8 +19,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "sigrok.h"
-#include "sigrok-internal.h"
+#include "libsigrok.h"
+#include "libsigrok-internal.h"
 #include "config.h"
 #include "dso.h"
 #include <string.h>
@@ -28,7 +28,7 @@
 #include <libusb.h>
 
 extern libusb_context *usb_context;
-extern GSList *dev_insts;
+extern struct sr_dev_driver hantek_dso_driver_info;
 
 
 static int send_begin(struct context *ctx)
@@ -104,16 +104,13 @@ err:
        return mps;
 }
 
-SR_PRIV int dso_open(int dev_index)
+SR_PRIV int dso_open(struct sr_dev_inst *sdi)
 {
        libusb_device **devlist;
        struct libusb_device_descriptor des;
-       struct sr_dev_inst *sdi;
        struct context *ctx;
        int err, skip, i;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
-               return SR_ERR_ARG;
        ctx = sdi->priv;
 
        if (sdi->status == SR_ST_ACTIVE)
@@ -133,7 +130,7 @@ SR_PRIV int dso_open(int dev_index)
                        continue;
 
                if (sdi->status == SR_ST_INITIALIZING) {
-                       if (skip != dev_index) {
+                       if (skip != sdi->index) {
                                /* Skip devices of this type that aren't the one we want. */
                                skip += 1;
                                continue;
@@ -672,7 +669,7 @@ SR_PRIV int dso_get_capturestate(struct context *ctx, uint8_t *capturestate,
         */
        bitvalue = 1;
        for (i = 0; i < 24; i++) {
-               // Each set bit inverts all bits with a lower value
+               /* Each set bit inverts all bits with a lower value. */
                if(toff & bitvalue)
                        toff ^= bitvalue - 1;
                bitvalue <<= 1;