Debian Squeeze + comedi sub-device issues

35 views
Skip to first unread message

Metrix

unread,
May 30, 2011, 7:52:39 PM5/30/11
to Comedi: Linux Control and Measurement Device Interface
Why is it that when I try to retrieve read or write sub-devices I get
0?

I have a National Instruments PCI-6503 card installed, and after boot
dmesg returns the following:

dmesg |grep comedi
[ 7.225145] comedi: module is from the staging directory, the
quality is unknown, you have been warned.
[ 7.299238] comedi: version 0.7.76 - http://www.comedi.org
[ 8.190770] comedi0: nidio:


I created the folllowing python script to get a feel for how comedi
works:
import comedi
#open device
device = comedi.comedi_open('/dev/comedi0')
print "----"
count = comedi.comedi_get_n_subdevices(device)
print "number of sub devices ", count
print "----"
subdevice = comedi.comedi_get_write_subdevice(device)
print "write device:", subdevice
print "----"
subdevice = comedi.comedi_get_read_subdevice(device)
print "read device:", subdevice
print "----"


when I run the Python script, I get the following output:
root@dev:/home/metrix/src/test# python test.py
----
number of sub devices 1
----
write device: -1
----
read device: -1
----


Brandon

Ian Abbott

unread,
May 31, 2011, 7:16:38 AM5/31/11
to comed...@googlegroups.com
Hi Brandon,

That's expected for this device. It only has a single DIO subdevice
(subdevice 0 is type COMEDI_SUBD_DIO) and it doesn't support the comedi
"cmd" interface in either the "read" or "write" directions, therefore
the device has neither a "read" nor a "write" subdevice.

It does support the comedi "insn" interface, and will handle INSN_BITS,
INSN_READ, INSN_WRITE, and INSN_CONFIG (with data[0] set to
INSN_CONFIG_DIO_INPUT, INSN_CONFIG_DIO_OUTPUT, or
INSN_CONFIG_DIO_QUERY). At the comedilib level, these correspond to
comedi_dio_bitfield (or comedi_dio_bitfield2), comedi_dio_read,
comedi_dio_write, and comedi_dio_config or comedi_dio_get_config. You
can use comedi_get_subdevice_type to check the type of subdevice.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-

Brandon Coleman

unread,
Jun 1, 2011, 12:24:25 PM6/1/11
to comed...@googlegroups.com
I added the following to my test script:
type = comedi.comedi_get_subdevice_type(device,0)
print "subdevice type: ", type
print "----"
count = comedi.comedi_get_n_channels(device,0)
print "number of channels: ", count
print "----"

returning:
subdevice type: -1
----
number of channels: -1
----

Googling further, could the issue in the link below be the same as the one I am having?

In an effort to get this working on my own, I upgraded my system to "unstable" to get a new kernel and latest comedi packages, and then ran: 

module-assistant a-i comedi 

to install the latest unstable comedi-source drivers, but now comedi is not loaded at boot time.  Should I go back to stable Debian, or should I stick with unstable to get this working?

Brandon




--
You received this message because you are subscribed to the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To post to this group, send email to comed...@googlegroups.com.
To unsubscribe from this group, send email to comedi_list...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/comedi_list?hl=en.


Ian Abbott

unread,
Jun 1, 2011, 5:48:07 PM6/1/11
to comed...@googlegroups.com
On 01/06/11 17:24, Brandon Coleman wrote:
> I added the following to my test script:
> type = comedi.comedi_get_subdevice_type(device,0)
> print "subdevice type: ", type
> print "----"
> count = comedi.comedi_get_n_channels(device,0)
> print "number of channels: ", count
> print "----"
>
> returning:
> subdevice type: -1
> ----
> number of channels: -1
> ----
>
> Googling further, could the issue in the link below be the same as the
> one I am having?
> http://groups.google.com/group/comedi_list/browse_thread/thread/2b995f61f0b07a0e?pli=1

That might be it - the modinfo command should tell you:

modinfo ni_pcidio

The output should have a 'depends:' line near the bottom like this:

depends: comedi,mite,8255

