Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Using hardware in scratchbox
Using real hardware in scratchbox: the webcam
One of the biggest problems Maemo developers can face is the lack of hardware support in scratchbox. If you are developing a Maemo application in scratchbox on Linux, you may have noticed that there is a directory called "dev" in the root.
The "/dev" directory contains special files. Each of them corresponds to a device. A device can be a console (ttyX), the physical memory (mem), as well as a hardware device, like a webcam a mouse and so on.
Developing in a constrained environment
A chroot on Unix operating systems is an operation that changes the apparent disk root directory for the current running process and its children. A program that is re-rooted to another directory cannot access or name files outside that directory. Scratchbox is a constrained environment that contains libs and binaries necessary to deploy and (partially) testing software for Maemo.Application running in the chrooted environment can access to hardware devices since the host /dev directory is mounted in the chroot environment.
N900 has two cameras: the bigger one (the back-camera) is associated to /dev/video0 and the front one is associated to /dev/video1. If the webcam is connected to your linux box, you should be able to get a video stream from /dev/video0. You can test it using gst-launch utility, which you can find in the package gstreamer-tools.
apt-get install gstreamer-tools
gst-launch-0.10 v4l2src device=/dev/video0 ! ffmpegcolorspace ! autovideosink