- g_poll(fds, devcnt, 1);
-
- for (i = 0; i < devcnt; i++) {
- if (fds[i].revents != G_IO_IN)
- continue;
- if (serial_read(fds[i].fd, buf, 4) != 4)
- continue;
- if (strncmp(buf, "1SLO", 4) && strncmp(buf, "1ALS", 4))
- continue;
-
- /* definitely using the OLS protocol, check if it supports
- * the metadata command
- */
- send_shortcommand(fds[i].fd, CMD_METADATA);
- probefd.fd = fds[i].fd;
- probefd.events = G_IO_IN;
- if (g_poll(&probefd, 1, 10) > 0) {
- /* got metadata */
- sdi = get_metadata(fds[i].fd);
- sdi->index = final_devcnt;
- ctx = sdi->priv;
- } else {
- /* not an OLS -- some other board that uses the sump protocol */
- sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
- "Sump", "Logic Analyzer", "v1.0");
- sdi->driver = odi;
- ctx = ols_dev_new();
- for (j = 0; j < 32; j++) {
- if (!(probe = sr_probe_new(j, SR_PROBE_LOGIC, TRUE,
- probe_names[j])))
- return 0;
- sdi->probes = g_slist_append(sdi->probes, probe);
- }
- sdi->priv = ctx;
- }
- ctx->serial = sr_serial_dev_inst_new(dev_names[i], -1);
- odi->instances = g_slist_append(odi->instances, sdi);
- devices = g_slist_append(devices, sdi);