CIS 4930/5641 Linux Kernel & Device Driver Programming




Final Project

Team Members

Chancy Kennedy (cak03c at fsu dot edu)
Tomas Mann (tfm07 at fsu dot edu)

Overview

For the final project of this class, we will be working on improving an existing HRT Frame Grabber Driver. For the purposes of this project, we chose the driver labeled JieKeSai, as posted in Dr. Baker's webpage.

Objectives

  • Compile and test a frame grabber device written by students in previous semesters.
  • Review code and update it to go along with the current kernel.

    Added after successful compiling of code posted on Dr. Baker's webpage (JieKeSai):
  • Review reading mechanisms used by the driver and try to improve the number of frames processed by second.
  • Work on integration of the driver with video software such as xawtv.

    Development Log

    Week 1

    June 3rd, 2008.
  • Installed video cards in the computers and tested the cameras.
  • June 4th, 2008.
  • Sorted out old drivers from previous semesters. Fixed a few
        deprecated calls in JieKeSai driver so it would compile.
  • June 5th, 2008.
  • Compiled and tested the old driver copied from Dr. Baker's page.
  • June 6th, 2008.
  • Installed both cards in the same box. The first time we tried running the install script, neither card responded, and when we tried to unload the module, the system crashed (system hang). After rebooting the system, the driver installed fine, but when we tried to test the driver, only the images from the greyscale card were displayed partially.
  • Week 2

  • Decided to work separately on Video for Linux 2 and I2C implementations.
  • Reviewed old ioctl implementation used in the old driver with the new pointer/object-oriented implementation.
  • Reviewed the generic I2C Linux implementation, and how it is used by the bttv driver.
  • Week 3

    June 16th, 2008.
  • Decided not to work on the I2C implementation and focus on the Video For Linux 2 implementation.
  • Changed old ioctl implementation used in the old driver with the new pointer/object-oriented implementation.
  • June 17th, 2008.
  • Revised implementation of v4l2 functions that set, get, and enumerate Video for Linux formats.
  • Worked on implementation of v4l2 functions that get and set the priority for the device. These functions are not currently used by our driver.
  • June 18th, 2008.
  • Worked on the implementation of v4l2 functions that query device capabilities (video capture and video streaming).
  • Worked on the implementation of v4l2 functions that get, set, and enumerate standards used by our video cards (both video cards only support NTSC).
  • Worked on the implementation of v4l2 functions that get and set the controls in the device (brightness and contrast).
  • June 19th, 2008.
  • Worked on the implementation of v4l2 functions that get, set, and enumerate inputs for the video device. Each card only has one input.
  • Reviewed existing functions that implement streaming (streamon, streamoff, reqbufs, qbuf, dqbuf, and querybuf).
  • Tested the driver with both cards. With the color card, xawtv seems to try different formats trying to find the correct format for the card, but never gets around to try the format that we actually support (V4L2_PIX_FMT_RGB565X). With the greyscale card, we get some scrambled video, but the driver crashes when we try to close xawtv.


  • Accomplishments

  • Gained fair understanding of Video for Linux 2 and its capabilities.
  • Implemented most of the v4l2 required functions (format, input, controls, standards...).
  • Updated driver to work partially with the current kernel (2.6.25.3) and the current version of xawtv (3.95).





    To Do

  • Revise ioctl functions that implement streaming and buffer manipulation. Most of this code is legacy code from previous teams.
  • Resolve format discrepancies with xawtv. Does xawtv support the format used by our card?
  • Implement ioctl functions for overlay?
  • Use generic I2C implementation.
  • Implement standard V4L2 buffers.
  • Revise and implement better locking mechanism.

    Notes

    In Summer 2008, there were two teams working on the HRT Frame Grabber device. We, Chancy Kennedy
    and Tomas Mann, focused on updating the Video for Linux 2 implementation for the device and making
    the driver work with the current versions of xawtv and the Linux kernel. The other team had plans
    to revise and fix errors on the driver. Their code should be consulted for any of the other functionality
    of the driver.


    Related Files

    This section lists all the files that we used, including the files written by previous teams and files that
    that reflect the modifications that we made. The diff files were obtained by using the diff command, ignoring
    all white space and blank lines. For example, the header diff file was obtained by running the command

    diff -w -B original_hrt.h hrt.h > h_diff.txt

    Original File Modified File diff file Description
    original hrt.h hrt.h header diff Header file for the HRT frame grabber.
    original hrt.c hrt.c implementation diff Implementation file for the HRT frame grabber.
    original Makefile     Makefile for the driver. We did not modify this file.
    original hrt_load     Script that loads the driver. We did not modify this file.
    original hrt_unload     Script that unloads the driver. We did not modify this file.
    capture.c     Test program found in the website for the V4L2 API Specification.
    hrttest.c
    Makefile
        Test program and its correspoiding Makefile, both written by a previous team. We used this program at the beginning to see what the status of the driver was. We did most of our testing using xawtv.


    Other Links

    xawtv-3.95/libng/plugins/drv0-v4l2.c
    -----> v4l2_setformat

    xawtv-3.95/common/capture.c
    -----> ng_grabber_setformat

    bt8xx/bttv-driver.c
    -----> bttv_video_template

    video/videodev.c
    -----> v4l1_ioctls
    -----> video_ioctl2
    -----> video_register_device