]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hp-59306a/api.c
raspberrypi-pico: Comment clean up, support a more general use case model
[libsigrok.git] / src / hardware / hp-59306a / api.c
index 76ea8d7e2952199157c9f01f7049e0dcc5d8e1c4..d2b840041d36dc227979f5b6dfde0a8f353372a4 100644 (file)
@@ -47,6 +47,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        struct channel_group_context *cgc;
        size_t idx, nr;
        struct sr_channel_group *cg;
+       char cg_name[24];
 
        /*
         * The device cannot get identified by means of SCPI queries.
@@ -73,15 +74,11 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        devc->channel_count = 6;
        for (idx = 0; idx < devc->channel_count; idx++) {
                nr = idx + 1;
-
-               cg = g_malloc0(sizeof(*cg));
-               cg->name = g_strdup_printf("CH%zu", nr);
-
+               snprintf(cg_name, sizeof(cg_name), "R%zu", nr);
                cgc = g_malloc0(sizeof(*cgc));
                cgc->number = nr;
-               cg->priv = cgc;
-
-               sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
+               cg = sr_channel_group_new(sdi, cg_name, cgc);
+               (void)cg;
        }
 
        return sdi;
@@ -183,7 +180,7 @@ static int config_list(uint32_t key, GVariant **data,
 
 static struct sr_dev_driver hp_59306a_driver_info = {
        .name = "hp-59306a",
-       .longname = "hp-59306a",
+       .longname = "HP 59306A",
        .api_version = 1,
        .init = std_init,
        .cleanup = std_cleanup,