drivers: implement config_list()
This commit is contained in:
parent
c5fb502f97
commit
a1c743fc51
|
@ -302,6 +302,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -370,6 +383,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -189,6 +189,30 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
if (!sdi || !sdi->priv)
|
||||
return SR_ERR_ARG;
|
||||
devc = sdi->priv;
|
||||
if (!devc->supp_rates.list) {
|
||||
sr_err("Instance did not contain a samplerate list.");
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
*data = &devc->supp_rates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -322,6 +346,7 @@ SR_PRIV struct sr_dev_driver alsa_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -843,6 +843,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
/* Software trigger to determine exact trigger position. */
|
||||
static int get_trigger_offset(uint16_t *samples, uint16_t last_sample,
|
||||
struct sigma_trigger *t)
|
||||
|
@ -1438,6 +1454,7 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -365,6 +365,23 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
fill_supported_samplerates_if_needed();
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int receive_data(int fd, int revents, void *cb_data)
|
||||
{
|
||||
int i, ret;
|
||||
|
@ -514,6 +531,7 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -246,6 +246,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -314,6 +327,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -298,6 +298,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void samples_generator(uint8_t *buf, uint64_t size,
|
||||
struct dev_context *devc)
|
||||
{
|
||||
|
@ -490,6 +506,7 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -336,6 +336,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -410,6 +423,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -650,6 +650,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int receive_data(int fd, int revents, void *cb_data)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
@ -1024,6 +1040,7 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -580,6 +580,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void send_chunk(struct sr_dev_inst *sdi, unsigned char *buf,
|
||||
int num_samples)
|
||||
{
|
||||
|
@ -914,6 +927,7 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -261,6 +261,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void mark_xfer(struct libusb_transfer *xfer)
|
||||
{
|
||||
|
||||
|
@ -480,6 +493,7 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -392,6 +392,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -493,6 +509,7 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
|
|||
.dev_clear = hw_cleanup,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -302,6 +302,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -337,6 +350,7 @@ SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -329,6 +329,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -504,6 +520,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
|
|||
.dev_clear = hw_cleanup,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -439,6 +439,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -509,6 +522,7 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -423,6 +423,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data, int dmm)
|
||||
{
|
||||
|
@ -522,6 +535,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.dev_clear = clear_instances_##ID_UPPER, \
|
||||
.config_get = config_get, \
|
||||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = hw_dev_open, \
|
||||
.dev_close = hw_dev_close, \
|
||||
.dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
|
||||
|
|
|
@ -238,6 +238,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -307,6 +320,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -255,6 +255,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
{
|
||||
|
@ -317,6 +330,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
@ -335,6 +349,7 @@ SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -298,6 +298,19 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void receive_transfer(struct libusb_transfer *transfer)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
@ -466,6 +479,7 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
|
|||
.dev_clear = clear_instances,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
|
@ -649,6 +649,22 @@ static int config_set(int id, const void *value, const struct sr_dev_inst *sdi)
|
|||
}
|
||||
}
|
||||
|
||||
static int config_list(int key, const void **data, const struct sr_dev_inst *sdi)
|
||||
{
|
||||
|
||||
(void)sdi;
|
||||
|
||||
switch (key) {
|
||||
case SR_CONF_SAMPLERATE:
|
||||
*data = &samplerates;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static void set_triggerbar(struct dev_context *devc)
|
||||
{
|
||||
unsigned int ramsize;
|
||||
|
@ -787,6 +803,7 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
|
|||
.dev_clear = hw_cleanup,
|
||||
.config_get = config_get,
|
||||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
|
|
Loading…
Reference in New Issue