- GSList *plugins, *l;
- struct sr_device_plugin *plugin;
-
- if (!(plugins = sr_list_hwplugins())) {
- sr_err("dev: %s: no supported devices/hwplugins", __func__);
- return SR_ERR; /* TODO: More specific error? */
- }
-
- /*
- * Initialize all plugins first. Since the init() call may involve
- * 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_init_hwplugins(plugin);
- }
-
- return SR_OK;
-}
-
-/**
- * Return the list of logic analyzer devices libsigrok has detected.
- *
- * If the libsigrok-internal device list is empty, a scan for attached
- * devices -- via a call to sr_device_scan() -- is performed first.
- *
- * TODO: Error handling?
- *
- * @return The list (GSList) of detected devices, or NULL if none were found.
- */
-GSList *sr_device_list(void)
-{
- if (!devices)
- sr_device_scan();
-
- return devices;
-}
-
-/**
- * Create a new device.
- *
- * TODO: 'plugin' can be const.
- * TODO: num_probes should be uint16_t.
- * TODO: Should return int, so that we can return SR_OK, SR_ERR_* etc.
- *
- * It is the caller's responsibility to g_free() the allocated memory when
- * no longer needed. TODO: Using which API function?
- *
- * @param plugin TODO.
- * If 'plugin' is NULL, the created device is a "virtual" one.
- * @param plugin_index TODO
- * @param num_probes The number of probes (>= 1) this device has.
- * TODO: 0 allowed?
- *
- * @return Pointer to the newly allocated device, or NULL upon errors.
- */
-struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
- int num_probes)
-{
- struct sr_device *device;
- int i;
-
- if (!plugin) {
- sr_err("dev: %s: plugin was NULL", __func__);
- return NULL; /* TODO: SR_ERR_ARG */
- }