comedi on an Arch Linux box: How to install using pacman / yaourt?

211 views
Skip to first unread message

th.myrna

unread,
Mar 13, 2011, 11:34:31 AM3/13/11
to Comedi: Linux Control and Measurement Device Interface
Hi all,

I wanted to install comedi on my up-to-date Arch Linux box using

yaourt -S comedi-cvs

After replacing cvs by git in the PKGBUILD, I got

(...)
checking for depmod... /sbin/depmod
configure: Using 2.6.37-ARCH as the uname -r value
configure: Using i686 as the uname -m value
checking for rpm... no
checking for Linux build in /lib/modules/2.6.37-ARCH/build... not
found
checking for Linux build in ../linux... not found
checking for Linux build in /usr/src/linux... not found
configure: error: Linux build directory not found
Aborting...

Seems I have to install the kernel sources, but I am not sure how to
do this: aur/kernel-devel is flaged out-of-date and core doesn't offer
kernel-devel.

Thin


Ian Abbott

unread,
Mar 13, 2011, 12:08:39 PM3/13/11
to comed...@googlegroups.com

I don't use Arch Linux, but the minimum google researching I've done
suggests you need the kernel26-headers package.

Some other things to consider:

1. Do the Arch kernels include the staging comedi drivers already?

2. In theory, it should be possible to do a DKMS version of the package
for Arch, which would automatically build the comedi modules when the
kernel is updated. There is an example dkms.conf in the comedi sources,
which I think is up-to-date, and just needs the PACKAGE_VERSION line
tweaking.

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

th.myrna

unread,
Mar 13, 2011, 1:32:06 PM3/13/11
to Comedi: Linux Control and Measurement Device Interface
On Mar 13, 5:08 pm, Ian Abbott <abbo...@mev.co.uk> wrote:
> On 13/03/2011 15:34, th.myrna wrote:
>
>
>
> > Hi all,
>
> > I wanted to install comedi on my up-to-date Arch Linux box using
>
> > yaourt -S comedi-cvs
>
> > After replacing cvs by git in the PKGBUILD, I got
>
> > (...)
> > checking for depmod... /sbin/depmod
> > configure: Using 2.6.37-ARCH as the uname -r value
> > configure: Using i686 as the uname -m value
> > checking for rpm... no
> > checking for Linux build in /lib/modules/2.6.37-ARCH/build... not
> > found
> > checking for Linux build in ../linux... not found
> > checking for Linux build in /usr/src/linux... not found
> > configure: error: Linux build directory not found
> >      Aborting...
>
> > Seems I have to install the kernel sources, but I am not sure how to
> > do this: aur/kernel-devel is flaged out-of-date and core doesn't offer
> > kernel-devel.
>
> I don't use Arch Linux, but the minimum google researching I've done
> suggests you need the kernel26-headers package.

Thanks for the hint, Ian. A "pacman -Ss kernel header" revealed

core/kernel26-headers 2.6.37.3-1
Header files and scripts for building modules for kernel26

as you said.

The build worked. I'll get at the hardware tomorrow to see if I can
access it now (a Data Translation DAQ box).


>
> Some other things to consider:
>
> 1. Do the Arch kernels include the staging comedi drivers already?
>
> 2. In theory, it should be possible to do a DKMS version of the package
> for Arch, which would automatically build the comedi modules when the
> kernel is updated. There is an example dkms.conf in the comedi sources,
> which I think is up-to-date, and just needs the PACKAGE_VERSION line
> tweaking.
>
> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk>        )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Many thanks
Thin


th.myrna

unread,
Mar 14, 2011, 6:16:20 AM3/14/11
to Comedi: Linux Control and Measurement Device Interface
Yesterday I instaled comedi and today I installed comedilib to be able
to access the dt9812 from a Python program. Then I remembered that
after installation a file comedi0 should live in /dev, which is needed
for comedi_config and later in Python programs as well. Alas, it is
not there. "modprobe comedi" didn't do the trick.

