Difference between revisions of "Firewire on CentOS"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(How to get firewire working in CentOS linux.)
 
(3 intermediate revisions by 2 users not shown)
Line 23: Line 23:
 
# Install ieee1394 ( and kmdl-ieee1394 ) from the ATrpms repository.
 
# Install ieee1394 ( and kmdl-ieee1394 ) from the ATrpms repository.
 
# Download the kmod-ieee1394 package frpm the ELRepo repository and install it using the rpm -Uvh command.  
 
# Download the kmod-ieee1394 package frpm the ELRepo repository and install it using the rpm -Uvh command.  
# Download packages libraw1394_8 and libraw1394 from ToraCat(http://centos.toracat.org/misc/CentOS-5/libraw1394/) and install it using the rpm -Uvh command.
+
# Download packages libraw1394_8 and libraw1394 from [http://centos.toracat.org/misc/CentOS-5/libraw1394/ ToraCat] and install it using the rpm -Uvh command.
 
# Download the latest libdc1394 library and install it (./configure, make, make install as root). Find the libdc1394 website with a google search.  After installation, move the libdc1394.so.22 file from the installation directory to /usr/lib64/
 
# Download the latest libdc1394 library and install it (./configure, make, make install as root). Find the libdc1394 website with a google search.  After installation, move the libdc1394.so.22 file from the installation directory to /usr/lib64/
  
Line 37: Line 37:
 
# Download and install [http://damien.douxchamps.net/ieee1394/coriander/ Coriander] (./configure, make, make install as root).
 
# Download and install [http://damien.douxchamps.net/ieee1394/coriander/ Coriander] (./configure, make, make install as root).
 
# Run "coriander".  On some system, you have to run it as the root user.
 
# Run "coriander".  On some system, you have to run it as the root user.
 +
 +
To install ffmpeg:
 +
Follow the instruction on this link to add DAG: http://linuxdeal.blogspot.com/2009/06/dag-repo-to-yum.html
 +
configure to use RPMforge:
 +
    rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
 +
    yum install ffmpeg.x86_64
 +
 +
== Modifications of OpenCV library 2.1.0 ==
 +
 +
In order to support firewire format 7 and other mode that PointGrey cameras can support, modification of OpenCV 2.1.0 is necessary. For PointGrey Flea2 camera, any low resolution mode in format 0 and format 1 decrease the field of view. Format 7 preserves the maximum field of view.
 +
Format 7 mode 0 is 1024*768 mono, 30fps,
 +
Format 7 mode 1 is 512*384 mono, 55 fps(as shown from coriander).
 +
 +
The modifications of OpenCV mostly happen in
 +
<pre>opencv/src/highgui/cvcap_dc1394_v2.cpp
 +
CvCaptureCAM_DC1394_v2_CPP constructor
 +
startCapture() function
 +
opencv/include/opencv/highgui.h
 +
CV_CAP_PROP_xxx
 +
</pre>
 +
 +
In the current modification, the default CvCapture is set to 1024*768 mono, 30fps, iso speed 800.
 +
 +
If the program complains fail to start DMA capture:
 +
# Check the ownership of device. It should be owned by current user.
 +
# Check coriander->service->ISO control. B mode and 800Mbps shoudld be selected.
 +
# Check coriander->Tools->Bandwidth Usage. Any in used bandwidth without a running program is caused by not properly release camera. Try to turn off the camera and turn back on, or reboot the machine. It is a good idea to use system trap to catch any unexpected exit and release the camera.

Latest revision as of 12:49, 2 September 2010

A note about repositories for yum

Yum uses online information to manage your system's packages. CentOS-Base is the main repository used by default. However, this is by no means the only repository. ATrpms, rpmforge, ElRepo, and DAG are four third-party repositories with many invaluable resources not maintained by CentOS-Base. There are many great tutorials online about how to add these to automatically work with yum. Whether you do it manually or with an RPM, you'll be adding a file to the /etc/yum/repos.d folder for that specific repository. The configuration files are easy to understand text documents. Make sure the line "enabled=0" exists in the file so that these extra repos are not used by default. Otherwise you'll get way more updates than you're asking for. When you want to use the repo, call yum with the --enablerepo=*reponamehere* option to enable it for that call and that call only. Many of the packages in this guide have no dependencies, in which case you can download the package from the repo's website rather than through yum.

