]> sigrok.org Git - sigrok-util.git/blobdiff - source/drv-api.c
new-driver: Logging helper fixes.
[sigrok-util.git] / source / drv-api.c
index 831c942c134f5b168467d69c99215b16cd14fd55..671149bd6fa4230d1d88de29632df177760540e6 100644 (file)
@@ -56,7 +56,7 @@ static int hw_init(void)
        struct drv_context *drvc;
 
        if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
-               sr_err("${short}: Driver context malloc failed.");
+               sr_err("Driver context malloc failed.");
                return SR_ERR;
        }
 
@@ -121,6 +121,7 @@ static int hw_info_get(int info_id, const void **data,
        switch (info_id) {
        /* TODO */
        default:
+               sr_err("Unknown info_id: %d.", info_id);
                return SR_ERR_ARG;
        }
 
@@ -132,13 +133,16 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
 {
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
+       if (sdi->status != SR_ST_ACTIVE) {
+               sr_err("Device inactive, can't set config options.");
                return SR_ERR;
+       }
 
        ret = SR_OK;
        switch (hwcap) {
        /* TODO */
        default:
+               sr_err("Unknown hardware capability: %d.", hwcap);
                ret = SR_ERR_ARG;
        }
 
@@ -158,8 +162,10 @@ static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
 {
        (void)cb_data;
 
-       if (sdi->status != SR_ST_ACTIVE)
+       if (sdi->status != SR_ST_ACTIVE) {
+               sr_err("Device inactive, can't stop acquisition.");
                return SR_ERR;
+       }
 
        /* TODO */