]> sigrok.org Git - libsigrok.git/blobdiff - hardware/openbench-logic-sniffer/ols.c
Add a struct sr_context * parameter to hw_init()
[libsigrok.git] / hardware / openbench-logic-sniffer / ols.c
index 643e2683ac1ecbb2260814075462a778fd856273..4d369bace57cf1bd962e7dfa22198ea4dd8956a1 100644 (file)
 #include "libsigrok-internal.h"
 #include "ols.h"
 
-#ifdef _WIN32
-#define O_NONBLOCK FIONBIO
-#endif
-
 #define SERIALCOMM "115200/8n1"
 
 static const int hwcaps[] = {
@@ -366,7 +362,7 @@ static struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
        return sdi;
 }
 
-static int hw_init(void)
+static int hw_init(struct sr_context *sr_ctx)
 {
        struct drv_context *drvc;
 
@@ -409,10 +405,8 @@ static GSList *hw_scan(GSList *options)
                        break;
                }
        }
-       if (!conn) {
-               sr_err("ols: No serial port specified.");
+       if (!conn)
                return NULL;
-       }
 
        if (serialcomm == NULL)
                serialcomm = SERIALCOMM;
@@ -427,7 +421,7 @@ static GSList *hw_scan(GSList *options)
         * have a match.
         */
        sr_info("ols: probing %s .", conn);
-       if (serial_open(serial, O_RDWR | O_NONBLOCK) != SR_OK)
+       if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
                return NULL;
 
        ret = SR_OK;
@@ -505,7 +499,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
 
        devc = sdi->priv;
 
-       if (serial_open(devc->serial, O_RDWR) != SR_OK)
+       if (serial_open(devc->serial, SERIAL_RDWR) != SR_OK)
                return SR_ERR;
 
        sdi->status = SR_ST_ACTIVE;