These instructions are for installing the ivtv driver as a module.

IMPORTANT: In case of problems first read this page:
	   http://www.ivtvdriver.org/index.php/Troubleshooting

Firmware
========

Instructions on how to obtain and install the required firmware files
can be found here:

http://www.ivtvdriver.org/index.php/Firmware

Kernel 2.6
==========

CONFIG needed:

 1. unpack the tarball
 2. cd ivtv
 3. make
 4. make install (as root)
 5. unload any old drivers
 6. depmod
 7. modprobe ivtv

Comments:
 * The driver is not affected by the 4k/8k stacks kernel configuration.

Creating device entries
=======================
If you are using udev or devfs then devices should be created automatically.
Otherwise you may need to: 

for i in 0 1 2 3 16 32 224 ; do \
    if [ ! -f /dev/video$i ]; then \
        echo "Creating /dev/video$i" && mknod /dev/video$i c 81 $i && \
        chown video /dev/video$i && chmod 660 /dev/video$i; \
    else echo "/dev/video$i already exists"; \
    fi; \
done

ln -s video0 /dev/video 

Here is a list of the base v4l devices:
crw-rw----    1 root     video     81,   0 Jun 19 22:22 /dev/video0
crw-rw----    1 root     video     81,  16 Jun 19 22:22 /dev/video16
crw-rw----    1 root     video     81,  24 Jun 19 22:22 /dev/video24
crw-rw----    1 root     video     81,  32 Jun 19 22:22 /dev/video32
crw-rw----    1 root     video     81,  48 Jun 19 22:22 /dev/video48
crw-rw----    1 root     video     81,  64 Jun 19 22:22 /dev/radio0
crw-rw----    1 root     video     81, 224 Jun 19 22:22 /dev/vbi0
crw-rw----    1 root     video     81, 232 Jun 19 22:22 /dev/vbi8
crw-rw----    1 root     video     81, 248 Jun 19 22:22 /dev/vbi16

Note the permissions of the device entries; your system may differ, so
ensure users have appropriate read/write access if receiving "permission
denied" errors.

Testing the installation
========================

install the modules
  modprobe ivtv

Capture some video
  cat /dev/video0 > my.mpg
(press ctrl-c after a few seconds)

play it back (for cards with a decoder only)
  cat my.mpg >/dev/video16
or
  mplayer my.mpg
or
  xine my.mpg

With any luck you'll see a picture (or more likely static) and hear some sound.

You can now use v4l2-ctl to set the input (s-video, audio etc) and ivtv-tune to
select a channel.

You may also now install the ivtvfb module: (for cards with a decoder only)
  modprobe ivtvfb

This can result in a black screen as nothing is being shown.

v4l2-ctl allows you to change the alpha (transparency) settings:

  v4l2-ctl -d /dev/video16 --set-fmt-output-overlay global_alpha=0

would turn off the fb display (clearest possible video)

  v4l2-ctl -d /dev/video16 --set-fmt-output-overlay global_alpha=50

would set the framebuffer to be transparency level 50 over the video.


Debugging the framebuffer
=========================

First make sure everything is wired up correctly.

Check video out
---------------
remove the video generating module and start it with a testcard image:
  rmmod ivtv saa7127
  modprobe saa7127 test_image=1
  modprobe ivtv

You should see 8 coloured bars on the screen.

Then restore normal operation:
  rmmod ivtv saa7127
  modprobe saa7127
  modprobe ivtv


Troubleshooting
===============

1. If having memory allocation errors, try rebooting fresh, and putting this
   into /etc/sysctl.conf (or the corresponding /proc filessystem config
   under /proc/vm/min_free_kbytes doing 'echo 16384 > /proc/vm/min_free_kbytes`)...

#for making ivtv happier with memory usage:
vm.min_free_kbytes=16384

2. Always reboot cold when troubleshooting, the card will keep settings over
   normal reboots

3. The framebuffer will not allow direct writing safely, it will mess up
   encoding and decoding, usually making the chip inoperable until another
   reboot.
