comedi.git
12 years agoTag user memory pointers with __user.
Ian Abbott [Thu, 19 Jan 2012 14:36:08 +0000 (14:36 +0000)]
Tag user memory pointers with __user.

Tag user memory pointers with __user.  Also replace some 'void *'
pointers in ioctl handler functions with more specific pointer types.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agolinux/compiler.h: Define __user and __iomem if missing.
Ian Abbott [Thu, 19 Jan 2012 13:11:15 +0000 (13:11 +0000)]
linux/compiler.h: Define __user and __iomem if missing.

In the linux/compiler.h compatibility header, define the __user and
__iomem macros with empty expansion if they are undefined.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoamplc_dio200: Fix harmless typo in 8254 subdevice cleanup
Ian Abbott [Tue, 17 Jan 2012 11:03:23 +0000 (11:03 +0000)]
amplc_dio200: Fix harmless typo in 8254 subdevice cleanup

Correct type of 'subpriv' variable in dio200_subdev_8254_cleanup().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodt9812: Fix logical || vs bitwise |.
Ian Abbott [Tue, 17 Jan 2012 10:13:59 +0000 (10:13 +0000)]
dt9812: Fix logical || vs bitwise |.

Fix bug discovered by Dan Carpenter in the "staging" sources.

In dt9212_configure_gain(), some bitmask constants were OR'ed together
logically (giving the value 1) when they should have been OR'ed together
bitwise.  The effect of this bug is that the analog gain would be set
incorrectly on the AI subdevice for certain ranges.

As it happens, the driver is incomplete regarding range settings anyway,
so the bug fix currently has no effect.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoRevert "Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl()."
Ian Abbott [Fri, 13 Jan 2012 10:29:58 +0000 (10:29 +0000)]
Revert "Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl()."

This reverts commit 824ffcaf3a1bd55a111ed67cf5b0cb3cd18b405f.

The check is unnecessary because user_cmd.chanlist_len has already been
checked against the maximum supported by the subdevice.

Thanks to Dan Carpenter for pointing this out.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agome4000: Correct previous change to INSN_CONFIG.
Ian Abbott [Mon, 9 Jan 2012 15:30:25 +0000 (15:30 +0000)]
me4000: Correct previous change to INSN_CONFIG.

I messed up the previous change to me4000.c on 2011-12-15 which meant
that INSN_CONFIG_DIO_INPUT behaved like INSN_CONFIG_DIO_OUTPUT and vice
versa!  Fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agome_daq: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:10:21 +0000 (21:10 +0000)]
me_daq: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also for INSN_WRITE on the AO subdevice, write the nth data value in the
loop instead of the 0th data value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoadv_pci_dio: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:07:43 +0000 (21:07 +0000)]
adv_pci_dio: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_at_ao: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:04:50 +0000 (21:04 +0000)]
ni_at_ao: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agousbdux: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:01:48 +0000 (21:01 +0000)]
usbdux: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodas1800: don't access *data when insn->bits == 0
Ian Abbott [Thu, 15 Dec 2011 20:57:29 +0000 (20:57 +0000)]
das1800: don't access *data when insn->bits == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoamplc_dio200: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:56:11 +0000 (20:56 +0000)]
amplc_dio200: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agocb_pcidas64: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:51:45 +0000 (20:51 +0000)]
cb_pcidas64: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoquatech_daqp_cs: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:47:07 +0000 (20:47 +0000)]
quatech_daqp_cs: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoadl_pci8164: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:42:01 +0000 (20:42 +0000)]
adl_pci8164: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also fixed instructions that printed the value of data[1] and returned 2
even though they only used data[0].

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_mio_common: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:32:32 +0000 (20:32 +0000)]
ni_mio_common: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoaddi_common: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:24:17 +0000 (20:24 +0000)]
addi_common: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

The INSN_READ handler for the EEPROM was ignoring insn->n.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agome4000: check for unsupported INSN_CONFIG
Ian Abbott [Thu, 15 Dec 2011 20:21:09 +0000 (20:21 +0000)]
me4000: check for unsupported INSN_CONFIG

