*/
SR_API int sr_dev_scan(void)
{
- GSList *plugins, *l;
- struct sr_dev_plugin *plugin;
+ int i;
+ struct sr_dev_plugin **plugins;
- if (!(plugins = sr_hw_list())) {
+ plugins = sr_hw_list();
+ if (!plugins[0]) {
sr_err("dev: %s: no supported devices/hwplugins", __func__);
return SR_ERR; /* TODO: More specific error? */
}
* a firmware upload and associated delay, we may as well get all
* of these out of the way first.
*/
- for (l = plugins; l; l = l->next) {
- plugin = l->data;
- /* TODO: Handle 'plugin' being NULL. */
- sr_hw_init(plugin);
- }
+ for (i = 0; plugins[i]; i++)
+ sr_hw_init(plugins[i]);
return SR_OK;
}
*/
SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
{
- int *capabilities, i;
+ int *hwcaps, i;
if (!dev) {
sr_err("dev: %s: dev was NULL", __func__);
/* TODO: Sanity check on 'hwcap'. */
- if (!(capabilities = dev->plugin->get_capabilities())) {
+ if (!(hwcaps = dev->plugin->hwcap_get_all())) {
sr_err("dev: %s: dev has no capabilities", __func__);
return FALSE; /* TODO: SR_ERR*. */
}
- for (i = 0; capabilities[i]; i++) {
- if (capabilities[i] != hwcap)
+ for (i = 0; hwcaps[i]; i++) {
+ if (hwcaps[i] != hwcap)
continue;
sr_spew("dev: %s: found hwcap %d", __func__, hwcap);
return TRUE;
if (data == NULL)
return SR_ERR_ARG;
- *data = dev->plugin->get_dev_info(dev->plugin_index, id);
+ *data = dev->plugin->dev_info_get(dev->plugin_index, id);
if (*data == NULL)
return SR_ERR;