130 likes | 277 Views
A new device driver for a video frame grabber. Binh Tran – Lucie Ngnepieba. Term Project – Kernel Device – Summer 2006. Outline. Overview Our goals Our achievement 4. Difficulties and our solutions 5. Discovered facts and our learns 6. Future works 7. Conclusion. Overview.
E N D
A new device driver for a video frame grabber Binh Tran – Lucie Ngnepieba Term Project – Kernel Device – Summer 2006
Outline Overview Our goals Our achievement 4. Difficulties and our solutions 5. Discovered facts and our learns 6. Future works 7. Conclusion
Overview ISA greyscale card PCI color card
Goals To compile correctly on the Linux distribution 2.6.16 To improve the previous Video frame grabber device driver to support Video4Linux. To integrate the previous driver and make it work on both grayscale and color support. To work on the low-level operation of the frame grabber to support the new interrupt-driven I/O feature (if time permits).
Previous student’s works Taken from the previous student’s journal (Atulya Mahajan, Huan Keat ("Sean") Toh): The device driver ran on Linux distribution 2.6.10 and 2.6.11. 2. The greyscale works correctly, but the color was fuzzy. 3. The cleanup function was inconsistent 4. Kernel panic when unload the module
Our achievements • Our device driver • is stable with the 2.6.16.14 kernel • works properly, consistently without errors( ie load module, unload module , auto-detect different devices, no kernel panic) (goal #1) • Our driver supports Video4linux (goal #2) • We improve the preview driver to support both grey scale and color cards (goal #3)
Problems found in the original device driver and our solutions • When compiled and executed the hrt module was loaded, but: • No device was detected, • The major number did not show up Sol: we put a series of debugging messages to test, and we add code in the hrt_init_module, hrt_cleanup_module, hrt_load, hrt_unload. 2. The two cards were detected as grayscale cards, and give us a warning message about sysfs needed.
(Cont) Sol: Switched the two cards, reboot, and load module again. It works. We diagnose the cards slots are sensitive. Moreover, sysfs is not a main issue. • The pci color card was not unregistered when we unload the module(this prob panic the kernel when unloading). First found by Danny • Sol: we add lines of code to unregister the color card in the hrt_cleanup and hrt_pci_cleanup functions • Pixels mapping among user space, kernel buffer and I/O devices do not work correctly, the color display was fuzzy • Sol: pixel mapping between kernel and user buf was not correct. We changed the way the mapping was done in the grab_field function. • And set the resolution in the test file to 640 x 480.
(Cont) • Missing libraries needed for Video4linux • Sol: we installed SDL libraries that was missing and modified the Makefile by adding the right location for those libraries
What we have learned • Learn how to build a driver for many different cards, especially video cards, in a kernel on Linux distribution 2.6 • Learn how to dissect the long source code(>65 pages with more than 3700 lines of codes) • Learn how to debug subtle errors • Improve how to use the following techniques • Char Device driver • Memory mapped I/O • Internal mutual exclusion (spinlocks and semaphores) • Use of IOCL’s • Interrupt & Timer management (tasklets and kernel timer API) Learn more about Linux like making a make file, etc… • Improve knowledge about Linux
Works left The color display for different resolutions still needs to be done To work on the low-level operation of the frame grabber to support the new interrupt-driven I/O feature (if time permits)
Conclusion We have achieved most of our main goals