New driver API function: config_list()
This takes an sr_config key and returns a list of possible values for that key to be submitted with config_set(). The format of the list and its contents is dependent on the key. This will replace the SR_DI_* keys that returned such a list before, such as SR_DI_SAMPLERATES.
This commit is contained in:
parent
035a1078fd
commit
c5fb502f97
16
hwdriver.c
16
hwdriver.c
|
@ -329,6 +329,22 @@ SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
|
|||
return ret;
|
||||
}
|
||||
|
||||
SR_API int sr_config_list(struct sr_dev_driver *driver, int id,
|
||||
const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (driver == NULL || data == NULL)
|
||||
return SR_ERR;
|
||||
|
||||
if (!driver->config_list)
|
||||
return SR_ERR;
|
||||
|
||||
ret = driver->config_list(id, data, sdi);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if a hardware driver has a specific capability.
|
||||
*
|
||||
|
|
|
@ -599,6 +599,8 @@ struct sr_dev_driver {
|
|||
const struct sr_dev_inst *sdi);
|
||||
int (*config_set) (int id, const void *value,
|
||||
const struct sr_dev_inst *sdi);
|
||||
int (*config_list) (int info_id, const void **data,
|
||||
const struct sr_dev_inst *sdi);
|
||||
|
||||
/* Device-specific */
|
||||
int (*dev_open) (struct sr_dev_inst *sdi);
|
||||
|
|
2
proto.h
2
proto.h
|
@ -72,6 +72,8 @@ SR_API int sr_driver_init(struct sr_context *ctx,
|
|||
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
|
||||
SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
|
||||
const void **data, const struct sr_dev_inst *sdi);
|
||||
SR_API int sr_config_list(struct sr_dev_driver *driver, int id,
|
||||
const void **data, const struct sr_dev_inst *sdi);
|
||||
SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap);
|
||||
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
||||
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
||||
|
|
Loading…
Reference in New Issue