How to get firewire working in CentOS linux.

There are two distinct steps to get firewire working: removing CentOS's nonfuntional attempts at firewire support, and adding third-party packages and modules that actually work.


First we need to disable and uninstall CentOS's (unsuccessful) attempts at firewire which are enabled by default.

  1. Open the file /etc/modprobe.d/blacklist and add these lines:
    blacklist firewire_core
    blacklist firewire_ohci
    This will prevent CentOS from loading the default firewire modules.
  2. Open up the Add/Remove Software program and search for "libraw". Uninstall all the packages with "libraw" in the name. We will be downloading an updated version of this package later.
  3. Reboot. This will complete the changes we just made.


Next we might need to update the kernel to a version that will support the ieee1394 package. Go to the ATrpms website to browse through the kmdl-ieee1394 packages. Each one corresponds to a specific kernel version. If none match your kernel version, you'll have to update the kernel. You can find your kernel version by typing "uname -r" into a terminal.

  1. Enable kernel upgrades from yum and upgrade to a version compatible with a kmdl-ieee1394 package from ATrpms. There are many good tutorials online for how to configure this.
  2. Reboot to load with the new kernel.
  3. You might have an issue with the video card driver. Download the latest driver from the NVidia website to solve this issue.


Now we can download the actual packages and modules that make firewire work.

  1. Install ieee1394 ( and kmdl-ieee1394 ) from the ATrpms repository.
  2. Download the kmod-ieee1394 package frpm the ELRepo repository and install it using the rpm -Uvh command.
  3. Download packages libraw1394_8 and libraw1394 from ToraCat and install it using the rpm -Uvh command.
  4. Download the latest libdc1394 library and install it (./configure, make, make install as root). Find the libdc1394 website with a google search. After installation, move the libdc1394.so.22 file from the installation directory to /usr/lib64/


The libraries and modules are all in place. Give the system a reboot for good luck and move on to getting the camera connected.

  1. Plug in the camera.
  2. Run /sbin/lsmod to see all the running modules. Grep for "1394" and you should get video1394, raw1394, ohci1394, and ieee1394. Grep for "firewire" and you should get nothing.
  3. Change the ownership of /dev/raw1394 and /dev/video1394/ and /dev/video1394/0 to the logged in user.


Now we need software to read in the camera data. Coriander is the best option I've found.

  1. Install ffmpeg from DAG. Use yum because there are a bunch of package dependencies, and yum will automatically download them for you.
  2. Download and install Coriander (./configure, make, make install as root).
  3. Run "coriander". On some system, you have to run it as the root user.

To install ffmpeg: Follow the instruction on this link to add DAG: http://linuxdeal.blogspot.com/2009/06/dag-repo-to-yum.html configure to use RPMforge:

   rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
   yum install ffmpeg.x86_64

Modifications of OpenCV library 2.1.0

In order to support firewire format 7 and other mode that PointGrey cameras can support, modification of OpenCV 2.1.0 is necessary. For PointGrey Flea2 camera, any low resolution mode in format 0 and format 1 decrease the field of view. Format 7 preserves the maximum field of view. Format 7 mode 0 is 1024*768 mono, 30fps, Format 7 mode 1 is 512*384 mono, 55 fps(as shown from coriander).

The modifications of OpenCV mostly happen in

opencv/src/highgui/cvcap_dc1394_v2.cpp 
CvCaptureCAM_DC1394_v2_CPP constructor
startCapture() function 
opencv/include/opencv/highgui.h 
CV_CAP_PROP_xxx

In the current modification, the default CvCapture is set to 1024*768 mono, 30fps, iso speed 800.

If the program complains fail to start DMA capture:

  1. Check the ownership of device. It should be owned by current user.
  2. Check coriander->service->ISO control. B mode and 800Mbps shoudld be selected.
  3. Check coriander->Tools->Bandwidth Usage. Any in used bandwidth without a running program is caused by not properly release camera. Try to turn off the camera and turn back on, or reboot the machine. It is a good idea to use system trap to catch any unexpected exit and release the camera.