Store the comedi_data_write() return values for channel 1 and 2 in the
'retval' variable, so that the following 'if(retval < 0) return retval;'
is meaningful. This also avoids a compiler warning: "Identical
condition 'retval<0', second condition is always false".
Thanks to David Binderman for the bug report.
Change 'AM_MAINTAINER_MODE' to 'AM_MAINTAINER_MODE([enable])' in
"configure.ac" so there is no need to pass the
'--enable-maintainer-mode' option to './configure'. If you really want
to disable "maintainer-mode", the '--disable-maintainer-mode' option can
be used.
Add option --subdevice-buffer to allow buffer sizes for arbitrary
subdevices (that have asynchronous command support) to be configured.
This complements the --read-buffer and --write-buffer options.
The required argument is a comma-separated list alternating between
subdevice number and buffer size, and should end with a buffer size.
The option and its argument may be specified multiple times.
Relying on <sys/types.h> to define major(), minor() and makedev() is
deprecated, so include <sys/sysmacros.h> to define them.
Als include <sys/types.h> and <unistd.h> as the Linux man page for
fstat() has them in the synopsys.
The lines:
%rename("%(strip:[COMEDI_])s", regextarget=1) "COMEDI_.*";
%rename("%(strip:[comedi_])s", regextarget=1) "comedi_.*";
caused errors on import due to _comedi function names not matching at
import time. Stripping names is now completely done in the globals()
modification at the end, which works properly.
to indicate if the old names should be stripped or not. This makes the
intent very clear in the generated comedi.py file.
[Reformatted commit message -- Ian Abbott]
Fixed Python3 incompatibility created by trying to modify module
globals() in iterator. Also simplified breaking backwards compatibility
switch as #define SWIGPYTHONONLYSHORT
[Reformatted commit message -- Ian Abbott]
Set new macro N_CHANS to 256 - the length of the chanlist[] array.
If the '-n' option sets options.n_chan higher than N_CHANS, reduce it to
avoid overrunning the chanlist[] array.
Use local function prepare_cmd_lib() -- which uses
comedi_get_cmd_generic_timed() -- to prepare a good command for the
device. Bail out early if it fails.
If the '-s' option has not been specified, default to using the current
'read' subdevice if there is one instead of defaulting to subdevice 0.
Fall back to using subdevice 0 if there is no 'read' subdevice.
If the '-s' option has not been specified, default to using the current
'read' subdevice if there is one instead of defaulting to subdevice 0.
Fall back to using subdevice 0 if there is no 'read' subdevice.
Updated documented URL of git repository, and provided instructions for
updating the URL of previously cloned repositories.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Use updated drivers.txt from the comedi.org Comedi package. The
documentation for the ADLINK drivers has been updated to capitalize
ADLINK in a consistent manner.
Rebuilt "doc/drivers.txt" using "make Documentation/comedi/drivers.txt"
in the Comedi package, which scans the driver sources for documentation.
Note: this is built from the comedi.org Comedi sources, not the Linux
"staging" Comedi sources.
Report the seconds and microseconds values from the INSN_GTOD
instructions as unsigned values to postpone the Y2038 problem to a Y2106
problem. Be a bit more careful with the conversion to a signed
difference. We wouldn't normally expect time to go backwards, but it is
possible if the system time is set to to an older time between the
instructions.
Also, in the description of INSN_GTOD in the Comedilib manual,
explicitly mention that the seconds and microseconds values are
unsigned.
comedi_dio_get_config(), comedi_dio_read(), comedi_dio_write(),
comedi_dio_bitfield2() (and comedi_dio_bitfield()) return -1 if the
subdevice type is unsuitable, but do not set an internal comedi error
code in that case. Change them to do so.
Also, don't bother checking if instruction list ioctl is supported in
comedi_get_dio_config(), as it doesn't use it.
Attempt to make the streaming command demos work if the specified
subdevice is not the default 'read' or 'write' subdevice (depending on
the direction of the command).
This uses the new comedi_set_read_subdevice() and
comedi_set_write_subdevice() functions.
Changing the read or write subdevice is currently supported only by the
Linux "in-tree" version of Comedi since kernel version 3.19.
Change comedi_set_read_subdevice() and comedi_set_write_subdevice() to
do nothing if the requested subdevice is already set as the current read
or write subdevice, respectively.
The functions now return success even if the Comedi drivers do not
support changes to the read or write subdevice as long as the specified
subdevice is the default one.
Added comedi_get_buffer_read_offset(), comedi_get_buffer_write_offset(),
comedi_get_buffer_read_count(), and comedi_get_buffer_write_count().
comedi_get_buffer_read_offset() is the same as
comedi_get_buffer_offset(), which has now been documented as deprecated,
but is currently still declared in "comedilib.h" by default. It gets
the read position within the buffer as an offset from the start of the
buffer (modulo the buffer size).
comedi_get_buffer_write_offset() gets the write position within the
buffer as an offset from the start of the buffer (modulo the buffer
size).
comedi_get_buffer_read_count() gets the number of bytes read from the
buffer, modulo UINT_MAX+1.
comedi_get_buffer_write_count() gets the number of bytes written to the
buffer, modulo UINT_MAX+1.
When testing streaming input (or streaming output) command functionality
for a subdevice, attempt to make it the current 'read' (or 'write')
subdevice by calling the new 'comedi_set_read_subdevice()' (or
'comedi_set_write_subdevice()') function.
That is currently only supported by the Linux "in-tree" version of
Comedi, since kernel version 3.19. If the attempt fails, and the
subdevice is not the current 'read' (or 'write') subdevice, the test
will report "not applicable" as before.
Add methods for several Comedilib functions that are currently absent
from the Ruby bindings.
Rename the comedi_to_physical, comedi_from_physical, and
cleanup_calibration_file methods to to_physical, from_physical, and
cleanup_calibration, either for consistency (comedi_to_physical and
comedi_from_physical) or because they are wrong
(cleanup_cleanup_calibration_file).
TODO: Add a binding for comedi_get_clock_source() as well, but I'm not
sure how to handle multiple output parameters.
The 'data' parameter (of type lsampl_t*) for
comedi_data_read_n(it,subd,chan,range,aref,data,n) is currently marked
as an OUTPUT parameter for SWIG, but we can only do that for single
objects, and this one points to an array of objects.
These functions allow the current read or write subdevice to be changed
to another subdevice that supports streaming input (for read), or
streaming output (for write) asynchronous commands.
They return 0 on success, in which case the comedi_get_read_subdevice()
or comedi_get_write_subdevice() functions will get the updated read or
write subdevice.
Changes are local to the "open file description" that was created by
comedi_open() (actually, by open()), and have no effect on other open
file descriptions created by other calls to comedi_open() (or open())
for the same underlying Comedi device node.
Changes to the read or write subdevice is not currently supported by the
comedi.org version of the Comedi drivers, but is supported by the Linux
"in-tree" Comedi drivers since kernel version 3.19.
Since comedi_ioctl() calls libc_error() to set __comedi_errno to errno
(and possibly print an error message), there is no need for callers of
comedi_ioctl() to set __comedi_errno immediately afterwards. But
comedi_command(), comedi_command_test(), and comedi_do_insnlist()
currently do that. Remove the unneeded setting of __comedi_errno in
those functions.
Also, comedi_command() and comedi_command_test() check __comedi_errno
regardless of whether comedi_ioctl() returnis an error, and possibly
modify the error code to an internal comedi error. Change them to only
do that if comedi_ioctl() returns an error, because __comedi_errno might
contain a stale value.