- tokens = g_strsplit(buf + 2, ",", 3);
- if (!strncmp("FLUKE", tokens[0], 5)
- && tokens[1] && tokens[2]) {
- for (i = 0; supported_flukedmm[i].model; i++) {
- if (strcmp(supported_flukedmm[i].modelname, tokens[0]))
- continue;
- if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Fluke",
- tokens[0] + 6, tokens[1])))
- return NULL;
- if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
- sr_dbg("fluke-dmm: failed to malloc devc");
- return NULL;
+ /* If CMD_ACK was OK, ID string follows. */
+ len = 128;
+ serial_readline(fd, &b, &len, 150);
+ if (len < 10)
+ continue;
+ tokens = g_strsplit(buf, ",", 3);
+ if (!strncmp("FLUKE", tokens[0], 5)
+ && tokens[1] && tokens[2]) {
+ for (i = 0; supported_flukedmm[i].model; i++) {
+ if (strcmp(supported_flukedmm[i].modelname, tokens[0] + 6))
+ continue;
+ /* Skip leading spaces in version number. */
+ for (s = 0; tokens[1][s] == ' '; s++);
+ if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Fluke",
+ tokens[0] + 6, tokens[1] + s)))
+ return NULL;
+ if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
+ sr_dbg("fluke-dmm: failed to malloc devc");
+ return NULL;
+ }
+ devc->profile = &supported_flukedmm[i];
+ devc->serial = sr_serial_dev_inst_new(conn, -1);
+ sdi->priv = devc;
+ sdi->driver = di;
+ if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
+ return NULL;
+ sdi->probes = g_slist_append(sdi->probes, probe);
+ drvc->instances = g_slist_append(drvc->instances, sdi);
+ devices = g_slist_append(devices, sdi);
+ break;