The INSN_CONFIG handler for the DIO subdevice should error out for
unsupported configuration instruction codes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodt2801: do INSN_CONFIG properly for DIO subdevice
Ian Abbott [Thu, 15 Dec 2011 20:08:16 +0000 (20:08 +0000)]
dt2801: do INSN_CONFIG properly for DIO subdevice

Handle INSN_CONFIG_DIO_INPUT, INSN_CONFIG_DIO_OUTPUT and
INSN_CONFIG_DIO_QUERY in data[0].

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodt2801: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:01:53 +0000 (20:01 +0000)]
dt2801: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_labpc: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:55:53 +0000 (19:55 +0000)]
ni_labpc: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodt282x: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:52:32 +0000 (19:52 +0000)]
dt282x: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agocb_pcidda: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:44:40 +0000 (19:44 +0000)]
cb_pcidda: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agodas08: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:38:52 +0000 (19:38 +0000)]
das08: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also handle INSN_WRITE properly for AO subdevices.  Should use the nth
data value in the loop, not the 0th.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoke_counter: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:32:31 +0000 (19:32 +0000)]
ke_counter: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agocb_pcidas: don't access *data when insn-en == 0
Ian Abbott [Thu, 15 Dec 2011 19:29:52 +0000 (19:29 +0000)]
cb_pcidas: don't access *data when insn-en == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoadv_pci1710: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:16:04 +0000 (19:16 +0000)]
adv_pci1710: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also, the INSN_WRITE handlers for AO subdevices were incorrectly storing
the data value past the end of the data array for read-back, instead of
the last data value (when insn->n > 0).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agos526: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:06:37 +0000 (19:06 +0000)]
s526: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also the INSN_WRITE code for pulse-train generation should only access
data[1] if insn->n >= 2.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoii_pci20kc: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 18:46:31 +0000 (18:46 +0000)]
ii_pci20kc: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agopoc: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 18:37:34 +0000 (18:37 +0000)]
poc: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agounioxx5: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 18:31:00 +0000 (18:31 +0000)]
unioxx5: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data in
this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agocomedi/drivers.c: handle insn->n == 0 in insn_rw_emulate_bits
Ian Abbott [Thu, 15 Dec 2011 18:01:39 +0000 (18:01 +0000)]
comedi/drivers.c: handle insn->n == 0 in insn_rw_emulate_bits

A recent change to do_insnlist_ioctl() and do_insn_ioctl() to handle
arbitrary limits on means that the 'data' pointer will now be NULL when
insn->n == 0.  Need to check insn->n is non-zero before accessing *data.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agousbdux: unlock on error in usbdux_ao_inttrig()
Ian Abbott [Wed, 30 Nov 2011 14:59:33 +0000 (14:59 +0000)]
usbdux: unlock on error in usbdux_ao_inttrig()

Follow patch by Dan Carpenter to the "staging" sources.

When trignum is invalid it returned without unlocking the mutex.
Fix it.

12 years agousbduxsigma: unlock on error in usbdux_ao_inttrig()
Ian Abbott [Wed, 30 Nov 2011 14:55:06 +0000 (14:55 +0000)]
usbduxsigma: unlock on error in usbdux_ao_inttrig()

Follow patch by Dan Carpenter to the "staging" sources.

When trignum is invalid it returned without unlocking the mutex.
Fix it.

12 years agoRemove arbitrary limit in do_insnlist_ioctl() and do_insn_ioctl().
Ian Abbott [Wed, 23 Nov 2011 15:50:45 +0000 (15:50 +0000)]
Remove arbitrary limit in do_insnlist_ioctl() and do_insn_ioctl().

Remove the arbitrary limit on number of samples per instruction.  It
will still be limited by the maximum size of a kmalloc() buffer.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoCheck integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl().
Ian Abbott [Wed, 23 Nov 2011 15:28:57 +0000 (15:28 +0000)]
Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl().