If the 8255 is missing then you have the bug mentioned on that thread.
Please let me know and I'll investigate further. It may need a bug fix
back porting to the stable kernel.

> In an effort to get this working on my own, I upgraded my system to
> "unstable" to get a new kernel and latest comedi packages, and then ran:
>
> module-assistant a-i comedi
>
> to install the latest unstable comedi-source drivers, but now comedi is
> not loaded at boot time. Should I go back to stable Debian, or should I
> stick with unstable to get this working?

Which kernels have you been using? The comedi-source package might be
too old to compile for your kernels.

Some of the Debian "unstable" kernels include pitifully few comedi
modules. For example linux-image-2.6-2.6.38-2-686 only includes
comedi.ko, 8255.ko and pcm_common.ko. Not very useful! It may be worth
filing a Debian bug to fix it.

Brandon Coleman

unread,
Jun 2, 2011, 12:11:17 AM6/2/11
to comed...@googlegroups.com
On Wed, Jun 1, 2011 at 4:48 PM, Ian Abbott <abb...@mev.co.uk> wrote:
On 01/06/11 17:24, Brandon Coleman wrote:
> I added the following to my test script:
> type = comedi.comedi_get_subdevice_type(device,0)
> print "subdevice type: ", type
> print "----"
> count = comedi.comedi_get_n_channels(device,0)
> print "number of channels: ", count
> print "----"
>
> returning:
> subdevice type: -1
> ----
> number of channels: -1
> ----
>
> Googling further, could the issue in the link below be the same as the
> one I am having?
> http://groups.google.com/group/comedi_list/browse_thread/thread/2b995f61f0b07a0e?pli=1

That might be it - the modinfo command should tell you:

modinfo ni_pcidio

The output should have a 'depends:' line near the bottom like this:

depends:        comedi,mite,8255

If the 8255 is missing then you have the bug mentioned on that thread.
Please let me know and I'll investigate further.  It may need a bug fix
back porting to the stable kernel.

After re-installing stable on my test machine, I found that I do get the "depends:        mite,comedi,8255"
however when the command: "comedi.comedi_get_subdevice_type(device,0)" still returns -1 
 
> In an effort to get this working on my own, I upgraded my system to
> "unstable" to get a new kernel and latest comedi packages, and then ran:
>
> module-assistant a-i comedi
>
> to install the latest unstable comedi-source drivers, but now comedi is
> not loaded at boot time.  Should I go back to stable Debian, or should I
> stick with unstable to get this working?

Which kernels have you been using?  The comedi-source package might be
too old to compile for your kernels.

Some of the Debian "unstable" kernels include pitifully few comedi
modules.  For example linux-image-2.6-2.6.38-2-686 only includes
comedi.ko, 8255.ko and pcm_common.ko.  Not very useful!  It may be worth
filing a Debian bug to fix it.

I tried the following images with and without using the module-assistant:
2.6.32-5-686 - debian stable, comedi loads automatically, running comedi.comedi_get_subdevice_type(device,0) returns -1
2.6.32+27~bpo50+1 - debian backports, /dev/comedi0 would not load
2.6.39+35 - debian unstable, /dev/comedi0 would not load 

I will look into getting a bug report filed with the Debian unstable kernal with this issue, with the hope that the next stable version will have the correct modules.  When I file the bug report, what should I ask for?  Request all comedi modules? or is there a list that I need to append to the report.

Brandon
--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abb...@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Ian Abbott

unread,
Jun 2, 2011, 5:57:40 AM6/2/11
to comed...@googlegroups.com
On 02/06/11 05:11, Brandon Coleman wrote:
> I will look into getting a bug report filed with the Debian unstable
> kernal with this issue, with the hope that the next stable version will
> have the correct modules. When I file the bug report, what should I ask
> for? Request all comedi modules? or is there a list that I need to
> append to the report.

You might as well ask for all comedi config options to be selected. I
suspect the problem arose because the kernel config options for changed
to give finer control over the comedi driver selection. A simple "make
oldconfig" with a kernel .config from an earlier kernel would have
deselected most of the comedi stuff by default.

Reply all
Reply to author
Forward
0 new messages