X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hwdriver.c;h=f74d47f05264b4dbd809ebc862ffbca326417371;hb=47211d65b4fdaca58694a51cdbf1ba8ee4270ee9;hp=91b0e6d9d0813cdfeb0c3f27889f8660fde301f7;hpb=80bf04263528998feb17cedc5b7aa9668dbc8d4d;p=libsigrok.git diff --git a/hwdriver.c b/hwdriver.c index 91b0e6d9..f74d47f0 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -193,6 +193,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status, sdi->vendor = vendor ? g_strdup(vendor) : NULL; sdi->model = model ? g_strdup(model) : NULL; sdi->version = version ? g_strdup(version) : NULL; + sdi->probes = NULL; sdi->priv = NULL; return sdi; @@ -222,6 +223,25 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) g_free(sdi); } +SR_PRIV struct sr_probe *sr_probe_new(int index, int type, + gboolean enabled, const char *name) +{ + struct sr_probe *probe; + + if (!(probe = g_try_malloc0(sizeof(struct sr_probe)))) { + sr_err("hwdriver: probe malloc failed"); + return NULL; + } + + probe->index = index; + probe->type = type; + probe->enabled = enabled; + if (name) + probe->name = g_strdup(name); + + return probe; +} + #ifdef HAVE_LIBUSB_1_0 SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus,