Utility to control digital cameras based on sierra imaging firmware
photopc [-h] [-V] [-v[v]] [-q] [-z] [-t] [-f timeformat] [-s <speed>] [-S <pseudo-speed>] [-l <device>] [command [params] ] ...
This is a command line tool to manipulate digital still cameras that use certain control protocol, namely Agfa ePhoto line, Epson PhotoPC line, Olympus D-xxxL line, Sanyo and Nikon (at least CoolPix 9xx) cameras. It can set camera parameters, download and erase pictures, e.t.c. It was originally developed for Epson PhotoPC 500, now the author uses it with Olympus D-600L, results with other models may vary.
-h
This option produces a help screen of all options and commands.
-V
This option prints software revision information.
-v
This option enables verbose output. Using two -v options increases the level of verbosity. This is primarily meant for debugging.
-q
This option sets quiet mode. If it is not specified, the program will show running download progress indicator.
-z
This option sets no time-zone processing mode. Use this option if the camera's clock is (should be) set up shifted by the local timezone offset.
-s speed
This option allows setting the data rate to use when communicating with the camera. Valid rates are 9600, 19200, 38400, 57600 and 115200 (the default).
-S speed
On some UNIX systems with some serial hardware/driver combinations you need to "lie" to the driver about the communication speed that you want to use at startup and during the session. Physical startup speed is always 19200. E.g., if on your system speeds up to 19200 are translated one to one, but in order to use 57600 baud you have to specify 50 baud, and you want to run at 57600, you'll need to specify photopc -s57600 -S19200,50 <commands ...>
Another example: if your driver will use physical speed four times as high as you told it to set, and you want to run at default 115200 physical speed, specify photopc -S4800,28800 <commands ...>
-t
Set timestamp of generated files to the time of snapshot.
-f timeformat
This option allows to specify the format for automatically generated image file names; the value is used as the format string for strftime(3) function. By default, names of the format "MMDD_NNN.jpg" are generated, where MM is a month, DD is a day, and NNN is a count starting from 001. A good starting point for the timeformat value could be "%Y_%m_%d-%H_%M_%S.jpg". If the format string contains context "%%XXXd" where XXX are digits, it is taken for the count, i.e. if the file with such name is present, next count is tried. If the format string does not contain "%%XXXd" part, the count field, if necessary, is appended at the end of the name.
A few single-character formats are used as shortcuts. "x" makes the name of seconds since the epoch in hexadecimal format (8 characters + ".jpg"), "d" - the same in decimal format (10 characters), "1" stands for default format "%m%d_%%03d.jpg", "2" stands for "%y%m%d%%02d.jpg", "3" stands for "%Y_%m_%d-%H_%M_%S.jpg" and 4 stands for "%Y/%m/%d/%H_%M_%S.jpg". The program attempts to create intermediate directories if necessary (and possible).
-l device
This allows specifying the serial device to use for communicating with the camera. The default is /dev/photopc (which is typically created as a (symbolic) link to the real device, e.g. /dev/ttyS0) in UNIX, and COM1: in DOS and Windows. Note that the program does not use UUCP style locks so you need to be certain that no other program, such as uugetty, uucico or mouse manager, is trying to access the same device.
After the options, one or more commands can be given in the command line.
Some commands accept frame-list as a parameter. Frame list is a comma-separated list of tokens (no whitespace allowed), each of the tokens being a word all, or a single number, or two numbers separated by a dash (-), or a number followed by a dash and a word last (without whitespace).
query
Display all current camera settings.
count
Output the number of pictures stored in the camera. This is intended for use in shell scripts.
list
List information about frames stored in the camera. Fields displayed are: frame number, size of image file, protection state, resolution mode, timestamp and filename if available. Faster than llist but may not work with some (older) models.
WARNING: this command changes current directory on models that support directory tree on the flash media.
llist
List more information about frames stored in the camera. Fields displayed are: frame number, protection state, size of image file, resolution mode, flash, shutter and timestamp. Slower than list and does not work with models that use Exif file format.
WARNING: this command changes current directory on models that support directory tree on the flash media.
cd <path>
On the models that support multiple directories on the flash media, change current directory as specified.
The program chdir's to the first non-empty folder at the beginning. So, your first cd command must specify full path starting with a slash. If it where unix you could also cd ../something but here we do not have a way to move up one level.
protect <frame-list> On | Off
Change "protected" status of frames. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. "Protected" frames cannot be erased with "erase" and "eraseall" commands or with the "erase" button on the camera.
erase <frame-list>
Erase frames. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame.
To avoid unexpected results, list of frames specified for this command is sorted and processed in reverse order.
eraseall
Erase all stored frames.
eraselast
Erase most recently taken frame.
snapshot
Take a picture.
off
Switch off the camera. This command only has this effect on some models (notably Olympus D-600L). On other models, it just terminates the session immediately (otherwise the camera would be active several seconds after the last command). On models with big timeout, such as Photopc 600, it may be wise to always issue "off" at the end of command row, to decrease power consumption.
All commands going after "off" are ignored.
image <frame-list> <file-or-dir-name>
Download an image or series of images from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored in JPEG (JFIF or Exif) format. Image file also contains a thumbnail portion, and set of parameters like the shutter speed, date and time, I.D. string and more. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names starting with month and date of snapshot, unless -f option is used, in which case unique names according to -f option setting.
thumbnail <frame-list> <file-or-dir-name>
Download a thumbnail image or series of thumbnails from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored in JPEG (JFIF or Exif) format. If the camera does not keep files in EXIF format, then the thumbnail file also contains a set of parameters like the shutter speed, date and time, I.D. string and more. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names according to -f option setting.
audio <frame-list> <file-or-dir-name>
Download an audio notice file or series of files from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored with ".wav" extention but the format is not RIFF WAV format. It is compressed in some way, probably with some variation of ADPCM. The program stores the raw data as provided by the camera, it is not playable as a normal .wav file. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names according to -f option setting.
preview <file-name>
take a `preview' snapshot and save image as a <file-name>. File is in JPEG (JFIF or Exif) format, and does not contain any additional data, just plain (very low resolution) image.
upload <file-name>
Upload image file into the camera. This command is not enabled in LOWMEMORY version (i.e. under MS/DOS).
WARNING! You cannot upload arbitrary JPEG file. Depending on the camera model, such attempt may result in the image not uploaded, not viewable, or even the camera "hung" needing to remove the batteries to make it work again. File previously downloaded from the same camera model is always uploadable. Otherwise, your milage may vary. photopc program does not perform any checks, so it's up to the user to provide the file in proper format.
mode Record | Play | Thumbnail
Set specified operation mode on certain models.
resolution Hi | Lo | Ext | <number>
Set the camera to high, low or extended resolution mode. Exact meaning of the modes is model-dependant and may specify different image dimensions and/or JPEG compression rate.
clock
Set the camera's internal real-time clock using the current date and time from the host computer. Time of taking a snapshot is included inside the JPEG files produced. Note that the models which display the time on the LCD will then display GMT rather than local time. With -z option, time shifted by the timezone offset is set, and the LCD will display local time. Using unshifted (GMT) time in the camera seems a proper way to go.
shutter <speed>
Set the camera shutter speed. Units can be specified in microseconds or in traditional form like "1/250". Valid interval depends on the model. If a value outside the interval is specified, the camera will set the speed to the nearest margin of the valid interval. Special speed value auto will set automatic shutter. Note that this only works while the camera is connected to the host, and automatically turns the flash off. While disconnected, shutter speed is always set automatically.
aperture Auto | Lo | Med | Hi
Set the lense aperture on models that support it.
flash Auto | Force | Off | AntiRedeye | SlowSync
Set the camera flash mode.
id <string>
Set the camera identifier string that is included inside the JPEG files produced. Only few models support this.
autoshut-host <seconds>
Automatically shut off the camera after that many seconds of inactivity while connected to the computer (on the host).
autoshut-field <seconds>
Automatically shut off the camera after that many seconds of inactivity while disconnected from the computer (in the field).
lcd-autoshut <seconds>
Automatically shut off the LCD monitor after that many seconds of inactivity.
lcd-brightness <value>
Set LCD brightness to the value (valid values are 1 to 7).
focus Macro | Normal | Infinity
Set the lens focusing mode. As far as I can tell, on fixed focus models macro only means force minimum aperture, not change the focal length. Only has effect in the same invocation with "snapshot" command.
adjust Normal | Contrast+ | Contrast- | Brightness+ | Brightness-
Set adjustment of picture brightness/contrast.
metering Center-weighted | Spot | Matrix
Set auto exposure metering mode.
whitebalance Normal | Sunny | Incandescent | Fluorescent | Flash | Preset | Cloudy
Set white balance.
color On | Off
Set color or B/W mode.
dzoom On | Off | <number>
Set digital zoom on or off. Note that low resolution must be set prior to turning on digital zoom. Numeric values have model-dependant meaning. Only has effect in the same invocation with "snapshot" command.
zoom <mm>
Set optical zoom value on models that support it.
% photopc query
% photopc -f "image%H:%M:%S" eraseall snapshot image 1 .
The latest version of this tool can be found at ftp://ftp.average.org/pub/photopc/; see also WWW page at http://www.average.org/digicam/.
Trademarks are properties of their respective owners.
On some models, powersaving timeouts are measured not in seconds but in 1/10 sec units. The program reports them as in seconds.
Llist command relies on the format of thumbnail image that does not contain necessary information on some models (e.g. Nikon CP 900), this command does not work for these models. List command, on the contrary, do not display useful data on models that do not return it in the register 47 (e.g. Agfa 780).
The program is known to have some timing problems talking to Nikon CP900 when the camera is "napping" in powersaving mode. Until the problem is solved, a workaround is to run the program this way:
$ photopc && photopc <command list>
Nikon seem to have some other problems too, especially when doing "actions" (e.g. snapshots, erase).
Another Nikon problem: if 32Mb (or bigger?) memry card is inserted, the program cannot get the number of frames taken, and if "all" or "NN-last" range is specified for downloading, the program fails. Specify explicit range of frames. Also, with any card, number of frames taken is not updated immediately after the "snapshot" command (the same has been reported for other models). If you find how to find the correct number of frames, please let me know.
The program is copyrighted by Eugene G. Crosser <[email protected]> and freely distributable. See README file for detailes. DOS and Windows support copyright Bruce D. Lightner <[email protected]>
The man page was originally written by Jeff Tranter <[email protected]>, who also contributed a few bugfixes. Some information about the serial protocol obtained from Jun-ichiro "itojun" Itoh <[email protected]>, Thierry Bousch <bousch%[email protected]> and other contributors.
epinfo(1), strftime(3), protocol description (protocol.htm in the source distribution).