[Previous] [Contents] [Index] [Next]

devfw-ohci

Driver for IEEE-1394 devices on OHCI controllers, primarily cameras

Syntax:


Note: You must be root to run this utility.

devfw-ohci [option[,option ...]] ... &

Runs on:

x86

Options:

None at present.

Description:

The devfw-ohci driver provides support for IEEE-1394 devices, primarily uncompressed digital cameras (not camcorders).

The driver, when started, finds all connected IEEE-1394 devices and creates device entries for them in the directory /dev/fw0. Created device names are of the form

devicetype-deviceident-serialnumber

with the three parts separated by dashes. No other dashes will appear in the device name.

For known devices (currently only digital cameras), a typical name might be

dc-unibrain-fire-i_1.2-8254

For unrecognized devices, the IEEE numeric device type and device identity are used, and the device is not usable, although it appears in the directory.

Hot-plugging of IEEE-1394 devices is fully supported. The filenames in the /dev/fw0 directory will change as required. The filename of a device is determined by its built-in serial number, not its position on the cable. Hot-plugging may cause an active device to return errors while the bus is resetting, so applications should be prepared to handle transient device errors. Once the bus is back up (this takes a few hundred milliseconds) the device should again be useable. Cameras are automatically reset and restored to their previous state after a bus reset.

This driver will work with multiple isochronous bus master machines on the same bus. This has been tested successfully with Windows 2000. However, some Linux drivers do not play well with others; they assume they are the only master on the bus. Note, though, that multiple computers on the same bus must avoid opening the same devices simultaneously. This is a limitation of the IEEE-1394 bus, which does not have a device allocation mechanism.

Usage:

Digital cameras - functions

read

Digital cameras can be read, but not written. Reading from a digital camera starts continuous frame capture using the current settings. Reading will return bytes from one frame, and the end of the frame is indicated by a return of zero bytes. The next read begins reading with the next frame. Reads will block waiting for the camera when necessary. Thus, to read each frame, just read until zero bytes are returned.

Errors

Error Meaning
EIO An I/O error has occured. The current frame is dropped, and the next read starts with the beginning of the next frame. I/O errors may appear when a bus reset occurs, which is a normal operation to be expected.
ETIMEDOUT The camera did not respond when expected. This timeout is short, only a few frame times.
EINVAL The camera is in an invalid state. devctl functions can leave the camera in an invalid state. Closing and reopening the device will return it to its factory defaults.

devctl

Function DCMD_MEDIA_DEVFW_CAMERA_FEATURE_READ

Usage:

int fd; /* file descriptor */
dc1394_feature_info info;
/* feature information structure */
...
int stat = devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_FEATURE_READ, &info, sizeof(info);

Reads one standard IEEE-1394 "Camera feature" into a Linux-compatible dc1394_feature_info structure. Typical features are camera gain and exposure time. See below for the full set of feature IDs.. Set feature_id in this structure before the call to devctl. The additional fields will then be filled in.

The "abs" fields are not currently supported.

Feature ID values:

FEATURE_BRIGHTNESS
FEATURE_EXPOSURE
FEATURE_SHARPNESS
FEATURE_WHITE_BALANCE
FEATURE_HUE
FEATURE_SATURATION
FEATURE_GAMMA
FEATURE_SHUTTER
FEATURE_GAIN
FEATURE_IRIS
FEATURE_FOCUS
FEATURE_TEMPERATURE
FEATURE_TRIGGER
FEATURE_ZOOM
FEATURE_PAN
FEATURE_TILT
FEATURE_OPTICAL_FILTER
FEATURE_CAPTURE_SIZE
FEATURE_CAPTURE_QUALITY

 

Fields of dc1394_feature_info:

unsigned int feature_id Which feature is being set or read - set by caller
dc1394bool_t available DC1394_TRUE if feature is supported by this hardware, otherwise DC1394_FALSE.
dc1394bool_t one_push  
dc1394bool_t absolute_capable  
dc1394bool_t readout_capable  
dc1394bool_t on_off_capable  
dc1394bool_t auto_capable DC1394_TRUE if feature can be set to FEATURE_MODE_AUTO.
dc1394bool_t manual_capable  
dc1394bool_t polarity_capable  
dc1394bool_t one_push_active  
dc1394bool_t is_on  
dc1394bool_t auto_active DC1394_TRUE if feature is set to FEATURE_MODE_AUTO.
char trigger_mode_capable_mask  
int trigger_mode  
dc1394bool_t trigger_polarity  
int min Minimum allowed numeric value of the feature.
int max Maximum allowed numeric value of the feature.
int value Numeric value of the feature. Set to control the feature.
Set to FEATURE_MODE_AUTO to let the device control this feature itself.
int BU_value  
int RV_value  
int target_value  
dc1394bool_t abs_control unsupported
float abs_value unsupported
float abs_max unsupported
float abs_min unsupported

Errors

Error Meaning
EIO An I/O error has occured.
EINVAL The feature number specified is invalid, or the size of the structure is incorrect.

 

Function DCMD_MEDIA_DEVFW_CAMERA_FEATURE_WRITE

Usage:

int fd; /* file descriptor */
dc1394_feature_info info;
/* feature information structure */
...
int stat = devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_FEATURE_WRITE, &info, sizeof(info));

