* TODO: Error checks?
* TODO: Option to only scan for specific devices or device classes.
*
- * @return SR_OK upon success, SR_ERR upon errors.
+ * @return SR_OK upon success, SR_ERR_BUG upon internal errors.
*/
SR_API int sr_dev_scan(void)
{
int i;
struct sr_dev_driver **drivers;
- drivers = sr_hw_list();
+ drivers = sr_driver_list();
if (!drivers[0]) {
sr_err("dev: %s: no supported hardware drivers", __func__);
- return SR_ERR; /* TODO: More specific error? */
+ return SR_ERR_BUG;
}
/*
* of these out of the way first.
*/
for (i = 0; drivers[i]; i++)
- sr_hw_init(drivers[i]);
+ sr_driver_init(drivers[i]);
return SR_OK;
}
* If the probe already has a different name assigned to it, it will be
* removed, and the new name will be saved instead.
*
- * TODO: Rename to sr_dev_probe_name_set().
- *
* @param dev TODO
* @param probenum The number of the probe whose name to set.
* Note that the probe numbers start at 1 (not 0!).
* upon other errors.
* If something other than SR_OK is returned, 'dev' is unchanged.
*/
-SR_API int sr_dev_probe_name(struct sr_dev *dev, int probenum,
- const char *name)
+SR_API int sr_dev_probe_name_set(struct sr_dev *dev, int probenum,
+ const char *name)
{
struct sr_probe *p;
{
int *hwcaps, i;
+ sr_spew("dev: %s: requesting hwcap %d", __func__, hwcap);
+
if (!dev) {
sr_err("dev: %s: dev was NULL", __func__);
return FALSE; /* TODO: SR_ERR_ARG. */
}
+ /*
+ * Virtual devices (which have dev->driver set to NULL) always say that
+ * they don't have the capability (they can't call hwcap_get_all()).
+ */
if (!dev->driver) {
- sr_err("dev: %s: dev->driver was NULL", __func__);
+ sr_dbg("dev: %s: dev->driver was NULL, this seems to be "
+ "a virtual device without capabilities", __func__);
return FALSE; /* TODO: SR_ERR_ARG. */
}