This is a standard test script included in the full CHDK distribution. It is used to verify the correct functioning of the capture mode control and play/record control APIs, as well as the capmode module.

The script has 3 modes, selected by setting 0-3 in the first option.

  • 0 Batch test
  • 1 Interactive Menu
  • 2 Single test

Batch test mode[]

Attempts to set each mode in the cameras modemap, and records the results to A/setmode.log

If the camera is started in play mode, the script switches to record mode before starting the test, and switches back to play when done.

The log format is

           <action>  | <modename> <chdkmode> <canonmode> <play/still/video> 


SET RECORD                   |            VIDEO_STD   9  2593 VID 1440ms sleep 47 OK
TRY        VIDEO_COMPACT  11 |        VIDEO_COMPACT  11  2595 VID  630ms OK
TRY      VIDEO_MY_COLORS  12 |        VIDEO_COMPACT  11  2595 VID    0ms SET  12 FAIL INVALID


  • The first action is "SET RECORD". The action was successful, and took 1440ms to complete. After it completed, the mode was VIDEO_STD, which has a CHDK mode number 9 and canon mode number 2593. As indicated by VID, CHDK recognized this as a video mode.
  • The second action was a successful attempt to set the mode to VIDEO_COMPACT
  • The third action was an unsuccessful attempt to set the mode to VIDEO_MY_COLORS. It failed because the mode was invalid, i.e. does not exist in the cameras modemap.


The second script menu option, batch type applies only to this mode. It is ignored in all other modes.

  • 0 test only modes that are valid in the current mode map.
  • 1 attempt to set all CHDK modes. NOTE: This is only useful for testing the script and the C API error reporting.

Menu Mode[]

This mode allows setting any valid mode through an interactive menu Console displays list of the names of all valid modes. Up and down scroll through the list, set tries to set the mode. After a mode is set, the script displays the current status and waits up to 10 sec for a key press Menu quits the script

Single test[]

This roughly behaves like setmode.bas, setting the mode specified in the script options


Single test mode is controlled by two options. These options are ignored in all other modes.

Single test type The third script menu option chooses whether this mode uses canon or CHDK mode numbers.

  • 0 The test will be performed using the set_capture_mode_canon function, and the test value will be interpreted as a PROPCASE_SHOOTING_MODE value.
  • 1 The test will be performed using set_capture_mode and the test value will be interpreted as a CHDK mode number.

Single test value This is the mode to set, as specified above.


  • This script requires the capmode module.

Camera notes[]

Verified on[]

Broken on[]