+ /* Skip if the device was not found */
+ if (!prof)
+ continue;
+ sr_info("zp: Found ZEROPLUS model %s", prof->model_name);
+
+ /* Register the device with libsigrok. */
+ if (!(sdi = sr_dev_inst_new(devcnt, SR_ST_INACTIVE,
+ VENDOR_NAME, prof->model_name, NULL))) {
+ sr_err("zp: %s: sr_dev_inst_new failed", __func__);
+ return NULL;
+ }
+ sdi->driver = zdi;
+
+ /* Allocate memory for our private driver context. */
+ if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
+ sr_err("zp: %s: devc malloc failed", __func__);
+ return NULL;
+ }
+ sdi->priv = devc;
+ devc->num_channels = prof->channels;
+#ifdef ZP_EXPERIMENTAL
+ devc->max_memory_size = 128 * 1024;
+ devc->max_samplerate = 200;
+#else
+ devc->max_memory_size = prof->sample_depth * 1024;
+ devc->max_samplerate = prof->max_sampling_freq;
+#endif
+ devc->max_samplerate *= SR_MHZ(1);
+ devc->memory_size = MEMORY_SIZE_8K;
+ // memset(devc->trigger_buffer, 0, NUM_TRIGGER_STAGES);
+
+ /* Fill in probelist according to this device's profile. */
+ for (j = 0; j < devc->num_channels; j++) {
+ if (!(probe = sr_probe_new(j, SR_PROBE_LOGIC, TRUE,
+ probe_names[j])))
+ return NULL;
+ sdi->probes = g_slist_append(sdi->probes, probe);
+ }
+
+ devices = g_slist_append(devices, sdi);
+ drvc->instances = g_slist_append(drvc->instances, sdi);
+ devc->usb = sr_usb_dev_inst_new(
+ libusb_get_bus_number(devlist[i]),
+ libusb_get_device_address(devlist[i]), NULL);
+ devcnt++;
+