+
+ return SR_OK;
+}
+
+/**
+ * Determine whether the specified device has the specified capability.
+ *
+ * TODO: Should return int?
+ *
+ * @param device Pointer to the device to be checked. Must not be NULL.
+ * The device's 'plugin' field must not be NULL either.
+ * @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_device *device, int hwcap)
+{
+ int *capabilities, i;
+
+ if (!device) {
+ sr_err("dev: %s: device was NULL", __func__);
+ return FALSE; /* TODO: SR_ERR_ARG. */
+ }
+
+ if (!device->plugin) {
+ sr_err("dev: %s: device->plugin was NULL", __func__);
+ return FALSE; /* TODO: SR_ERR_ARG. */
+ }
+
+ /* TODO: Sanity check on 'hwcap'. */
+
+ if (!(capabilities = device->plugin->get_capabilities())) {
+ sr_err("dev: %s: device has no capabilities", __func__);
+ return FALSE; /* TODO: SR_ERR*. */
+ }
+
+ for (i = 0; capabilities[i]; i++) {
+ if (capabilities[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 device Pointer to the device to be checked. Must not be NULL.
+ * The device's 'plugin' 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.
+ */
+int sr_dev_get_info(const struct sr_device *device, int id,
+ const void **data)
+{
+ if ((device == NULL) || (device->plugin == NULL))
+ return SR_ERR_ARG;
+
+ if (data == NULL)
+ return SR_ERR_ARG;
+
+ *data = device->plugin->get_device_info(device->plugin_index, id);
+
+ if (*data == NULL)
+ return SR_ERR;
+
+ return SR_OK;