This program captures images and movies on a Sony picturebook
PCG-C1XS, taking advantage of the built in CCD camera and hardware
JPEG encoder.

For the latest version see http://samba.org/picturebook/

Usage
-----

You must run capture as root. When someone gets around to making
this a kernel driver for V4L then that will change. 

Running capture is pretty easy. Try "capture -h" for a list of options
and experiment. You will probbaly find "capture -s" most useful if you
are running capture interactively. Use the jogger dial to change
capture modes and the capture button to take photos and movies.

Movies
------

You can capture AVI MJPEG movies using the -V option with a specified
capture time or using -s and changing to a AVI mode. These can be
played back using xanim. Unfortunately xanim has trouble keeping up
with the frame rate, but I find that if you let xanim loop through
once then hit stop/play it will play faster the 2nd time through.

If you want to send/store your movies then you'll probably want to
convert them to MPEG format, which is _much_ smaller and plays more
smoothly. Use the supplied avitompeg script to convert the AVI files
and mpeg_play to play them. You will need to have mpeg_encode and
djpeg to run avitompeg. You may need to use the -framerate option to
mpeg_play.

Other VAIOs
-----------

The C1XN also seems to work. Probably all the picturebooks that have
the Kawasaki chip on the PCI bus will work (run lspci to see if yours
does). I haven't tried with the older picturebooks that don't have the
kawasaki chip on the PCI bus - maybe the chip is there but hidden
somewhere else?

The -j option can be used on non-VAIO picturebooks to read the SPIC,
allowing you to watch events on the special keys like the little "p"
button on the 505 models. You also get events on the jogger, battery
insert, lid open/close etc.

setuid
------

Normally you have to run capture as root. You can instead make capture
setuid by running:

 chown root capture
 chmod u+s capture

The code drops all privileges after initialisation, thus making it
setuid safe. If anyone wants to do a security audit then that would be
appreciated. The main area of concern is that after dropping
privileges the program still has iopl(3) set, so if there are any
buffer overflows they could be exploited. I've tried to be careful,
but the usual warnings about setuid programs apply (maybe make it
executable by only a particular group).


To Do
-----

I'd like to add sound recording support to the AVI capture but first
I'll need to get audio input working on this machine. I don't seem to
get any interrupts. Suggestions welcome.

The code needs to be moved into the kernel fairly soon. It is quite
risky doing dma in user space (think about what happens if the app
dies and the pages get reused by something like the page cache).

Credit
------

The code is partly based on work by Werner Almesberger
(almesber@lrc.epfl.ch). Stephen Rothwell (sfr@linuxcare.com.au) helped
me work out the ACPI AML stuff, and Paul Mackerras
(paulus@linuxcare.com.au) helped with the early work on getting the
camera to power on (he soldered a LED onto the camera circuitry so we
could tell when it was powered on). Paul 'Rusty' Russell
(rusty@linuxcare.com.au) wrote the register dump routines. Martin
Schwenke (martins@linuxcare.com.au) helped with the YUV->RGB
conversion code.


--
Andrew Tridgell
tridge@linuxcare.com
July 2000