dmesg says after connecting the hardware:

comedi: module is from the staging directory, the quality is unknown,
you have been warned.
comedi: version 0.7.76 - http://www.comedi.org

and

dt9812: module is from the staging directory, the quality is unknown,
you have been warned.
dt9812 5-1:1.0: USB DT9812 (ffff.ffff.ffff) #0x00705227

ffff.ffff.ffff looks strange but I can't say whether this is okay or
not.

There seems to be a step left out by yaourt -S comedi-cvs and yaourt -
S comedilib-cvs (PKGBUILDs changed to access git). Any idea?

Best regards
Thin

Ian Abbott

unread,
Mar 14, 2011, 10:00:31 AM3/14/11
to comed...@googlegroups.com

One thing that is apparent is that it's not using the comedi modules you
built and installed from git, it's using modules from the kernel's
"staging" directory. These must have been shipped with the kernel26
package.

Barring bugs, it shouldn't matter which modules are installed though.

The problem you are seeing is due to Comedi's auto-configuration
mechanism, and the fact that the dt9812 module does not currently
support it. Don't worry, there is a workaround, but first a bit of
background.

When the comedi module is loaded, it reserves a certain number of slots
for "manually configured" devices and creates the /dev/comediN device
files for these reserved slots during module load. It also creates
extra device files automatically for any "automatically configured"
devices that try to register themselves with the comedi core. By
default, the number of reserved slots is 0, so the only /dev/comediN
device files that are created are those for "automatically configured"
devices.

As I mentioned, the dt9812 module does not currently use the
auto-configuration mechanism. So it needs to use one of the reserved
slots, and by default there aren't any!

The comedi module has a couple of module parameters you can set that
control the number of devices and the auto-configuration mechanism. The
options can be set by creating a file "/etc/modprobe.d/comedi.conf". If
your system doesn't have the "/etc/modprobe.d/" directory, you may need
to edit the "/etc/modprobe.conf" file instead.

The first of these parameters is 'comedi_num_legacy_minors', which sets
the number of comedi devices reserved for manual configuration and by
default is 0. The following configuration line sets it to 4, but you
can use any number from 0 to 48:

options comedi comedi_num_legacy_minors=4

The second of these parameters is 'comedi_autoconfig' which controls
whether the auto-configuration mechanism is enabled and by default is 1
(enabled). You can disable the auto-configuration mechanism by setting
it to 0, for example:

options comedi comedi_autoconfig=0

It's possible to combine the two parameters on the same line:

options comedi comedi_autoconfig=0 comedi_num_legacy_minors=4

One quirk is that if comedi_autoconfig=0 and comedi_num_legacy_minors=0,
the comedi_num_legacy_minors value gets automagically changed to 16,
otherwise the comedi module would be completely useless!

Note that these module parameters won't take effect until the main
comedi module is reloaded.

After reloading the comedi module with a non-zero
comedi_num_legacy_minors or with comedi_autoconfig set to 0, you should
see some "/dev/comediN" device files. You can then manually configure
the comedi device using the comedi_config command as root, e.g.:

comedi_config /dev/comedi0 dt9812

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-

th.myrna

unread,
Mar 15, 2011, 2:07:19 PM3/15/11
to Comedi: Linux Control and Measurement Device Interface


On Mar 14, 3:00 pm, Ian Abbott <abbo...@mev.co.uk> wrote:
> On 14/03/2011 10:16, th.myrna wrote:
>

Thank you, Ian, it works!

I had to reboot and then to reload the module. I don't boot my
notebook a lot, so I have yet to see what will happen then. Do I have
to enter "modeprobe comedi" in any start script?

And, I had to change permissions of /dev/comedi0 to a+rw to be able to
open the device.

Best regards
Thin


> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk>             )=-

Ian Abbott

