+ for (i = 0; i < ARRAY_SIZE(supported_ics_usbrelay); i++) {
+ profile = &supported_ics_usbrelay[i];
+ if (device_id != profile->id)
+ continue;
+ sdi = g_malloc0(sizeof(*sdi));
+ sdi->status = SR_ST_INACTIVE;
+ sdi->vendor = g_strdup("ICStation");
+ sdi->model = g_strdup(profile->modelname);
+ sdi->inst_type = SR_INST_SERIAL;
+ sdi->conn = serial;
+ sdi->connection_id = g_strdup(conn);
+
+ devc = g_malloc0(sizeof(*devc));
+ sdi->priv = devc;
+ devc->relay_count = profile->nb_channels;
+ devc->relay_mask = (1U << devc->relay_count) - 1;
+ /* Assume that all relays are off at the start. */
+ devc->relay_state = 0;
+ for (ch_idx = 0; ch_idx < devc->relay_count; ch_idx++) {
+ cg = g_malloc0(sizeof(*cg));
+ cg->name = g_strdup_printf("R%zu", ch_idx + 1);
+ cgc = g_malloc0(sizeof(*cgc));
+ cg->priv = cgc;
+ cgc->index = ch_idx;
+ sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
+ }
+
+ devices = g_slist_append(devices, sdi);
+ break;
+ }