+ sr_dbg("dev: %s: Setting '%s' trigger for probe %d.", __func__,
+ p->trigger, probenum);
+
+ return SR_OK;
+}
+
+/**
+ * Determine whether the specified device has the specified capability.
+ *
+ * @param dev Pointer to the device to be checked. Must not be NULL.
+ * If the device's 'driver' field is NULL (virtual device), this
+ * function will always return FALSE (virtual devices don't have
+ * a hardware capabilities list).
+ * @param hwcap The capability that should be checked (whether it's supported
+ * by the specified device).
+ *
+ * @return TRUE, if the device has the specified capability, FALSE otherwise.
+ * FALSE is also returned upon invalid input parameters or other
+ * error conditions.
+ */
+SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
+{
+ const int *hwcaps;
+ int i;
+
+ sr_spew("dev: %s: requesting hwcap %d", __func__, hwcap);
+
+ if (!dev) {
+ sr_err("dev: %s: dev was NULL", __func__);
+ return FALSE;
+ }
+
+ /*
+ * 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_dbg("dev: %s: dev->driver was NULL, this seems to be "
+ "a virtual device without capabilities", __func__);
+ return FALSE;
+ }
+
+ /* TODO: Sanity check on 'hwcap'. */
+
+ if (!(hwcaps = dev->driver->hwcap_get_all())) {
+ sr_err("dev: %s: dev has no capabilities", __func__);
+ return FALSE;
+ }
+
+ for (i = 0; hwcaps[i]; i++) {
+ if (hwcaps[i] != hwcap)
+ continue;
+ sr_spew("dev: %s: found hwcap %d", __func__, hwcap);
+ return TRUE;
+ }
+
+ sr_spew("dev: %s: hwcap %d not found", __func__, hwcap);
+
+ return FALSE;
+}
+
+/**
+ * Returns information about the given device.
+ *
+ * @param dev Pointer to the device to be checked. Must not be NULL.
+ * The device's 'driver' field must not be NULL either.
+ * @param id The type of information.
+ * @param data The return value. Must not be NULL.
+ *
+ * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
+ * upon other errors.
+ */
+SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data)
+{
+ if ((dev == NULL) || (dev->driver == NULL))
+ return SR_ERR_ARG;
+
+ if (data == NULL)
+ return SR_ERR_ARG;
+
+ *data = dev->driver->dev_info_get(dev->driver_index, id);
+
+ if (*data == NULL)
+ return SR_ERR;
+
+ return SR_OK;