-
- //Create the device context and set its params
- struct dev_context *devc;
- if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
- sr_err("Device context malloc failed.");
- return devices;
- }
-
- if (mso_parse_serial(iSerial, iProduct, devc) != SR_OK) {
- sr_err("Invalid iSerial: %s.", iSerial);
- g_free(devc);
- return devices;
- }
-
- char hwrev[32];
- sprintf(hwrev, "r%d", devc->hwrev);
- devc->ctlbase1 = 0;
- devc->protocol_trigger.spimode = 0;
- for (i = 0; i < 4; i++) {
- devc->protocol_trigger.word[i] = 0;
- devc->protocol_trigger.mask[i] = 0xff;
- }
-
- if (!(devc->serial = sr_serial_dev_inst_new(conn, serialcomm)))
- {
- g_free(devc);
- return devices;
- }
-
- struct sr_dev_inst *sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
- manufacturer, product, hwrev);
-
- if (!sdi) {
- sr_err("Unable to create device instance for %s",
- sysname);
- sr_dev_inst_free(sdi);
- g_free(devc);
- return devices;
- }
-
- sdi->driver = di;
- sdi->priv = devc;
-
- for (i = 0; i < NUM_PROBES; i++) {
- struct sr_probe *probe;
- if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
- mso19_probe_names[i])))
- return 0;
- sdi->probes = g_slist_append(sdi->probes, probe);
- }
-
- //Add the driver
- struct drv_context *drvc = di->priv;
- drvc->instances = g_slist_append(drvc->instances, sdi);
- devices = g_slist_append(devices, sdi);
- }
+
+ //Create the device context and set its params
+ struct dev_context *devc;
+ if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
+ sr_err("Device context malloc failed.");
+ return devices;
+ }
+
+ if (mso_parse_serial(iSerial, iProduct, devc) != SR_OK) {
+ sr_err("Invalid iSerial: %s.", iSerial);
+ g_free(devc);
+ return devices;
+ }
+
+ char hwrev[32];
+ sprintf(hwrev, "r%d", devc->hwrev);
+ devc->ctlbase1 = 0;
+ devc->protocol_trigger.spimode = 0;
+ for (i = 0; i < 4; i++) {
+ devc->protocol_trigger.word[i] = 0;
+ devc->protocol_trigger.mask[i] = 0xff;
+ }
+
+ if (!(devc->serial = sr_serial_dev_inst_new(conn, serialcomm))) {
+ g_free(devc);
+ return devices;
+ }
+
+ struct sr_dev_inst *sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
+ manufacturer, product, hwrev);
+
+ if (!sdi) {
+ sr_err("Unable to create device instance for %s",
+ sysname);
+ sr_dev_inst_free(sdi);
+ g_free(devc);
+ return devices;
+ }
+
+ sdi->driver = di;
+ sdi->priv = devc;
+
+ for (i = 0; i < NUM_PROBES; i++) {
+ struct sr_probe *probe;
+ ptype = (i == 0) ? SR_PROBE_ANALOG : SR_PROBE_LOGIC;
+ if (!(probe = sr_probe_new(i, ptype, TRUE,
+ mso19_probe_names[i])))
+ return 0;
+ sdi->probes = g_slist_append(sdi->probes, probe);
+ }
+
+ //Add the driver
+ struct drv_context *drvc = di->priv;
+ drvc->instances = g_slist_append(drvc->instances, sdi);
+ devices = g_slist_append(devices, sdi);
+ }