X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcolead-slm%2Fapi.c;h=b75af7f6d2b8043c9f1f19d4dde441bcfe0399c8;hb=208c1d35435626a11afa1ab301b2071b2a4e187b;hp=eedffbfbf56097c157ead4fbc5a19f5c88ec352e;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git
diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c
index eedffbfb..b75af7f6 100644
--- a/src/hardware/colead-slm/api.c
+++ b/src/hardware/colead-slm/api.c
@@ -17,15 +17,15 @@
* along with this program. If not, see .
*/
+#include
#include
-#include "libsigrok.h"
-#include "libsigrok-internal.h"
-#include "protocol.h"
#include
#include
#include
-#include
#include
+#include
+#include "libsigrok-internal.h"
+#include "protocol.h"
/* The Colead SL-5868P uses this. */
#define SERIALCOMM "2400/8n1"
@@ -58,7 +58,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
GSList *devices, *l;
const char *conn, *serialcomm;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@@ -98,7 +98,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
@@ -137,18 +137,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
switch (key) {
case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
- if (g_variant_get_uint64(data) == 0) {
- sr_err("LIMIT_MSEC can't be 0.");
- return SR_ERR;
- }
devc->limit_msec = g_variant_get_uint64(data);;
- sr_dbg("Setting time limit to %" PRIu64 "ms.",
- devc->limit_msec);
break;
case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = g_variant_get_uint64(data);
- sr_dbg("Setting sample limit to %" PRIu64 ".",
- devc->limit_samples);
break;
default:
return SR_ERR_NA;
@@ -187,14 +179,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
-
+ devc = sdi->priv;
devc->cb_data = cb_data;
- /* Send header packet to the session bus. */
std_session_send_df_header(cb_data, LOG_PREFIX);
/* Poll every 150ms, or whenever some data comes in. */
@@ -227,5 +214,5 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};