"Under-voltage condition", NULL},
{SR_CONF_UNDER_VOLTAGE_CONDITION_ACTIVE, SR_T_BOOL, "uvc_active",
"Under-voltage condition active", NULL},
+ {SR_CONF_TRIGGER_LEVEL, SR_T_FLOAT, "triggerlevel",
+ "Trigger level", NULL},
/* Special stuff */
{SR_CONF_SESSIONFILE, SR_T_STRING, "sessionfile",
}
}
-/** Allocate struct sr_config.
- * A floating reference can be passed in for data.
- * @private
+/**
+ * Allocate struct sr_config.
+ *
+ * A floating reference can be passed in for data.
+ *
+ * @private
*/
SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data)
{
return src;
}
-/** Free struct sr_config.
- * @private
+/**
+ * Free struct sr_config.
+ *
+ * @private
*/
SR_PRIV void sr_config_free(struct sr_config *src)
{
/**
* Query value of a configuration key at the given driver or device instance.
*
- * @param[in] driver The sr_dev_driver struct to query.
+ * @param[in] driver The sr_dev_driver struct to query. Must not be NULL.
* @param[in] sdi (optional) If the key is specific to a device, this must
* contain a pointer to the struct sr_dev_inst to be checked.
- * Otherwise it must be NULL.
+ * Otherwise it must be NULL. If sdi is != NULL, sdi->priv must
+ * also be != NULL.
* @param[in] cg The channel group on the device for which to list the
- * values, or NULL.
+ * values, or NULL.
* @param[in] key The configuration key (SR_CONF_*).
* @param[in,out] data Pointer to a GVariant where the value will be stored.
* Must not be NULL. The caller is given ownership of the GVariant
* @retval SR_OK Success.
* @retval SR_ERR Error.
* @retval SR_ERR_ARG The driver doesn't know that key, but this is not to be
- * interpreted as an error by the caller; merely as an indication
- * that it's not applicable.
+ * interpreted as an error by the caller; merely as an indication
+ * that it's not applicable.
*
* @since 0.3.0
*/
if (check_key(driver, sdi, cg, key, SR_CONF_GET, NULL) != SR_OK)
return SR_ERR_ARG;
+ if (sdi && !sdi->priv) {
+ sr_err("Can't get config (sdi != NULL, sdi->priv == NULL).");
+ return SR_ERR;
+ }
+
if ((ret = driver->config_get(key, data, sdi, cg)) == SR_OK) {
log_key(sdi, cg, key, SR_CONF_GET, *data);
/* Got a floating reference from the driver. Sink it here,
* @retval SR_OK Success.
* @retval SR_ERR Error.
* @retval SR_ERR_ARG The driver doesn't know that key, but this is not to be
- * interpreted as an error by the caller; merely as an indication
- * that it's not applicable.
+ * interpreted as an error by the caller; merely as an indication
+ * that it's not applicable.
*
* @since 0.3.0
*/
/**
* List all possible values for a configuration key.
*
- * @param[in] driver The sr_dev_driver struct to query.
+ * @param[in] driver The sr_dev_driver struct to query. Must not be NULL.
* @param[in] sdi (optional) If the key is specific to a device, this must
* contain a pointer to the struct sr_dev_inst to be checked.
+ * Otherwise it must be NULL. If sdi is != NULL, sdi->priv must
+ * also be != NULL.
* @param[in] cg The channel group on the device for which to list the
* values, or NULL.
* @param[in] key The configuration key (SR_CONF_*).
* @retval SR_OK Success.
* @retval SR_ERR Error.
* @retval SR_ERR_ARG The driver doesn't know that key, but this is not to be
- * interpreted as an error by the caller; merely as an indication
- * that it's not applicable.
+ * interpreted as an error by the caller; merely as an indication
+ * that it's not applicable.
*
* @since 0.3.0
*/
if (check_key(driver, sdi, cg, key, SR_CONF_LIST, NULL) != SR_OK)
return SR_ERR_ARG;
}
+ if (sdi && !sdi->priv) {
+ sr_err("Can't list config (sdi != NULL, sdi->priv == NULL).");
+ return SR_ERR;
+ }
if ((ret = driver->config_list(key, data, sdi, cg)) == SR_OK) {
log_key(sdi, cg, key, SR_CONF_LIST, *data);
g_variant_ref_sink(*data);