unread,
Mar 15, 2011, 3:39:23 PM3/15/11
to comed...@googlegroups.com
On 15/03/2011 18:07, th.myrna wrote:
> On Mar 14, 3:00 pm, Ian Abbott<abbo...@mev.co.uk> wrote:
>> On 14/03/2011 10:16, th.myrna wrote:
>
> Thank you, Ian, it works!
>
> I had to reboot and then to reload the module. I don't boot my
> notebook a lot, so I have yet to see what will happen then. Do I have
> to enter "modeprobe comedi" in any start script?

It depends. When you plug in the dt9812, the modules should be loaded
automatically, but the dt9812 module doesn't do the comedi autoconfig
thing, so it needs to be configured with the comedi_config module.

The dt9812 module is also unusual in that it allows the comedi device to
be configured as a dt9812 even if the device is not currently plugged
in. You might want to take advantage of that by running a startup
script that does "modprobe dt9812" (which also loads the comedi module
as a dependency) followed by "comedi_config /dev/comedi0 dt9812". The
device won't work until you plug it in of course!

> And, I had to change permissions of /dev/comedi0 to a+rw to be able to
> open the device.

It's probably better to avoid making it world accessible and just make
it owner and group accessible. Set the permissions to 0660 and change
the group owner to a specific group. Debian uses the group "iocard".
Some people use the group "comedi". In either case, you probably need
to create the group and make your username a member of it.

The mode and group owner of the /dev/comedi* files can be set set using
a UDEV rule in /dev/udev/rules/90-comedi.rules, for example using mode
0660 and group "iocard":

KERNEL=="comedi[0-9]*" MODE="0660" GROUP="iocard"

or:

SUBSYSTEM=="comedi" MODE="0660" GROUP="iocard"

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-

th.myrna

unread,
Mar 17, 2011, 8:15:32 AM3/17/11
to Comedi: Linux Control and Measurement Device Interface
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk>        )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Ian, thanks a lot for your elaborated answers!

I yet have to go into all this.

One question is bothering me, though: Where could I have found all
this information. I looked on comedi.org, where quite a few pages
didn't work. And the fact that its cvs server was down wasn't very
promising. What did I overlook? If I did not overlook anything and
this kind of docs is really missing: Didn't you think about a "Getting
Started" document describing all this? Should I try to create one,
that's later proof-read by you?

Best regards
Thin

th.myrna

unread,
Mar 20, 2011, 5:12:32 AM3/20/11
to Comedi: Linux Control and Measurement Device Interface
After I tried to use a different device, for which no driver is
provided (tried to use a NI USB 6229 with a PCI driver), my DT9812
module stopped working: "** NULL pointer: filler.c, line 58", when I
run my app.

Strange. Reboot, reload, nothing helped. So I decided to go through
all the hoops of getting at a dkms solution, because my system seems
to loads the module from staging.

This is what I did:

- Get the sources of comedi: git clone git://comedi.org/git/comedi/comedi.git

- Copy them to /usr/src/comedi-0.7.76+20100623cvs-1.nodist

- Run ./autogen.sh there.

- dkms add -m comedi comedi-0.7.76+20100623cvs-1.nodist

- dkms build -m comedi comedi-0.7.76+20100623cvs-1.nodist

- dkms install -m comedi comedi-0.7.76+20100623cvs-1.nodist

- reboot

- Plug in the dt9812

- And this is what dmesg says:

usb 5-1: new full speed USB device using uhci_hcd and address 3
comedi: version 0.7.76 - http://www.comedi.org
dt9812: module is from the staging directory, the quality is unknown,
you have been warned.
dt9812 5-1:1.0: USB DT9812 (ffff.ffff.ffff) #0x00705227
usbcore: registered new interface driver dt9812

So the system still doesn't use *my* driver?

comedi_test still reports
# comedi_test -f /dev/comedi0
** NULL pointer: filler.c, line 58
E: comedi_open("/dev/comedi0"): Cannot allocate memory

I'm stuck and w/o any access to my dt9812 box. How can I get rid of
the obviously buggy staging driver?

Thin



> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbo...@mev.co.uk>        )=-

Ian Abbott

unread,
Mar 22, 2011, 7:05:15 AM3/22/11
to comed...@googlegroups.com

I wonder why it cannot allocate that memory? Is it->n_subdevices
getting set to something stupid?

> I'm stuck and w/o any access to my dt9812 box. How can I get rid of
> the obviously buggy staging driver?

It's possible to mess around with /etc/depmod.conf or /etc/depmod.d/ to
change the search order for all modules, or override the module
directory for specifically named modules - see 'man depmod.conf'. If
you make changes there, I think you need to run 'depmod -a' afterwards
to regenerate the dependencies.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-

th.myrna

unread,
Mar 23, 2011, 3:54:08 PM3/23/11
to Comedi: Linux Control and Measurement Device Interface

On Mar 22, 12:05 pm, Ian Abbott <abbo...@mev.co.uk> wrote:

> I wonder why it cannot allocate that memory? Is it->n_subdevices
> getting set to something stupid?

No idea, my app isn't running anymore, because of that error.

>
> It's possible to mess around with /etc/depmod.conf or /etc/depmod.d/ to
> change the search order for all modules, or override the module
> directory for specifically named modules - see 'man depmod.conf'. If
> you make changes there, I think you need to run 'depmod -a' afterwards
> to regenerate the dependencies.
>

Ian, would you mind to guide me? Reason: There's no /etc/depmod.conf,
just a /etc/modprobe.d/modprobe.conf, which is empty. If I exec a

modprobe -l comedi

it reads

kernel/drivers/staging/comedi/comedi.ko.gz
kernel/comedi/comedi.ko

modeprobe -r comedi

doesn't seem to have an effect, because

modeprobe -l comedi

again reads

kernel/drivers/staging/comedi/comedi.ko.gz
kernel/comedi/comedi.ko

So, the man pages of depmod.conf tell me about an easy command syntax:

override modulename kernelversion modulesubdirectory

Yes, syntax is easy, but I'm not sure here about the content.
modulename would be comedi, but what about kernelversion, and
modulesubdirectory?

The staging driver seems to live in /usr/src/linux-2.6.37-ARCH/drivers/
staging/comedi, although there's only a file names Kconfig - weird.

My driver lives in /usr/src/comedi-0.7.76+20100623cvs-1.nodist, at
least I thinks so: My commands to build and install it were:

dkms build -m comedi -v 0.7.76+20100623cvs-1.nodist
dkms install -m comedi -v 0.7.76+20100623cvs-1.nodist

BTW, uname -a reports

Linux <host name hidden by me> 2.6.37-ARCH #1 SMP PREEMPT Tue Mar 15
11:40:49 UTC 2011 i686 Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
GenuineIntel GNU/Linux

So, my guess is:

override comedi 2.6.37-ARCH comedi-0.7.76+20100623cvs-1.nodist

As I don't want to kill my Linux (or isn't dealing with modules as
dangerous as I consider it being?), may I ask: Am I right?

Thin

Ian Abbott

unread,
Mar 24, 2011, 6:08:26 AM3/24/11
to comed...@googlegroups.com

It's always handy to have more than one bootable kernel in your grub
config when experimenting with kernel stuff. ;)

I haven't used depmod.conf yet either, but my understanding is you can set:

override comedi 2.6.37-ARCH kernel/comedi

i.e. kernelversion is the `uname -r` value, and modulesubdirectory is
the subdirectory under /lib/modules/`uname -r`/ where the module is to
be found. I'm guessing that the module will be found in any
subdirectory of the specified subdirectory, but I haven't tested it.

You can use * for kernelversion to make life easier.

Rather than listing all the comedi modules, I think you can just change
the search path like so:

search kernel/comedi updates built-in

but I haven't tested that either yet!

Reply all
Reply to author
Forward
0 new messages