×
Namespaces

Variants
Actions

Using hardware in scratchbox

From Nokia Developer Wiki
Jump to: navigation, search


Article Metadata
Compatibility
Platform(s): Maemo
Article
Keywords: Maemo, scratchbox
Created: gnuton ()
Last edited: hamishwillee (24 Jun 2011)

Using real hardware in scratchbox: the webcam

Introduction:

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

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.

Webcam

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
This page was last modified on 24 June 2011, at 12:22.
33 page views in the last 30 days.
×