+ /*
+ * All ASIX logic analyzers have a serial number, which
+ * reads as a hex number, and tells the device type.
+ */
+ ret = sr_atoul_base(serno_txt, &serno_num, &end, 16);
+ if (ret != SR_OK || !end || *end) {
+ sr_warn("Cannot interpret serial number %s.", serno_txt);
+ continue;
+ }
+ dev_type = ASIX_TYPE_NONE;
+ dev_text = NULL;
+ serno_pre = serno_num >> 16;
+ switch (serno_pre) {
+ case 0xa601:
+ dev_type = ASIX_TYPE_SIGMA;
+ dev_text = "SIGMA";
+ sr_info("Found SIGMA, serno %s.", serno_txt);
+ break;
+ case 0xa602:
+ dev_type = ASIX_TYPE_SIGMA;
+ dev_text = "SIGMA2";
+ sr_info("Found SIGMA2, serno %s.", serno_txt);
+ break;
+ case 0xa603:
+ dev_type = ASIX_TYPE_OMEGA;
+ dev_text = "OMEGA";
+ sr_info("Found OMEGA, serno %s.", serno_txt);
+ if (!ASIX_WITH_OMEGA) {
+ sr_warn("OMEGA support is not implemented yet.");
+ continue;
+ }
+ break;
+ default:
+ sr_warn("Unknown serno %s, skipping.", serno_txt);
+ continue;
+ }
+
+ /* Create a device instance, add it to the result set. */
+
+ sdi = g_malloc0(sizeof(*sdi));
+ devices = g_slist_append(devices, sdi);
+ sdi->status = SR_ST_INITIALIZING;
+ sdi->vendor = g_strdup("ASIX");
+ sdi->model = g_strdup(dev_text);
+ sdi->serial_num = g_strdup(serno_txt);
+ sdi->connection_id = g_strdup(conn_id);
+ for (chidx = 0; chidx < ARRAY_SIZE(channel_names); chidx++)
+ sr_channel_new(sdi, chidx, SR_CHANNEL_LOGIC,
+ TRUE, channel_names[chidx]);
+
+ devc = g_malloc0(sizeof(*devc));
+ sdi->priv = devc;
+ devc->id.vid = des.idVendor;
+ devc->id.pid = des.idProduct;
+ devc->id.serno = serno_num;
+ devc->id.prefix = serno_pre;
+ devc->id.type = dev_type;
+ sr_sw_limits_init(&devc->limit.config);
+ devc->capture_ratio = 50;
+ devc->use_triggers = FALSE;
+
+ /* Get current hardware configuration (or use defaults). */
+ (void)sigma_fetch_hw_config(sdi);