]> sigrok.org Git - libsigrok.git/blobdiff - hardware/zeroplus-logic-cube/zeroplus.c
sr: cleanup callback: Return int.
[libsigrok.git] / hardware / zeroplus-logic-cube / zeroplus.c
index 6a6ed0b74340ac896e372d9b3d3dee42cc0272e5..02ba89d719866242c6216c21fe26b20982c8deae 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the sigrok project.
  *
- * Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -485,10 +485,12 @@ static int hw_closedev(int device_index)
        return SR_OK;
 }
 
-static void hw_cleanup(void)
+static int hw_cleanup(void)
 {
        GSList *l;
 
+       /* TODO: Error handling. */
+
        /* Properly close all devices... */
        for (l = device_instances; l; l = l->next)
                close_device((struct sr_device_instance *)l->data);
@@ -502,6 +504,8 @@ static void hw_cleanup(void)
        if (usb_context)
                libusb_exit(usb_context);
        usb_context = NULL;
+
+       return SR_OK;
 }
 
 static void *hw_get_device_info(int device_index, int device_info_id)
@@ -698,7 +702,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 }
 
 /* This stops acquisition on ALL devices, ignoring device_index. */
-static void hw_stop_acquisition(int device_index, gpointer session_device_id)
+static int hw_stop_acquisition(int device_index, gpointer session_device_id)
 {
        struct sr_datafeed_packet packet;
        struct sr_device_instance *sdi;
@@ -709,16 +713,18 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
 
        if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
-               return; /* FIXME */
+               return SR_ERR_BUG;
        }
 
        if (!(zp = sdi->priv)) {
                sr_err("zp: %s: sdi->priv was NULL", __func__);
-               return; /* FIXME */
+               return SR_ERR_BUG;
        }
 
        analyzer_reset(zp->usb->devhdl);
        /* TODO: Need to cancel and free any queued up transfers. */
+
+       return SR_OK;
 }
 
 SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {