In Linux, only the kernel can directly act upon a piece of hardware. Therefor we need to add the Comedi module to the kernel. There are a few different steps.
A conveient utility for seeing what is on you pci bus is /sbin/lspci[man lspci]. If I have just put in a new card there is a good chance it will not be recognived (see "Unknown device 2a70" below):
[he3]$ /sbin/lspci 00:00.0 Host bridge: Intel Corp. 440FX - 82441FX PMC [Natoma] (rev 02) 00:07.0 ISA bridge: Intel Corp. 82371SB PIIX3 ISA [Natoma/Triton II] (rev 01) 00:07.1 IDE interface: Intel Corp. 82371SB PIIX3 IDE [Natoma/Triton II] 00:0b.0 VGA compatible controller: Matrox Graphics, Inc. MGA 2064W [Millennium] (rev 01) 00:0f.0 Class ff00: National Instruments: Unknown device 2a70 00:11.0 Ethernet controller: 3Com Corporation 3c900 Combo [Boomerang] |
I need to update the file /usr/share/hwdata/pci.ids
[download].
Now:
[he3]$ /sbin/lspci 00:00.0 Host bridge: Intel Corp. 440FX - 82441FX PMC [Natoma] (rev 02) 00:07.0 ISA bridge: Intel Corp. 82371SB PIIX3 ISA [Natoma/Triton II] (rev 01) 00:07.1 IDE interface: Intel Corp. 82371SB PIIX3 IDE [Natoma/Triton II] 00:0b.0 VGA compatible controller: Matrox Graphics, Inc. MGA 2064W [Millennium] (rev 01) 00:0f.0 Class ff00: National Instruments PCI-6024E 00:11.0 Ethernet controller: 3Com Corporation 3c900 Combo [Boomerang] |
This just means that it knows the name of the card - but still nothing about using it.
Since the Comedi module will be complied against the kernal source it is important that the source is complete. When Linux is installed pre-complied (as is normal) the source may not be complete.
So at this stage you will go through the early stages of compiling the kernel - without actually compiling and installing a new kernel (yes - you could do that if you wanted to - but you do not need to).
You need to go through the configure and make dependences steps.
The following instructions are for location /usr/src/linux-2.4.18-27.7.x (or what ever version of Linux you have). If you perform these in that area you need to be root. You can do this in user-space and not as root, but you will need to be root later anyhow to install comedi.
EXTRAVERSION = -27.7.xcustom
if it has the word "custom", edit it so it says:
EXTRAVERSION = -27.7.x
The RedHat release of Linux includes the word "custom" such that if you custom build a kernel it will not over write the original. We are not going to build a new kernel.
Next we compile the comedi module. By defalt it will drive four cards. We includ the instructions to add more cards.
dev: -mknod -m 666 /dev/comedi0 c 98 0 -mknod -m 666 /dev/comedi1 c 98 1 -mknod -m 666 /dev/comedi2 c 98 2 -mknod -m 666 /dev/comedi3 c 98 3 |
To add two more cards:
dev: -mknod -m 666 /dev/comedi0 c 98 0 -mknod -m 666 /dev/comedi1 c 98 1 -mknod -m 666 /dev/comedi2 c 98 2 -mknod -m 666 /dev/comedi3 c 98 3 -mknod -m 666 /dev/comedi4 c 98 4 -mknod -m 666 /dev/comedi5 c 98 5 |
Also, edit line 40 of include/linux/comedi.h
was:
#define COMEDI_NDEVICES 4 |
now:
#define COMEDI_NDEVICES 6 |
./configure
then answer the questions
|
Enter location of Linux source tree /usr/src/linux-2.4.18-27.7.x Verbose Debugging (CONFIG_COMEDI_DEBUG) [Y/n/?] Y Kernel Comedilib (CONFIG_COMEDI_KLIB) [N/m/?] n * * Hardware device drivers *
in general - enter Y for the manufactorer you want and m
Data Translation boards (CONFIG_COMEDI_DT) [N/y/?] n DAS08 compatible driver (CONFIG_COMEDI_DAS08) [N/m/?] n DAS16 compatible driver (CONFIG_COMEDI_DAS16) [N/m/?] n
... and many more N ... Generic 8255 support (CONFIG_COMEDI_8255) [M/n/?] m ... N for everything else...
|
You will want to install comedilib at this point. Most of comedilib is needed for AIPs (future pages). But it also contains the startup program.
As root:
and that is it.
Some notes about comedi_config
[man comedi_config]
Two useful options
Some general Linux module monitoring tools
You can see all the modules runing with the tool:
/sbin/modprobe [man modprobe]
in short - to just see comedi, try:
/sbin/rmmod [man rmmod]
/sbin/modprobe -c | grep comedi
alias char-major-98 comedi
post-install cimio /usr/sbin/comedi_config /dev/comedi0 ni_pcimio 0,15
post-install ni_pcimio /scratch/comedilib/comedi_calibrate/comedi_calibrate -f /dev/comedi0
You can also remove a loaded module with: