| 1215 | } |
| 1216 | |
| 1217 | static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, |
| 1218 | struct sr_channel *ch, |
| 1219 | struct sr_channel_group *cg ) |
| 1220 | { |
| 1221 | struct DSL_context *devc; |
| 1222 | int ret, num_probes; |
| 1223 | struct sr_usb_dev_inst *usb; |
| 1224 | struct libusb_device_handle *hdl; |
| 1225 | struct ctl_wr_cmd wr_cmd; |
| 1226 | unsigned int i; |
| 1227 | GSList *l; |
| 1228 | int nv; |
| 1229 | |
| 1230 | assert(sdi); |
| 1231 | assert(sdi->priv); |
| 1232 | |
| 1233 | (void)cg; |
| 1234 | |
| 1235 | if (sdi->status != SR_ST_ACTIVE) { |
| 1236 | return SR_ERR; |
| 1237 | } |
| 1238 | |
| 1239 | devc = sdi->priv; |
| 1240 | usb = sdi->conn; |
| 1241 | hdl = usb->devhdl; |
| 1242 | |
| 1243 | ret = dsl_config_set(id, data, sdi, ch, cg); |
| 1244 | if (ret == SR_OK) |
| 1245 | return ret; |
| 1246 | |
| 1247 | ret = SR_OK; |
| 1248 | if (id == SR_CONF_CLOCK_TYPE) { |
| 1249 | devc->clock_type = g_variant_get_boolean(data); |
| 1250 | } else if (id == SR_CONF_CLOCK_EDGE) { |
| 1251 | devc->clock_edge = g_variant_get_boolean(data); |
| 1252 | } else if (id == SR_CONF_LIMIT_SAMPLES) { |
| 1253 | devc->limit_samples = g_variant_get_uint64(data); |
| 1254 | } else if (id == SR_CONF_PROBE_VDIV) { |
| 1255 | ch->vdiv = g_variant_get_uint64(data); |
| 1256 | ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_VDIV)); |
| 1257 | if (ret == SR_OK) |
| 1258 | sr_dbg("%s: setting VDIV of channel %d to %d mv", |
| 1259 | __func__, ch->index, ch->vdiv); |
| 1260 | else |
| 1261 | sr_dbg("%s: setting VDIV of channel %d to %d mv failed", |
| 1262 | __func__, ch->index, ch->vdiv); |
| 1263 | } else if (id == SR_CONF_PROBE_FACTOR) { |
| 1264 | ch->vfactor = g_variant_get_uint64(data); |
| 1265 | sr_dbg("%s: setting Factor of channel %d to %d", __func__, |
| 1266 | ch->index, ch->vfactor); |
| 1267 | } else if (id == SR_CONF_TIMEBASE) { |
| 1268 | devc->timebase = g_variant_get_uint64(data); |
| 1269 | } else if (id == SR_CONF_PROBE_COUPLING) { |
| 1270 | ch->coupling = g_variant_get_byte(data); |
| 1271 | if (ch->coupling == SR_GND_COUPLING) |
| 1272 | ch->coupling = SR_DC_COUPLING; |
| 1273 | ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_COUPLING)); |
| 1274 | if (ret == SR_OK) |
no test coverage detected