Commit Graph

1430 Commits

Author SHA1 Message Date
Ian Abbott cbb8ca63c9 comedi_board_info: Clarify usage message
Put square brackets around "COMEDI_DEVICE" on the usage line to indicate
that it is optional, and add a line to indicate that it defaults to
"/dev/comedi0" if unspecified.

Also change "1Ghz" to "1 GHz" in the description of the -F option.
2018-03-07 11:27:42 +00:00
Ian Abbott 8295ed72bb configure.ac: Update version from 0.11.0 to 0.11.0a 2018-03-07 11:17:39 +00:00
ian-abbott 360414930e
Merge pull request #2 from Exchizz/master
getopt() returns int, not char. comedi_board_info keeps showing help,…
2018-03-07 11:10:58 +00:00
Mathias Neerup 49175cb240 getopt() returns int, not char. comedi_boarf_info keeps showing help, even though no parameters are specified. 2018-03-07 11:14:58 +01:00
Ian Abbott baf0baf090 AUTHORS: Add Joseph Timothy Foley and Spencer E. Olson
Various fixes and improvements to SWIG and Python support, and the
comedi.h header file.
2017-09-27 14:00:44 +01:00
Ian Abbott 1b988961a2 demo/gpct_pulse_generator: Fix some error checking
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.
2017-09-20 16:26:36 +01:00
Ian Abbott 44c031d0f2 doc/drivers.txt: Rebuilt from Comedi sources
Rebuilt from the "out-of-tree" Comedi kernel module sources.  The
adv_pci1710 driver gains support for Advantech PCI-1716.
2017-05-11 12:12:37 +01:00
Ian Abbott 6e08ff2ff2 configure.ac: Enable "maintainer-mode" by default
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.
2017-05-02 17:09:31 +01:00
Ian Abbott 05bdfb7cfa doc/drivers.txt: Rebuilt from Comedi sources
Note: This is built from the "out-of-tree" Comedi kernel module sources,
not the Linux "staging" Comedi kernel sources.
2017-04-27 16:35:31 +01:00
Ian Abbott e14ce3bc9c man: update comedi(7) 2017-04-21 16:56:24 +01:00
Ian Abbott 43806f72fc comedi_config: Various changes to man page 2017-04-21 16:35:31 +01:00
Ian Abbott 7d4414c7a3 comedi_config: Bump version to 0.11.0 2017-04-21 14:23:09 +01:00
Ian Abbott 351958b119 comedi_config: Add --subdevice-buffer option
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.
2017-04-21 14:15:32 +01:00
Ian Abbott 3f8514739a lib/calib.c: Include <sys/sysmacros.h> for fstat()
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.
2017-04-10 19:02:55 +01:00
Ian Abbott 99958da64f swig/python: Removed test_comedi.py
It was untested, and never worked.  It would be better to replace it
with some small demo programs, similar to the C language demo programs.
2017-04-10 14:14:29 +01:00
Joseph Timothy Foley 6a73a96cbf swig/comedi.i: Fixed the "break backwards compatibility"
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]
2017-04-10 14:01:29 +01:00
Joseph Timothy Foley f28772a982 Ignore __pycache__ created during python SWIG testing. 2017-03-14 11:08:38 +00:00
Joseph Timothy Foley 492c691576 swig/comedi.i: Fix a Python 3 incompatibility
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]
2017-03-14 11:07:02 +00:00
Joseph Timothy Foley 1e7fd436c9 Ignore any python compiled files in SWIG directory: *.pyc 2017-03-12 21:06:24 +00:00
Ian Abbott 5a5a46b4ee Add .gitignore file 2016-11-08 18:14:20 +00:00
Ian Abbott fa9c5d14c9 demo/mmap: limit options.n_chan to 256
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.
2016-11-08 14:57:16 +00:00
Ian Abbott 235338eb7e demo/cmd: limit options.n_chan to N_CHANS
If the '-n' option sets options.n_chan to something higher than N_CHANS
(256), reduce it to avoid overrunning the chanlist[] array.
2016-11-08 14:52:44 +00:00
Ian Abbott facb713cd8 demo/mmap: check subdevice exists and supports 'read' commands
Check the subdevice actually exists and that it claims to support 'read'
commands (SDF_CMD_READ subdevice flag set), bailing out early if not.
2016-11-08 14:29:58 +00:00
Ian Abbott ad70295bb4 demo/mmap: use comedi_get_cmd_generic_timed()
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.
2016-11-08 14:25:43 +00:00
Ian Abbott 1e8ca17ba9 demo/mmap: default to 'read' subdevice instead of subdevice 0
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.
2016-11-08 14:20:49 +00:00
Ian Abbott c2cf7c8018 demo/cmd: check subdevice exists and supports 'read' commands
Check the subdevice actually exists and that it claims to support 'read'
commands (SDF_CMD_READ subdevice flag set), bailing out early if not.
2016-11-08 14:15:35 +00:00
Ian Abbott b7cb7f2331 demo/cmd: bail out if fail to prepare command
Check return value of prepare_cmd_lib() and exit if less than 0.

