Commit graph

1346 commits

Author SHA1 Message Date
Éric Piel
371dcc56e6 swig: remove comedi_ prefix from the function names
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.
2014-02-03 12:32:51 +00:00
Ian Abbott
1465834a26 demo/inpn: correct ranges in range loop
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!
2014-01-09 15:23:13 +00:00
Ian Abbott
6ee63ff0b0 README.Git: add minimum required Bison version
The minimum required version of Bison when building from git sources is
1.875 or possibly higher.  Mention 1.875 as the minimum version for now.
2014-01-07 14:56:22 +00:00
Ian Abbott
2277e82787 lib/calib_yacc.y: eliminate priv() casting function
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.
2014-01-07 14:28:43 +00:00
Ian Abbott
c689eff475 lib: replace YYPARSE_PARAM and YYLEX_PARAM
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.
2014-01-07 14:24:36 +00:00
Ian Abbott
e8cefc0a0d demo/ao_mmap: remove spurious 'i' from an output message 2013-11-08 13:12:01 +00:00
Ian Abbott
1f0020e108 demo/ao_mmap: remove msync() call
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.
2013-11-08 13:06:38 +00:00
Ian Abbott
5f3b60573e m4/am-check-python-headers.m4: Try python-config --includes
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.
2013-08-21 11:06:24 +01:00
Ian Abbott
155529234a doc/funcref: fixed a couple of minor mark-up issues. 2013-07-23 17:43:19 +01:00
Ian Abbott
18fc613988 include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2013-05-14 17:35:49 +01:00
Ian Abbott
6c5d883481 demo: tut3.c: add 'return 0;' to end of main() function. 2013-05-14 14:25:50 +01:00
Ian Abbott
0404ed50dd doc/driverwriting.xml: editing Kbuild
Add a step to the instructions for integrating a new driver into comedi.
The Kbuild file needs to be edited.
2013-05-14 12:50:14 +01:00
Ian Abbott
383919639a demo/sender: add error checking
Check for errors from comedi_dio_config() and comedi_do_insnlist().
2013-05-07 13:43:11 +01:00
Ian Abbott
c413483a66 demo/dio: exit with failure if comedi_dio_config() fails. 2013-05-07 13:29:54 +01:00
Ian Abbott
a19f4d463f demo/choose_routing: remove unused variable 'period_ns'. 2013-05-07 13:24:03 +01:00
Ian Abbott
82ee0c80e2 testing: remove unused variables in comedi_test program
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.
2013-05-07 13:15:54 +01:00
Ian Abbott
fdf9d2d98b lib/data.c: remove unused variables
Remove unused variable 's' from comedi_data_write() and
comedi_data_read_delayed().
2013-05-07 13:01:08 +01:00
Ian Abbott
0868eccbf7 lib: remove cached cmd_timed and cmd_timed_errno from subdevice
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.
2013-05-07 12:58:30 +01:00
Ian Abbott
2811aea038 lib: check some malloc/calloc/realloc failures
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().
2013-05-07 12:32:26 +01:00
Ian Abbott
df2466c0f6 doc: add missing -lm option to command line for compiling tut1 2013-04-15 12:26:05 +01:00
Ian Abbott
ada711164c doc: Bump to version 0.10.2. 2013-03-21 16:36:42 +00:00
Ian Abbott
d9b2a47a32 configure.ac: Bump to 0.10.2
Bump the comedilib libtool version code to 10:2:10, so the comedilib
version becomes 0.10.2.
2013-03-21 16:34:14 +00:00
Ian Abbott
ddec51884b include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2013-03-21 16:27:56 +00:00
Ian Abbott
f4e228e231 lib/calib_lex.l: Add #define YY_NO_INPUT to C pre-amble
This suppresses a compiler warning about 'input' defined but not used.
2013-03-21 15:49:18 +00:00
Ian Abbott
cc0c9e7405 lib/calib_yacc.y: Move comedi_parse_calibration_file()
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().
2013-03-21 15:36:14 +00:00
Ian Abbott
90ce9a94bd lib: fix calib_yyparse() conflict
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".
2013-03-21 15:12:35 +00:00
Ian Abbott
3dfae5a6ee configure.ac: Replaced AM_CONFIG_HEADER() with AC_CONFIG_HEADERS()
AM_CONFIG_HEADER is obsolete and doesn't work with Automake 1.13.  Use
AC_CONFIG_HEADERS instead.
2013-01-21 16:15:30 +00:00
Ian Abbott
af8ab01d90 configure.ac: Move AS_LIBTOOL() and SCXI_SO_VERSION
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
2013-01-21 16:06:40 +00:00
W. Trevor King
af00348ee7 configure.ac: Add AM_PROG_AR for automake-1.12
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
2013-01-21 15:55:21 +00:00
Ian Abbott
977d9057a1 doc: Add Éric Piel to comedilib manual authors and copyright 2012-10-29 17:23:43 +00:00
Ian Abbott
df124b2ba9 AUTHORS: Add Éric Piel
Éric started a section on language bindings (for Python in particular)
to the Comedilib manual.
2012-10-29 17:11:20 +00:00
Éric Piel
7d4ad9ad15 doc: add a section about Python bindings
This section goes into a "Language bindings" section where description
for Perl and Ruby could also go.
2012-10-29 17:08:09 +00:00
Ian Abbott
e185d974ba comedi_board_info: improve display of external ranges.
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]
2012-10-15 16:18:47 +01:00
Ian Abbott
b1824dba8d 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.
2012-10-15 15:52:47 +01:00
Ian Abbott
1994c8d96c comedi_board_info: increased length of strtmp[]
`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.
2012-10-15 15:47:46 +01:00
Ian Abbott
ba3117525a doc/Makefile.am: fix maintainer-clean-local rule.
The maintainer-clean-local rule was removing the wrong file for
comedilib.pdf.
2012-08-28 14:19:09 +01:00
Ian Abbott
bafead2b6d doc: Bump to version 0.10.1. 2012-08-28 12:08:47 +01:00
Ian Abbott
2c810c12e3 doc/install.xml: Describe comedi_num_legacy_minors.
Add some info to the Install section about reserving devices for manual
configuration using the comedi_num_legacy_minors module parameter.
2012-08-28 11:54:39 +01:00
Ian Abbott
6bd3e85bdf etc/udev: Add z99_comedi.rules to EXTRA_DIST
Mark z99_comedi.rules to be added to the released sources, but don't
install it.
2012-08-28 11:52:42 +01:00
Ian Abbott
604a4dd8aa udev: Add commented out rule to set group owner to "iocard".
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.
2012-08-28 10:41:34 +01:00
Ian Abbott
a3fe997aed README.Git: Add dblatex to optional dependencies 2012-08-28 10:12:50 +01:00
Ian Abbott
c331390b14 configure.ac: Minor correction to example package version sequence.
Removed a stray '.'.
2012-08-22 12:48:53 +01:00
Ian Abbott
94ee527845 configure.ac: Expand rules for setting package/library version.
The comedilib manual version is usually only updated if the manual has
changed since the previous release (although it ought to change anyway
if any library interfaces have changed).  Allow a lower-case letter (or
sequence of letters) to be appended to the comedilib package version if
the only changes are outside the library sources and language bindings.
2012-08-22 12:20:03 +01:00
Ian Abbott
3f8ba17c76 configure.ac: Bump to 0.10.1
Bump the comedilib libtool version code to 10:1:10, so the comedilib
version becomes 0.10.1.

The comedilib manual version hasn't been updated.
2012-08-22 10:09:58 +01:00
Anders Blomdell
2b8c2f8087 comedi_open has file descriptor leak
If something fails after a succesful open, cleanup fails to close the file.

The code

   cleanup:
         if(it)
                 free(it);

needs to be replaced with something like:

   cleanup:
         if (it) {
           if (it->fd >= 0) {
             close(it->fd);
           }
         free(it);

Regards

Anders Blomdell
2012-08-22 09:54:19 +01:00
Ian Abbott
50ad010b31 configure.ac: Add reminder comment for updating documentation version.
The comedilib manual mentions the version of comedilib it applies to.
This is not done automatically; it is done by editing
"doc/comedilib.ent".  Add a comment to configure.ac as a reminder.
2012-05-15 14:31:08 +01:00
Ian Abbott
96078fcada doc: Add Comedilib version number
In "comedilib.ent", Add an XML entity 'comedilib_version' expanding to
the Comedilib version '0.10.0'.  This is hard-edited in rather than set
dynamically.  Setting it dynamically would be nice but producing it from
an AC_OUTPUT() file isn't all that nice as it would end up in the
'build' tree and we'd some ugly 'make' rule to copy it to the 'source'
tree.  For now, just edit it manually as required.  At least having it
as an entity means it only needs to be set in a single documentation
file!

In "comedilib.xml", change the subtitle to mention Comedilib and the
version number, using the comediliv_version entity.
2012-05-14 17:00:35 +01:00
Ian Abbott
648fac4772 demo/tut3.c: memset options to 0 before modifying
options.verbose was used uninitialized.
2012-05-14 15:04:10 +01:00
Ian Abbott
d1ad074b8c demo/tut3: Removed a couple of unused variables. 2012-05-14 14:54:33 +01:00
Ian Abbott
51dbae239b demo/pwm: Removed an unused variable. 2012-05-14 14:53:13 +01:00