static int hw_set_configuration(int device_index, int capability, void *value) { struct sr_device_instance *sdi; struct fx2_device *fx2; int ret; uint64_t *tmp_u64; if (!(sdi = sr_get_device_instance(device_instances, device_index))) return SR_ERR; fx2 = sdi->priv; if (capability == SR_HWCAP_SAMPLERATE) { tmp_u64 = value; ret = set_configuration_samplerate(sdi, *tmp_u64); } else if (capability == SR_HWCAP_PROBECONFIG) { ret = configure_probes(fx2, (GSList *) value); } else if (capability == SR_HWCAP_LIMIT_SAMPLES) { tmp_u64 = value; fx2->limit_samples = *tmp_u64; ret = SR_OK; } else { ret = SR_ERR; } return ret; }
int hw_set_configuration(int device_index, int capability, void *value) { struct usb_device_instance *udi; int ret; uint64_t *tmp_u64; if( !(udi = get_usb_device_instance(usb_devices, device_index)) ) return SIGROK_NOK; if(capability == HWCAP_SAMPLERATE) { tmp_u64 = value; ret = set_configuration_samplerate(udi, *tmp_u64); } else if(capability == HWCAP_PROBECONFIG) ret = configure_probes( (GSList *) value); else if(capability == HWCAP_LIMIT_SAMPLES) { limit_samples = strtoull(value, NULL, 10); ret = SIGROK_OK; } else ret = SIGROK_NOK; return ret; }