Magic Lantern Firmware Wiki


328pages on
this wiki
Add New Page
Add New Page Talk0

This is a port of CHDK PTP implementation. It should be compatible with ptpcam (and maybe other PTP tools from CHDK).

See Canon PTP


CONFIG_PTP          = y

in Makefile.user

ptpcam --chdkEdit

Download source:

Warning: the patches from are obsolete (do not download them, the command codes were changed a bit).

There's also a version in contrib/ptpcam in the repository, but it says

error: camera has unsupported camera version 0.1; some functionality may be missing or cause unintented consequences


<conn> help
q quit                         quit program
h help                         list commands
r reset                        reconnect to camera
  version                      get CHDK PTP version (ptpcam and camera)
  shutdown-hard                shutdown camera (hard)
  shutdown-soft                shutdown camera (soft)
  reboot                       reboot camera
  reboot <filename>            reboot camera using specified firmware update
  reboot-fi2                   reboot camera using default firmware update
m memory <address>             get byte at address
m memory <address>-<address>   get bytes at given range
m memory <address> <num>       get num bytes at given address
  set <address> <long>         set long value at address
c call <address> <arg1> ...    call function at address with given arguments
u upload <local> <remote>      upload local file to camera
d download <remote> <local>    download file from camera
  mode <val>                   set mode (0=playback,1=record)
  lua {code}                   execute lua code
  luar {code}                  execute "return {code}" and retreive result

Some examplesEdit

./ptpcam --chdk

<conn> m 0x350080-0x350180
00350080  c8 24 00 00 92 32 b6 5d  5b 4d 41 47 49 43 5d 20  |.$...2.][MAGIC] |
00350090  64 65 62 75 67 5f 6c 6f  6f 70 5f 74 61 73 6b 3a  |debug_loop_task:|
003500a0  31 31 38 30 3a 20 4d 6f  76 52 65 63 53 74 61 74  |1180: MovRecStat|
003500b0  65 3a 20 30 00 00 00 00  00 00 00 00 00 00 00 00  |e: 0............|

<conn> download B:/MAGIC.CFG magic.cfg
<conn> upload magic.cfg B:/MAGIC.CFG

Installing ML without swapping the cardEdit

make ptpinstall

Under the hood, it's done like this:


ptpinstall: autoexec.bin
	gvfs-mount -s gphoto2
	sleep 2
	cat ptpcam.txt | ptpcam --chdk
	diff autoexec.bin autoexec.test


upload autoexec.bin B:/AUTOEXEC.BIN
download B:/AUTOEXEC.BIN autoexec.test

To install everything:

cd $CF_CARD && find -type f -exec echo upload {} B:/{} \; | sed -e 's/\.\///g' | ptpcam --chdk


See [1].

Also on Fandom

Random Wiki