{
0x04b4, 0x6022, 0x04b5, 0x6022,
"Hantek", "6022BE", "hantek-6022be.fw",
- dc_coupling, ARRAY_SIZE(dc_coupling),
+ dc_coupling, ARRAY_SIZE(dc_coupling), FALSE,
},
{
0x8102, 0x8102, 0x1D50, 0x608E,
"Sainsmart", "DDS120", "sainsmart-dds120.fw",
- acdc_coupling, ARRAY_SIZE(acdc_coupling),
+ acdc_coupling, ARRAY_SIZE(acdc_coupling), TRUE,
},
ALL_ZERO
};
break;
case SR_CONF_COUPLING:
tmp_str = g_variant_get_string(data, NULL);
- for (i = 0; devc->coupling_vals[i]; i++) {
+ for (i = 0; i < devc->coupling_tab_size; i++) {
if (!strcmp(tmp_str, devc->coupling_vals[i])) {
devc->coupling[ch_idx] = i;
break;
}
}
- if (devc->coupling_vals[i] == 0)
+ if (i == devc->coupling_tab_size)
ret = SR_ERR_ARG;
break;
default:
GVariantBuilder gvb;
unsigned int i;
GVariant *gvar;
- struct dev_context *devc;
+ struct dev_context *devc = NULL;
if (key == SR_CONF_SCAN_OPTIONS) {
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
return SR_OK;
}
- if (!sdi)
- return SR_ERR_ARG;
-
- devc = sdi->priv;
+ if (sdi)
+ devc = sdi->priv;
if (!cg) {
switch (key) {
devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(uint32_t));
break;
case SR_CONF_COUPLING:
+ if (!devc)
+ return SR_ERR_NA;
*data = g_variant_new_strv(devc->coupling_vals, devc->coupling_tab_size);
break;
case SR_CONF_VDIV:
struct dev_context *devc = sdi->priv;
uint8_t coupling = 0xFF & ((devc->coupling[1] << 4) | devc->coupling[0]);
- sr_dbg("update coupling 0x%x", coupling);
-
- return write_control(sdi, COUPLING_REG, coupling);
+ if (devc->has_coupling) {
+ sr_dbg("update coupling 0x%x", coupling);
+ return write_control(sdi, COUPLING_REG, coupling);
+ } else {
+ sr_dbg("coupling not supported");
+ return SR_OK;
+ }
}
SR_PRIV int hantek_6xxx_update_channels(const struct sr_dev_inst *sdi)