If the comedi data buffer is larger than the total size of the data
being written to the buffer in first test_cmd_write_fast_1chan(), the
first loop iterates endlessly writing 0 bytes to the buffer. Break out
of the first loop once the required amount of data has been written.
In the rule to make the 'calibrations' directory during installation,
use Make variable '$(localstatedir)' instead of shell variable
'${localstatedir}'. Also remove an unnecessary '/' after '$(DESTDIR)'
in the rule.
Add an install-data-local rule that creates the
${localstatedir}/lib/comedi/calibrations during installation. This
matches the directory name used by the
comedi_get_default_calibration_path() function.
Builds on some systems need the line:
comedi_la_LIBADD = -lm
in lib/Makefile.am
Reported by Jan Banda, using a Linux Mint Petra system with gcc version
4.8.1.
python always use the namespace of the library so it was redundant.
so what used to be written comedi.comedi_open() can be written comedi.open().
The main trick is to add a special python code that allows for the old names to still be compatible.
That avoids to break every single python program previously written.
The demo is supposed to take one reading for each channel for each
range, but was using the range from the command line options instead.
Thanks to Daniele Mazzi for spotting the bug!
Parse parameters are now passed as the correct type instead of `void *`,
so the static inline priv() function is no longer needed to cast the
pointer to the correct type.
In the Bison source calib_yacc.y, replace the use of YYPARSE_PARAM and
YYLEX_PARAM C macros with the %parse-param and %lex-param declarations.
I still need a C macro in combination with %lex-param for it to work, so
I'm not sure I'm doing it right!
Also correct the %pure_parser declaration which should be %pure-parser
(i.e. the underscore should be a dash). This has a knock-on effect for
the yyerror() function, which now needs an extra parameter.
The msync() call doesn't seem to work on Comedi devices, and seems a bit
pointless anyway, as it is meant for use on files with a backing store.
Remove it.
Some systems (e.g. Arch Linux) put the Python C headers in a strange
place, so try and run `$PYTHON-config --includes` first to find the -I
options to pass to the C compiler. Fall back to the old method if it
fails.
Thanks to Darrell Enns for reporting the problem and suggesting a
solution. I changed it a bit.
Remove the global variable 'capabilities' which is set to 0 by the
get_capabilities() function but not used anywhere else. Remove the
'type' and 'flags' local variables from get_capabilities() which are set
to the return values of comedi_get_subdevice_type() and
comedi_get_subdevice_flags() but never used. Remove the 'tmp' local
variable from test_segfault(); it was involved in a volatile memory
access to test for segmentation faults. Still do the volatile memory
access but don't use the variable.
Remove the cmd_timed and cmd_timed_errno members from the internal
struct subdevice_struct.
cmd_timed_errno is checked but never set, so it will always be 0 and the
code that uses it is buggy as it returns the value of s->cmd_mask_errno
if s->cmd_timed_errno is non-zero and sets s->cmd_mask_errno on failure.
It shouldn't be setting s->cmd_mask_errno at all.
Since the generic timed command could depend on the length of the
channel list, don't bother caching the result, and don't set
s->cmd_mask_errno on failure.
Some calls to malloc(), realloc() or calloc() do not check the result.
Do so. Also call internal function libc_error() if they fail to set the
result for comedi_errno().
Move the comedi_parse_calibration_file() function definition to the
bottom of the file. It calls calib_yyparse() and the declaration might
not be in scope since we removed the declaration from
"lib/libinternal.h", but we know it will be declared somewhere above the
bottom of the generated "lib/calib_yacc.c" above the new location of
comedi_parse_calibration_file().
For newer versions of Bison, the declaration of our calib_yyparse()
function in "lib/libinternal.h" clashes with that in the generated
"lib/calib_yacc.h".
Remove the declarations of calib_yyerror() and calib_yyparse() from
"lib/libinternal.h" and declare them in "lib/calib_yacc.c".
Move the call to AS_LIBTOOL() to avoid warnings from automake 1.12.6.
Move SCXI_SO_VERSION as it is nearby!
On Gentoo Linux:
$ WANT_AUTOMAKE=1.12 ./autogen.sh
configure.ac:101: warning: LT_INIT was called before AM_PROG_AR
/usr/share/aclocal-1.12/ar-lib.m4:13: AM_PROG_AR is expanded from...
configure.ac:101: the top level
configure.ac:101: warning: AC_PROG_LIBTOOL was called before AM_PROG_AR
/usr/share/aclocal-1.12/ar-lib.m4:13: AM_PROG_AR is expanded from...
configure.ac:101: the top level
configure.ac:101: warning: LT_INIT was called before AM_PROG_AR
aclocal.m4:8669: AM_PROG_AR is expanded from...
configure.ac:101: the top level
configure.ac:101: warning: AC_PROG_LIBTOOL was called before AM_PROG_AR
aclocal.m4:8669: AM_PROG_AR is expanded from...
configure.ac:101: the top level
This is what automake told me to do:
$ ./autogen.sh
...
automake: warnings are treated as errors
/usr/share/automake-1.12/am/ltlibrary.am: warning: 'libcomedi.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.12/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
lib/Makefile.am:2: while processing Libtool library 'libcomedi.la'
...
autoreconf-2.69: automake failed with exit status: 1
AM_PROG_AR is new in automake-1.11.2. For further details, see:
http://lists.gnu.org/archive/html/bug-automake/2012-05/msg00009.html
The units for a range with internal unit code `RF_EXTERNAL | UNIT_volt` is currently
displayed as " (unknown unit 256)", for example an external bipolar
voltage range -1 to 1 is displayed as:
[-1 (unknown unit 256),1 (unknown unit 256)]
Change it to be displayed as:
[-1*EXT V,1*EXT V]
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.
`strtmp` is currently declared as `char strtmp[16]`, but that may be too
short for the calls to `unit_to_desc()` when the type of unit is
unknown. Increase its length to 32.
There is already a commented out rule in the example udev rules file
"z99_comedi.rules" to set the mode to 0660 and set the group owner to
"comedi". Add an almost identical commented out rule to set the group
owner to "iocard" as this is favoured by Debian.