]> sigrok.org Git - libsigrok.git/blobdiff - hardware/openbench-logic-sniffer/ols.c
allow for intermediate stage in stopping acquisition
[libsigrok.git] / hardware / openbench-logic-sniffer / ols.c
index 7a89d77518f65e290778c1f7c32783d1761dc812..6f914a8c8991851dac884897d025fb3de3b773fe 100644 (file)
@@ -369,7 +369,7 @@ static int hw_init(void)
 
        if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
                sr_err("ols: driver context malloc failed.");
-               return SR_ERR;
+               return SR_ERR_MALLOC;
        }
        odi->priv = drvc;
 
@@ -519,6 +519,15 @@ hw_init_free_ports:
        return devices;
 }
 
+static GSList *hw_dev_list(void)
+{
+       struct drv_context *drvc;
+
+       drvc = odi->priv;
+
+       return drvc->instances;
+}
+
 static int hw_dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -754,6 +763,7 @@ static int receive_data(int fd, int revents, void *cb_data)
                 */
                sr_source_remove(fd);
                sr_source_add(fd, G_IO_IN, 30, receive_data, cb_data);
+               /* TODO: Check malloc return code. */
                devc->raw_sample_buf = g_try_malloc(devc->limit_samples * 4);
                if (!devc->raw_sample_buf) {
                        sr_err("ols: %s: devc->raw_sample_buf malloc failed",
@@ -1063,10 +1073,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
 }
 
 /* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
-
        /* Avoid compiler warnings. */
        (void)cb_data;
 
@@ -1082,6 +1090,8 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
        .init = hw_init,
        .cleanup = hw_cleanup,
        .scan = hw_scan,
+       .dev_list = hw_dev_list,
+       .dev_clear = hw_cleanup,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
        .info_get = hw_info_get,