Check for integer overflow when allocating buffer for channel list.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoCheck integer overflow in do_insnlist_ioctl().
Ian Abbott [Wed, 23 Nov 2011 15:16:53 +0000 (15:16 +0000)]
Check integer overflow in do_insnlist_ioctl().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoRevert "Check integer overflow in do_insnlist_ioctl()"
Ian Abbott [Wed, 23 Nov 2011 14:43:03 +0000 (14:43 +0000)]
Revert "Check integer overflow in do_insnlist_ioctl()"

Xi Wang pointed out a flaw in the current check.

12 years agoni_pcimio: Added support for NI PXIe-6251
Ian Abbott [Tue, 15 Nov 2011 15:16:09 +0000 (15:16 +0000)]
ni_pcimio: Added support for NI PXIe-6251

Paul Fulmek reports that PXIe-6251 works the same as the existing
PCIe-6251 and just needs the new PCI device ID adding to ni_pci_table[]
and a new entry adding to ni_boards[] based on the existing entry for
PCIe-6251.

The new entry has PCI device ID 0x72e8 and board name "pxie-6251".

Thanks Paul!

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoChecks for NULL pointers to prevent kernel oops when a USB DAQ
Bernd Porr [Tue, 8 Nov 2011 22:49:30 +0000 (22:49 +0000)]
Checks for NULL pointers to prevent kernel oops when a USB DAQ
device is plugged out while communicating to a userspace program.

12 years agoCorrected wrong analogue input range. It's not +/-2.65V but +/-2.65V/2.
Bernd Porr [Tue, 8 Nov 2011 22:47:23 +0000 (22:47 +0000)]
Corrected wrong analogue input range. It's not +/-2.65V but +/-2.65V/2.

12 years agoCheck integer overflow in do_insnlist_ioctl()
Ian Abbott [Mon, 7 Nov 2011 10:20:23 +0000 (10:20 +0000)]
Check integer overflow in do_insnlist_ioctl()

Follow patch to "staging" comedi kernel sources by Dan Carpenter.

There is an integer overflow here that could cause memory corruption
on 32 bit systems.

