Use old Canon cameras with Python.
Bases: exceptions.Exception
Bases: object
Camera objects are the intended API endpoint. Cameras have two public properties which provide most of the interesting functionality:
- storage for filesystem operations, and
- capture for taking pictures.
Get the current date and time stored and ticking on the camera.
Do remote captures.
Camera model string as stored on it.
True if the camera is not running on battery power.
The owner of this camera, writable.
Access the camera filesystem.
Find a canon camera on some usb bus, possibly.
Pass in idProduct for your particular model, default values are for a PowerShot G3.
Bases: object
Manage taking pictures via USB. The whole point.
shooting modes: P, M, Av, Tv
Metering Mode 0 White Balance 1
whaat?
Lens Focal Length Drive Mode Owner’s Name
XXX: Remote Capture 2.5.7 seems to do this in a different manner.
Bases: canon.util.Bitfield
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
Bases: canon.capture.RemoteControlCommand
Bases: canon.capture.GetParamsCmd
Bases: canon.capture.RemoteControlCommand
Bases: canon.capture.RemoteControlCommand
Bases: canon.commands.FixedResponseCommand
Bases: canon.capture.SetParamsCmd
Bases: canon.capture.RemoteControlCommand
Bases: canon.capture.RemoteControlCommand
Bases: canon.capture.RemoteControlCommand
Bases: canon.capture.RemoteControlCommand
Bases: canon.util.Bitfield
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
Bases: object
A USB camera command.
Subclasses of Command are concrete commands to be executed on the camera. Instances thereof can run themselves on a CanonUSB instance and should each implement some sort of response parsing.
cmd1, cmd2 and cmd3 define the command to be executed.
All of the following properties need to be set for a command class:
cmd1 is a command code.
cmd2 is 0x11 for storage and 0x12 for control commands.
cmd3 is 0x201 for fixed-response-length commands and 0x202 for variable length.
Yield chunk sizes to read.
Return the length of the first chunk of data to be read.
This differs for different commands, but should always be at least 0x40.
Return a command instance from a command packet.
This is used for parsing sniffed USB traffic.
Simply the class name for convenient access.
Calculate the size of the next chunk to read.
See http://www.graphics.cornell.edu/~westin/canon/ch03s02.html#par.VarXfers
Return the serial id of this command.
Generate one if not given in the constructor.
Bases: type
Bases: canon.commands.Command
Extract resplen from the response header
For cmd3=0x201 (fixed response length) commands word at 0x00 is response length excluding the first 0x40, as well as the word at 0x48, the header of the next layer?
Bases: canon.commands.FixedResponseCommand
Lock keys and turn off LCD
Bases: canon.commands.FixedResponseCommand
Doesn’t appear to be supported by the G3.
Bases: canon.commands.FixedResponseCommand
Bases: canon.commands.FixedResponseCommand
Bases: canon.commands.FixedResponseCommand
Bases: canon.commands.FixedResponseCommand
Identify camera.
execute() -> (model, owner, version) strings
Bases: canon.commands.VariableResponseCommand
Flash device identification.
Bases: canon.commands.FixedResponseCommand
Change camera owner
Bases: canon.commands.FixedResponseCommand
Bases: canon.commands.Command
Return the response length, excluding the first 0x40 bytes.
Communicate with a Canon camera, old style.
This protocol implementation is heavily based on http://www.graphics.cornell.edu/~westin/canon/index.html and gphoto2’s source. Sporadic comments here are mostly copied from gphoto’s source and docs.
– need to put that somewhere – wValue differs between operations. wIndex is always 0x00 wLength is simply the length of data.
Bases: object
USB Link to the camera.
Read from the control pipe.
bRequest is 0x4 if length of data is >1, 0x0c otherwise (length >1 ? 0x04 : 0x0C) bmRequestType is 0xC0 during read and 0x40 during write.
Bring the camera into a state where it accepts commands.
There: http://www.graphics.cornell.edu/~westin/canon/ch03.html#sec.USBCameraInit
Check if the camera has been initialized.
gphoto2 source claims that this command doesn’t change the state of the camera and can safely be issued without any side effects.
Check if the camera has been initialized.
gphoto2 source claims that this command doesn’t change the state of the camera and can safely be issued without any side effects.
Bases: object
Returns the Windows-like camera FS root.
Download a file from the camera.
target is either a file-like object or the file name to open and write to. thumbnail says wheter to get the thumbnail or the whole file.
Return an FSEntry for the path or storage root.
By default this will return the tree starting at path with large enough recursion depth to cover every file on the FS.
Bases: canon.util.Bitfield
Bases: object
Bases: canon.commands.VariableResponseCommand
Bases: canon.commands.VariableResponseCommand
Bases: array.array
Packs an array(‘B’, ...) as a set of flags
This can be any length and must be subclassed. Subclasses define cls._size to be the length of the bitfield in bytes and any number of instances of Flag as class attributes.
The Flag instances provide the descriptor protocol and convenient access to values of various flag within the array.
A set of bitmasks within a bitfield.
This may represent combinations of bit states between 8 and 64 bits long, instances are descriptors on Bitfield-s.
Yield successive n-sized chunks from l.
Return the binary data as nicely printed hexadecimal text.