From b1824dba8d6200dbc43373e7b68590b769a80519 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 15 Oct 2012 15:52:47 +0100 Subject: [PATCH] comedi_board_info: reset n_chans_for_generic_timed for each subdevice 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comedi_board_info/comedi_board_info.c b/comedi_board_info/comedi_board_info.c index 506669e..26c5426 100644 --- a/comedi_board_info/comedi_board_info.c +++ b/comedi_board_info/comedi_board_info.c @@ -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) -- 2.26.2