Also change prepare_cmd_lib() to write its error message to stderr
instead of stdout.
2016-11-08 13:48:56 +00:00
Ian Abbott 4329a08403 demo/cmd: default to the 'read' subdevice instead of subdevice 0
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.
2016-11-08 13:38:36 +00:00
Ian Abbott 9cf2bba2e0 README: Git repository migrated to github.com
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>
2016-09-19 15:30:14 +01:00
Ian Abbott a2573fff8f doc/drivers.txt: Rebuilt from Comedi - capitalize ADLINK consistently
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.
2016-07-07 11:23:37 +01:00
Ian Abbott f6c1318c6c doc/drivers.txt: Rebuilt from comedi
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.
2016-07-07 10:58:55 +01:00
Ian Abbott c45f319171 comedi_test: deal with INSN_GTOD values more carefully
Try and avoid arithmetic overflow when converting the difference between
two INSN_GTOD timestamps to a signed number of microseconds.
2016-06-20 11:29:14 +01:00
Ian Abbott a4dd004076 demo/insn: report start and end time as unsigned values
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.
2016-06-20 11:09:55 +01:00
Ian Abbott e0ee6039eb c++: Add a lot of missing wrapper functions to comedilib.hpp
Add missing C++ wrappers for most comedilib functions.  Also make some
of the existing wrappers 'const' where if that appears to have been
omitted.
2016-06-10 10:42:37 +01:00
Ian Abbott 70d6a02dd9 lib: dio: set internal error for incompatible subdevice type
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.
2016-06-09 15:04:28 +01:00
Ian Abbott 2fb6289b1c comedi.h: replace bare 'unsigned' with 'unsigned int' 2016-05-16 11:24:07 +01:00
Ian Abbott 7958fec6c5 doc: Makefile.am: rebuild manual when tutorial program source changes 2016-05-13 18:14:57 +01:00
Ian Abbott 6373588120 doc: include the full tut3.c program listing
Include the full tut3.c program listing in the document as it's not much
bigger than tut3_part.c and it's a pain maintaining both of them.
2016-05-13 17:55:39 +01:00
Ian Abbott 59c563fea6 demo: reformat the tutorial examples a bit 2016-05-13 17:45:15 +01:00
Ian Abbott 80d809282c demo: update demo programs to set read or write subdevice
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.
2016-05-13 17:19:10 +01:00
Ian Abbott 7a8b838e66 demo: poll: fix polling of wrong subdevice
The call to comedi_poll() always sets the subdevice parameter to 0.  Set
it to the subdevice that the streaming command is using.
2016-05-13 16:42:14 +01:00
Ian Abbott 8c31fb88c1 lib: don't change read or write subdevice unnecessarily
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.
2016-05-13 16:18:02 +01:00
Ian Abbott aff4937e03 Added some more buffer position functions for use with mmap
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.
2016-05-13 15:14:47 +01:00
Ian Abbott fad46b9b16 doc: tweak some of the documentation for streaming acquisition functions 2016-05-13 14:30:19 +01:00
Ian Abbott 22caa42aee doc: command_funcref.txt: fix DocBook tag
Change '<em>' to '<emphasis>'.
2016-05-13 14:19:58 +01:00
Ian Abbott 67a364cf93 comedi_test: attempt to change read and write subdevice during test
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.
2016-05-13 11:48:31 +01:00
Ian Abbott ae03f3932e swig/ruby: update bindings
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.
2016-05-12 19:35:40 +01:00
Ian Abbott 5762a1dd60 doc: corrected link content comedi_cleanup_calibration_file
'comedi_cleanup_calibrate_calibration_file' should be
'comedi_cleanup_calibration'.
2016-05-12 19:08:31 +01:00
Ian Abbott 43a3ae9a27 comedilib.h: Don't mark 'data' parameter of comedi_data_read_n for SWIG
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.
2016-05-12 18:52:35 +01:00
Ian Abbott aec40a79aa doc: refer to device file descriptors rather than device files 2016-05-12 18:18:08 +01:00