+
+ return SR_OK;
+}
+
+/**
+ * Determine whether the specified device has the specified capability.
+ *
+ * TODO: Should return int?
+ *
+ * @param dev Pointer to the device to be checked. Must not be NULL.
+ * The device's 'driver' 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_dev *dev, int hwcap)
+{
+ int *hwcaps, i;
+
+ if (!dev) {
+ sr_err("dev: %s: dev was NULL", __func__);
+ return FALSE; /* TODO: SR_ERR_ARG. */
+ }
+
+ if (!dev->driver) {
+ sr_err("dev: %s: dev->driver was NULL", __func__);
+ return FALSE; /* TODO: SR_ERR_ARG. */
+ }
+
+ /* TODO: Sanity check on 'hwcap'. */
+
+ if (!(hwcaps = dev->driver->hwcap_get_all())) {
+ sr_err("dev: %s: dev has no capabilities", __func__);
+ return FALSE; /* TODO: SR_ERR*. */
+ }
+
+ 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;