* Try to find message consisting of device code and several
* (at least 4) data bytes.
*/
+ serial_flush(serial);
for (bytecnt = 0; bytecnt < 100; bytecnt++) {
byte = read_byte(serial, timeout_us);
if ((byte == -1) || (timeout_us < g_get_monotonic_time()))
return NULL;
}
- serial_flush(serial);
-
model = scan_model_sm(serial);
/*
serialcomm = SERIALCOMM_1X_RS232;
g_free(serial->serialcomm);
serial->serialcomm = g_strdup(serialcomm);
- if (serial_set_paramstr(serial, serialcomm) == SR_OK) {
- serial_flush(serial);
+ if (serial_set_paramstr(serial, serialcomm) == SR_OK)
model = scan_model_sm(serial);
- }
}
if (model != METRAHIT_NONE) {
}
};
- /* Free last alloc if no device found */
- if (devc->model == METRAHIT_NONE) {
- g_free(devc);
- sr_dev_inst_free(sdi);
- }
+ /* Free last alloc that was done in preparation. */
+ g_free(devc);
+ sr_dev_inst_free(sdi);
return std_scan_complete(di, devices);
return std_serial_dev_close(sdi);
}
-static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
- const struct sr_channel_group *cg)
+static int config_get(uint32_t key, GVariant **data,
+ const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
struct dev_context *devc;
}
/** Implementation of config_list for Metrahit 1x/2x send mode */
-static int config_list_sm(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
- const struct sr_channel_group *cg)
+static int config_list_sm(uint32_t key, GVariant **data,
+ const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts_sm);
}
/** Implementation of config_list for Metrahit 2x bidirectional mode */
-static int config_list_bd(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
- const struct sr_channel_group *cg)
+static int config_list_bd(uint32_t key, GVariant **data,
+ const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts_bd);
}