insnlist.n_insns could be a very high value size calculation for
kmalloc() could overflow resulting in a smaller "insns" than
expected.  In the for (i = 0; i < insnlist.n_insns; i++) {... loop
we would read past the end of the buffer, possibly corrupting memory
as well.

12 years agoFix signal handling in read and write
Ian Abbott [Tue, 1 Nov 2011 09:49:29 +0000 (09:49 +0000)]
Fix signal handling in read and write

Follow bug-fix by Federico Vaga on the Linux "staging" version:

After sleeping on a wait queue, signal_pending(current) should be
checked (not before sleeping).

12 years agoFix mmap_count.
Ian Abbott [Tue, 1 Nov 2011 09:43:56 +0000 (09:43 +0000)]
Fix mmap_count.

Follow bug-fix by Federico Vaga in Linux "staging" version:

In comedi_fops, mmap_count is decremented at comedi_vm_ops->close but it
is not incremented at comedi_vm_ops->open. This may result in a negative
counter.  The patch introduces the open method to keep the counter
consistent.

The bug was triggerd by this sample code:

        mmap(0, ...., comedi_fd);
        fork();
        exit(0);

12 years agousbduxsigma: Remove conditional code that calls sema_init
Ian Abbott [Mon, 26 Sep 2011 09:29:35 +0000 (10:29 +0100)]
usbduxsigma: Remove conditional code that calls sema_init

Bernd says the removed code was needed for Ubuntu 10.04 LTS kernel, but
it's better to remove it and solve any problems for that kernel another
way.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoAdded support for the new board by ITL called USBDUXsigma.
Bernd Porr [Sat, 3 Sep 2011 12:48:31 +0000 (13:48 +0100)]
Added support for the new board by ITL called USBDUXsigma.

12 years agoRename some function parameters from 'register' to 'reg'.
Ian Abbott [Wed, 14 Sep 2011 08:53:31 +0000 (09:53 +0100)]
Rename some function parameters from 'register' to 'reg'.

[Porting over relevant part of patch by Chris Peterson for Linux kernel
sources.]

Some function prototypes declare an 'int register' parameter. gcc -W
warns "‘register’ is not at beginning of declaration" because the
compiler thinks the parameter has been marked as a 'register' variable
but the author just wanted to name the parameter "register" (which is a
reserved keyword).

12 years agoAdded support for trailing edge external trigger to ni_pcidio
Nico Nell [Mon, 12 Sep 2011 20:47:07 +0000 (14:47 -0600)]
Added support for trailing edge external trigger to ni_pcidio

12 years agoAUTHORS: Add Nicholas Nell for various patches
Ian Abbott [Thu, 8 Sep 2011 11:11:44 +0000 (12:11 +0100)]
AUTHORS: Add Nicholas Nell for various patches

12 years agoAdded comedi_poll support to ni_pcidio
Nico Nell [Thu, 18 Aug 2011 17:14:30 +0000 (11:14 -0600)]
Added comedi_poll support to ni_pcidio

12 years agoFix warnings about including deprecated <linux/config.h>
Ian Abbott [Mon, 5 Sep 2011 12:29:20 +0000 (13:29 +0100)]
Fix warnings about including deprecated <linux/config.h>

Change Comedi's <linux/config.h> compatibility header so it only
includes the real <linux/config.h> for kernel versions below 2.6.15.
Previously it was included for kernel versions below 2.6.19 (when it was
removed from the kernel sources) but wasn't needed for 2.6.15 onwards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoDeal with backported bool type for RHEL5's 2.6.18 kernel
Ian Abbott [Mon, 5 Sep 2011 12:17:20 +0000 (13:17 +0100)]
Deal with backported bool type for RHEL5's 2.6.18 kernel

RHEL5's 2.6.18 kernel includes a change backported from 2.6.19 that
declares a generic 'bool' type in <linux/types.h> and declares the
'false' and 'true' enum values in <linux/stddef.h>.  Comedi's
compatibility header for <linux/stddef.h> declared the 'false' and
'true' enum values for any kernel version below 2.6.19.  This resulted
in comedi failing to build due to redeclaration errors.

Add an autoconf test to see if the generic 'bool' type is defined in
<linux/types.h> and if so define the macro
CONFIG_COMEDI_HAVE_GENERIC_BOOL_TYPE in <config.h>.  Conditionally
declare the 'bool' type in the <linux/types.h> compatibility header and
change the condition for declaring the 'false' and 'true' enum values in
the <linux/stddef.h> compatibility header so they are only declared if
the CONFIG_COMEDI_HAVE_GENERIC_BOOL_TYPE macro is undefined.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_pcidio: Forgot to include irq flags variable for spinlock.
Ian Abbott [Mon, 18 Jul 2011 11:16:18 +0000 (12:16 +0100)]
ni_pcidio: Forgot to include irq flags variable for spinlock.

I messed up the previous commit.  Need to include a variable in
setup_mite_dma() to hold the IRQ flags when grabbing the spinlock.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_pcidio: Grab MITE channel spinlock while preparing and arming DMA.
Ian Abbott [Mon, 18 Jul 2011 11:08:38 +0000 (12:08 +0100)]
ni_pcidio: Grab MITE channel spinlock while preparing and arming DMA.

When setting up the DMA for 'read' streaming acquisition command, grab
the MITE channel spinlock before preparing and arming the DMA.

Change inspired by ni_ai_setup_MITE_dma() in ni_mio_common.c.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoni_pcidio: Mark buffer for writing when setting up DMA.
Ian Abbott [Mon, 18 Jul 2011 10:30:08 +0000 (11:30 +0100)]
ni_pcidio: Mark buffer for writing when setting up DMA.

When setting up the DMA for 'read' streaming acquisition on the DIO
subdevice, mark the whole buffer as writable before starting the DMA.
This prevents a spurious detection of a DMA overwrite of good data
during the first interrupt.

Problem reported by Nico Nell.  Fix suggested by Frank Mori Hess.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoFix infoleak to userspace.
Ian Abbott [Mon, 27 Jun 2011 10:05:39 +0000 (11:05 +0100)]
Fix infoleak to userspace.

Following Vasiliy Kulikov <segoon _at_ openwall _dot_ org>'s patch for
the staging sources:

driver_name and board_name are pointers to strings, not buffers of size
COMEDI_NAMELEN.  Copying COMEDI_NAMELEN bytes of a string containing
less than COMEDI_NAMELEN-1 bytes would leak some unrelated bytes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoAdvantech PCI-1739U support
Nico Nell [Wed, 15 Jun 2011 19:46:19 +0000 (20:46 +0100)]
Advantech PCI-1739U support

Hello,

I've added a bit of simple configuration to adv_pci_dio.c in order to
make the PCI-1739U work with the adv_pci_dio driver. I have tested
inputs only so far but they seem to work. A git style patch is
attached.

Thanks,

--
Nicholas Nell
Professional Research Assistant
University of Colorado
nicholas.nell@colorado.edu
303-492-5661

From c2a97fef832aa70b7fb2eff60de6412829b314ba Mon Sep 17 00:00:00 2001
From: Gene Ray <user@SLICE-testing.Colorado.EDU>
Date: Thu, 2 Jun 2011 12:58:37 -0600
Subject: [PATCH] Added functionality for the Advantech PCI-1739U DIO board

12 years agoconfigure: Recognize kernel 3.x
Ian Abbott [Thu, 2 Jun 2011 13:47:01 +0000 (14:47 +0100)]
configure: Recognize kernel 3.x

Support Linus's alpha-maleness kernel version numbering change.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoaddi-data: Get rid of redundant ps_BoardInfo
Ian Abbott [Mon, 16 May 2011 15:06:32 +0000 (16:06 +0100)]
addi-data: Get rid of redundant ps_BoardInfo

The ps_BoardInfo pointer in the device private data is redundant as we
can just use the this_board macro to access the same data, as is done
elsewhere in the code.  Get rid of the pointer and change the code to
use the this_board macro instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoaddi_data: Don't overwrite read-only data
Ian Abbott [Mon, 16 May 2011 14:57:24 +0000 (15:57 +0100)]
addi_data: Don't overwrite read-only data

The drivers for ADDI-DATA cards can override some static parameters for
the board type using information read from EEPROM.  Unfortunately, they
currently write the parameters from the EEPROM back to the shared,
read-only board data!  The problem has been masked during compilation by
type-casting away the const-ness of the data.

This patch changes the code to use an area in the private data for the
board instance to hold the parameters read from EEPROM (after
initializing the parameters from the static board data).  It also
changes the type-casts to the read-only data to preserve the const
qualifier.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoAUTHORS: Added Ivan Russkih (Иван Русских).
Ian Abbott [Mon, 16 May 2011 09:53:21 +0000 (10:53 +0100)]
AUTHORS: Added Ivan Russkih (Иван Русских).

Added for patch to adv_pci_dio to support counter subdevice on PCI-1751.

12 years agoadv_pci_dio: Add 8254 counter subdevice to PCI-1751
Ian Abbott [Mon, 16 May 2011 09:31:42 +0000 (10:31 +0100)]
adv_pci_dio: Add 8254 counter subdevice to PCI-1751

The Advantech PCI-1751 has a 8254 counter chip providing 3 counter
channels.  Add a counter subdevice for this card.

Patch from Иван Русских (vanekrus at gmail dot com).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agocomedi: Removal of <linux/smp_lock.h>
Ian Abbott [Fri, 13 May 2011 13:55:19 +0000 (14:55 +0100)]
comedi: Removal of <linux/smp_lock.h>

The <linux/smp_lock.h> header (used for the Big Kernel Lock) is removed
in kernel 2.6.39.  It was included by:

  comedi/comedi_compat32.c
  comedi/drivers/usbdux.c
  comedi/drivers/usbduxfast.c

The usbdux and usbduxfast drivers shouldn't need to include the header
as they don't grab the BKL, so remove the #include line for these
drivers.

The comedi_compat32 code only uses it when calling the ioctl file
operation, and that can only happen for kernels up to 2.6.35 (and even
then it wouldn't be called if the unlocked_ioctl file operation is
available!). Ifdef out the #include line.  Also include
<linux/version.h> explicitly to avoid compiler errors for 2.6.39 kernel.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoconfigure.ac: Change reference to CVS to Git.
Ian Abbott [Tue, 10 May 2011 13:26:31 +0000 (14:26 +0100)]
configure.ac: Change reference to CVS to Git.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoINSTALL: Changed reference to cvs to git.
Ian Abbott [Tue, 10 May 2011 13:18:16 +0000 (14:18 +0100)]
INSTALL: Changed reference to cvs to git.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years ago.gitignore: Ignore the file 'missing'.
Ian Abbott [Tue, 10 May 2011 13:14:14 +0000 (14:14 +0100)]
.gitignore: Ignore the file 'missing'.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoRemove references to .cvsignore from .gitignore files.
Ian Abbott [Tue, 10 May 2011 13:13:05 +0000 (14:13 +0100)]
Remove references to .cvsignore from .gitignore files.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoRename the .cvsignore files to .gitignore
Ian Abbott [Tue, 10 May 2011 13:08:53 +0000 (14:08 +0100)]
Rename the .cvsignore files to .gitignore

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoREADME: Updated mailing list details.
Ian Abbott [Tue, 10 May 2011 12:51:35 +0000 (13:51 +0100)]
README: Updated mailing list details.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoREADME: Removed reference to non-existant comedi FTP site.
Ian Abbott [Tue, 10 May 2011 11:47:01 +0000 (12:47 +0100)]
README: Removed reference to non-existant comedi FTP site.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoREADME: Changed CVS references to Git.
Ian Abbott [Tue, 10 May 2011 11:43:50 +0000 (12:43 +0100)]
README: Changed CVS references to Git.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
12 years agoREADME.CVS: Renamed to README.Git and edited slightly
Ian Abbott [Tue, 10 May 2011 11:33:37 +0000 (12:33 +0100)]
README.CVS: Renamed to README.Git and edited slightly

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
13 years agoAdd #include <linux/version.h> to include/asm/uaccess.h
Ian Abbott [Thu, 3 Mar 2011 15:47:44 +0000 (15:47 +0000)]
Add #include <linux/version.h> to include/asm/uaccess.h

The include/asm/uaccess.h compatibility header uses LINUX_VERSION_CODE
and KERNEL_VERSION, but doesn't #include <linux/version.h> to define
those macros.  This caused a build failure for at least one person.

Perhaps we should just remove the file though, as it's only needed for
really ancient kernels (before 2.2.0) that we no longer support.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
13 years agoni_labpc: Use shared IRQ for PCMCIA card.
Ian Abbott [Wed, 19 Jan 2011 10:54:39 +0000 (10:54 +0000)]
ni_labpc: Use shared IRQ for PCMCIA card.

13 years agoMost drivers ignore the base channel in insn->chanspec for INSN_BITS
Ian Abbott [Tue, 18 Jan 2011 16:26:27 +0000 (16:26 +0000)]
Most drivers ignore the base channel in insn->chanspec for INSN_BITS
instructions.  If the subdevice has no more than 32 channels, and the
base channel is non-zero, modify the instruction chanspec and data before
passing it to the driver with base channel set to 0, and modify the
returned data.

13 years agopcmmio: Avoid compiler warning about uninitialized irq[1] which is out of
Ian Abbott [Thu, 13 Jan 2011 12:07:33 +0000 (12:07 +0000)]
pcmmio: Avoid compiler warning about uninitialized irq[1] which is out of
bounds of irq[] anyway (as MAX_ASICS = 1).

13 years agoAdded Brice DUBOST for cb_pcidas contributions (edge and inverted level
Ian Abbott [Mon, 22 Nov 2010 10:28:01 +0000 (10:28 +0000)]
Added Brice DUBOST for cb_pcidas contributions (edge and inverted level
external triggering for start argument of AI command on PCI-DAS1602 series).

13 years agocb_pcidas: Applied patch from Brice DUBOST to support CR_EDGE and CR_INVERT
Ian Abbott [Mon, 22 Nov 2010 10:23:56 +0000 (10:23 +0000)]
cb_pcidas: Applied patch from Brice DUBOST to support CR_EDGE and CR_INVERT
start_arg flags for AI commands on PCI_DAS1602 series.

13 years agoFix memory leak spotted by Nicolas Kaiser in the staging sources.
Ian Abbott [Mon, 15 Nov 2010 10:25:43 +0000 (10:25 +0000)]
Fix memory leak spotted by Nicolas Kaiser in the staging sources.

13 years agoni_mio_cs: I broke support for 2.6.35 when adding support for 2.6.36 due
Ian Abbott [Tue, 9 Nov 2010 12:28:29 +0000 (12:28 +0000)]
ni_mio_cs: I broke support for 2.6.35 when adding support for 2.6.36 due
to using a wrong #ifdef in mio_cs_config().  Sorry!  This fixes it.

13 years agoMore ugly PCMCIA changes for 2.6.37 kernel.
Ian Abbott [Mon, 8 Nov 2010 15:15:05 +0000 (15:15 +0000)]
More ugly PCMCIA changes for 2.6.37 kernel.

13 years agoPCMCIA support broke again with 2.6.36(-rc) kernel, so add more uqly hacks.
Ian Abbott [Fri, 8 Oct 2010 14:32:24 +0000 (14:32 +0000)]
PCMCIA support broke again with 2.6.36(-rc) kernel, so add more uqly hacks.

13 years agoserial2002: old 'ioctl' file operation removed in 2.6.36.
Ian Abbott [Fri, 8 Oct 2010 14:30:02 +0000 (14:30 +0000)]
serial2002: old 'ioctl' file operation removed in 2.6.36.

13 years agocomedi_compat32: old 'ioctl' file operation removed in 2.6.36.
Ian Abbott [Fri, 8 Oct 2010 11:10:02 +0000 (11:10 +0000)]
comedi_compat32: old 'ioctl' file operation removed in 2.6.36.

13 years agoI messed up the #ifdefs on the previous commit. Sorry!
Ian Abbott [Fri, 8 Oct 2010 09:59:20 +0000 (09:59 +0000)]
I messed up the #ifdefs on the previous commit.  Sorry!

13 years agoquatech_daqp_cs: Replace eos semaphore with a completion. Build tested only.
Ian Abbott [Thu, 30 Sep 2010 16:31:27 +0000 (16:31 +0000)]
quatech_daqp_cs: Replace eos semaphore with a completion.  Build tested only.

Note: the wait_for_completion_interruptible() function needs 2.6.11 kernel
or above, but I'm pretty sure this driver (and other PCMCIA drivers) is
currently broken for those kernels anyway, so I'm not bothering to implement
the function in compatibility headers just yet.

13 years agoPCMCIA support broke again with 2.6.35 kernel, so add yet more ugly hacks.
Ian Abbott [Thu, 30 Sep 2010 15:59:41 +0000 (15:59 +0000)]
PCMCIA support broke again with 2.6.35 kernel, so add yet more ugly hacks.

13 years agodt9812, usbdux, usbduxfast: Use mutex instead of semaphore.
Ian Abbott [Mon, 26 Jul 2010 11:47:08 +0000 (11:47 +0000)]
dt9812, usbdux, usbduxfast: Use mutex instead of semaphore.

13 years agoAdd #include <linux/semaphore.h>.
Ian Abbott [Mon, 26 Jul 2010 11:16:30 +0000 (11:16 +0000)]
Add #include <linux/semaphore.h>.
TODO: Migrate to use mutex instead, but note that it currently initializes
the semaphore in the 'locked' state.

13 years agoCompatibility header for <linux/semaphore.h>. Just includes the proper
Ian Abbott [Mon, 26 Jul 2010 11:14:07 +0000 (11:14 +0000)]
Compatibility header for <linux/semaphore.h>.  Just includes the proper
<linux/semaphore.h> if CONFIG_COMEDI_HAVE_LINUX_SEMAPHORE_H is defined,
otherwise it includes <asm/semaphore.h> instead.

13 years agoAdd check for existance of <linux/semaphore.h> header and define the
Ian Abbott [Mon, 26 Jul 2010 11:12:19 +0000 (11:12 +0000)]
Add check for existance of <linux/semaphore.h> header and define the
CONFIG_COMEDI_HAVE_LINUX_SEMAPHORE_H macro in config.h if present. Note
<linux/semaphore.h> was added in kernel version 2.6.26, replacing
<asm/semaphore.h>.  We need a compatibility header for it.

13 years agoAdd a dkms.conf file for building comedi with DKMS
Ian Abbott [Wed, 23 Jun 2010 15:12:40 +0000 (15:12 +0000)]
Add a dkms.conf file for building comedi with DKMS
(Dynamic Kernel Module Support).

13 years agoPCMCIA support broke with the 2.6.33 kernel, so add support back in.
Ian Abbott [Tue, 22 Jun 2010 16:12:24 +0000 (16:12 +0000)]
PCMCIA support broke with the 2.6.33 kernel, so add support back in.
I don't know if it works, but at least it should compile!
The driver source code changes are very inelegant.

Note that the IRQ attributes have been changed from IRQ_TYPE_EXCLUSIVE to
IRQ_TYPE_DYNAMIC_SHARING.

13 years agoadl_pci9111: bug fix for AI commands when scan_begin_src is TRIG_FOLLOW.
Ian Abbott [Fri, 18 Jun 2010 10:00:26 +0000 (10:00 +0000)]
adl_pci9111: bug fix for AI commands when scan_begin_src is TRIG_FOLLOW.
The dev_private->scan_delay should have been left set to 0 in this case,
but it ended up being set to (unsigned int)-1.

13 years agoChange example Driver: comment block slightly to avoid it being matched by
Ian Abbott [Mon, 14 Jun 2010 10:42:02 +0000 (10:42 +0000)]
Change example Driver: comment block slightly to avoid it being matched by
updated 'dump_doc' script.

13 years agoAllow "*" (optionally surrounded by a space on each side) to precede
Ian Abbott [Mon, 14 Jun 2010 10:34:38 +0000 (10:34 +0000)]
Allow "*" (optionally surrounded by a space on each side) to precede
"Driver:" and strip this from all the lines in the comment block.

13 years agoCheck for RTAI include directory "${RTAI_DIR}/include/rtai" before checking
Ian Abbott [Wed, 26 May 2010 11:17:33 +0000 (11:17 +0000)]
Check for RTAI include directory "${RTAI_DIR}/include/rtai" before checking
for "${RTAI_DIR}/include".  This is because Debian uses --with-rtaidir=/usr
but puts the RTAI include files in /usr/include/rtai.

13 years agoFix previous commit. For COMEDI_BUFINFO, if command not active, report back
Ian Abbott [Wed, 19 May 2010 16:49:49 +0000 (16:49 +0000)]
Fix previous commit.  For COMEDI_BUFINFO, if command not active, report back
the last buffer position instead of random junk.

13 years agoadv_pci_dio: Forgot to update the 'Updated:' line when the driver
Ian Abbott [Wed, 19 May 2010 14:40:46 +0000 (14:40 +0000)]
adv_pci_dio: Forgot to update the 'Updated:' line when the driver
description was changed in Revision 1.26.

13 years agoadv_pci_dio: Protect access to counter subdevice with a spin lock.
Ian Abbott [Wed, 19 May 2010 14:31:19 +0000 (14:31 +0000)]
adv_pci_dio: Protect access to counter subdevice with a spin lock.