comedi_board_info: reset n_chans_for_generic_timed for each subdevice
authorIan Abbott <abbotti@mev.co.uk>
Mon, 15 Oct 2012 14:52:47 +0000 (15:52 +0100)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 15 Oct 2012 14:52:47 +0000 (15:52 +0100)
Add variable `def_n_chans_for_generic_timed` to hold the preferred
number of channels to use in calls to `comedi_get_cmd_generic_timed()`.
Reset the `n_chans_for_generic_timed` variable to this value each time
around the loop for each subdevice before clipping the value to the
number of channels the subdevice has.

comedi_board_info/comedi_board_info.c

index 506669edfde86b89053d7b3f86ecb05d61f3eb92..26c5426882d51421e7aa54044fc713c34d1b3dd2 100644 (file)
@@ -210,13 +210,14 @@ int main(int argc,char *argv[])
        char *filename = default_filename;
        char c;
        char strtmp[32];
-       int n_chans_for_generic_timed = 1;
+       int def_n_chans_for_generic_timed = 1;
+       int n_chans_for_generic_timed;
        int freq_for_generic_timed = 1E9;
 
        while (-1 != (c = getopt(argc, argv, "hvn:F:"))) {
                switch (c) {
                case 'n':
-                       n_chans_for_generic_timed = strtoul(optarg, NULL, 0);
+                       def_n_chans_for_generic_timed = strtoul(optarg, NULL, 0);
                        break;
                case 'F':
                        freq_for_generic_timed = strtoul(optarg, NULL, 0);
@@ -300,6 +301,7 @@ int main(int argc,char *argv[])
                        }
                }
                printf("  command:\n");
+               n_chans_for_generic_timed = def_n_chans_for_generic_timed;
                if (n_chans_for_generic_timed>n_chans)
                        n_chans_for_generic_timed = n_chans;
                if (n_chans_for_generic_timed<1)