Menu

Home

geehalel

Brief history

The pwc driver supports a family of cameras based on the Philips SAA8112/8116 controller, known as "Philips webcams". It includes the Philips Vesta/Toucam/SPC900 models, some Logitech Quickcam (3000/4000/Zoom/Orbit) and other OEM webcams. The pwc driver is in the kernel mainline tree since many years, and has been regularly maintained and enhanced to cope with the V4L2 framework evolution. It was originally developed by Luc Saillard.

Usage in Astrophotography

This family of webcams may be modded to support long exposures as firstly described by Steve Chambers. The operation consists in directly driving the CCD to start accumulation without streaming, and then to catch the first outgoing frame using the normal streaming operation. The signal driving the CCD may be derived from:
* a parallel port: not present anymore on modern computers
* a serial port: using either RTS or DTR signal
* the signal toggling the webcam led (when present) as it may be controlled from the host

The motivation for this modification is that the successive updates of the mainline pwc driver have turned inoperant the usage of such modded webcams. Firstly the CCD seems to be resetted when streaming starts because of a systematic resetting of the video mode (this is induced by the power saving capabilities of some models which asks to reset the video mode if it has been changed by the user during sleep). Secondly the control of the led have disappeared when the driver has been ported to the V4L2 API.

The resetting of the CCD may be simply avoided by immediately starting streaming as the long exposure starts. The drawback is that you get unvalid frames at the fps rate till the long exposure signal is set (maybe unless you use a blocking read method). So you have to drop theses frames, and trigger the capture when long exposure stops. This is what have been implemented in the indi_v4l2_ccd driver (which uses mmap method). The benefit is that you will keep the power saving capability of your webcam if it supports it.

Modifications of the pwc driver

This version adds V4L2 controls (V4L2_CID_FLASH_STROBE/STROBE_STOP) to drive the led present on some cameras. These controls are disabled by default so you have to load the module with the flashled parameter set to 1 (modprobe pwc flashled=1, see below). So if you have a LX led modded camera you may control a long exposure by first setting the V4L2_CID_FLASH_STROBE control, wait for exposure time, and then sets the V4L2_CID_FLASH_STROBE_STOP control. The next frame you will read should be the long exposure frame. You may write your own application to perform these steps.

This scheme has been added to the INDI indi_v4l2_ccd driver.

This version also synchronously sets the video mode when power_save is off. This allows Long Exposure modded cameras to capture the frame (normally the video mode is asynchronously set in
the camera when streaming starts, and this resets the CCD). Here too you have to load the module with the power_save parameter set to 0 (modprobe pwc power_save=0, see below).

Howto

Here are the steps to install this module on your computer. You're supposed to be logged as a normal user and located in your home directory (or any directory you can write to).

1
2
3
4
5
6
7
8
#!/bin/sh
# check out a read-only working copy anonymously over HTTP.
# svn checkout http://pwc-lxled.googlecode.com/svn/trunk/ pwc-lxled
svn checkout svn://svn.code.sf.net/p/pwc-lxled/code/trunk pwc-lxled
# goto the newly created directory containing the sources
cd pwc-lxled
# make the module
make -C /lib/modules/`uname -r`/build M=$PWD

Now you have to install the module as root and set some options if you want a permanent setting.

1
2
3
4
5
#!/bin/sh
# install the module as root (under Ubuntu-like distribution)
sudo make -C /lib/modules/`uname -r`/build M=$PWD modules_install
#you may set the module parameters permanently to suit your needs
sudo echo "options pwc flashled=1 power_save=0" >> /etc/modules.d/pwc.conf

To manually load/unload the module

1
2
3
4
5
#!/bin/sh
#load the module with long exposure parameters
sudo modprobe pwc flahled=1 power_save=0
# unload the module
sudo modprobe -r pwc

This has been tested on a x86_64 Fedora 20 distribution using 3.17.7 kernel version with a SPC900NC led modded webcam, using the mmap buffer access method, by the way of a specific version of indi_v4l2_ccd.

  • 2015/01/04: Proper buffer release to vb2 core for kernel > 3.15 (see note)
  • 2015/03/07: streamoff/vb2_queue_cancel still buggy with 3.18.7
  • 2016/04/06: tagged release 3 for kernel <= 4.1
  • 2016/04/07: updates for kernel 4.4
  • 2021/02/07: tagged release 5 for kernel 4.4+
  • 2021/02/07: updates for kernel 5.4