+ devc = g_malloc0(sizeof(struct dev_context));
+ devc->samplerate = SR_HZ(10);
+
+ sdi = g_malloc0(sizeof(struct sr_dev_inst));
+ sdi->status = SR_ST_INACTIVE;
+ sdi->model = g_strdup("Acme cape");
+ sdi->driver = di;
+ sdi->priv = devc;
+
+ status = bl_acme_is_sane();
+ if (!status)
+ goto err_out;
+
+ /*
+ * Iterate over all ACME connectors and check if any probes
+ * are present.
+ */
+ for (i = 0; i < MAX_PROBES; i++) {
+ /*
+ * First check if there's an energy probe on this connector. If
+ * not, and we're already at the fifth probe - see if we can
+ * detect a temperature probe.
+ */
+ status = bl_acme_detect_probe(bl_acme_get_enrg_addr(i),
+ PROBE_NUM(i),
+ ENRG_PROBE_NAME);
+ if (status) {
+ /* Energy probe detected. */
+ status = bl_acme_register_probe(sdi,
+ PROBE_ENRG,
+ bl_acme_get_enrg_addr(i),
+ PROBE_NUM(i));
+ if (!status) {
+ sr_err("Error registering power probe %d",
+ PROBE_NUM(i));
+ continue;
+ }
+
+ } else if (i >= TEMP_PRB_START_INDEX) {
+ status = bl_acme_detect_probe(bl_acme_get_temp_addr(i),
+ PROBE_NUM(i),
+ TEMP_PROBE_NAME);
+ if (status) {
+ /* Temperature probe detected. */
+ status = bl_acme_register_probe(sdi,PROBE_TEMP,
+ bl_acme_get_temp_addr(i),
+ PROBE_NUM(i));
+ if (!status) {
+ sr_err("Error registering temp "
+ "probe %d", PROBE_NUM(i));
+ continue;
+ }
+ }
+
+ }
+ }
+
+ devices = g_slist_append(devices, sdi);
+ drvc->instances = g_slist_append(drvc->instances, sdi);