Writes one standard IEEE-1394 "Camera feature" into a dc1394_feature_info structure. Typical features are camera gain and exposure time. See abovefor the full set. Normal usage is to set feature_id, fill in the structure using DCMD_MEDIA_DEVFW_CAMERA_FEATURE_READ,set value to the desired value for the feature, then use DCMD_MEDIA_DEVFW_CAMERA_FEATURE_WRITE. Currently, the only settable field is value, but other fields may become settable in future, so it's best to get full feature information before setting it.

It's possible to put a camera into an invalid state with this call. If an error is returned, resetting the device with the devctl function DCMD_MEDIA_DEVFW_CAMERA_RESET, or closing and reopening the device, will reset the camera to its default state.

Errors

Error Meaning
EIO An I/O error has occured.
EINVAL Some parameter value is invalid. This includes out-of-range values rejected by the camera itself.

 

Function DCMD_MEDIA_DEVFW_CAMERA_VIDEO_MODE_READ

Usage:

int fd; /* file descriptor */
dc1394_video_mode_t mode; /* video mode*/
...
devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_VIDEO_MODE_READ, &mode, sizeof(mode));

Gets the video mode (frame size, color depth, and frame rate) of the camera. videomode and framerate are chosen from the following tables.

Most cameras will support only some of the listed modes. Attempts to set an invalid mode will return EINVAL.

Errors

Error Meaning
EIO An I/O error has occured.
EINVAL Some parameter value is invalid. This includes out-of-range values rejected by the camera itself.

 

Function DCMD_MEDIA_DEVFW_CAMERA_VIDEO_MODE_WRITE

Usage:

int fd; /* file descriptor */
dc1394_video_mode_t mode; /* video mode*/
...
int stat = devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_VIDEO_MODE_WRITE, &mdoe, sizeof(info));

Sets the video mode (frame size, color depth, and frame rate) of the camera. The standard table of IEEE-1394 camera formats and modes is used. Only the fields videomode and framerate are settable.

videomode and framerate are chosen from the following tables.

Video modes
Frame rates
MODE_160x120_YUV444
MODE_320x240_YUV422
MODE_640x480_YUV411
MODE_640x480_YUV422
MODE_640x480_RGB
MODE_640x480_MONO
MODE_640x480_MONO16
MODE_800x600_YUV422
MODE_800x600_RGB
MODE_800x600_MONO
MODE_1024x768_YUV422
MODE_1024x768_RGB
MODE_1024x768_MONO
MODE_800x600_MONO16
MODE_1024x768_MONO16
MODE_1280x960_YUV422
MODE_1280x960_RGB
MODE_1280x960_MONO
MODE_1600x1200_YUV422
MODE_1600x1200_RGB
MODE_1600x1200_MONO
MODE_1280x960_MONO16
MODE_1600x1200_MONO16
FRAMERATE_1_875
FRAMERATE_3_75
FRAMERATE_7_5
FRAMERATE_15
FRAMERATE_30
FRAMERATE_60

Most cameras will support only some of the listed modes. Attempts to set an invalid mode will return EINVAL.

After setting the video mode, it is useful to read it back, which will retrieve the number of bytes per frame.

Errors

Error Meaning
EIO An I/O error has occured.
EINVAL Some parameter value is invalid. This includes out-of-range values rejected by the camera itself.

 

Function DCMD_MEDIA_DEVFW_CAMERA_TIMESTAMP_READ

Usage:

#include <time.h>
int fd; /* file descriptor */
struct timespec frametime;
/* time of frame arrival */
...
int stat = devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_TIMESTAMP_READ, &frametime, sizeof(frametime));

This function returns the time, from CLOCK_REALTIME, that the current frame arrived from the camera over the IEEE-1394 bus. It is intended for precise synchronization of camera events, and for the detection of missing frames. The "current frame" is the one currently being read or most recently read.

Errors

Error Meaning
EINVAL The size field is incorrect.
EIO An I/O error has occured.

 

Function DCMD_MEDIA_DEVFW_CAMERA_TAKEPICTURE

Usage:

int fd; /* file descriptor */
...
devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_TAKEPICTURE, 0, 0);

Puts the camera into single-frame mode and takes one picture., which can then be read.

Errors

Error Meaning
EIO An I/O error has occured.

 

Function DCMD_MEDIA_DEVFW_CAMERA_RESET

Usage:

int fd; /* file descriptor */
...
devctl(fd,DCMD_MEDIA_DEVFW_CAMERA_RESET, 0, 0);

Stops the camera, discards any pending input, and resets the camera to factory defaults. This also puts the camera back in continuous mode.

Errors

Error Meaning
EIO An I/O error has occured.

 

Supported chipsets

IEEE-1394 supported features

Feature Provision
Isochronous bus manager Yes
Isochronous cycle manager Yes
Will cooperate with other bus managers on same bus Yes
Multiple adapters on same host support Not implemented
IEEE-1394 device hot-plugging support Yes
Power management support Not implemented

Device classes supported

Feature Provision
DC1394-compatible cameras Supported in all fixed-size frame modes

Files:

This driver needs the Mindready Low-Level Adapter support package installed.

liblla.so
Mindready low-level adapter library

Bugs:

The first few frames from some cameras are garbage data.

Testing has been limited to Unibrain cameras.

Only continuous mode (not "takepicture" single frame mode) is currently supported.

Author:

John Nagle / Team Overbot / nagle@overbot.com

 


[Previous] [Contents] [Index] [Next]