]> sigrok.org Git - libsigrok.git/blobdiff - hardware/openbench-logic-sniffer/ols.c
sr: remove unused argument from hardware driver function init()
[libsigrok.git] / hardware / openbench-logic-sniffer / ols.c
index 7cdd77e64076ba2cb898b78cb0f2246fe41bab1e..02afff33a7df027fc3f733681ceafd979669f17f 100644 (file)
@@ -38,8 +38,8 @@
 #include <arpa/inet.h>
 #endif
 #include <glib.h>
-#include "sigrok.h"
-#include "sigrok-internal.h"
+#include "libsigrok.h"
+#include "libsigrok-internal.h"
 #include "ols.h"
 
 #ifdef _WIN32
@@ -93,14 +93,14 @@ static const char *probe_names[NUM_PROBES + 1] = {
 };
 
 /* default supported samplerates, can be overridden by device metadata */
-static struct sr_samplerates samplerates = {
+static const struct sr_samplerates samplerates = {
        SR_HZ(10),
        SR_MHZ(200),
        SR_HZ(1),
        NULL,
 };
 
-/* List of struct sr_serial_dev_inst */
+/* List of struct sr_dev_inst. */
 static GSList *dev_insts = NULL;
 
 static int send_shortcommand(int fd, uint8_t command)
@@ -348,7 +348,7 @@ static struct sr_dev_inst *get_metadata(int fd)
        return sdi;
 }
 
-static int hw_init(const char *devinfo)
+static int hw_init(void)
 {
        struct sr_dev_inst *sdi;
        struct context *ctx;
@@ -359,12 +359,8 @@ static int hw_init(const char *devinfo)
 
        final_devcnt = 0;
 
-       if (devinfo)
-               ports = g_slist_append(NULL, g_strdup(devinfo));
-       else
-               /* No specific device given, so scan all serial ports. */
-               ports = list_serial_ports();
-
+       /* Scan all serial ports. */
+       ports = list_serial_ports();
        num_ports = g_slist_length(ports);
 
        if (!(fds = g_try_malloc0(num_ports * sizeof(GPollFD)))) {
@@ -398,7 +394,7 @@ static int hw_init(const char *devinfo)
                fd = serial_open(l->data, O_RDWR | O_NONBLOCK);
                if (fd != -1) {
                        serial_params[devcnt] = serial_backup_params(fd);
-                       serial_set_params(fd, 115200, 8, 0, 1, 2);
+                       serial_set_params(fd, 115200, 8, SERIAL_PARITY_NONE, 1, 2);
                        ret = SR_OK;
                        for (i = 0; i < 5; i++) {
                                if ((ret = send_shortcommand(fd,