#define LOG_PREFIX "hwdriver"
/** @endcond */
-extern SR_PRIV struct sr_dev_driver *drivers_list[];
+extern SR_PRIV struct sr_dev_driver **drivers_lists[];
/**
* @file
"Trigger matches", NULL},
{SR_CONF_SAMPLE_INTERVAL, SR_T_UINT64, "sample_interval",
"Sample interval", NULL},
- {SR_CONF_NUM_TIMEBASE, SR_T_INT32, "num_timebase",
- "Number of time bases", NULL},
+ {SR_CONF_NUM_HDIV, SR_T_INT32, "num_hdiv",
+ "Number of horizontal divisions", NULL},
{SR_CONF_NUM_VDIV, SR_T_INT32, "num_vdiv",
"Number of vertical divisions", NULL},
{SR_CONF_SPL_WEIGHT_FREQ, SR_T_STRING, "spl_weight_freq",
*/
SR_API struct sr_dev_driver **sr_driver_list(void)
{
+ static struct sr_dev_driver **combined_list = NULL;
+ struct sr_dev_driver ***lists, **drivers;
+ GArray *array;
- return drivers_list;
+ if (combined_list)
+ return combined_list;
+
+ array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
+ for (lists = drivers_lists; *lists; lists++)
+ for (drivers = *lists; *drivers; drivers++)
+ g_array_append_val(array, *drivers);
+ combined_list = (struct sr_dev_driver **)array->data;
+ g_array_free(array, FALSE);
+
+ return combined_list;
}
/**
}
sr_spew("Initializing driver '%s'.", driver->name);
- if ((ret = driver->init(ctx)) < 0)
+ if ((ret = driver->init(driver, ctx)) < 0)
sr_err("Failed to initialize the driver: %d.", ret);
return ret;
return NULL;
}
- l = driver->scan(options);
+ l = driver->scan(driver, options);
sr_spew("Scan of '%s' found %d devices.", driver->name,
g_slist_length(l));
drivers = sr_driver_list();
for (i = 0; drivers[i]; i++) {
if (drivers[i]->cleanup)
- drivers[i]->cleanup();
+ drivers[i]->cleanup(drivers[i]);
+ drivers[i]->priv = NULL;
}
}