5123
Comment: Project details for the media controller virtual driver
|
6553
Add two additional tasks
|
Deletions are marked like this. | Additions are marked like this. |
Line 50: | Line 50: |
=== Testing the Virtual V4L Driver === The Virtual V4L driver is available in the drivers/media/platform/vivid/ directory of the kernel sources. * If the driver isn't selected in the kernel configuration, select, build and install it. * The vivid driver isn't associated with a particular device and is thus not loaded automatically. Load it manually with modprobe. * Make sure that a device node has been created in /dev. The device node should be named /dev/video[0-9] depending on the number of other V4L devices present. * Use your favourite webcam application to open the device and display video. The driver will generate a colour bar test pattern by default. If you have no favourite webcam application use qv4l2 from the v4l-utils package. === Creating a Skeleton Driver === The skeleton driver will serve as the base for the virtual Media Controller driver. * Follow the Hello World kernel module example from chapter 2 of the [http://lwn.net/Kernel/LDD3/ Linux Device Drivers, Third Edition] to create the skeleton driver. Note that the book has been written based on the 2.6.10 kernel, you might thus need to adapt the code to kernel API changes that have occured since then. The module should be placed in drivers/media/. * Compile the module, load it and make sure it prints the expected Hello World message in the kernel log. * Don't forget to commit your work in your kernel git tree. |
About Me
I've written media-related Linux drivers for consumer and embedded devices since 2001 and I'm one of the Video4Linux core developers. I've given Linux media-related talks at the FOSDEM, LPC and ELC. I currently work as an embedded Linux consultant through my company Ideas on Board where I develop a wide range of embedded drivers including DRM/KMS and V4L2.
Project Details
The [http://linuxtv.org/downloads/v4l-dvb-apis/media_controller.html Media Controller] kernel API has been designed to exposing detailed information about media devices, and video capture devices in particular, to userspace. While the API is not limited to a particular type of device, it has so far been used mostly to expose the topology of complex embedded media devices to applications, allowing a fine-grained control over the device that wasn't possible through the V4L API alone.
Handling those devices in userspace isn't simple due to the hardware complexity. Careful testing of applications and userspace libraries is thus needed, especially when they aim at supporting a wide range of devices. The fact that the devices with which code needs to be tested are embedded and not always easily available to developers further increases testing issues.
A similar issue exists with the V4L API and has been addressed by a [http://lwn.net/Articles/607160/ kernel driver] that emulates a V4L device without requiring hardware. The goal of this project is to create a similar driver for the Media Controller API.
Resources
The Media Controller API documentation is available at http://linuxtv.org/downloads/v4l-dvb-apis/media_controller.html (built from the DocBook documentation in the kernel source tree).
- Documentation/media-framework.txt in the kernel source tree.
The Media Controller development mailing list is linux-media@vger.kernel.org.
- Media developers hang around in the #v4l IRC channel on freenode.net.
Tasks
Tasks must be completed in the order listed. The tasks list isn't complete yet.
Building the Media Controller Test Tool
A userspace utility named media-ctl is available as part of the v4l-utils package. In order to test the code that will be developed for this project the latest version of media-ctl will be needed. Furthermore, as changes to media-ctl might need to be performed as well, the utility should be compiled from its sources.
Clone the v4l-utils git tree. The git web overview page is available at http://git.linuxtv.org/cgit.cgi/v4l-utils.git/ and lists the git URL.
- The build system is based on autotools. Configure and build the software. This should produce a media-ctl wrapper script in the utils/media-ctl/ directory that executes the compiled binary in utils/media-ctl/.libs. You can either install the media-ctl binary locally using 'make install' or run it from the source tree using the wrapper script.
- Run the media-ctl tool without arguments. It should output a help text.
- Perform a small modification to the function that prints the help text, recompile the software, and run media-ctl to ensure your modification has been taken into account.
Testing the Test Tool with a Hardware Device
This task is optional but recommended.
While no access to hardware is needed to implement a virtual Media Controller driver, understanding the API is easier done when testing on a real device. All USB cameras [http://ideasonboard.org/uvc/faq/#faq1 compatible with the USB Video Class] can be used to first experiment with the Media Controller API.
The uvcvideo kernel driver implements the Media Controller API when the kernel is build with Media Controller support.
- Clone the mainline kernel git tree, configure and build it. You can use your distribution's running kernel configuration file as a default. Make sure to enable both the CONFIG_MEDIA_CONTROLLER and the CONFIG_USB_VIDEO_CLASS options (the latter can be enabled as a module).
- Install the kernel you have built. Make sure not to overwrite your distribution's kernel, but instead install the new kernel as a multi-boot option. This will allow you to reboot into a working system should the newly built kernel fail to boot properly.
- Plug a UVC-compatible camera and check that the uvcvideo module gets loaded (if you have built it as a module) and that driver prints successful device detection messages in the kernel log.
- Run the media-ctl tool with the -p option to display the full device topology in text form and study it.
- Run the media-ctl tool with the --print-dot option and redirect the output to a file named uvc.dot. Process that file using the dot utility (part of the graphviz package) with 'dot -Tps -o uvc.ps uvc.dot' to generate a graph representing the device topology in postscript form. Open the generated postscript file and study how it relates to the text form of the device topology.
Testing the Virtual V4L Driver
The Virtual V4L driver is available in the drivers/media/platform/vivid/ directory of the kernel sources.
- If the driver isn't selected in the kernel configuration, select, build and install it.
- The vivid driver isn't associated with a particular device and is thus not loaded automatically. Load it manually with modprobe.
- Make sure that a device node has been created in /dev. The device node should be named /dev/video[0-9] depending on the number of other V4L devices present.
- Use your favourite webcam application to open the device and display video. The driver will generate a colour bar test pattern by default. If you have no favourite webcam application use qv4l2 from the v4l-utils package.
Creating a Skeleton Driver
The skeleton driver will serve as the base for the virtual Media Controller driver.
Follow the Hello World kernel module example from chapter 2 of the [http://lwn.net/Kernel/LDD3/ Linux Device Drivers, Third Edition] to create the skeleton driver. Note that the book has been written based on the 2.6.10 kernel, you might thus need to adapt the code to kernel API changes that have occured since then. The module should be placed in drivers/media/.
- Compile the module, load it and make sure it prints the expected Hello World message in the kernel log.
- Don't forget to commit your work in your kernel git tree.
Contact Info
Email: MailTo(laurent.pinchart AT ideasonboard DOT com) IRC: pinchartl on freenode.net and irc.oftc.net