Bug 587 - trigger source digital channels use DIGxx syntax
Summary: trigger source digital channels use DIGxx syntax
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Driver: rigol-ds (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
Depends on:
Reported: 2015-05-05 21:18 CEST by karlp
Modified: 2017-05-10 18:29 CEST (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description karlp 2015-05-05 21:18:23 CEST
From the programming manual: 

"In EDGE mode, <src> could be CHANnel<n>, EXT, ACLine or DIGital<m>;"

Note the full caps for DIG.  This is _despite_ the return values only being Dxx syntax.  (Thanks Riglol)

A quick hack in src/hardware/rigol-ds/api.c where the ":TRIG:EDGE:SOUR %s" command is sent fixes triggering on digital channels, but I don't have an appropriate patch that's actually correct for the string manip in this library.
The below doesn't handle channels 10..15 at all for instance...

diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c
index 7a195bb..cc462ad 100644
--- a/src/hardware/rigol-ds/api.c
+++ b/src/hardware/rigol-ds/api.c
@@ -721,8 +721,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                                        tmp_str = "CHAN3";
                                else if (!strcmp(devc->trigger_source, "CH4"))
                                        tmp_str = "CHAN4";
-                               else
-                                       tmp_str = (char *)devc->trigger_source;
+                               else {
+                                        sprintf(tmp_str, "DIG%c", devc->trigger_source[1]);
+                                       //tmp_str = (char *)devc->trigger_source;
+                                }
                                ret = rigol_ds_config_set(sdi, ":TRIG:EDGE:SOUR %s", tmp_str);
Comment 1 Martin Ling 2017-05-10 18:29:51 CEST
I haven't tested this properly yet but this commit ought to fix this: